bitmovin-player-react-native 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RNBitmovinPlayer.podspec +1 -1
- package/lib/index.d.mts +2273 -0
- package/lib/index.js +417 -68
- package/lib/index.mjs +414 -69
- package/package.json +8 -8
- package/src/components/PlayerView/index.tsx +8 -15
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,2273 @@
|
|
|
1
|
+
import { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Quartiles that can be reached during an ad playback.
|
|
5
|
+
*/
|
|
6
|
+
declare enum AdQuartile {
|
|
7
|
+
FIRST = "first",
|
|
8
|
+
MID_POINT = "mid_point",
|
|
9
|
+
THIRD = "third"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The possible types an `AdSource` can be.
|
|
13
|
+
*/
|
|
14
|
+
declare enum AdSourceType {
|
|
15
|
+
IMA = "ima",
|
|
16
|
+
UNKNOWN = "unknown",
|
|
17
|
+
PROGRESSIVE = "progressive"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents an ad source which can be assigned to an `AdItem`. An `AdItem` can have multiple `AdSource`s
|
|
21
|
+
* as waterfalling option.
|
|
22
|
+
*/
|
|
23
|
+
interface AdSource {
|
|
24
|
+
/**
|
|
25
|
+
* The ad tag / url to the ad manifest.
|
|
26
|
+
*/
|
|
27
|
+
tag: string;
|
|
28
|
+
/**
|
|
29
|
+
* The `AdSourceType` of this `AdSource`.
|
|
30
|
+
*/
|
|
31
|
+
type: AdSourceType;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Represents an ad break which can be scheduled for playback.
|
|
35
|
+
*
|
|
36
|
+
* One single `AdItem` can have multiple `AdSource`s where all but the first act as fallback ad sources
|
|
37
|
+
* if the first one fails to load. The start and end of an ad break are signaled via `AdBreakStartedEvent`
|
|
38
|
+
* and `AdBreakFinishedEvent`.
|
|
39
|
+
*/
|
|
40
|
+
interface AdItem {
|
|
41
|
+
/**
|
|
42
|
+
* The playback position at which the ad break is scheduled to start. Default value is "pre".
|
|
43
|
+
*
|
|
44
|
+
* Possible values are:
|
|
45
|
+
* • "pre": pre-roll ad (for VoD and Live streaming)
|
|
46
|
+
* • "post": post-roll ad (for VoD streaming only)
|
|
47
|
+
* • fractional seconds: "10", "12.5" (mid-roll ad, for VoD and Live streaming)
|
|
48
|
+
* • percentage of the entire video duration: "25%", "50%" (mid-roll ad, for VoD streaming only)
|
|
49
|
+
* • timecode hh:mm:ss.mmm: "00:10:30.000", "01:00:00.000" (mid-roll ad, for VoD streaming only)
|
|
50
|
+
*/
|
|
51
|
+
position?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The `AdSource`s that make up this `AdItem`. The first ad source in this array is used as the main ad.
|
|
54
|
+
* Subsequent ad sources act as a fallback, meaning that if the main ad source does not provide a
|
|
55
|
+
* valid response, the subsequent ad sources will be utilized one after another.
|
|
56
|
+
*
|
|
57
|
+
* The fallback ad sources need to have the same `AdSourceType` as the main ad source.
|
|
58
|
+
*/
|
|
59
|
+
sources: AdSource[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Contains configuration values regarding the ads which should be played back by the player.
|
|
63
|
+
*/
|
|
64
|
+
interface AdvertisingConfig {
|
|
65
|
+
/**
|
|
66
|
+
* The ad items that are scheduled when a new playback session is started via `Player.load()`.
|
|
67
|
+
*/
|
|
68
|
+
schedule: AdItem[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Contains the base configuration options for an ad.
|
|
72
|
+
*/
|
|
73
|
+
interface AdConfig {
|
|
74
|
+
/**
|
|
75
|
+
* Specifies how many seconds of the main video content should be replaced by ad break(s).
|
|
76
|
+
*/
|
|
77
|
+
replaceContentDuration: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Holds various additional ad data.
|
|
81
|
+
*/
|
|
82
|
+
interface AdData {
|
|
83
|
+
/**
|
|
84
|
+
* The average bitrate of the progressive media file as defined in the VAST response.
|
|
85
|
+
*/
|
|
86
|
+
bitrate?: number;
|
|
87
|
+
/**
|
|
88
|
+
* The maximum bitrate of the streaming media file as defined in the VAST response.
|
|
89
|
+
*/
|
|
90
|
+
maxBitrate?: number;
|
|
91
|
+
/**
|
|
92
|
+
* The MIME type of the media file or creative as defined in the VAST response.
|
|
93
|
+
*/
|
|
94
|
+
mimeType?: string;
|
|
95
|
+
/**
|
|
96
|
+
* The minimum bitrate of the streaming media file as defined in the VAST response.
|
|
97
|
+
*/
|
|
98
|
+
minBitrate?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Defines basic properties available for every ad type.
|
|
102
|
+
*/
|
|
103
|
+
interface Ad {
|
|
104
|
+
/**
|
|
105
|
+
* The url the user should be redirected to when clicking the ad.
|
|
106
|
+
*/
|
|
107
|
+
clickThroughUrl?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Holds various additional `AdData`.
|
|
110
|
+
*/
|
|
111
|
+
data?: AdData;
|
|
112
|
+
/**
|
|
113
|
+
* The height of the ad.
|
|
114
|
+
*/
|
|
115
|
+
height: number;
|
|
116
|
+
/**
|
|
117
|
+
* Identifier for the ad. This might be autogenerated.
|
|
118
|
+
*/
|
|
119
|
+
id?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Determines whether an ad is linear, i.e. playback of main content needs to be paused for the ad.
|
|
122
|
+
*/
|
|
123
|
+
isLinear: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* The corresponding media file url for the ad.
|
|
126
|
+
*/
|
|
127
|
+
mediaFileUrl?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The width of the ad.
|
|
130
|
+
*/
|
|
131
|
+
width: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Contains information about an ad break.
|
|
135
|
+
*/
|
|
136
|
+
interface AdBreak {
|
|
137
|
+
/**
|
|
138
|
+
* The ads scheduled for this `AdBreak`.
|
|
139
|
+
*/
|
|
140
|
+
ads: Ad[];
|
|
141
|
+
/**
|
|
142
|
+
* The id of the corresponding `AdBreakConfig`. This will be auto-generated.
|
|
143
|
+
*/
|
|
144
|
+
id: string;
|
|
145
|
+
/**
|
|
146
|
+
* The time in seconds in the media timeline the `AdBreak` is scheduled for.
|
|
147
|
+
*/
|
|
148
|
+
scheduleTime: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
interface NativeInstanceConfig {
|
|
152
|
+
/**
|
|
153
|
+
* Optionally user-defined string `id` for the native instance.
|
|
154
|
+
* Used to access a certain native instance from any point in the source code then call
|
|
155
|
+
* methods/properties on it.
|
|
156
|
+
*
|
|
157
|
+
* When left empty, a random `UUIDv4` is generated for it.
|
|
158
|
+
* @example
|
|
159
|
+
* Accessing or creating the `Player` with `nativeId` equal to `my-player`:
|
|
160
|
+
* ```
|
|
161
|
+
* const player = new Player({ nativeId: 'my-player' })
|
|
162
|
+
* player.play(); // call methods and properties...
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
nativeId?: string;
|
|
166
|
+
}
|
|
167
|
+
declare abstract class NativeInstance<Config extends NativeInstanceConfig> {
|
|
168
|
+
/**
|
|
169
|
+
* Optionally user-defined string `id` for the native instance, or UUIDv4.
|
|
170
|
+
*/
|
|
171
|
+
readonly nativeId: string;
|
|
172
|
+
/**
|
|
173
|
+
* The configuration object used to initialize this instance.
|
|
174
|
+
*/
|
|
175
|
+
readonly config?: Config;
|
|
176
|
+
/**
|
|
177
|
+
* Generate UUID in case the user-defined `nativeId` is empty.
|
|
178
|
+
*/
|
|
179
|
+
constructor(config?: Config);
|
|
180
|
+
/**
|
|
181
|
+
* Flag indicating whether the native resources of this object have been created internally
|
|
182
|
+
* .i.e `initialize` has been called.
|
|
183
|
+
*/
|
|
184
|
+
abstract isInitialized: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Create the native object/resources that will be managed by this instance.
|
|
187
|
+
*/
|
|
188
|
+
abstract initialize(): void;
|
|
189
|
+
/**
|
|
190
|
+
* Flag indicating whether the native resources of this object have been disposed .i.e
|
|
191
|
+
* `destroy` has been called.
|
|
192
|
+
*/
|
|
193
|
+
abstract isDestroyed: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Dispose the native object/resources created by this instance during `initialize`.
|
|
196
|
+
*/
|
|
197
|
+
abstract destroy(): void;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Available cdn provider options for AnalyticsConfig.
|
|
202
|
+
*/
|
|
203
|
+
declare enum CdnProvider {
|
|
204
|
+
BITMOVIN = "bitmovin",
|
|
205
|
+
AKAMAI = "akamai",
|
|
206
|
+
FASTLY = "fastly",
|
|
207
|
+
MAXCDN = "maxcdn",
|
|
208
|
+
CLOUDFRONT = "cloudfront",
|
|
209
|
+
CHINACACHE = "chinacache",
|
|
210
|
+
BITGRAVITY = "bitgravity"
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Object used to configure a new `AnalyticsCollector` instance.
|
|
214
|
+
*/
|
|
215
|
+
interface AnalyticsConfig extends NativeInstanceConfig, CustomDataConfig {
|
|
216
|
+
/**
|
|
217
|
+
* CDN Provide that the video playback session is using.
|
|
218
|
+
*/
|
|
219
|
+
cdnProvider?: CdnProvider;
|
|
220
|
+
/**
|
|
221
|
+
* User ID of the customer.
|
|
222
|
+
*/
|
|
223
|
+
customUserId?: string;
|
|
224
|
+
/**
|
|
225
|
+
* ID of the video in the CMS system.
|
|
226
|
+
*/
|
|
227
|
+
videoId?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Human readable title of the video asset currently playing.
|
|
230
|
+
*/
|
|
231
|
+
title?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Analytics key.
|
|
234
|
+
*/
|
|
235
|
+
key: string;
|
|
236
|
+
/**
|
|
237
|
+
* Player key.
|
|
238
|
+
*/
|
|
239
|
+
playerKey?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Breadcrumb path to show where in the app the user is.
|
|
242
|
+
*/
|
|
243
|
+
path?: string;
|
|
244
|
+
/**
|
|
245
|
+
* Flag to see if stream is live before stream metadata is available (default: false).
|
|
246
|
+
*/
|
|
247
|
+
isLive?: boolean;
|
|
248
|
+
/**
|
|
249
|
+
* Flag to enable Ad tracking (default: false).
|
|
250
|
+
*/
|
|
251
|
+
ads?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Flag to use randomised userId not depending on device specific values (default: false).
|
|
254
|
+
*/
|
|
255
|
+
randomizeUserId?: boolean;
|
|
256
|
+
}
|
|
257
|
+
interface CustomDataConfig {
|
|
258
|
+
/**
|
|
259
|
+
* Optional free-form custom data
|
|
260
|
+
*/
|
|
261
|
+
customData1?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Optional free-form custom data
|
|
264
|
+
*/
|
|
265
|
+
customData2?: string;
|
|
266
|
+
/**
|
|
267
|
+
* Optional free-form custom data
|
|
268
|
+
*/
|
|
269
|
+
customData3?: string;
|
|
270
|
+
/**
|
|
271
|
+
* Optional free-form custom data
|
|
272
|
+
*/
|
|
273
|
+
customData4?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Optional free-form custom data
|
|
276
|
+
*/
|
|
277
|
+
customData5?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Optional free-form custom data
|
|
280
|
+
*/
|
|
281
|
+
customData6?: string;
|
|
282
|
+
/**
|
|
283
|
+
* Optional free-form custom data
|
|
284
|
+
*/
|
|
285
|
+
customData7?: string;
|
|
286
|
+
/**
|
|
287
|
+
* Optional free-form custom data
|
|
288
|
+
*/
|
|
289
|
+
customData8?: string;
|
|
290
|
+
/**
|
|
291
|
+
* Optional free-form custom data
|
|
292
|
+
*/
|
|
293
|
+
customData9?: string;
|
|
294
|
+
/**
|
|
295
|
+
* Optional free-form custom data
|
|
296
|
+
*/
|
|
297
|
+
customData10?: string;
|
|
298
|
+
/**
|
|
299
|
+
* Optional free-form custom data
|
|
300
|
+
*/
|
|
301
|
+
customData11?: string;
|
|
302
|
+
/**
|
|
303
|
+
* Optional free-form custom data
|
|
304
|
+
*/
|
|
305
|
+
customData12?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Optional free-form custom data
|
|
308
|
+
*/
|
|
309
|
+
customData13?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Optional free-form custom data
|
|
312
|
+
*/
|
|
313
|
+
customData14?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Optional free-form custom data
|
|
316
|
+
*/
|
|
317
|
+
customData15?: string;
|
|
318
|
+
/**
|
|
319
|
+
* Optional free-form custom data
|
|
320
|
+
*/
|
|
321
|
+
customData16?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Optional free-form custom data
|
|
324
|
+
*/
|
|
325
|
+
customData17?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Optional free-form custom data
|
|
328
|
+
*/
|
|
329
|
+
customData18?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Optional free-form custom data
|
|
332
|
+
*/
|
|
333
|
+
customData19?: string;
|
|
334
|
+
/**
|
|
335
|
+
* Optional free-form custom data
|
|
336
|
+
*/
|
|
337
|
+
customData20?: string;
|
|
338
|
+
/**
|
|
339
|
+
* Optional free-form custom data
|
|
340
|
+
*/
|
|
341
|
+
customData21?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Optional free-form custom data
|
|
344
|
+
*/
|
|
345
|
+
customData22?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Optional free-form custom data
|
|
348
|
+
*/
|
|
349
|
+
customData23?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Optional free-form custom data
|
|
352
|
+
*/
|
|
353
|
+
customData24?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Optional free-form custom data
|
|
356
|
+
*/
|
|
357
|
+
customData25?: string;
|
|
358
|
+
/**
|
|
359
|
+
* Optional free-form custom data
|
|
360
|
+
*/
|
|
361
|
+
customData26?: string;
|
|
362
|
+
/**
|
|
363
|
+
* Optional free-form custom data
|
|
364
|
+
*/
|
|
365
|
+
customData27?: string;
|
|
366
|
+
/**
|
|
367
|
+
* Optional free-form custom data
|
|
368
|
+
*/
|
|
369
|
+
customData28?: string;
|
|
370
|
+
/**
|
|
371
|
+
* Optional free-form custom data
|
|
372
|
+
*/
|
|
373
|
+
customData29?: string;
|
|
374
|
+
/**
|
|
375
|
+
* Optional free-form custom data
|
|
376
|
+
*/
|
|
377
|
+
customData30?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Experiment name needed for A/B testing.
|
|
380
|
+
*/
|
|
381
|
+
experimentName?: string;
|
|
382
|
+
}
|
|
383
|
+
interface SourceMetadata extends CustomDataConfig {
|
|
384
|
+
/**
|
|
385
|
+
* ID of the video in the CMS system
|
|
386
|
+
*/
|
|
387
|
+
videoId?: String;
|
|
388
|
+
/**
|
|
389
|
+
* Human readable title of the video asset currently playing
|
|
390
|
+
*/
|
|
391
|
+
title?: String;
|
|
392
|
+
/**
|
|
393
|
+
* Breadcrumb path to show where in the app the user is
|
|
394
|
+
*/
|
|
395
|
+
path?: String;
|
|
396
|
+
/**
|
|
397
|
+
* Flag to see if stream is live before stream metadata is available
|
|
398
|
+
*/
|
|
399
|
+
isLive?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* CDN Provider that the video playback session is using
|
|
402
|
+
*/
|
|
403
|
+
cdnProvider?: String;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Analytics collector that can be attached to a player object in order to collect and send
|
|
408
|
+
* its analytics information.
|
|
409
|
+
*/
|
|
410
|
+
declare class AnalyticsCollector extends NativeInstance<AnalyticsConfig> {
|
|
411
|
+
/**
|
|
412
|
+
* Whether the native `AnalyticsCollector` object has been created.
|
|
413
|
+
*/
|
|
414
|
+
isInitialized: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* The native player id that this analytics collector is attached to.
|
|
417
|
+
*/
|
|
418
|
+
playerId?: string;
|
|
419
|
+
/**
|
|
420
|
+
* Whether the native `AnalyticsCollector` object has been disposed.
|
|
421
|
+
*/
|
|
422
|
+
isDestroyed: boolean;
|
|
423
|
+
/**
|
|
424
|
+
* Initializes a native `BitmovinPlayerCollector` object.
|
|
425
|
+
*/
|
|
426
|
+
initialize: () => void;
|
|
427
|
+
/**
|
|
428
|
+
* Disposes the native `BitmovinPlayerCollector` object that has been created
|
|
429
|
+
* during initialization.
|
|
430
|
+
*/
|
|
431
|
+
destroy: () => void;
|
|
432
|
+
/**
|
|
433
|
+
* Attach a player instance to this analytics plugin. After this is completed, BitmovinAnalytics
|
|
434
|
+
* will start monitoring and sending analytics data based on the attached player instance.
|
|
435
|
+
*
|
|
436
|
+
* @param playerId - Native Id of the player to attach this collector instance.
|
|
437
|
+
*/
|
|
438
|
+
attach: (playerId: string) => void;
|
|
439
|
+
/**
|
|
440
|
+
* Detach a player instance from this analytics plugin if there's any attached. If no player is attached,
|
|
441
|
+
* nothing happens.
|
|
442
|
+
*/
|
|
443
|
+
detach: () => void;
|
|
444
|
+
/**
|
|
445
|
+
* Dynamically updates analytics custom data information. Use this method
|
|
446
|
+
* to update your custom data during runtime.
|
|
447
|
+
*
|
|
448
|
+
* @param customData - Analytics custom data config.
|
|
449
|
+
*/
|
|
450
|
+
setCustomDataOnce: (customData: CustomDataConfig) => void;
|
|
451
|
+
/**
|
|
452
|
+
* Sets the internal analytics custom data state.
|
|
453
|
+
*
|
|
454
|
+
* @param customData - Analytics custom data config.
|
|
455
|
+
*/
|
|
456
|
+
setCustomData: (customData: CustomDataConfig) => void;
|
|
457
|
+
/**
|
|
458
|
+
* Gets the current custom data config from the native `BitmovinPlayerCollector` instance.
|
|
459
|
+
*
|
|
460
|
+
* @returns The current custom data config.
|
|
461
|
+
*/
|
|
462
|
+
getCustomData: () => Promise<CustomDataConfig>;
|
|
463
|
+
/**
|
|
464
|
+
* Gets the current user id used by the native `BitmovinPlayerCollector` instance.
|
|
465
|
+
*
|
|
466
|
+
* @returns The current user id.
|
|
467
|
+
*/
|
|
468
|
+
getUserId: () => Promise<string>;
|
|
469
|
+
/**
|
|
470
|
+
* Adds source metadata for the current source loaded into the player.
|
|
471
|
+
* This method should be called every time a new source is loaded into the player to ensure
|
|
472
|
+
* that the analytics data is correct.
|
|
473
|
+
* @param sourceMetadata - Source metadata to set.
|
|
474
|
+
*/
|
|
475
|
+
addSourceMetadata: (sourceMetadata: SourceMetadata) => any;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* An audio session category defines a set of audio behaviors.
|
|
480
|
+
* Choose a category that most accurately describes the audio behavior you require.
|
|
481
|
+
*
|
|
482
|
+
* Note the `playback` category is required in order to properly enable picture in picture support.
|
|
483
|
+
*
|
|
484
|
+
* - `ambient`: The category for an app in which sound playback is nonprimary — that is, your app also works with the sound turned off.
|
|
485
|
+
* - `multiRoute`: The category for routing distinct streams of audio data to different output devices at the same time.
|
|
486
|
+
* - `playAndRecord`: The category for recording (input) and playback (output) of audio, such as for a Voice over Internet Protocol (VoIP) app.
|
|
487
|
+
* - `playback`: The category for playing recorded music or other sounds that are central to the successful use of your app.
|
|
488
|
+
* - `record`: The category for recording audio while also silencing playback audio.
|
|
489
|
+
* - `soloAmbient`: The default audio session category.
|
|
490
|
+
*
|
|
491
|
+
* @platform iOS
|
|
492
|
+
* @see https://developer.apple.com/documentation/avfaudio/avaudiosession/category
|
|
493
|
+
*/
|
|
494
|
+
declare type AudioSessionCategory = 'ambient' | 'multiRoute' | 'playAndRecord' | 'playback' | 'record' | 'soloAmbient';
|
|
495
|
+
/**
|
|
496
|
+
* An object that communicates to the system how you intend to use audio in your app.
|
|
497
|
+
*
|
|
498
|
+
* @platform iOS
|
|
499
|
+
* @see https://developer.apple.com/documentation/avfaudio/avaudiosession
|
|
500
|
+
*/
|
|
501
|
+
declare const AudioSession: {
|
|
502
|
+
/**
|
|
503
|
+
* Sets the audio session's category.
|
|
504
|
+
*
|
|
505
|
+
* @platform iOS
|
|
506
|
+
* @see https://developer.apple.com/documentation/avfaudio/avaudiosession/1616583-setcategory
|
|
507
|
+
*/
|
|
508
|
+
setCategory: (category: AudioSessionCategory) => Promise<void>;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Utility type that maps the specified optional props from the target `Type` to be
|
|
513
|
+
* required props. Note all the other props stay unaffected.
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* type MyType = {
|
|
517
|
+
* a?: string;
|
|
518
|
+
* b?: number;
|
|
519
|
+
* c?: boolean;
|
|
520
|
+
* };
|
|
521
|
+
*
|
|
522
|
+
* type MyRequiredType = MakeRequired<MyType, 'a' | 'c'> // => { a: string; b?: number; c: boolean; }
|
|
523
|
+
*/
|
|
524
|
+
declare type MakeRequired<Type, Key extends keyof Type> = Omit<Type, Key> & Required<Pick<Type, Key>>;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Supported subtitle/caption file formats.
|
|
528
|
+
*/
|
|
529
|
+
declare enum SubtitleFormat {
|
|
530
|
+
CEA = "cea",
|
|
531
|
+
TTML = "ttml",
|
|
532
|
+
VTT = "vtt"
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Represents a custom subtitle track source that can be added to `SourceConfig.subtitleTracks`.
|
|
536
|
+
*/
|
|
537
|
+
interface SubtitleTrack {
|
|
538
|
+
/**
|
|
539
|
+
* The URL to the timed file, e.g. WebVTT file.
|
|
540
|
+
*/
|
|
541
|
+
url?: string;
|
|
542
|
+
/**
|
|
543
|
+
* The label for this track.
|
|
544
|
+
*/
|
|
545
|
+
label?: string;
|
|
546
|
+
/**
|
|
547
|
+
* The unique identifier for this track. If no value is provided, a random UUIDv4 will be generated for it.
|
|
548
|
+
*/
|
|
549
|
+
identifier?: string;
|
|
550
|
+
/**
|
|
551
|
+
* Specifies the file format to be used by this track.
|
|
552
|
+
*/
|
|
553
|
+
format?: SubtitleFormat;
|
|
554
|
+
/**
|
|
555
|
+
* If set to true, this track would be considered as default. Default is `false`.
|
|
556
|
+
*/
|
|
557
|
+
isDefault?: boolean;
|
|
558
|
+
/**
|
|
559
|
+
* Tells if a subtitle track is forced. If set to `true` it means that the player should automatically
|
|
560
|
+
* select and switch this subtitle according to the selected audio language. Forced subtitles do
|
|
561
|
+
* not appear in `Player.getAvailableSubtitles`.
|
|
562
|
+
*
|
|
563
|
+
* Default is `false`.
|
|
564
|
+
*/
|
|
565
|
+
isForced?: boolean;
|
|
566
|
+
/**
|
|
567
|
+
* The IETF BCP 47 language tag associated with this track, e.g. `pt`, `en`, `es` etc.
|
|
568
|
+
*/
|
|
569
|
+
language?: string;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Helper type that represents an entry in `SourceConfig.subtitleTracks` list.
|
|
573
|
+
*
|
|
574
|
+
* Since `SubtitleTrack` has all of its properties as optionals for total compatibility with
|
|
575
|
+
* values that may be sent from native code, this type serves as a reinforcer of what properties
|
|
576
|
+
* should be required during the registration of an external subtitle track from JS.
|
|
577
|
+
*/
|
|
578
|
+
declare type SideLoadedSubtitleTrack = MakeRequired<SubtitleTrack, 'url' | 'label' | 'language' | 'format'>;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Quality definition of a video representation.
|
|
582
|
+
*/
|
|
583
|
+
interface VideoQuality {
|
|
584
|
+
/**
|
|
585
|
+
* The id of the media quality.
|
|
586
|
+
*/
|
|
587
|
+
id: string;
|
|
588
|
+
/**
|
|
589
|
+
* The label of the media quality that should be exposed to the user.
|
|
590
|
+
*/
|
|
591
|
+
label?: string;
|
|
592
|
+
/**
|
|
593
|
+
* The bitrate of the media quality.
|
|
594
|
+
*/
|
|
595
|
+
bitrate?: number;
|
|
596
|
+
/**
|
|
597
|
+
* The codec of the media quality.
|
|
598
|
+
*/
|
|
599
|
+
codec?: string;
|
|
600
|
+
/**
|
|
601
|
+
* The frame rate of the video quality. If the frame rate is not known or not applicable a value of -1 will be returned.
|
|
602
|
+
*/
|
|
603
|
+
frameRate?: number;
|
|
604
|
+
/**
|
|
605
|
+
* The height of the video quality.
|
|
606
|
+
*/
|
|
607
|
+
height?: number;
|
|
608
|
+
/**
|
|
609
|
+
* The width of the video quality.
|
|
610
|
+
*/
|
|
611
|
+
width?: number;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Represents an audio track for a video.
|
|
616
|
+
*/
|
|
617
|
+
interface AudioTrack {
|
|
618
|
+
/**
|
|
619
|
+
* The URL to the timed file, e.g. WebVTT file.
|
|
620
|
+
*/
|
|
621
|
+
url?: string;
|
|
622
|
+
/**
|
|
623
|
+
* The label for this track.
|
|
624
|
+
*/
|
|
625
|
+
label?: string;
|
|
626
|
+
/**
|
|
627
|
+
* The unique identifier for this track. If no value is provided, a random UUIDv4 will be generated for it.
|
|
628
|
+
*/
|
|
629
|
+
identifier?: string;
|
|
630
|
+
/**
|
|
631
|
+
* If set to true, this track would be considered as default. Default is `false`.
|
|
632
|
+
*/
|
|
633
|
+
isDefault?: boolean;
|
|
634
|
+
/**
|
|
635
|
+
* The IETF BCP 47 language tag associated with this track, e.g. `pt`, `en`, `es` etc.
|
|
636
|
+
*/
|
|
637
|
+
language?: string;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Base event type for all events.
|
|
642
|
+
*/
|
|
643
|
+
interface Event {
|
|
644
|
+
/**
|
|
645
|
+
* This event name as it is on the native side.
|
|
646
|
+
*/
|
|
647
|
+
name: string;
|
|
648
|
+
/**
|
|
649
|
+
* The UNIX timestamp in which this event happened.
|
|
650
|
+
*/
|
|
651
|
+
timestamp: number;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Base event type for error and warning events.
|
|
655
|
+
*/
|
|
656
|
+
interface ErrorEvent extends Event {
|
|
657
|
+
/**
|
|
658
|
+
* Error/Warning's code number.
|
|
659
|
+
*/
|
|
660
|
+
code?: number;
|
|
661
|
+
/**
|
|
662
|
+
* Error/Warning's localized message.
|
|
663
|
+
*/
|
|
664
|
+
message: string;
|
|
665
|
+
/**
|
|
666
|
+
* Underlying data emitted with the Error/Warning.
|
|
667
|
+
*/
|
|
668
|
+
data?: Record<string, any>;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Emitted when a source is loaded into the player.
|
|
672
|
+
* Seeking and time shifting are allowed as soon as this event is seen.
|
|
673
|
+
*/
|
|
674
|
+
interface PlayerActiveEvent extends Event {
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Emitted when a player error happens.
|
|
678
|
+
*/
|
|
679
|
+
interface PlayerErrorEvent extends ErrorEvent {
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Emitted when a player warning happens.
|
|
683
|
+
*/
|
|
684
|
+
interface PlayerWarningEvent extends ErrorEvent {
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Emitted when the player is destroyed.
|
|
688
|
+
*/
|
|
689
|
+
interface DestroyEvent extends Event {
|
|
690
|
+
}
|
|
691
|
+
/**
|
|
692
|
+
* Emitted when the player is muted.
|
|
693
|
+
*/
|
|
694
|
+
interface MutedEvent extends Event {
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Emitted when the player is unmuted.
|
|
698
|
+
*/
|
|
699
|
+
interface UnmutedEvent extends Event {
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Emitted when the player is ready for immediate playback, because initial audio/video
|
|
703
|
+
* has been downloaded.
|
|
704
|
+
*/
|
|
705
|
+
interface ReadyEvent extends Event {
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Emitted when the player is paused.
|
|
709
|
+
*/
|
|
710
|
+
interface PausedEvent extends Event {
|
|
711
|
+
/**
|
|
712
|
+
* The player's playback time from when this event happened.
|
|
713
|
+
*/
|
|
714
|
+
time: number;
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Emitted when the player received an intention to start/resume playback.
|
|
718
|
+
*/
|
|
719
|
+
interface PlayEvent extends Event {
|
|
720
|
+
/**
|
|
721
|
+
* The player's playback time from when this event happened.
|
|
722
|
+
*/
|
|
723
|
+
time: number;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Emitted when playback has started.
|
|
727
|
+
*/
|
|
728
|
+
interface PlayingEvent extends Event {
|
|
729
|
+
/**
|
|
730
|
+
* The player's playback time from when this event happened.
|
|
731
|
+
*/
|
|
732
|
+
time: number;
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Emitted when the playback of the current media has finished.
|
|
736
|
+
*/
|
|
737
|
+
interface PlaybackFinishedEvent extends Event {
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Source object representation the way it appears on `Event` payloads such as `SeekEvent`, for example.
|
|
741
|
+
*
|
|
742
|
+
* This interface only type hints what should be the shape of a `Source` object inside an `Event`'s
|
|
743
|
+
* payload during runtime so it has no direct relation with the `Source` class present in `src/source.ts`.
|
|
744
|
+
*
|
|
745
|
+
* Do not mistake it for a `NativeInstance` type.
|
|
746
|
+
*/
|
|
747
|
+
interface EventSource {
|
|
748
|
+
/**
|
|
749
|
+
* Event's source duration in seconds.
|
|
750
|
+
*/
|
|
751
|
+
duration: number;
|
|
752
|
+
/**
|
|
753
|
+
* Whether this event's source is currently active in a player.
|
|
754
|
+
*/
|
|
755
|
+
isActive: boolean;
|
|
756
|
+
/**
|
|
757
|
+
* Whether this event's source is currently attached to a player instance.
|
|
758
|
+
*/
|
|
759
|
+
isAttachedToPlayer: boolean;
|
|
760
|
+
/**
|
|
761
|
+
* Metadata for this event's source.
|
|
762
|
+
*/
|
|
763
|
+
metadata?: Record<string, any>;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Emitted when the player is about to seek to a new position.
|
|
767
|
+
* Only applies to VoD streams.
|
|
768
|
+
*/
|
|
769
|
+
interface SeekEvent extends Event {
|
|
770
|
+
/**
|
|
771
|
+
* Removed source metadata.
|
|
772
|
+
*/
|
|
773
|
+
from: {
|
|
774
|
+
time: number;
|
|
775
|
+
source: EventSource;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Added source metadata.
|
|
779
|
+
*/
|
|
780
|
+
to: {
|
|
781
|
+
time: number;
|
|
782
|
+
source: EventSource;
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Emitted when seeking has finished and data to continue playback is available.
|
|
787
|
+
* Only applies to VoD streams.
|
|
788
|
+
*/
|
|
789
|
+
interface SeekedEvent extends Event {
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Emitted when the player starts time shifting.
|
|
793
|
+
* Only applies to live streams.
|
|
794
|
+
*/
|
|
795
|
+
interface TimeShiftEvent extends Event {
|
|
796
|
+
/**
|
|
797
|
+
* The position from which we start the time shift
|
|
798
|
+
*/
|
|
799
|
+
position: number;
|
|
800
|
+
/**
|
|
801
|
+
* The position to which we want to jump for the time shift
|
|
802
|
+
*/
|
|
803
|
+
targetPosition: number;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Emitted when time shifting has finished and data is available to continue playback.
|
|
807
|
+
* Only applies to live streams.
|
|
808
|
+
*/
|
|
809
|
+
interface TimeShiftedEvent extends Event {
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Emitted when the player begins to stall and to buffer due to an empty buffer.
|
|
813
|
+
*/
|
|
814
|
+
interface StallStartedEvent extends Event {
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Emitted when the player ends stalling, due to enough data in the buffer.
|
|
818
|
+
*/
|
|
819
|
+
interface StallEndedEvent extends Event {
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Emitted when the current playback time has changed.
|
|
823
|
+
*/
|
|
824
|
+
interface TimeChangedEvent extends Event {
|
|
825
|
+
/**
|
|
826
|
+
* The player's playback time from when this event happened.
|
|
827
|
+
*/
|
|
828
|
+
currentTime: number;
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Emitted when a new source loading has started.
|
|
832
|
+
* It doesn't mean that the loading of the new manifest has finished.
|
|
833
|
+
*/
|
|
834
|
+
interface SourceLoadEvent extends Event {
|
|
835
|
+
/**
|
|
836
|
+
* Source that is about to load.
|
|
837
|
+
*/
|
|
838
|
+
source: EventSource;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Emitted when a new source is loaded.
|
|
842
|
+
* It doesn't mean that the loading of the new manifest has finished.
|
|
843
|
+
*/
|
|
844
|
+
interface SourceLoadedEvent extends Event {
|
|
845
|
+
/**
|
|
846
|
+
* Source that was loaded into player.
|
|
847
|
+
*/
|
|
848
|
+
source: EventSource;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Emitted when the current source has been unloaded.
|
|
852
|
+
*/
|
|
853
|
+
interface SourceUnloadedEvent extends Event {
|
|
854
|
+
/**
|
|
855
|
+
* Source that was unloaded from player.
|
|
856
|
+
*/
|
|
857
|
+
source: EventSource;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Emitted when a source error happens.
|
|
861
|
+
*/
|
|
862
|
+
interface SourceErrorEvent extends ErrorEvent {
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Emitted when a source warning happens.
|
|
866
|
+
*/
|
|
867
|
+
interface SourceWarningEvent extends ErrorEvent {
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Emitted when a new audio track is added to the player.
|
|
871
|
+
*/
|
|
872
|
+
interface AudioAddedEvent extends Event {
|
|
873
|
+
/**
|
|
874
|
+
* Audio track that has been added.
|
|
875
|
+
*/
|
|
876
|
+
audioTrack: AudioTrack;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Emitted when the player's selected audio track has changed.
|
|
880
|
+
*/
|
|
881
|
+
interface AudioChangedEvent extends Event {
|
|
882
|
+
/**
|
|
883
|
+
* Audio track that was previously selected.
|
|
884
|
+
*/
|
|
885
|
+
oldAudioTrack: AudioTrack;
|
|
886
|
+
/**
|
|
887
|
+
* Audio track that is selected now.
|
|
888
|
+
*/
|
|
889
|
+
newAudioTrack: AudioTrack;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Emitted when an audio track is removed from the player.
|
|
893
|
+
*/
|
|
894
|
+
interface AudioRemovedEvent extends Event {
|
|
895
|
+
/**
|
|
896
|
+
* Audio track that has been removed.
|
|
897
|
+
*/
|
|
898
|
+
audioTrack: AudioTrack;
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Emitted when a new subtitle track is added to the player.
|
|
902
|
+
*/
|
|
903
|
+
interface SubtitleAddedEvent extends Event {
|
|
904
|
+
/**
|
|
905
|
+
* Subtitle track that has been added.
|
|
906
|
+
*/
|
|
907
|
+
subtitleTrack: SubtitleTrack;
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Emitted when a subtitle track is removed from the player.
|
|
911
|
+
*/
|
|
912
|
+
interface SubtitleRemovedEvent extends Event {
|
|
913
|
+
/**
|
|
914
|
+
* Subtitle track that has been removed.
|
|
915
|
+
*/
|
|
916
|
+
subtitleTrack: SubtitleTrack;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Emitted when the player's selected subtitle track has changed.
|
|
920
|
+
*/
|
|
921
|
+
interface SubtitleChangedEvent extends Event {
|
|
922
|
+
/**
|
|
923
|
+
* Subtitle track that was previously selected.
|
|
924
|
+
*/
|
|
925
|
+
oldSubtitleTrack: SubtitleTrack;
|
|
926
|
+
/**
|
|
927
|
+
* Subtitle track that is selected now.
|
|
928
|
+
*/
|
|
929
|
+
newSubtitleTrack: SubtitleTrack;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Emitted when the player enters Picture in Picture mode.
|
|
933
|
+
*
|
|
934
|
+
* @platform iOS, Android
|
|
935
|
+
*/
|
|
936
|
+
interface PictureInPictureEnterEvent extends Event {
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Emitted when the player exits Picture in Picture mode.
|
|
940
|
+
*
|
|
941
|
+
* @platform iOS, Android
|
|
942
|
+
*/
|
|
943
|
+
interface PictureInPictureExitEvent extends Event {
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Emitted when the player has finished entering Picture in Picture mode on iOS.
|
|
947
|
+
*
|
|
948
|
+
* @platform iOS
|
|
949
|
+
*/
|
|
950
|
+
interface PictureInPictureEnteredEvent extends Event {
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Emitted when the player has finished exiting Picture in Picture mode on iOS.
|
|
954
|
+
*
|
|
955
|
+
* @platform iOS
|
|
956
|
+
*/
|
|
957
|
+
interface PictureInPictureExitedEvent extends Event {
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Emitted when the fullscreen functionality has been enabled.
|
|
961
|
+
*
|
|
962
|
+
* @platform iOS, Android
|
|
963
|
+
*/
|
|
964
|
+
interface FullscreenEnabledEvent extends Event {
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Emitted when the fullscreen functionality has been disabled.
|
|
968
|
+
*
|
|
969
|
+
* @platform iOS, Android
|
|
970
|
+
*/
|
|
971
|
+
interface FullscreenDisabledEvent extends Event {
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Emitted when the player enters fullscreen mode.
|
|
975
|
+
*
|
|
976
|
+
* @platform iOS, Android
|
|
977
|
+
*/
|
|
978
|
+
interface FullscreenEnterEvent extends Event {
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Emitted when the player exits fullscreen mode.
|
|
982
|
+
*
|
|
983
|
+
* @platform iOS, Android
|
|
984
|
+
*/
|
|
985
|
+
interface FullscreenExitEvent extends Event {
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Emitted when the availability of the Picture in Picture mode changed on Android.
|
|
989
|
+
*
|
|
990
|
+
* @platform Android
|
|
991
|
+
*/
|
|
992
|
+
interface PictureInPictureAvailabilityChangedEvent extends Event {
|
|
993
|
+
/**
|
|
994
|
+
* Whether Picture in Picture is available.
|
|
995
|
+
*/
|
|
996
|
+
isPictureInPictureAvailable: boolean;
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Emitted when an ad break has started.
|
|
1000
|
+
*/
|
|
1001
|
+
interface AdBreakStartedEvent extends Event {
|
|
1002
|
+
/**
|
|
1003
|
+
* The `AdBreak` that has started.
|
|
1004
|
+
*/
|
|
1005
|
+
adBreak?: AdBreak;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Emitted when an ad break has finished.
|
|
1009
|
+
*/
|
|
1010
|
+
interface AdBreakFinishedEvent extends Event {
|
|
1011
|
+
/**
|
|
1012
|
+
* The `AdBreak` that has finished.
|
|
1013
|
+
*/
|
|
1014
|
+
adBreak?: AdBreak;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Emitted when the playback of an ad has started.
|
|
1018
|
+
*/
|
|
1019
|
+
interface AdStartedEvent extends Event {
|
|
1020
|
+
/**
|
|
1021
|
+
* The `Ad` this event is related to.
|
|
1022
|
+
*/
|
|
1023
|
+
ad?: Ad;
|
|
1024
|
+
/**
|
|
1025
|
+
* The target URL to open once the user clicks on the ad.
|
|
1026
|
+
*/
|
|
1027
|
+
clickThroughUrl?: string;
|
|
1028
|
+
/**
|
|
1029
|
+
* The `AdSourceType` of the started `Ad`.
|
|
1030
|
+
*/
|
|
1031
|
+
clientType?: AdSourceType;
|
|
1032
|
+
/**
|
|
1033
|
+
* The duration of the ad in seconds.
|
|
1034
|
+
*/
|
|
1035
|
+
duration: number;
|
|
1036
|
+
/**
|
|
1037
|
+
* The index of the ad in the queue.
|
|
1038
|
+
*/
|
|
1039
|
+
indexInQueue: number;
|
|
1040
|
+
/**
|
|
1041
|
+
* The position of the corresponding `Ad`.
|
|
1042
|
+
*/
|
|
1043
|
+
position?: string;
|
|
1044
|
+
/**
|
|
1045
|
+
* The skip offset of the ad in seconds.
|
|
1046
|
+
*/
|
|
1047
|
+
skipOffset: number;
|
|
1048
|
+
/**
|
|
1049
|
+
* The content time at which the `Ad` is played.
|
|
1050
|
+
*/
|
|
1051
|
+
timeOffset: number;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Emitted when an ad has finished playback.
|
|
1055
|
+
*/
|
|
1056
|
+
interface AdFinishedEvent extends Event {
|
|
1057
|
+
/**
|
|
1058
|
+
* The `Ad` that finished playback.
|
|
1059
|
+
*/
|
|
1060
|
+
ad?: Ad;
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Emitted when an error with the ad playback occurs.
|
|
1064
|
+
*/
|
|
1065
|
+
interface AdErrorEvent extends ErrorEvent {
|
|
1066
|
+
/**
|
|
1067
|
+
* The `AdConfig` for which the ad error occurred.
|
|
1068
|
+
*/
|
|
1069
|
+
adConfig?: AdConfig;
|
|
1070
|
+
/**
|
|
1071
|
+
* The `AdItem` for which the ad error occurred.
|
|
1072
|
+
*/
|
|
1073
|
+
adItem?: AdItem;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Emitted when an ad was clicked.
|
|
1077
|
+
*/
|
|
1078
|
+
interface AdClickedEvent extends Event {
|
|
1079
|
+
/**
|
|
1080
|
+
* The click through url of the ad.
|
|
1081
|
+
*/
|
|
1082
|
+
clickThroughUrl?: string;
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Emitted when an ad was skipped.
|
|
1086
|
+
*/
|
|
1087
|
+
interface AdSkippedEvent extends Event {
|
|
1088
|
+
/**
|
|
1089
|
+
* The `Ad` that was skipped.
|
|
1090
|
+
*/
|
|
1091
|
+
ad?: Ad;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Emitted when the playback of an ad has progressed over a quartile boundary.
|
|
1095
|
+
*/
|
|
1096
|
+
interface AdQuartileEvent extends Event {
|
|
1097
|
+
/**
|
|
1098
|
+
* The `AdQuartile` boundary that playback has progressed over.
|
|
1099
|
+
*/
|
|
1100
|
+
quartile: AdQuartile;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Emitted when an ad manifest was successfully downloaded, parsed and added into the ad break schedule.
|
|
1104
|
+
*/
|
|
1105
|
+
interface AdScheduledEvent extends Event {
|
|
1106
|
+
/**
|
|
1107
|
+
* The total number of scheduled ads.
|
|
1108
|
+
*/
|
|
1109
|
+
numberOfAds: number;
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Emitted when the download of an ad manifest is started.
|
|
1113
|
+
*/
|
|
1114
|
+
interface AdManifestLoadEvent extends Event {
|
|
1115
|
+
/**
|
|
1116
|
+
* The `AdBreak` this event is related to.
|
|
1117
|
+
*/
|
|
1118
|
+
adBreak?: AdBreak;
|
|
1119
|
+
/**
|
|
1120
|
+
* The `AdConfig` of the loaded ad manifest.
|
|
1121
|
+
*/
|
|
1122
|
+
adConfig?: AdConfig;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Emitted when an ad manifest was successfully loaded.
|
|
1126
|
+
*/
|
|
1127
|
+
interface AdManifestLoadedEvent extends Event {
|
|
1128
|
+
/**
|
|
1129
|
+
* The `AdBreak` this event is related to.
|
|
1130
|
+
*/
|
|
1131
|
+
adBreak?: AdBreak;
|
|
1132
|
+
/**
|
|
1133
|
+
* The `AdConfig` of the loaded ad manifest.
|
|
1134
|
+
*/
|
|
1135
|
+
adConfig?: AdConfig;
|
|
1136
|
+
/**
|
|
1137
|
+
* How long it took for the ad tag to be downloaded in milliseconds.
|
|
1138
|
+
*/
|
|
1139
|
+
downloadTime: number;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Emitted when the current video playback quality has changed.
|
|
1143
|
+
*/
|
|
1144
|
+
interface VideoPlaybackQualityChangedEvent extends Event {
|
|
1145
|
+
/**
|
|
1146
|
+
* The new quality
|
|
1147
|
+
*/
|
|
1148
|
+
newVideoQuality: VideoQuality;
|
|
1149
|
+
/**
|
|
1150
|
+
* The previous quality
|
|
1151
|
+
*/
|
|
1152
|
+
oldVideoQuality: VideoQuality;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* Type that defines all event props supported by `PlayerView` and `NativePlayerView`.
|
|
1157
|
+
* Used to generate the specific events interface for each component.
|
|
1158
|
+
*/
|
|
1159
|
+
interface EventProps {
|
|
1160
|
+
onAdBreakFinished: AdBreakFinishedEvent;
|
|
1161
|
+
onAdBreakStarted: AdBreakStartedEvent;
|
|
1162
|
+
onAdClicked: AdClickedEvent;
|
|
1163
|
+
onAdError: AdErrorEvent;
|
|
1164
|
+
onAdFinished: AdFinishedEvent;
|
|
1165
|
+
onAdManifestLoad: AdManifestLoadEvent;
|
|
1166
|
+
onAdManifestLoaded: AdManifestLoadedEvent;
|
|
1167
|
+
onAdQuartile: AdQuartileEvent;
|
|
1168
|
+
onAdScheduled: AdScheduledEvent;
|
|
1169
|
+
onAdSkipped: AdSkippedEvent;
|
|
1170
|
+
onAdStarted: AdStartedEvent;
|
|
1171
|
+
onDestroy: DestroyEvent;
|
|
1172
|
+
onEvent: Event;
|
|
1173
|
+
onFullscreenEnabled: FullscreenEnabledEvent;
|
|
1174
|
+
onFullscreenDisabled: FullscreenDisabledEvent;
|
|
1175
|
+
onFullscreenEnter: FullscreenEnterEvent;
|
|
1176
|
+
onFullscreenExit: FullscreenExitEvent;
|
|
1177
|
+
onMuted: MutedEvent;
|
|
1178
|
+
onPaused: PausedEvent;
|
|
1179
|
+
onPictureInPictureAvailabilityChanged: PictureInPictureAvailabilityChangedEvent;
|
|
1180
|
+
onPictureInPictureEnter: PictureInPictureEnterEvent;
|
|
1181
|
+
onPictureInPictureEntered: PictureInPictureEnteredEvent;
|
|
1182
|
+
onPictureInPictureExit: PictureInPictureExitEvent;
|
|
1183
|
+
onPictureInPictureExited: PictureInPictureExitedEvent;
|
|
1184
|
+
onPlay: PlayEvent;
|
|
1185
|
+
onPlaybackFinished: PlaybackFinishedEvent;
|
|
1186
|
+
onPlayerActive: PlayerActiveEvent;
|
|
1187
|
+
onPlayerError: PlayerErrorEvent;
|
|
1188
|
+
onPlayerWarning: PlayerWarningEvent;
|
|
1189
|
+
onPlaying: PlayingEvent;
|
|
1190
|
+
onReady: ReadyEvent;
|
|
1191
|
+
onSeek: SeekEvent;
|
|
1192
|
+
onSeeked: SeekedEvent;
|
|
1193
|
+
onTimeShift: TimeShiftEvent;
|
|
1194
|
+
onTimeShifted: TimeShiftedEvent;
|
|
1195
|
+
onStallStarted: StallStartedEvent;
|
|
1196
|
+
onStallEnded: StallEndedEvent;
|
|
1197
|
+
onSourceError: SourceErrorEvent;
|
|
1198
|
+
onSourceLoad: SourceLoadEvent;
|
|
1199
|
+
onSourceLoaded: SourceLoadedEvent;
|
|
1200
|
+
onSourceUnloaded: SourceUnloadedEvent;
|
|
1201
|
+
onSourceWarning: SourceWarningEvent;
|
|
1202
|
+
onAudioAdded: AudioAddedEvent;
|
|
1203
|
+
onAudioChanged: AudioChangedEvent;
|
|
1204
|
+
onAudioRemoved: AudioRemovedEvent;
|
|
1205
|
+
onSubtitleAdded: SubtitleAddedEvent;
|
|
1206
|
+
onSubtitleChanged: SubtitleChangedEvent;
|
|
1207
|
+
onSubtitleRemoved: SubtitleRemovedEvent;
|
|
1208
|
+
onTimeChanged: TimeChangedEvent;
|
|
1209
|
+
onUnmuted: UnmutedEvent;
|
|
1210
|
+
onVideoPlaybackQualityChanged: VideoPlaybackQualityChangedEvent;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Event props for `PlayerView`.
|
|
1214
|
+
*
|
|
1215
|
+
* Note the events of `PlayerView` are simply a proxy over
|
|
1216
|
+
* the events from `NativePlayerView` just removing RN's bubbling data.
|
|
1217
|
+
*/
|
|
1218
|
+
declare type PlayerViewEvents = {
|
|
1219
|
+
[Prop in keyof EventProps]?: (event: EventProps[Prop]) => void;
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Represents a FairPlay Streaming DRM config.
|
|
1224
|
+
*/
|
|
1225
|
+
interface FairplayConfig {
|
|
1226
|
+
/**
|
|
1227
|
+
* The DRM license acquisition URL.
|
|
1228
|
+
*/
|
|
1229
|
+
licenseUrl: string;
|
|
1230
|
+
/**
|
|
1231
|
+
* The URL to the FairPlay Streaming certificate of the license server.
|
|
1232
|
+
*/
|
|
1233
|
+
certificateUrl?: string;
|
|
1234
|
+
/**
|
|
1235
|
+
* A dictionary to specify custom HTTP headers for the license request.
|
|
1236
|
+
*/
|
|
1237
|
+
licenseRequestHeaders?: Record<string, string>;
|
|
1238
|
+
/**
|
|
1239
|
+
* A dictionary to specify custom HTTP headers for the certificate request.
|
|
1240
|
+
*/
|
|
1241
|
+
certificateRequestHeaders?: Record<string, string>;
|
|
1242
|
+
/**
|
|
1243
|
+
* A block to prepare the loaded certificate before building SPC data and passing it into the
|
|
1244
|
+
* system. This is needed if the server responds with anything else than the certificate, e.g. if
|
|
1245
|
+
* the certificate is wrapped into a JSON object. The server response for the certificate request
|
|
1246
|
+
* is passed as parameter “as is”.
|
|
1247
|
+
*
|
|
1248
|
+
* Note that both the passed `certificate` data and this block return value should be a Base64
|
|
1249
|
+
* string. So use whatever solution suits you best to handle Base64 in React Native.
|
|
1250
|
+
*
|
|
1251
|
+
* @param certificate - Base64 encoded certificate data.
|
|
1252
|
+
* @returns The processed Base64 encoded certificate.
|
|
1253
|
+
*/
|
|
1254
|
+
prepareCertificate?: (certificate: string) => string;
|
|
1255
|
+
/**
|
|
1256
|
+
* A block to prepare the data which is sent as the body of the POST license request.
|
|
1257
|
+
* As many DRM providers expect different, vendor-specific messages, this can be done using
|
|
1258
|
+
* this user-defined block.
|
|
1259
|
+
*
|
|
1260
|
+
* Note that both the passed `message` data and this block return value should be a Base64 string.
|
|
1261
|
+
* So use whatever solution suits you best to handle Base64 in React Native.
|
|
1262
|
+
*
|
|
1263
|
+
* @param message - Base64 encoded message data.
|
|
1264
|
+
* @param assetId - Stream asset ID.
|
|
1265
|
+
* @returns The processed Base64 encoded message.
|
|
1266
|
+
*/
|
|
1267
|
+
prepareMessage?: (message: string, assetId: string) => string;
|
|
1268
|
+
/**
|
|
1269
|
+
* A block to prepare the data which is sent as the body of the POST request for syncing the DRM
|
|
1270
|
+
* license information.
|
|
1271
|
+
*
|
|
1272
|
+
* Note that both the passed `syncMessage` data and this block return value should be a Base64
|
|
1273
|
+
* string. So use whatever solution suits you best to handle Base64 in React Native.
|
|
1274
|
+
*
|
|
1275
|
+
* @param message - Base64 encoded message data.
|
|
1276
|
+
* @param assetId - Asset ID.
|
|
1277
|
+
* @returns The processed Base64 encoded sync message.
|
|
1278
|
+
*/
|
|
1279
|
+
prepareSyncMessage?: (syncMessage: string, assetId: string) => string;
|
|
1280
|
+
/**
|
|
1281
|
+
* A block to prepare the loaded CKC Data before passing it to the system. This is needed if the
|
|
1282
|
+
* server responds with anything else than the license, e.g. if the license is wrapped into a JSON
|
|
1283
|
+
* object.
|
|
1284
|
+
*
|
|
1285
|
+
* Note that both the passed `license` data and this block return value should be a Base64 string.
|
|
1286
|
+
* So use whatever solution suits you best to handle Base64 in React Native.
|
|
1287
|
+
*
|
|
1288
|
+
* @param license - Base64 encoded license data.
|
|
1289
|
+
* @returns The processed Base64 encoded license.
|
|
1290
|
+
*/
|
|
1291
|
+
prepareLicense?: (license: string) => string;
|
|
1292
|
+
/**
|
|
1293
|
+
* A block to prepare the URI (without the skd://) from the HLS manifest before passing it to the
|
|
1294
|
+
* system.
|
|
1295
|
+
*
|
|
1296
|
+
* @param licenseServerUrl - License server URL string.
|
|
1297
|
+
* @returns The processed license server URL string.
|
|
1298
|
+
*/
|
|
1299
|
+
prepareLicenseServerUrl?: (licenseServerUrl: string) => string;
|
|
1300
|
+
/**
|
|
1301
|
+
* A block to prepare the `contentId`, which is sent to the FairPlay Streaming license server as
|
|
1302
|
+
* request body, and which is used to build the SPC data. As many DRM providers expect different,
|
|
1303
|
+
* vendor-specific messages, this can be done using this user-defined block. The parameter is the
|
|
1304
|
+
* skd:// URI extracted from the HLS manifest (m3u8) and the return value should be the contentID
|
|
1305
|
+
* as string.
|
|
1306
|
+
*
|
|
1307
|
+
* @param contentId - Extracted content id string.
|
|
1308
|
+
* @returns The processed contentId.
|
|
1309
|
+
*/
|
|
1310
|
+
prepareContentId?: (contentId: string) => string;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* Represents a Widevine Streaming DRM config.
|
|
1315
|
+
* Android only.
|
|
1316
|
+
*/
|
|
1317
|
+
interface WidevineConfig {
|
|
1318
|
+
/**
|
|
1319
|
+
* The DRM license acquisition URL.
|
|
1320
|
+
*/
|
|
1321
|
+
licenseUrl: string;
|
|
1322
|
+
/**
|
|
1323
|
+
* A map containing the HTTP request headers, or null.
|
|
1324
|
+
*/
|
|
1325
|
+
httpHeaders: Record<string, string>;
|
|
1326
|
+
/**
|
|
1327
|
+
* A block to prepare the data which is sent as the body of the POST license request.
|
|
1328
|
+
* As many DRM providers expect different, vendor-specific messages, this can be done using
|
|
1329
|
+
* this user-defined block.
|
|
1330
|
+
*
|
|
1331
|
+
* Note that both the passed `message` data and this block return value should be a Base64 string.
|
|
1332
|
+
* So use whatever solution suits you best to handle Base64 in React Native.
|
|
1333
|
+
*
|
|
1334
|
+
* @param message - Base64 encoded message data.
|
|
1335
|
+
* @returns The processed Base64 encoded message.
|
|
1336
|
+
*/
|
|
1337
|
+
prepareMessage?: (message: string) => string;
|
|
1338
|
+
/**
|
|
1339
|
+
* A block to prepare the loaded CKC Data before passing it to the system. This is needed if the
|
|
1340
|
+
* server responds with anything else than the license, e.g. if the license is wrapped into a JSON
|
|
1341
|
+
* object.
|
|
1342
|
+
*
|
|
1343
|
+
* Note that both the passed `license` data and this block return value should be a Base64 string.
|
|
1344
|
+
* So use whatever solution suits you best to handle Base64 in React Native.
|
|
1345
|
+
*
|
|
1346
|
+
* @param license - Base64 encoded license data.
|
|
1347
|
+
* @returns The processed Base64 encoded license.
|
|
1348
|
+
*/
|
|
1349
|
+
prepareLicense?: (license: string) => string;
|
|
1350
|
+
/**
|
|
1351
|
+
* Set widevine's preferred security level.
|
|
1352
|
+
*/
|
|
1353
|
+
preferredSecurityLevel?: string;
|
|
1354
|
+
/**
|
|
1355
|
+
* Indicates if the DRM sessions should be kept alive after a source is unloaded.
|
|
1356
|
+
* This allows DRM sessions to be reused over several different source items with the same DRM configuration as well
|
|
1357
|
+
* as the same DRM scheme information.
|
|
1358
|
+
* Default: `false`
|
|
1359
|
+
*/
|
|
1360
|
+
shouldKeepDrmSessionsAlive: boolean;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* Represents the general Streaming DRM config.
|
|
1365
|
+
*/
|
|
1366
|
+
interface DrmConfig extends NativeInstanceConfig {
|
|
1367
|
+
/**
|
|
1368
|
+
* FairPlay specific configuration. Only applicable for iOS.
|
|
1369
|
+
*/
|
|
1370
|
+
fairplay?: FairplayConfig;
|
|
1371
|
+
/**
|
|
1372
|
+
* Widevine specific configuration. Only applicable for Android.
|
|
1373
|
+
*/
|
|
1374
|
+
widevine?: WidevineConfig;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Represents a native DRM configuration object.
|
|
1378
|
+
*/
|
|
1379
|
+
declare class Drm extends NativeInstance<DrmConfig> {
|
|
1380
|
+
/**
|
|
1381
|
+
* Whether this object's native instance has been created.
|
|
1382
|
+
*/
|
|
1383
|
+
isInitialized: boolean;
|
|
1384
|
+
/**
|
|
1385
|
+
* Whether this object's native instance has been disposed.
|
|
1386
|
+
*/
|
|
1387
|
+
isDestroyed: boolean;
|
|
1388
|
+
/**
|
|
1389
|
+
* Allocates the DRM config instance and its resources natively.
|
|
1390
|
+
*/
|
|
1391
|
+
initialize: () => void;
|
|
1392
|
+
/**
|
|
1393
|
+
* Destroys the native DRM config and releases all of its allocated resources.
|
|
1394
|
+
*/
|
|
1395
|
+
destroy: () => void;
|
|
1396
|
+
/**
|
|
1397
|
+
* iOS only.
|
|
1398
|
+
*
|
|
1399
|
+
* Applies the user-defined `prepareCertificate` function to native's `certificate` data and store
|
|
1400
|
+
* the result back in `DrmModule`.
|
|
1401
|
+
*
|
|
1402
|
+
* Called from native code when `FairplayConfig.prepareCertificate` is dispatched.
|
|
1403
|
+
*
|
|
1404
|
+
* @param certificate - Base64 encoded certificate data.
|
|
1405
|
+
*/
|
|
1406
|
+
onPrepareCertificate: (certificate: string) => void;
|
|
1407
|
+
/**
|
|
1408
|
+
* Applies the user-defined `prepareMessage` function to native's `message` data and store
|
|
1409
|
+
* the result back in `DrmModule`.
|
|
1410
|
+
*
|
|
1411
|
+
* Called from native code when `prepareMessage` is dispatched.
|
|
1412
|
+
*
|
|
1413
|
+
* @param message - Base64 encoded message data.
|
|
1414
|
+
* @param assetId - Optional asset ID. Only sent by iOS.
|
|
1415
|
+
*/
|
|
1416
|
+
onPrepareMessage: (message: string, assetId?: string) => void;
|
|
1417
|
+
/**
|
|
1418
|
+
* iOS only.
|
|
1419
|
+
*
|
|
1420
|
+
* Applies the user-defined `prepareSyncMessage` function to native's `syncMessage` data and
|
|
1421
|
+
* store the result back in `DrmModule`.
|
|
1422
|
+
*
|
|
1423
|
+
* Called from native code when `FairplayConfig.prepareSyncMessage` is dispatched.
|
|
1424
|
+
*
|
|
1425
|
+
* @param syncMessage - Base64 encoded sync SPC message data.
|
|
1426
|
+
*/
|
|
1427
|
+
onPrepareSyncMessage: (syncMessage: string, assetId: string) => void;
|
|
1428
|
+
/**
|
|
1429
|
+
* Applies the user-defined `prepareLicense` function to native's `license` data and store
|
|
1430
|
+
* the result back in `DrmModule`.
|
|
1431
|
+
*
|
|
1432
|
+
* Called from native code when `prepareLicense` is dispatched.
|
|
1433
|
+
*
|
|
1434
|
+
* @param license - Base64 encoded license data.
|
|
1435
|
+
*/
|
|
1436
|
+
onPrepareLicense: (license: string) => void;
|
|
1437
|
+
/**
|
|
1438
|
+
* iOS only.
|
|
1439
|
+
*
|
|
1440
|
+
* Applies the user-defined `prepareLicenseServerUrl` function to native's `licenseServerUrl` data
|
|
1441
|
+
* and store the result back in `DrmModule`.
|
|
1442
|
+
*
|
|
1443
|
+
* Called from native code when `FairplayConfig.prepareLicenseServerUrl` is dispatched.
|
|
1444
|
+
*
|
|
1445
|
+
* @param licenseServerUrl - The license server URL string.
|
|
1446
|
+
*/
|
|
1447
|
+
onPrepareLicenseServerUrl: (licenseServerUrl: string) => void;
|
|
1448
|
+
/**
|
|
1449
|
+
* iOS only.
|
|
1450
|
+
*
|
|
1451
|
+
* Applies the user-defined `prepareContentId` function to native's `contentId` string
|
|
1452
|
+
* and store the result back in `DrmModule`.
|
|
1453
|
+
*
|
|
1454
|
+
* Called from native code when `FairplayConfig.prepareContentId` is dispatched.
|
|
1455
|
+
*
|
|
1456
|
+
* @param contentId - The extracted contentId string.
|
|
1457
|
+
*/
|
|
1458
|
+
onPrepareContentId: (contentId: string) => void;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Types of media that can be handled by the player.
|
|
1463
|
+
*/
|
|
1464
|
+
declare enum SourceType {
|
|
1465
|
+
/**
|
|
1466
|
+
* Indicates a missing source type.
|
|
1467
|
+
*/
|
|
1468
|
+
NONE = "none",
|
|
1469
|
+
/**
|
|
1470
|
+
* Indicates media type HLS.
|
|
1471
|
+
*/
|
|
1472
|
+
HLS = "hls",
|
|
1473
|
+
/**
|
|
1474
|
+
* Indicates media type DASH.
|
|
1475
|
+
*/
|
|
1476
|
+
DASH = "dash",
|
|
1477
|
+
/**
|
|
1478
|
+
* Indicates media type Progressive MP4.
|
|
1479
|
+
*/
|
|
1480
|
+
PROGRESSIVE = "progressive"
|
|
1481
|
+
}
|
|
1482
|
+
/**
|
|
1483
|
+
* The different loading states a `Source` instance can be in.
|
|
1484
|
+
*/
|
|
1485
|
+
declare enum LoadingState {
|
|
1486
|
+
/**
|
|
1487
|
+
* The source is unloaded.
|
|
1488
|
+
*/
|
|
1489
|
+
UNLOADED = 0,
|
|
1490
|
+
/**
|
|
1491
|
+
* The source is currently loading.
|
|
1492
|
+
*/
|
|
1493
|
+
LOADING = 1,
|
|
1494
|
+
/**
|
|
1495
|
+
* The source is loaded.
|
|
1496
|
+
*/
|
|
1497
|
+
LOADED = 2
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Represents a source configuration that be loaded into a player instance.
|
|
1501
|
+
*/
|
|
1502
|
+
interface SourceConfig extends NativeInstanceConfig {
|
|
1503
|
+
/**
|
|
1504
|
+
* The url for this source configuration.
|
|
1505
|
+
*/
|
|
1506
|
+
url: string;
|
|
1507
|
+
/**
|
|
1508
|
+
* The `SourceType` for this configuration.
|
|
1509
|
+
*/
|
|
1510
|
+
type?: SourceType;
|
|
1511
|
+
/**
|
|
1512
|
+
* The title of the video source.
|
|
1513
|
+
*/
|
|
1514
|
+
title?: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* The URL to a preview image displayed until the video starts.
|
|
1517
|
+
*/
|
|
1518
|
+
poster?: string;
|
|
1519
|
+
/**
|
|
1520
|
+
* Indicates whether to show the poster image during playback.
|
|
1521
|
+
* Useful, for example, for audio-only streams.
|
|
1522
|
+
*/
|
|
1523
|
+
isPosterPersistent?: boolean;
|
|
1524
|
+
/**
|
|
1525
|
+
* The DRM config for the source.
|
|
1526
|
+
*/
|
|
1527
|
+
drmConfig?: DrmConfig;
|
|
1528
|
+
/**
|
|
1529
|
+
* External subtitle tracks to be added into the player.
|
|
1530
|
+
*/
|
|
1531
|
+
subtitleTracks?: SideLoadedSubtitleTrack[];
|
|
1532
|
+
/**
|
|
1533
|
+
* External thumbnails to be added into the player.
|
|
1534
|
+
*/
|
|
1535
|
+
thumbnailTrack?: string;
|
|
1536
|
+
/**
|
|
1537
|
+
* The optional custom metadata. Also sent to the cast receiver when loading the Source.
|
|
1538
|
+
*/
|
|
1539
|
+
metadata?: Record<string, string>;
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* Represents audio and video content that can be loaded into a player.
|
|
1543
|
+
*/
|
|
1544
|
+
declare class Source extends NativeInstance<SourceConfig> {
|
|
1545
|
+
/**
|
|
1546
|
+
* The native DRM config reference of this source.
|
|
1547
|
+
*/
|
|
1548
|
+
drm?: Drm;
|
|
1549
|
+
/**
|
|
1550
|
+
* Whether the native `Source` object has been created.
|
|
1551
|
+
*/
|
|
1552
|
+
isInitialized: boolean;
|
|
1553
|
+
/**
|
|
1554
|
+
* Whether the native `Source` object has been disposed.
|
|
1555
|
+
*/
|
|
1556
|
+
isDestroyed: boolean;
|
|
1557
|
+
/**
|
|
1558
|
+
* Allocates the native `Source` instance and its resources natively.
|
|
1559
|
+
*/
|
|
1560
|
+
initialize: () => void;
|
|
1561
|
+
/**
|
|
1562
|
+
* Destroys the native `Source` and releases all of its allocated resources.
|
|
1563
|
+
*/
|
|
1564
|
+
destroy: () => void;
|
|
1565
|
+
/**
|
|
1566
|
+
* The duration of the source in seconds if it’s a VoD or `INFINITY` if it’s a live stream.
|
|
1567
|
+
* Default value is `0` if the duration is not available or not known.
|
|
1568
|
+
*/
|
|
1569
|
+
duration: () => Promise<number>;
|
|
1570
|
+
/**
|
|
1571
|
+
* Whether the source is currently active in a player (i.e. playing back or paused).
|
|
1572
|
+
* Only one source can be active in the same player instance at any time.
|
|
1573
|
+
*/
|
|
1574
|
+
isActive: () => Promise<boolean>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Whether the source is currently attached to a player instance.
|
|
1577
|
+
*/
|
|
1578
|
+
isAttachedToPlayer: () => Promise<boolean>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Metadata for the currently loaded source.
|
|
1581
|
+
*/
|
|
1582
|
+
metadata: () => Promise<Record<string, any> | null>;
|
|
1583
|
+
/**
|
|
1584
|
+
* Set metadata for the currently loaded source.
|
|
1585
|
+
* Setting the metadata to `null` clears the metadata object in native source.
|
|
1586
|
+
*/
|
|
1587
|
+
setMetadata: (metadata: Record<string, any> | null) => void;
|
|
1588
|
+
/**
|
|
1589
|
+
* The current `LoadingState` of the source.
|
|
1590
|
+
*/
|
|
1591
|
+
loadingState: () => Promise<LoadingState>;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Contains config values which can be used to alter the visual presentation and behaviour of the player UI.
|
|
1596
|
+
*/
|
|
1597
|
+
interface StyleConfig {
|
|
1598
|
+
/**
|
|
1599
|
+
* Sets if the UI should be enabled or not. Default value is `true`.
|
|
1600
|
+
* @example
|
|
1601
|
+
* ```
|
|
1602
|
+
* const player = new Player({
|
|
1603
|
+
* styleConfig: {
|
|
1604
|
+
* isUiEnabled: false,
|
|
1605
|
+
* },
|
|
1606
|
+
* });
|
|
1607
|
+
* ```
|
|
1608
|
+
*/
|
|
1609
|
+
isUiEnabled?: boolean;
|
|
1610
|
+
/**
|
|
1611
|
+
* Sets which user interface type should be used.
|
|
1612
|
+
* Default value is `UserInterfaceType.bitmovin` on `iOS` and `UserInterfaceType.system` on `tvOS`.
|
|
1613
|
+
* This setting only applies if `StyleConfig.isUiEnabled` is set to true.
|
|
1614
|
+
* @example
|
|
1615
|
+
* ```
|
|
1616
|
+
* const player = new Player({
|
|
1617
|
+
* styleConfig: {
|
|
1618
|
+
* userInterfaceType: UserInterfaceType.System,
|
|
1619
|
+
* },
|
|
1620
|
+
* });
|
|
1621
|
+
* ```
|
|
1622
|
+
* @platform iOS, tvOS
|
|
1623
|
+
*/
|
|
1624
|
+
userInterfaceType?: UserInterfaceType;
|
|
1625
|
+
/**
|
|
1626
|
+
* Sets the CSS file that will be used for the UI. The default CSS file will be completely replaced by the CSS file set with this property.
|
|
1627
|
+
* @example
|
|
1628
|
+
* ```
|
|
1629
|
+
* const player = new Player({
|
|
1630
|
+
* styleConfig: {
|
|
1631
|
+
* playerUiCss: 'https://domain.tld/path/to/bitmovinplayer-ui.css',
|
|
1632
|
+
* },
|
|
1633
|
+
* });
|
|
1634
|
+
* ```
|
|
1635
|
+
* @platform iOS, Android
|
|
1636
|
+
*/
|
|
1637
|
+
playerUiCss?: string;
|
|
1638
|
+
/**
|
|
1639
|
+
* Sets a CSS file which contains supplemental styles for the player UI. These styles will be added to the default CSS file or the CSS file set with `StyleConfig.playerUiCss`.
|
|
1640
|
+
* @example
|
|
1641
|
+
* ```
|
|
1642
|
+
* const player = new Player({
|
|
1643
|
+
* styleConfig: {
|
|
1644
|
+
* supplementalPlayerUiCss: 'https://domain.tld/path/to/bitmovinplayer-supplemental-ui.css',
|
|
1645
|
+
* },
|
|
1646
|
+
* });
|
|
1647
|
+
* ```
|
|
1648
|
+
* @platform iOS, Android
|
|
1649
|
+
*/
|
|
1650
|
+
supplementalPlayerUiCss?: string;
|
|
1651
|
+
/**
|
|
1652
|
+
* Sets the JS file that will be used for the UI. The default JS file will be completely replaced by the JS file set with this property.
|
|
1653
|
+
* @example
|
|
1654
|
+
* ```
|
|
1655
|
+
* const player = new Player({
|
|
1656
|
+
* styleConfig: {
|
|
1657
|
+
* playerUiJs: 'https://domain.tld/path/to/bitmovinplayer-ui.js',
|
|
1658
|
+
* },
|
|
1659
|
+
* });
|
|
1660
|
+
* ```
|
|
1661
|
+
* @platform iOS, Android
|
|
1662
|
+
*/
|
|
1663
|
+
playerUiJs?: string;
|
|
1664
|
+
/**
|
|
1665
|
+
* Determines how the video content is scaled or stretched within the parent container’s bounds. Possible values are defined in `ScalingMode`.
|
|
1666
|
+
* Default value is `ScalingMode.fit`.
|
|
1667
|
+
* @example
|
|
1668
|
+
* ```
|
|
1669
|
+
* const player = new Player({
|
|
1670
|
+
* styleConfig: {
|
|
1671
|
+
* scalingMode: ScalingMode.Zoom,
|
|
1672
|
+
* },
|
|
1673
|
+
* });
|
|
1674
|
+
* ```
|
|
1675
|
+
*/
|
|
1676
|
+
scalingMode?: ScalingMode;
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Specifies how the video content is scaled or stretched.
|
|
1680
|
+
*/
|
|
1681
|
+
declare enum ScalingMode {
|
|
1682
|
+
/**
|
|
1683
|
+
* Specifies that the player should preserve the video’s aspect ratio and fit the video within the container's bounds.
|
|
1684
|
+
*/
|
|
1685
|
+
Fit = "Fit",
|
|
1686
|
+
/**
|
|
1687
|
+
* Specifies that the video should be stretched to fill the container’s bounds. The aspect ratio may not be preserved.
|
|
1688
|
+
*/
|
|
1689
|
+
Stretch = "Stretch",
|
|
1690
|
+
/**
|
|
1691
|
+
* Specifies that the player should preserve the video’s aspect ratio and fill the container’s bounds.
|
|
1692
|
+
*/
|
|
1693
|
+
Zoom = "Zoom"
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Indicates which type of UI should be used.
|
|
1697
|
+
* @platform iOS, tvOS
|
|
1698
|
+
*/
|
|
1699
|
+
declare enum UserInterfaceType {
|
|
1700
|
+
/**
|
|
1701
|
+
* Indicates that Bitmovin's customizable UI should be used.
|
|
1702
|
+
*/
|
|
1703
|
+
Bitmovin = "Bitmovin",
|
|
1704
|
+
/**
|
|
1705
|
+
* Indicates that the system UI should be used.
|
|
1706
|
+
*/
|
|
1707
|
+
System = "System",
|
|
1708
|
+
/**
|
|
1709
|
+
* Indicates that only subtitles should be displayed along with the video content.
|
|
1710
|
+
*/
|
|
1711
|
+
Subtitle = "Subtitle"
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* This configuration is used as an incubator for experimental features. Tweaks are not officially
|
|
1716
|
+
* supported and are not guaranteed to be stable, i.e. their naming, functionality and API can
|
|
1717
|
+
* change at any time within the tweaks or when being promoted to an official feature and moved
|
|
1718
|
+
* into its final configuration namespace.
|
|
1719
|
+
*/
|
|
1720
|
+
interface TweaksConfig {
|
|
1721
|
+
/**
|
|
1722
|
+
* The frequency in seconds onTimeChanged is called with TimeChangedEvents.
|
|
1723
|
+
*
|
|
1724
|
+
* Default value in iOS is `1.0`.
|
|
1725
|
+
* Default value in Android is `0.2`.
|
|
1726
|
+
*
|
|
1727
|
+
* @platform iOS, Android
|
|
1728
|
+
*/
|
|
1729
|
+
timeChangedInterval?: number;
|
|
1730
|
+
/**
|
|
1731
|
+
* If enabled, HLS playlists will be parsed and additional features and events are enabled. This includes:
|
|
1732
|
+
*
|
|
1733
|
+
* - MetadataEvents carrying segment-specific metadata for custom HLS tags, like #EXT-X-SCTE35
|
|
1734
|
+
* - MetadataParsedEvents carrying segment-specific metadata for custom HLS tags, like #EXT-X-SCTE35
|
|
1735
|
+
* - DrmDataParsedEvents when a #EXT-X-KEY is found
|
|
1736
|
+
* - Player.availableVideoQualities includes additional information
|
|
1737
|
+
* - Automatic retries when HLS playlist requests failed with non-2xx HTTP status code
|
|
1738
|
+
*
|
|
1739
|
+
* Default is false.
|
|
1740
|
+
*
|
|
1741
|
+
* @platform iOS
|
|
1742
|
+
*/
|
|
1743
|
+
isNativeHlsParsingEnabled?: boolean;
|
|
1744
|
+
/**
|
|
1745
|
+
* If enabled, playlists will be downloaded by the Bitmovin Player SDK instead of AVFoundation.
|
|
1746
|
+
* This enables additional features and events, like:
|
|
1747
|
+
*
|
|
1748
|
+
* - DownloadFinishedEvents for playlist downloads.
|
|
1749
|
+
* - SourceWarningEvents when no #EXT-X-PLAYLIST-TYPE is found If set to false, enabling
|
|
1750
|
+
* nativeHlsParsingEnabled won’t have any effect.
|
|
1751
|
+
*
|
|
1752
|
+
* Default is true.
|
|
1753
|
+
*
|
|
1754
|
+
* @platform iOS
|
|
1755
|
+
*/
|
|
1756
|
+
isCustomHlsLoadingEnabled?: boolean;
|
|
1757
|
+
/**
|
|
1758
|
+
* The threshold which will be applied when seeking to the end in seconds. This value will be used
|
|
1759
|
+
* to calculate the maximum seekable time when calling player.seek(time:) or player.playlist.seek(source:time:),
|
|
1760
|
+
* so the maximum value will be duration - seekToEndThreshold.
|
|
1761
|
+
*
|
|
1762
|
+
* This is useful if the duration of the segments does not match the duration specified in the
|
|
1763
|
+
* manifest. In this case, if we try to seek to the end, AVPlayer could get stuck and might stall
|
|
1764
|
+
* forever Therefore increasing this value could help.
|
|
1765
|
+
*
|
|
1766
|
+
* Default is 0.5.
|
|
1767
|
+
*
|
|
1768
|
+
* @platform iOS
|
|
1769
|
+
*/
|
|
1770
|
+
seekToEndThreshold?: number;
|
|
1771
|
+
/**
|
|
1772
|
+
* Specifies the player behaviour when Player.play is called. Default is 'relaxed'.
|
|
1773
|
+
*
|
|
1774
|
+
* - 'relaxed': Starts playback when enough media data is buffered and continuous playback without stalling can be ensured. If insufficient media data is buffered for playback to start, the player will act as if the buffer became empty during playback.
|
|
1775
|
+
* - 'aggressive': When the buffer is not empty, this setting will cause the player to start playback of available media immediately. If insufficient media data is buffered for playback to start, the player will act as if the buffer became empty during playback.
|
|
1776
|
+
*
|
|
1777
|
+
* @platform iOS
|
|
1778
|
+
*/
|
|
1779
|
+
playbackStartBehaviour?: 'relaxed' | 'aggressive';
|
|
1780
|
+
/**
|
|
1781
|
+
* Specifies the player behaviour when stalling should be exited. Default is 'relaxed'.
|
|
1782
|
+
*
|
|
1783
|
+
* - 'relaxed': The player will wait until the buffer is filled that it can, most likely, ensure continuous playback without another stalling right after playback continued.
|
|
1784
|
+
* - 'aggressive': The player will try to unstall as soon as some media data became available and will start playback of this media immediately.
|
|
1785
|
+
*
|
|
1786
|
+
* @platform iOS
|
|
1787
|
+
*/
|
|
1788
|
+
unstallingBehaviour?: 'relaxed' | 'aggressive';
|
|
1789
|
+
/**
|
|
1790
|
+
* Constantly aggregated and weighted bandwidth samples are summed up to this weight limit to calculate an bandwidth estimation. Remaining samples (i.e. that would lead to exceeding the limit) are dropped from memory as they are not relevant anymore.
|
|
1791
|
+
* Default is 2000.
|
|
1792
|
+
*
|
|
1793
|
+
* @platform Android
|
|
1794
|
+
*/
|
|
1795
|
+
bandwidthEstimateWeightLimit?: number;
|
|
1796
|
+
/**
|
|
1797
|
+
* Some devices have an incorrect implementation of MediaCodec.setOutputSurface. This leads to failure when the surface changes. To prevent failure, the codec will be released and re-instantiated in those scenarios.
|
|
1798
|
+
*
|
|
1799
|
+
* @platform Android
|
|
1800
|
+
*/
|
|
1801
|
+
devicesThatRequireSurfaceWorkaround?: {
|
|
1802
|
+
/**
|
|
1803
|
+
* A device name as reported by Build.DEVICE.
|
|
1804
|
+
*
|
|
1805
|
+
* @see Build.DEVICE: https://developer.android.com/reference/kotlin/android/os/Build.html#DEVICE--
|
|
1806
|
+
*/
|
|
1807
|
+
deviceNames?: string[];
|
|
1808
|
+
/**
|
|
1809
|
+
* A model name as reported by Build.MODEL.
|
|
1810
|
+
*
|
|
1811
|
+
* @see Build.MODEL: https://developer.android.com/reference/kotlin/android/os/Build.html#MODEL--
|
|
1812
|
+
*/
|
|
1813
|
+
modelNames?: string[];
|
|
1814
|
+
};
|
|
1815
|
+
/**
|
|
1816
|
+
* Specifies if the language property on DASH Representations, HLS Renditions and SmoothStreaming QualityLevels is normalized.
|
|
1817
|
+
* If enabled, language properties are normalized to IETF BCP 47 language tags. Default is true.
|
|
1818
|
+
*
|
|
1819
|
+
* Examples:
|
|
1820
|
+
* - "ENG" is normalized to "en"
|
|
1821
|
+
* - "en_us" is normalized to "en-us"
|
|
1822
|
+
* - "en-US-x-lvariant-POSIX" is normalized to "en-us-posix"
|
|
1823
|
+
*
|
|
1824
|
+
* @platform Android
|
|
1825
|
+
*/
|
|
1826
|
+
languagePropertyNormalization?: boolean;
|
|
1827
|
+
/**
|
|
1828
|
+
* The interval in which dynamic DASH windows are updated locally. I.e. The rate by which the
|
|
1829
|
+
* playback window is moved forward on the timeline.
|
|
1830
|
+
*
|
|
1831
|
+
* @platform Android
|
|
1832
|
+
*/
|
|
1833
|
+
localDynamicDashWindowUpdateInterval?: number;
|
|
1834
|
+
/**
|
|
1835
|
+
* Specifies whether default positioning values should be assumed when parsing TTML regions in case of
|
|
1836
|
+
* unsupported TTML features. Default is true
|
|
1837
|
+
*
|
|
1838
|
+
* @platform Android
|
|
1839
|
+
*/
|
|
1840
|
+
shouldApplyTtmlRegionWorkaround?: boolean;
|
|
1841
|
+
/**
|
|
1842
|
+
* Specifies whether a DRM session should be used for clear tracks of type video and audio. Using
|
|
1843
|
+
* DRM sessions for clear content avoids the recreation of decoders when transitioning between clear
|
|
1844
|
+
* and encrypted sections of content. Default is false.
|
|
1845
|
+
*
|
|
1846
|
+
* @platform Android
|
|
1847
|
+
*/
|
|
1848
|
+
useDrmSessionForClearPeriods?: boolean;
|
|
1849
|
+
/**
|
|
1850
|
+
* Specifies whether a DRM session should be used for clear tracks of type video and audio in a clear
|
|
1851
|
+
* source that follows after a DRM protected source. In addition, a DRM session will be used for clear
|
|
1852
|
+
* periods in a DRM protected source. Using DRM sessions for clear content avoids the recreation of
|
|
1853
|
+
* decoders when transitioning between clear and encrypted sections of content. Default is false.
|
|
1854
|
+
*
|
|
1855
|
+
* @platform Android
|
|
1856
|
+
*/
|
|
1857
|
+
useDrmSessionForClearSources?: boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* Specifies if the player should always fall back to an extractor matching the file type, if no
|
|
1860
|
+
* matching extractor was found. If the fallback is applied, this will ignore potential incompatibilities
|
|
1861
|
+
* with streams and thus can result in unstable or failing playback.
|
|
1862
|
+
*
|
|
1863
|
+
* @platform Android
|
|
1864
|
+
*/
|
|
1865
|
+
useFiletypeExtractorFallbackForHls?: boolean;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* Object used to configure a new `Player` instance.
|
|
1870
|
+
*/
|
|
1871
|
+
interface PlayerConfig extends NativeInstanceConfig {
|
|
1872
|
+
/**
|
|
1873
|
+
* Bitmovin license key that can be found in the Bitmovin portal.
|
|
1874
|
+
* If a license key is set here, it will be used instead of the license key found in the `Info.plist` and `AndroidManifest.xml`.
|
|
1875
|
+
* @example
|
|
1876
|
+
* Configuring the player license key from source code:
|
|
1877
|
+
* ```
|
|
1878
|
+
* const player = new Player({
|
|
1879
|
+
* licenseKey: '\<LICENSE-KEY-CODE\>',
|
|
1880
|
+
* });
|
|
1881
|
+
* ```
|
|
1882
|
+
* @example
|
|
1883
|
+
* `licenseKey` can be safely omitted from source code if it has
|
|
1884
|
+
* been configured in Info.plist/AndroidManifest.xml.
|
|
1885
|
+
* ```
|
|
1886
|
+
* const player = new Player(); // omit `licenseKey`
|
|
1887
|
+
* player.play(); // call methods and properties...
|
|
1888
|
+
* ```
|
|
1889
|
+
*/
|
|
1890
|
+
licenseKey?: string;
|
|
1891
|
+
/**
|
|
1892
|
+
* Configures playback behaviour. A default PlaybackConfig is set initially.
|
|
1893
|
+
*/
|
|
1894
|
+
playbackConfig?: PlaybackConfig;
|
|
1895
|
+
/**
|
|
1896
|
+
* Configures the visual presentation and behaviour of the player UI. A default StyleConfig is set initially.
|
|
1897
|
+
*/
|
|
1898
|
+
styleConfig?: StyleConfig;
|
|
1899
|
+
/**
|
|
1900
|
+
* Configures advertising functionality. A default AdvertisingConfig is set initially.
|
|
1901
|
+
*/
|
|
1902
|
+
advertisingConfig?: AdvertisingConfig;
|
|
1903
|
+
/**
|
|
1904
|
+
* Configures experimental features. A default TweaksConfig is set initially.
|
|
1905
|
+
*/
|
|
1906
|
+
tweaksConfig?: TweaksConfig;
|
|
1907
|
+
/**
|
|
1908
|
+
* Configures analytics functionality.
|
|
1909
|
+
*/
|
|
1910
|
+
analyticsConfig?: AnalyticsConfig;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Configures the playback behaviour of the player.
|
|
1914
|
+
*/
|
|
1915
|
+
interface PlaybackConfig {
|
|
1916
|
+
/**
|
|
1917
|
+
* Whether the player starts playing automatically after loading a source or not. Default is `false`.
|
|
1918
|
+
* @example
|
|
1919
|
+
* ```
|
|
1920
|
+
* const player = new Player({
|
|
1921
|
+
* playbackConfig: {
|
|
1922
|
+
* isAutoplayEnabled: true,
|
|
1923
|
+
* },
|
|
1924
|
+
* });
|
|
1925
|
+
* ```
|
|
1926
|
+
*/
|
|
1927
|
+
isAutoplayEnabled?: boolean;
|
|
1928
|
+
/**
|
|
1929
|
+
* Whether the sound is muted on startup or not. Default value is `false`.
|
|
1930
|
+
* @example
|
|
1931
|
+
* ```
|
|
1932
|
+
* const player = new Player({
|
|
1933
|
+
* playbackConfig: {
|
|
1934
|
+
* isMuted: true,
|
|
1935
|
+
* },
|
|
1936
|
+
* });
|
|
1937
|
+
* ```
|
|
1938
|
+
*/
|
|
1939
|
+
isMuted?: boolean;
|
|
1940
|
+
/**
|
|
1941
|
+
* Whether time shift / DVR for live streams is enabled or not. Default is `true`.
|
|
1942
|
+
* @example
|
|
1943
|
+
* ```
|
|
1944
|
+
* const player = new Player({
|
|
1945
|
+
* playbackConfig: {
|
|
1946
|
+
* isTimeShiftEnabled: false,
|
|
1947
|
+
* },
|
|
1948
|
+
* });
|
|
1949
|
+
* ```
|
|
1950
|
+
*/
|
|
1951
|
+
isTimeShiftEnabled?: boolean;
|
|
1952
|
+
/**
|
|
1953
|
+
* Whether background playback is enabled or not.
|
|
1954
|
+
* Default is `false`.
|
|
1955
|
+
*
|
|
1956
|
+
* When set to `true`, playback is not automatically paused
|
|
1957
|
+
* anymore when the app moves to the background.
|
|
1958
|
+
* When set to `true`, also make sure to properly configure your app to allow
|
|
1959
|
+
* background playback.
|
|
1960
|
+
*
|
|
1961
|
+
* On tvOS, background playback is only supported for audio-only content.
|
|
1962
|
+
*
|
|
1963
|
+
* Default is `false`.
|
|
1964
|
+
*
|
|
1965
|
+
* @example
|
|
1966
|
+
* ```
|
|
1967
|
+
* const player = new Player({
|
|
1968
|
+
* {
|
|
1969
|
+
* isBackgroundPlaybackEnabled: true,
|
|
1970
|
+
* }
|
|
1971
|
+
* })
|
|
1972
|
+
* ```
|
|
1973
|
+
*/
|
|
1974
|
+
isBackgroundPlaybackEnabled?: boolean;
|
|
1975
|
+
/**
|
|
1976
|
+
* Whether the Picture in Picture mode option is enabled or not. Default is `false`.
|
|
1977
|
+
* @example
|
|
1978
|
+
* ```
|
|
1979
|
+
* const player = new Player({
|
|
1980
|
+
* playbackConfig: {
|
|
1981
|
+
* isPictureInPictureEnabled: true,
|
|
1982
|
+
* },
|
|
1983
|
+
* });
|
|
1984
|
+
* ```
|
|
1985
|
+
*/
|
|
1986
|
+
isPictureInPictureEnabled?: boolean;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* Loads, controls and renders audio and video content represented through `Source`s. A player
|
|
1990
|
+
* instance can be created via the `usePlayer` hook and will idle until one or more `Source`s are
|
|
1991
|
+
* loaded. Once `load` is called, the player becomes active and initiates necessary downloads to
|
|
1992
|
+
* start playback of the loaded source(s).
|
|
1993
|
+
*
|
|
1994
|
+
* Can be attached to `PlayerView` component in order to use Bitmovin's Player Web UI.
|
|
1995
|
+
* @see PlayerView
|
|
1996
|
+
*/
|
|
1997
|
+
declare class Player extends NativeInstance<PlayerConfig> {
|
|
1998
|
+
/**
|
|
1999
|
+
* Currently active source, or `null` if none is active.
|
|
2000
|
+
*/
|
|
2001
|
+
source?: Source;
|
|
2002
|
+
/**
|
|
2003
|
+
* Analytics collector currently attached to this player instance.
|
|
2004
|
+
*/
|
|
2005
|
+
analyticsCollector?: AnalyticsCollector;
|
|
2006
|
+
/**
|
|
2007
|
+
* Whether the native `Player` object has been created.
|
|
2008
|
+
*/
|
|
2009
|
+
isInitialized: boolean;
|
|
2010
|
+
/**
|
|
2011
|
+
* Whether the native `Player` object has been disposed.
|
|
2012
|
+
*/
|
|
2013
|
+
isDestroyed: boolean;
|
|
2014
|
+
/**
|
|
2015
|
+
* Allocates the native `Player` instance and its resources natively.
|
|
2016
|
+
*/
|
|
2017
|
+
initialize: () => void;
|
|
2018
|
+
/**
|
|
2019
|
+
* Destroys the native `Player` and releases all of its allocated resources.
|
|
2020
|
+
*/
|
|
2021
|
+
destroy: () => void;
|
|
2022
|
+
/**
|
|
2023
|
+
* Loads a new `Source` from `sourceConfig` into the player.
|
|
2024
|
+
*/
|
|
2025
|
+
load: (sourceConfig: SourceConfig) => void;
|
|
2026
|
+
/**
|
|
2027
|
+
* Loads the given `Source` into the player.
|
|
2028
|
+
*/
|
|
2029
|
+
loadSource: (source: Source) => void;
|
|
2030
|
+
/**
|
|
2031
|
+
* Unloads all `Source`s from the player.
|
|
2032
|
+
*/
|
|
2033
|
+
unload: () => void;
|
|
2034
|
+
/**
|
|
2035
|
+
* Starts or resumes playback after being paused. Has no effect if the player is already playing.
|
|
2036
|
+
*/
|
|
2037
|
+
play: () => void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Pauses the video if it is playing. Has no effect if the player is already paused.
|
|
2040
|
+
*/
|
|
2041
|
+
pause: () => void;
|
|
2042
|
+
/**
|
|
2043
|
+
* Seeks to the given playback time specified by the parameter `time` in seconds. Must not be
|
|
2044
|
+
* greater than the total duration of the video. Has no effect when watching a live stream since
|
|
2045
|
+
* seeking is not possible.
|
|
2046
|
+
*
|
|
2047
|
+
* @param time - The time to seek to in seconds.
|
|
2048
|
+
*/
|
|
2049
|
+
seek: (time: number) => void;
|
|
2050
|
+
/**
|
|
2051
|
+
* Shifts the time to the given `offset` in seconds from the live edge. The resulting offset has to be within the
|
|
2052
|
+
* timeShift window as specified by `maxTimeShift` (which is a negative value) and 0. When the provided `offset` is
|
|
2053
|
+
* positive, it will be interpreted as a UNIX timestamp in seconds and converted to fit into the timeShift window.
|
|
2054
|
+
* When the provided `offset` is negative, but lower than `maxTimeShift`, then it will be clamped to `maxTimeShift`.
|
|
2055
|
+
* Has no effect for VoD.
|
|
2056
|
+
*
|
|
2057
|
+
* Has no effect if no sources are loaded.
|
|
2058
|
+
*/
|
|
2059
|
+
timeShift: (offset: number) => void;
|
|
2060
|
+
/**
|
|
2061
|
+
* Mutes the player if an audio track is available. Has no effect if the player is already muted.
|
|
2062
|
+
*/
|
|
2063
|
+
mute: () => void;
|
|
2064
|
+
/**
|
|
2065
|
+
* Unmutes the player if it is muted. Has no effect if the player is already unmuted.
|
|
2066
|
+
*/
|
|
2067
|
+
unmute: () => void;
|
|
2068
|
+
/**
|
|
2069
|
+
* Sets the player's volume between 0 (silent) and 100 (max volume).
|
|
2070
|
+
*
|
|
2071
|
+
* @param volume - The volume level to set.
|
|
2072
|
+
*/
|
|
2073
|
+
setVolume: (volume: number) => void;
|
|
2074
|
+
/**
|
|
2075
|
+
* @returns The player's current volume level.
|
|
2076
|
+
*/
|
|
2077
|
+
getVolume: () => Promise<number>;
|
|
2078
|
+
/**
|
|
2079
|
+
* @returns The current playback time in seconds.
|
|
2080
|
+
*
|
|
2081
|
+
* For VoD streams the returned time ranges between 0 and the duration of the asset.
|
|
2082
|
+
*
|
|
2083
|
+
* For live streams it can be specified if an absolute UNIX timestamp or a value
|
|
2084
|
+
* relative to the playback start should be returned.
|
|
2085
|
+
*
|
|
2086
|
+
* @param mode - The time mode to specify: an absolute UNIX timestamp ('absolute') or relative time ('relative').
|
|
2087
|
+
*/
|
|
2088
|
+
getCurrentTime: (mode?: 'relative' | 'absolute') => Promise<number>;
|
|
2089
|
+
/**
|
|
2090
|
+
* @returns The total duration in seconds of the current video or INFINITY if it’s a live stream.
|
|
2091
|
+
*/
|
|
2092
|
+
getDuration: () => Promise<number>;
|
|
2093
|
+
/**
|
|
2094
|
+
* @returns `true` if the player is muted.
|
|
2095
|
+
*/
|
|
2096
|
+
isMuted: () => Promise<boolean>;
|
|
2097
|
+
/**
|
|
2098
|
+
* @returns `true` if the player is currently playing, i.e. has started and is not paused.
|
|
2099
|
+
*/
|
|
2100
|
+
isPlaying: () => Promise<boolean>;
|
|
2101
|
+
/**
|
|
2102
|
+
* @returns `true` if the player has started playback but it's currently paused.
|
|
2103
|
+
*/
|
|
2104
|
+
isPaused: () => Promise<boolean>;
|
|
2105
|
+
/**
|
|
2106
|
+
* @returns `true` if the displayed video is a live stream.
|
|
2107
|
+
*/
|
|
2108
|
+
isLive: () => Promise<boolean>;
|
|
2109
|
+
/**
|
|
2110
|
+
* @remarks Only available for iOS devices.
|
|
2111
|
+
* @returns `true` when media is played externally using AirPlay.
|
|
2112
|
+
*/
|
|
2113
|
+
isAirPlayActive: () => Promise<boolean>;
|
|
2114
|
+
/**
|
|
2115
|
+
* @remarks Only available for iOS devices.
|
|
2116
|
+
* @returns `true` when AirPlay is available.
|
|
2117
|
+
*/
|
|
2118
|
+
isAirPlayAvailable: () => Promise<boolean>;
|
|
2119
|
+
/**
|
|
2120
|
+
* @returns An array containing AudioTrack objects for all available audio tracks.
|
|
2121
|
+
*/
|
|
2122
|
+
getAvailableAudioTracks: () => Promise<AudioTrack[]>;
|
|
2123
|
+
/**
|
|
2124
|
+
* Sets the audio track to the ID specified by trackIdentifier. A list can be retrieved by calling getAvailableAudioTracks.
|
|
2125
|
+
*/
|
|
2126
|
+
setAudioTrack: (trackIdentifier: string) => Promise<void>;
|
|
2127
|
+
/**
|
|
2128
|
+
* @returns An array containing SubtitleTrack objects for all available subtitle tracks.
|
|
2129
|
+
*/
|
|
2130
|
+
getAvailableSubtitles: () => Promise<SubtitleTrack[]>;
|
|
2131
|
+
/**
|
|
2132
|
+
* Sets the subtitle track to the ID specified by trackIdentifier. A list can be retrieved by calling getAvailableSubtitles.
|
|
2133
|
+
*/
|
|
2134
|
+
setSubtitleTrack: (trackIdentifier?: string) => Promise<void>;
|
|
2135
|
+
/**
|
|
2136
|
+
* Dynamically schedules the `adItem` for playback.
|
|
2137
|
+
* Has no effect if there is no active playback session.
|
|
2138
|
+
*
|
|
2139
|
+
* @param adItem - Ad to be scheduled for playback.
|
|
2140
|
+
*
|
|
2141
|
+
* @platform iOS, Android
|
|
2142
|
+
*/
|
|
2143
|
+
scheduleAd: (adItem: AdItem) => void;
|
|
2144
|
+
/**
|
|
2145
|
+
* Skips the current ad.
|
|
2146
|
+
* Has no effect if the current ad is not skippable or if no ad is being played back.
|
|
2147
|
+
*
|
|
2148
|
+
* @platform iOS, Android
|
|
2149
|
+
*/
|
|
2150
|
+
skipAd: () => void;
|
|
2151
|
+
/**
|
|
2152
|
+
* @returns `true` while an ad is being played back or when main content playback has been paused for ad playback.
|
|
2153
|
+
* @platform iOS, Android
|
|
2154
|
+
*/
|
|
2155
|
+
isAd: () => Promise<boolean>;
|
|
2156
|
+
/**
|
|
2157
|
+
* The current time shift of the live stream in seconds. This value is always 0 if the active `source` is not a
|
|
2158
|
+
* live stream or no sources are loaded.
|
|
2159
|
+
*/
|
|
2160
|
+
getTimeShift: () => Promise<number>;
|
|
2161
|
+
/**
|
|
2162
|
+
* The limit in seconds for time shifting. This value is either negative or 0 and it is always 0 if the active
|
|
2163
|
+
* `source` is not a live stream or no sources are loaded.
|
|
2164
|
+
*/
|
|
2165
|
+
getMaxTimeShift: () => Promise<number>;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Handles the UI state change when fullscreen should be entered or exited.
|
|
2170
|
+
*/
|
|
2171
|
+
interface FullscreenHandler {
|
|
2172
|
+
/**
|
|
2173
|
+
* Indicates if the UI is currently in fullscreen mode
|
|
2174
|
+
*/
|
|
2175
|
+
isFullscreenActive: boolean;
|
|
2176
|
+
/**
|
|
2177
|
+
* Is called by the `PlayerView` when the UI should enter fullscreen mode.
|
|
2178
|
+
*/
|
|
2179
|
+
enterFullscreen(): void;
|
|
2180
|
+
/**
|
|
2181
|
+
* Is called by the `PlayerView` when the UI should exit fullscreen mode.
|
|
2182
|
+
*/
|
|
2183
|
+
exitFullscreen(): void;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
interface CustomMessageSender {
|
|
2187
|
+
sendMessage(message: string, data: string | undefined): void;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
/**
|
|
2191
|
+
* Android and iOS only.
|
|
2192
|
+
* For Android it requires Player SDK version 3.39.0 or higher.
|
|
2193
|
+
*
|
|
2194
|
+
* Provides a two-way communication channel between the Player UI and the integration.
|
|
2195
|
+
*/
|
|
2196
|
+
declare class CustomMessageHandler {
|
|
2197
|
+
private readonly onReceivedSynchronousMessage;
|
|
2198
|
+
private readonly onReceivedAsynchronousMessage;
|
|
2199
|
+
customMessageSender?: CustomMessageSender;
|
|
2200
|
+
/**
|
|
2201
|
+
* Android and iOS only.
|
|
2202
|
+
*
|
|
2203
|
+
* Creates a new `CustomMessageHandler` instance to handle two-way communication between the integation and the Player UI.
|
|
2204
|
+
*
|
|
2205
|
+
* @param onReceivedSynchronousMessage - A function that will be called when the Player UI sends a synchronous message to the integration.
|
|
2206
|
+
* @param onReceivedAsynchronousMessage - A function that will be called when the Player UI sends an asynchronous message to the integration.
|
|
2207
|
+
*/
|
|
2208
|
+
constructor({ onReceivedSynchronousMessage, onReceivedAsynchronousMessage, }: {
|
|
2209
|
+
onReceivedSynchronousMessage: (message: string, data: string | undefined) => string | undefined;
|
|
2210
|
+
onReceivedAsynchronousMessage: (message: string, data: string | undefined) => void;
|
|
2211
|
+
});
|
|
2212
|
+
receivedSynchronousMessage(message: string, data: string | undefined): string | undefined;
|
|
2213
|
+
receivedAsynchronousMessage(message: string, data: string | undefined): void;
|
|
2214
|
+
/**
|
|
2215
|
+
* Android and iOS only.
|
|
2216
|
+
*
|
|
2217
|
+
* Sends a message to the Player UI.
|
|
2218
|
+
*
|
|
2219
|
+
* @param message - Identifier for the callback which should be called.
|
|
2220
|
+
* @param data - Payload for the callback.
|
|
2221
|
+
*/
|
|
2222
|
+
sendMessage(message: string, data: string | undefined): void;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* Base `PlayerView` component props. Used to stablish common
|
|
2227
|
+
* props between `NativePlayerView` and `PlayerView`.
|
|
2228
|
+
* @see NativePlayerView
|
|
2229
|
+
*/
|
|
2230
|
+
interface BasePlayerViewProps {
|
|
2231
|
+
style?: ViewStyle;
|
|
2232
|
+
}
|
|
2233
|
+
/**
|
|
2234
|
+
* `PlayerView` component props.
|
|
2235
|
+
* @see PlayerView
|
|
2236
|
+
*/
|
|
2237
|
+
interface PlayerViewProps extends BasePlayerViewProps, PlayerViewEvents {
|
|
2238
|
+
/**
|
|
2239
|
+
* `Player` instance (generally returned from `usePlayer` hook) that will control
|
|
2240
|
+
* and render audio/video inside the `PlayerView`.
|
|
2241
|
+
*/
|
|
2242
|
+
player: Player;
|
|
2243
|
+
/**
|
|
2244
|
+
* The `FullscreenHandler` that is used by the `PlayerView` to control the fullscreen mode.
|
|
2245
|
+
*/
|
|
2246
|
+
fullscreenHandler?: FullscreenHandler;
|
|
2247
|
+
/**
|
|
2248
|
+
* The `CustomMessageHandler` that can be used to directly communicate with the embedded WebUi.
|
|
2249
|
+
*/
|
|
2250
|
+
customMessageHandler?: CustomMessageHandler;
|
|
2251
|
+
/**
|
|
2252
|
+
* Can be set to `true` to request fullscreen mode, or `false` to request exit of fullscreen mode.
|
|
2253
|
+
* Should not be used to get the current fullscreen state. Use `onFullscreenEnter` and `onFullscreenExit`
|
|
2254
|
+
* or the `FullscreenHandler.isFullscreenActive` property to get the current state.
|
|
2255
|
+
* Using this property to change the fullscreen state, it is ensured that the embedded Player UI is also aware
|
|
2256
|
+
* of potential fullscreen state changes.
|
|
2257
|
+
* To use this property, a `FullscreenHandler` must be set.
|
|
2258
|
+
*/
|
|
2259
|
+
isFullscreenRequested?: Boolean;
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Component that provides the Bitmovin Player UI and default UI handling to an attached `Player` instance.
|
|
2263
|
+
* This component needs a `Player` instance to work properly so make sure one is passed to it as a prop.
|
|
2264
|
+
*/
|
|
2265
|
+
declare function PlayerView({ style, player, fullscreenHandler, customMessageHandler, isFullscreenRequested, ...props }: PlayerViewProps): JSX.Element;
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* React hook that creates and returns a reference to a `Player` instance
|
|
2269
|
+
* that can be used inside any component.
|
|
2270
|
+
*/
|
|
2271
|
+
declare function usePlayer(config?: PlayerConfig): Player;
|
|
2272
|
+
|
|
2273
|
+
export { Ad, AdBreak, AdBreakFinishedEvent, AdBreakStartedEvent, AdClickedEvent, AdConfig, AdData, AdErrorEvent, AdFinishedEvent, AdItem, AdManifestLoadEvent, AdManifestLoadedEvent, AdQuartile, AdQuartileEvent, AdScheduledEvent, AdSkippedEvent, AdSource, AdSourceType, AdStartedEvent, AdvertisingConfig, AnalyticsCollector, AnalyticsConfig, AudioAddedEvent, AudioChangedEvent, AudioRemovedEvent, AudioSession, AudioSessionCategory, BasePlayerViewProps, CdnProvider, CustomDataConfig, CustomMessageHandler, DestroyEvent, Drm, DrmConfig, ErrorEvent, Event, EventSource, FairplayConfig, FullscreenDisabledEvent, FullscreenEnabledEvent, FullscreenEnterEvent, FullscreenExitEvent, FullscreenHandler, LoadingState, MutedEvent, PausedEvent, PictureInPictureAvailabilityChangedEvent, PictureInPictureEnterEvent, PictureInPictureEnteredEvent, PictureInPictureExitEvent, PictureInPictureExitedEvent, PlayEvent, PlaybackConfig, PlaybackFinishedEvent, Player, PlayerActiveEvent, PlayerConfig, PlayerErrorEvent, PlayerView, PlayerViewProps, PlayerWarningEvent, PlayingEvent, ReadyEvent, ScalingMode, SeekEvent, SeekedEvent, SideLoadedSubtitleTrack, Source, SourceConfig, SourceErrorEvent, SourceLoadEvent, SourceLoadedEvent, SourceMetadata, SourceType, SourceUnloadedEvent, SourceWarningEvent, StallEndedEvent, StallStartedEvent, StyleConfig, SubtitleAddedEvent, SubtitleChangedEvent, SubtitleFormat, SubtitleRemovedEvent, SubtitleTrack, TimeChangedEvent, TimeShiftEvent, TimeShiftedEvent, UnmutedEvent, UserInterfaceType, VideoPlaybackQualityChangedEvent, WidevineConfig, usePlayer };
|