-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathindex.d.ts
More file actions
822 lines (796 loc) · 26.4 KB
/
index.d.ts
File metadata and controls
822 lines (796 loc) · 26.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
declare module "@jwplayer/jwplayer-react-native" {
import React from "react";
import { ViewStyle } from "react-native";
// ============================================================================
// UNIFIED CONFIGURATION TYPES
// ============================================================================
// For detailed type definitions, see types/ directory
// Types are also available by importing from '@jwplayer/jwplayer-react-native/types'
// Main configuration interface - see types/unified-config.d.ts for full documentation
export interface JWPlayerConfig {
license: string;
file?: string;
sources?: any[];
playlist?: any[] | string;
playlistIndex?: number;
autostart?: boolean;
mute?: boolean;
repeat?: boolean;
preload?: 'auto' | 'none' | boolean;
stretching?: 'uniform' | 'fill' | 'exactfit' | 'none';
playbackRates?: number[];
playbackRateControls?: boolean;
bitrateUpperBound?: number;
advertising?: any;
related?: any;
pid?: string;
playerId?: string;
styling?: any;
uiConfig?: any;
backgroundAudioEnabled?: boolean;
category?: string;
categoryOptions?: string[];
mode?: string;
forceLegacyConfig?: boolean;
playlistItemCallbackEnabled?: boolean;
playerInModal?: boolean;
fullScreenOnLandscape?: boolean;
landscapeOnFullScreen?: boolean;
portraitOnExitFullScreen?: boolean;
exitFullScreenOnPortrait?: boolean;
enableLockScreenControls?: boolean;
pipEnabled?: boolean;
useTextureView?: boolean;
allowCrossProtocolRedirectsSupport?: boolean;
displaytitle?: boolean;
displayTitle?: boolean;
displaydescription?: boolean;
displayDescription?: boolean;
nextupoffset?: string | number;
thumbnailPreview?: number;
logoView?: any;
title?: string;
description?: string;
image?: string;
tracks?: any[];
starttime?: number;
mediaid?: string;
mediaId?: string;
[key: string]: any;
}
// Main configuration type alias
export type Config = JWPlayerConfig;
// Re-export common types with proper names
export type JWAdvertisingConfig = any;
export type JWPlaylistItem = any;
export type JWSource = any;
export type JWTrack = any;
export type JWImaDaiSettings = any;
export type JWImaSdkSettings = any;
export type JWAdBreak = any;
export type JWAdRules = any;
export type JWUiConfig = any;
export type JWLogoView = any;
export type JWRelatedConfig = any;
export type JWStyling = any;
export type ThumbnailPreview = 101 | 102 | 103;
export type Stretching = 'uniform' | 'fill' | 'exactfit' | 'none';
// ============================================================================
// BACKWARD COMPATIBILITY
// ============================================================================
/**
* @deprecated Use JWPlayerConfig or Config instead
* Maintained for backward compatibility
*/
interface JwConfig {
pid?: string;
mute?: boolean;
forceLegacyConfig?: boolean;
playlistItemCallbackEnabled?: boolean;
useTextureView?: boolean;
autostart?: boolean;
nextupoffset?: string | number;
repeat?: boolean;
allowCrossProtocolRedirectsSupport?: boolean;
displaytitle?: boolean;
displaydescription?: boolean;
stretching?: string;
thumbnailPreview?: number;
preload?: boolean;
playlist?: any[] | string;
sources?: any[];
file?: string;
playlistIndex?: number;
related?: any;
uiConfig?: any;
logoView?: any;
advertising?: any;
playbackRates?: number[];
playbackRateControls?: boolean;
license: string;
playerInModal?: boolean;
fullScreenOnLandscape?: boolean;
landscapeOnFullScreen?: boolean;
portraitOnExitFullScreen?: boolean;
exitFullScreenOnPortrait?: boolean;
enableLockScreenControls?: boolean;
pipEnabled?: boolean;
[key: string]: any;
}
// ============================================================================
// TYPE ALIASES FOR BACKWARD COMPATIBILITY
// ============================================================================
/**
* @deprecated Use Stretching from unified types
*/
type JwStretching = Stretching;
/**
* @deprecated Use ThumbnailPreview from unified types
*/
type JwThumbnailPreview = ThumbnailPreview;
// Re-export advertising types with legacy names for backward compatibility
/**
* @deprecated Advertising types are now imported from unified types
* Use JWAdvertisingConfig instead
*/
type VmapAdvertisingConfig = import('./types').VmapAdvertisingConfig;
type VastAdvertisingConfig = import('./types').VastAdvertisingConfig;
type ImaVmapAdvertisingConfig = import('./types').ImaAdvertisingConfig;
type ImaAdvertisingConfig = import('./types').ImaAdvertisingConfig;
type ImaDaiAdvertisingConfig = import('./types').ImaDaiAdvertisingConfig;
/**
* @deprecated Use JWAdRules from unified types
*/
type JwStartOnSeek = "pre" | "none";
/**
* @deprecated Use JWAdBreak from unified types
*/
type JwAdType = "LINEAR" | "NONLINEAR";
/**
* @deprecated Use OmidSupport from unified types
*/
type JwOmidSupport = "auto" | "enabled" | "disabled";
/**
* @deprecated Use LogoPosition from unified types
*/
type JwLogoPosition = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
// Re-export playlist and media types for backward compatibility
/**
* @deprecated These types are now imported from unified types
* Direct usage is discouraged - import from './types' instead
*/
type JwRelatedOnComplete = "hide" | "show" | "none" | "autoplay";
type JwOnRelatedClick = "play" | "link";
// ============================================================================
// LEGACY TYPE DEFINITIONS
// ============================================================================
// The following types are maintained for backward compatibility with existing code.
// New code should use the unified types imported from './types' above.
// These legacy definitions may be removed in a future major version.
/**
* @deprecated Use types from './types' instead
*/
interface AudioTrack {
autoSelect: boolean;
defaultTrack: boolean;
groupId: string;
language: string;
name: string;
}
export interface QualityLevel {
playListPosition: number;
bitRate: number;
label: string;
height: number;
width: number;
index: number;
}
interface CastingDevice {
name?: string;
identifier?: string;
}
interface Source {
file: string;
label: string;
default?: boolean;
}
type TrackKind = "captions" | "chapters" | "thumbnails";
interface Track {
file: string;
label: string;
kind: TrackKind;
default?: boolean;
}
interface JWAdSettings {
allowsBackgroundPlayback?: boolean;
// Add other ad settings properties as needed
}
interface IMASettings {
locale?: string;
ppid?: string;
maxRedirects?: number;
sessionID?: string;
debugMode?: boolean;
}
interface AdSchedule {
tag: string;
offset: string;
}
// interface CompanionAdSlot {
// viewId: string; // Reference to a UIView in the application
// size?: { width: number; height: number };
// }
interface GoogleDAIStream {
videoID?: string;
cmsID?: string;
assetKey?: string;
apiKey?: string;
adTagParameters?: { [key: string]: string };
}
interface AdRule {
startOn: number;
frequency: number;
timeBetweenAds: number;
startOnSeek: 'none' | 'pre'; // Mapped from JWAdShownOnSeek
}
// interface FriendlyObstruction {
// viewId: string;
// purpose: 'mediaControls' | 'closeAd' | 'notVisible' | 'other'; // Mapped from JWFriendlyObstructionPurpose
// reason?: string;
// }
type ClientTypes = "vast" | "ima" | "ima_dai";
interface VASTAdvertising {
adSchedule?: AdSchedule[];
adVmap?: string;
tag?: string; // Vast xml url
openBrowserOnAdClick?: boolean;
adClient: "vast";
adRules?: AdRule;
adSettings?: JWAdSettings;
}
interface IMAAdvertising {
adSchedule?: AdSchedule[];
adVmap?: string;
tag?: string; // Vast xml url
adClient: "ima";
adRules?: AdRule;
imaSettings?: IMASettings;
// companionAdSlots?: CompanionAdSlot[];
// friendlyObstructions?: FriendlyObstruction[];
}
interface IMA_DAIAdvertising {
adClient: "ima_dai";
imaSettings?: IMASettings;
// friendlyObstructions?: FriendlyObstruction[];
googleDAIStream?: GoogleDAIStream;
}
type Advertising = VASTAdvertising | IMAAdvertising | IMA_DAIAdvertising;
interface PlaylistItem {
file: string;
sources?: Source[];
image?: string;
title?: string;
description?: string;
mediaId?: string;
adSchedule?: AdSchedule[];
adVmap?: string;
tracks?: Track[];
recommendations?: string;
startTime?: number;
autostart?: boolean;
/**
* Data to be passed to Chromecast receiver (optional and typically used for DRM implementations)
*
* Only made available in legacy objects as there is no way to pass this otherwise
*/
userInfo?: { [key: string]: any };
}
type RelatedOnClicks = "play" | "link";
type RelatedOnCompletes = "show" | "hide" | "autoplay";
interface Related {
onClick?: RelatedOnClicks;
onComplete?: RelatedOnCompletes;
heading?: string;
url?: string;
autoplayMessage?: string;
autoplayTimer?: number;
}
interface Font {
name?: string;
size?: number;
}
type EdgeStyles = "none" | "dropshadow" | "raised" | "depressed" | "uniform";
// All `Styling` is only intended to be used with iOS. Android requires overloading
// of the JWP IDs seen here: https://docs.jwplayer.com/players/docs/android-styling-guide
interface Styling {
colors?: {
buttons?: string;
backgroundColor?: string;
fontColor?: string;
timeslider?: {
thumb?: string;
rail?: string;
slider?: string;
};
};
font?: Font;
showTitle?: boolean;
showDesc?: boolean;
captionsStyle?: {
font?: Font;
fontColor?: string;
backgroundColor?: string;
highlightColor?: string;
edgeStyle?: EdgeStyles;
};
menuStyle?: {
font?: Font;
fontColor?: string;
backgroundColor?: string;
};
}
type Preloads = "auto" | "none";
type InterfaceBehaviors = "normal" | "hidden" | "onscreen";
type UIGroups =
| "overlay"
| "control_bar"
| "center_controls"
| "next_up"
| "error"
| "playlist"
| "controls_container"
| "settings_menu"
| "quality_submenu"
| "captions_submenu"
| "playback_submenu"
| "audiotracks_submenu"
| "casting_menu";
type AudioSessionCategory =
| "Ambient"
| "SoloAmbient"
| "Playback"
| "Record"
| "PlayAndRecord"
| "MultiRoute";
type AudioSessionCategoryOptions =
| "MixWithOthers"
| "DuckOthers"
| "AllowBluetooth"
| "DefaultToSpeaker"
| "InterruptSpokenAudioAndMix"
| "AllowBluetoothA2DP"
| "AllowAirPlay"
| "OverrideMutedMicrophone";
type AudioSessionMode =
| "Default"
| "VoiceChat"
| "VideoChat"
| "GameChat"
| "VideoRecording"
| "Measurement"
| "MoviePlayback"
| "SpokenAudio"
| "VoicePrompt";
type JWControlType =
| "forward"
| "rewind"
| "pip"
| "airplay"
| "chromecast"
| "next"
| "previous"
| "settings"
| "languages"
| "fullscreen";
/**
* @deprecated Legacy iOS config interface - use JWPlayerConfig instead
*/
interface LegacyIOSConfig {
license: string;
advertising?: Advertising;
autostart?: boolean;
controls?: boolean;
repeat?: boolean;
nextUpStyle?: { offsetSeconds: number; offsetPercentage: number };
styling?: Styling;
backgroundAudioEnabled?: boolean;
category?: AudioSessionCategory;
categoryOptions?: Array<AudioSessionCategoryOptions>;
mode?: AudioSessionMode;
fullScreenOnLandscape?: boolean;
landscapeOnFullScreen?: boolean;
portraitOnExitFullScreen?: boolean;
exitFullScreenOnPortrait?: boolean;
playerInModal?: boolean;
playlist?: PlaylistItem[];
stretching?: string;
related?: Related;
preload?: Preloads;
interfaceBehavior?: InterfaceBehaviors;
interfaceFadeDelay?: number;
hideUIGroups?: UIGroups[];
processSpcUrl?: string;
fairplayCertUrl?: string;
contentUUID?: string;
viewOnly?: boolean;
enableLockScreenControls?: boolean;
pipEnabled?: boolean;
offlineMessage?: string;
offlineImage?: string;
forceFullScreenOnLandscape?: boolean;
forceLandscapeOnFullScreen?: boolean;
}
interface BaseEvent<T> {
nativeEvent: T;
}
interface SeekEventProps {
position: number;
offset: number;
}
interface SeekedEventProps {
position: number;
}
interface RateChangedEventProps {
rate: number;
at: number;
}
interface PlayerSetupErrorProps {
errorMessage?: string;
errorCode?: number;
}
interface PlayerErrorProps {
error?: string;
errorCode?: number;
description?: string;
}
interface TimeEventProps {
position: number;
duration: number;
}
interface ControlBarVisibleEventProps {
visible: boolean;
}
interface PlaylistEventProps {
playlist: PlaylistItem[]
}
interface LoadEventProps {
loadTime: number;
}
interface PlaylistItemEventProps {
playlistItem: PlaylistItem;
index?: number;
}
interface PlayerErrorEventProps {
code: string;
error: string;
}
interface PlayerWarningEventProps {
code?: number;
warning?: string;
adErrorCode?: number; // Android only
}
interface AdEventProps {
client: number;
reason?: string;
type: number;
}
// Overloaded type to be used in multiple error events
interface CaptionsChangedEventProps {
index?: number;
}
interface CaptionTrack {
/** @platform android */
file?: string;
label: string;
default: boolean;
}
interface CaptionsListEventProps {
index: number;
tracks?: CaptionTrack[];
/** @deprecated Use tracks array instead */
file?: string;
/** @deprecated Use tracks array instead */
label?: string;
/** @deprecated Use tracks array instead */
default?: boolean;
}
interface CastingEventProps {
device?: string;
active?: boolean;
available?: boolean;
}
interface CastingDeviceEventProps {
device?: string;
}
interface CastingErrorEventProps {
error?: string;
}
interface CastingDevice {
name: string;
identifier: string;
}
interface CastingDevicesAvailableEventProps {
/**
* JSON-encoded `CastingDevice[]`. Parse with `JSON.parse()` before use.
* @platform ios
*/
devices?: string;
}
interface VisibleEventProps {
visible: boolean;
}
interface ScreenTappedEventProps {
x: number;
y: number;
}
interface UpdateBufferEventProps {
percent: number;
position: number;
}
interface PlayerSize {
width: number;
height: number;
}
interface PlayerSizeChangeEventProps {
/**
* JSON-encoded `{ oldSize: PlayerSize; newSize: PlayerSize }`.
* Parse with `JSON.parse()` before use.
* @platform ios
*/
sizes?: string;
}
type NativeError = (event: BaseEvent<PlayerErrorEventProps> | BaseEvent<PlayerSetupErrorProps> | BaseEvent<PlayerErrorProps>) => void;
type NativeWarning = (event: BaseEvent<PlayerWarningEventProps>) => void;
interface PropsType {
config: JWPlayerConfig | JwConfig | LegacyIOSConfig;
style?: ViewStyle;
controls?: boolean;
forceLegacyConfig?: boolean;
onPlayerReady?: () => void;
onPlaylist?: (event: BaseEvent<PlaylistEventProps>) => void;
onLoaded? : (event: BaseEvent<LoadEventProps>) => void;
onBeforePlay?: () => void;
onBeforeComplete?: () => void;
onComplete?: () => void;
onPlay?: () => void;
onPause?: () => void;
onSeek?: (event: BaseEvent<SeekEventProps>) => void;
onSeeked?: (event?: BaseEvent<SeekedEventProps>) => void;
onRateChanged?: (event?: BaseEvent<RateChangedEventProps>) => void;
onSetupPlayerError?: NativeError;
onPlayerError?: NativeError;
onPlayerWarning?: NativeWarning;
onPlayerAdError?: NativeError;
onPlayerAdWarning?: NativeWarning;
onAdEvent?: (event: BaseEvent<AdEventProps>) => void;
onAdTime?: (event: BaseEvent<TimeEventProps>) => void;
onBuffer?: () => void;
onTime?: (event: BaseEvent<TimeEventProps>) => void;
onFullScreenRequested?: () => void;
onFullScreen?: () => void;
onFullScreenExitRequested?: () => void;
onFullScreenExit?: () => void;
onControlBarVisible?: (event: BaseEvent<ControlBarVisibleEventProps>) => void;
onPlaylistComplete?: () => void;
onPlaylistItem?: (event: BaseEvent<PlaylistItemEventProps>) => void;
onPlaylistItemMetadataChanged?: (event: BaseEvent<PlaylistItemEventProps>) => void;
onCaptionsChanged?: (event: BaseEvent<CaptionsChangedEventProps>) => void;
onCaptionsList?: (event: BaseEvent<CaptionsListEventProps>) => void;
onAudioTracks?: () => void;
/** @platform ios */
onIdle?: () => void;
/** @platform ios */
onVisible?: (event: BaseEvent<VisibleEventProps>) => void;
/** @platform ios */
onAttemptPlay?: () => void;
/** @platform ios */
onUpdateBuffer?: (event: BaseEvent<UpdateBufferEventProps>) => void;
/** @platform ios */
onScreenTapped?: (event: BaseEvent<ScreenTappedEventProps>) => void;
/** @platform ios */
onPlayerSizeChange?: (event: BaseEvent<PlayerSizeChangeEventProps>) => void;
onCasting?: (event: BaseEvent<CastingEventProps>) => void;
/** @platform ios */
onCastingDevicesAvailable?: (event: BaseEvent<CastingDevicesAvailableEventProps>) => void;
/** @platform ios */
onConnectedToCastingDevice?: (event: BaseEvent<CastingDeviceEventProps>) => void;
/** @platform ios */
onDisconnectedFromCastingDevice?: (event: BaseEvent<CastingErrorEventProps>) => void;
/** @platform ios */
onConnectionTemporarilySuspended?: () => void;
/** @platform ios */
onConnectionRecovered?: () => void;
/** @platform ios */
onConnectionFailed?: (event: BaseEvent<CastingErrorEventProps>) => void;
/** @platform ios */
onCastingEnded?: (event: BaseEvent<CastingErrorEventProps>) => void;
/** @platform ios */
onCastingFailed?: (event: BaseEvent<CastingErrorEventProps>) => void;
shouldComponentUpdate?: (nextProps: any, nextState: any) => boolean;
onBeforeNextPlaylistItem?: (event: BaseEvent<PlaylistItemEventProps>) => void;
}
export const JWPlayerAdEvents: {
/// This event is reported when the ad break has come to an end.
JWAdEventTypeAdBreakEnd: 0;
/// This event is reported when the ad break has begun.
JWAdEventTypeAdBreakStart: 1;
/// This event is reported when the user taps the ad.
JWAdEventTypeClicked: 2;
/// This event is reported when the ad is done playing.
JWAdEventTypeComplete: 3;
/// This event is used to report the ad impression, supplying additional detailed information about the ad.
JWAdEventTypeImpression: 4;
/// This event reports meta data information associated with the ad.
JWAdEventTypeMeta: 5;
/// The event is reported when the ad pauses.
JWAdEventTypePause: 6;
/// This event is reported when the ad begins playing, even in the middle of the stream after it was paused.
JWAdEventTypePlay: 7;
/// The event reports data about the ad request, when the ad is about to be loaded.
JWAdEventTypeRequest: 8;
/// This event reports the schedule of ads across the currently playing content.
JWAdEventTypeSchedule: 9;
/// This event is reported when the user skips the ad.
JWAdEventTypeSkipped: 10;
/// This event is reported when the ad begins.
JWAdEventTypeStarted: 11;
/// This event relays information about ad companions.
JWAdEventTypeCompanion: 12;
/// This event is reported when the ad has loaded. (Android only)
JWAdEventTypeLoaded: 13;
/// This event is reported when the ad VAST XML has loaded. (Android only)
JWAdEventTypeLoadedXml: 14;
/// This event is reported when an ad break was ignored (e.g. because another is playing). (Android only)
JWAdEventTypeAdBreakIgnored: 15;
};
export const JWPlayerState: {
JWPlayerStateUnknown?: number;
JWPlayerStateIdle: number;
JWPlayerStateBuffering: number;
JWPlayerStatePlaying: number;
JWPlayerStatePaused: number;
JWPlayerStateComplete: number;
JWPlayerStateError: number | null;
};
export const JWPlayerAdClients: {
JWAdClientJWPlayer: 0;
JWAdClientGoogleIMA: 1;
JWAdClientGoogleIMADAI: 2;
JWAdClientUnknown: 3;
};
export default class JWPlayer extends React.Component<PropsType> {
quite(): void;
pause(): void;
play(): void;
stop(): void;
toggleSpeed(): void;
setSpeed(speed: number): void;
setCurrentQuality(index: number): void;
currentQuality(): number;
getQualityLevels(): Promise<QualityLevel[] | null>;
setVolume(volume: number): void;
setPlaylistIndex(index: number): void;
setControls(show: boolean): void;
setLockScreenControls(show: boolean): void;
seekTo(time: number): void;
changePlaylist(fileUrl: string): void;
/**
* Side load playlist items into an already setup player
* @param playlistItems `PlaylistItem` or `JWPlaylistItem`
*/
loadPlaylist(playlistItems: PlaylistItem[] | JWPlaylistItem[]): void;
/**
* Side load playlist via URL into an already setup player
* @param playlistUrl URL for playlist to load (format for response: json)
*/
loadPlaylistWithUrl(playlistUrl: string): void;
/**
* Updates the currently playing playlist item's metadata without reloading.
* Only non-null fields are applied; omitted fields leave existing values unchanged.
* Fires `onPlaylistItemMetadataChanged` with the updated item on both platforms.
*
* @param metadata.refreshNotification **Android-only, temporary workaround.**
* When `true` on Android with `backgroundAudioEnabled: true`, the RN bridge cycles the
* foreground MediaService after updating metadata so the lock-screen / notification shade
* rebuilds with the new title and description. Without this flag the JW Android SDK
* updates the MediaSession metadata but leaves the visible notification stale. Expect a
* brief notification flicker and a momentary audio-focus transition while the service
* rebinds.
*
* Known limitation: the poster image is downloaded asynchronously by the SDK, so the
* rebuilt notification typically still shows the previous poster. The poster refreshes
* on the next playback state change (pause/play, seek).
*
* Remove this flag from your call site once a future JW Android SDK release refreshes the
* notification natively. No-op on iOS — JWPlayerKit already refreshes the lock-screen
* controls via LockScreenControlsHandler.
*/
setPlaylistItemMetadata(metadata: {
title?: string | null;
description?: string | null;
image?: string | null;
refreshNotification?: boolean;
}): void;
setFullscreen(fullScreen: boolean): void;
time(): Promise<number | null>;
position(): Promise<number | null>;
togglePIP(): void;
setUpCastController(): void;
presentCastDialog(): void;
connectedDevice(): Promise<CastingDevice | null>;
availableDevices(): Promise<CastingDevice[] | null>;
castState(): Promise<number | null>;
playerState(): Promise<number | null>;
getAudioTracks(): Promise<AudioTrack[] | null>;
getCurrentAudioTrack(): Promise<number | null>;
setCurrentAudioTrack(index: number): void;
setCurrentCaptions(index: number): void;
getCurrentCaptions(): Promise<number | null>;
setVisibility(visibility: boolean, controls: JWControlType[]): void;
/**
* Reconfigures or recreates the player with a new configuration.
*
* IMPORTANT: This method should only be called after the player has been properly
* initialized and is ready (i.e., after onPlayerReady has fired). Calling this
* method before the player is ready may lead to undefined behavior.
*
* **Platform Behavior:**
*
* - **iOS**: Always performs a complete player recreation by:
* 1. Safely handling PiP state if active (waits for PiP to close)
* 2. Performing complete cleanup of the current player instance
* 3. Creating a new player instance with the provided config
*
* - **Android**: Intelligently determines whether to recreate or reconfigure:
* - ~90% of cases: Reconfigures existing player (preserves player instance, faster)
* - ~10% of cases: Recreates player (only when necessary, e.g., license changes)
* - Automatically handles state preservation (fullscreen, PiP)
*
* **Use this method when you need to:**
* - Switch to a new playlist or video programmatically
* - Update player configuration dynamically (e.g., from user settings)
* - Handle content changes during PiP mode
* - Write cross-platform code (same API works on both platforms)
*
* **Do NOT use this method:**
* - Before the player is ready (wait for onPlayerReady)
* - When the player is not properly initialized
*
* **For simple playlist updates, consider using `loadPlaylist()` instead.**
*
* @example
* ```typescript
* // Cross-platform example - works the same on both iOS and Android
* const switchVideo = () => {
* playerRef.current?.recreatePlayerWithConfig({
* license: 'YOUR_LICENSE_KEY',
* playlist: [{
* file: 'https://example.com/video.mp4',
* title: 'New Video'
* }],
* autostart: true
* });
* };
*
* // Use inside onPlayerReady
* <JWPlayer
* ref={playerRef}
* config={initialConfig}
* onPlayerReady={() => {
* // Now safe to use recreatePlayerWithConfig
* console.log('Player ready, can switch content if needed');
* }}
* />
* ```
*
* @param config The new configuration to apply
* @throws May throw if called before player is ready or with invalid config
*/
recreatePlayerWithConfig(config: JWPlayerConfig | JwConfig | LegacyIOSConfig): void;
/**
* Only called inside `onBeforeNextPlaylistItem` callback, and once per callback
* @param playlistItem `PlaylistItem` or `JWPlaylistItem`
*/
resolveNextPlaylistItem(playlistItem: PlaylistItem | JWPlaylistItem): void;
}
}