bitmovin-player-react-native 1.18.0 → 1.19.0
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/CHANGELOG.md +11 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +34 -1
- package/build/advertising.d.ts +20 -0
- package/build/advertising.d.ts.map +1 -1
- package/build/advertising.js.map +1 -1
- package/build/modules/PlayerModule.d.ts +10 -1
- package/build/modules/PlayerModule.d.ts.map +1 -1
- package/build/modules/PlayerModule.js.map +1 -1
- package/build/player.d.ts +2 -0
- package/build/player.d.ts.map +1 -1
- package/build/player.js +38 -0
- package/build/player.js.map +1 -1
- package/ios/RNBitmovinPlayer.podspec +1 -1
- package/package.json +1 -1
- package/src/advertising.ts +20 -0
- package/src/modules/PlayerModule.ts +15 -1
- package/src/player.ts +42 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.19.0] - 2026-05-08
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Android: `AdvertisingConfig.shouldPlayAdBreak` callback to decide at runtime whether a scheduled ad break should play
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Update Bitmovin's native iOS SDK version to `3.113.0`
|
|
12
|
+
- Update Bitmovin's native Android SDK version to `3.152.0+jason`
|
|
13
|
+
|
|
3
14
|
## [1.18.0] - 2026-05-01
|
|
4
15
|
|
|
5
16
|
### Added
|
package/android/build.gradle
CHANGED
|
@@ -108,6 +108,6 @@ dependencies {
|
|
|
108
108
|
|
|
109
109
|
// Bitmovin
|
|
110
110
|
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
|
|
111
|
-
implementation 'com.bitmovin.player:player:3.
|
|
112
|
-
implementation 'com.bitmovin.player:player-media-session:3.
|
|
111
|
+
implementation 'com.bitmovin.player:player:3.152.0+jason'
|
|
112
|
+
implementation 'com.bitmovin.player:player-media-session:3.152.0+jason'
|
|
113
113
|
}
|
|
@@ -24,6 +24,7 @@ class PlayerModule : Module() {
|
|
|
24
24
|
|
|
25
25
|
val mediaSessionPlaybackManager by lazy { MediaSessionPlaybackManager(appContext) }
|
|
26
26
|
private val shouldLoadAdItemWaiter = ResultWaiter<Boolean>()
|
|
27
|
+
private val shouldPlayAdBreakWaiter = ResultWaiter<Boolean>()
|
|
27
28
|
private val imaSettingsWaiter = ResultWaiter<Map<String, Any?>>()
|
|
28
29
|
|
|
29
30
|
override fun definition() = ModuleDefinition {
|
|
@@ -43,11 +44,12 @@ class PlayerModule : Module() {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
shouldLoadAdItemWaiter.clear()
|
|
47
|
+
shouldPlayAdBreakWaiter.clear()
|
|
46
48
|
imaSettingsWaiter.clear()
|
|
47
49
|
PlayerRegistry.clear()
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
Events("onShouldLoadAdItem", "onImaBeforeInitialization")
|
|
52
|
+
Events("onShouldLoadAdItem", "onShouldPlayAdBreak", "onImaBeforeInitialization")
|
|
51
53
|
|
|
52
54
|
AsyncFunction("play") { nativeId: NativeId ->
|
|
53
55
|
val player = PlayerRegistry.getPlayer(nativeId)
|
|
@@ -285,6 +287,10 @@ class PlayerModule : Module() {
|
|
|
285
287
|
shouldLoadAdItemWaiter.complete(id, shouldLoad)
|
|
286
288
|
}
|
|
287
289
|
|
|
290
|
+
AsyncFunction("setShouldPlayAdBreak") { id: Int, shouldPlay: Boolean ->
|
|
291
|
+
shouldPlayAdBreakWaiter.complete(id, shouldPlay)
|
|
292
|
+
}
|
|
293
|
+
|
|
288
294
|
AsyncFunction("initializeWithConfig") { nativeId: NativeId, config: Map<String, Any>?,
|
|
289
295
|
networkNativeId: NativeId?, decoderNativeId: NativeId?, ->
|
|
290
296
|
initializePlayer(nativeId, config, networkNativeId, decoderNativeId, null)
|
|
@@ -325,6 +331,7 @@ class PlayerModule : Module() {
|
|
|
325
331
|
@Suppress("UNCHECKED_CAST")
|
|
326
332
|
val configJson = config as? Map<String, Any?>
|
|
327
333
|
setupShouldLoadAdItem(nativeId, configJson, playerConfig)
|
|
334
|
+
setupShouldPlayAdBreak(nativeId, configJson, playerConfig)
|
|
328
335
|
setupImaBeforeInitialization(nativeId, configJson, playerConfig)
|
|
329
336
|
val enableMediaSession = config?.getMap("mediaControlConfig")
|
|
330
337
|
?.toMediaControlConfig()?.isEnabled ?: true
|
|
@@ -407,6 +414,32 @@ class PlayerModule : Module() {
|
|
|
407
414
|
)
|
|
408
415
|
}
|
|
409
416
|
|
|
417
|
+
private fun setupShouldPlayAdBreak(
|
|
418
|
+
nativeId: NativeId,
|
|
419
|
+
configJson: Map<String, Any?>?,
|
|
420
|
+
playerConfig: PlayerConfig,
|
|
421
|
+
) {
|
|
422
|
+
val advertisingConfigJson = configJson?.getMap("advertisingConfig") ?: return
|
|
423
|
+
if (!advertisingConfigJson.containsKey("shouldPlayAdBreak")) {
|
|
424
|
+
return
|
|
425
|
+
}
|
|
426
|
+
val advertisingConfig = playerConfig.advertisingConfig ?: AdvertisingConfig()
|
|
427
|
+
playerConfig.advertisingConfig = advertisingConfig.copy(
|
|
428
|
+
shouldPlayAdBreak = { adBreak ->
|
|
429
|
+
val (id, wait) = shouldPlayAdBreakWaiter.make(250)
|
|
430
|
+
sendEvent(
|
|
431
|
+
"onShouldPlayAdBreak",
|
|
432
|
+
bundleOf(
|
|
433
|
+
"nativeId" to nativeId,
|
|
434
|
+
"id" to id,
|
|
435
|
+
"adBreak" to adBreak.toJson(),
|
|
436
|
+
),
|
|
437
|
+
)
|
|
438
|
+
wait() ?: true
|
|
439
|
+
},
|
|
440
|
+
)
|
|
441
|
+
}
|
|
442
|
+
|
|
410
443
|
private fun createBeforeInitializationCallback(nativeId: NativeId): BeforeInitializationCallback =
|
|
411
444
|
BeforeInitializationCallback { settings ->
|
|
412
445
|
val (id, wait) = imaSettingsWaiter.make(250)
|
package/build/advertising.d.ts
CHANGED
|
@@ -108,6 +108,26 @@ export interface AdvertisingConfig {
|
|
|
108
108
|
* - `false` → the ad item will be skipped and removed from the playback schedule.
|
|
109
109
|
*/
|
|
110
110
|
shouldLoadAdItem?: (adItem: AdItem) => boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Called right before a scheduled ad break starts playback.
|
|
113
|
+
*
|
|
114
|
+
* Use this callback to conditionally allow or skip ad breaks at runtime
|
|
115
|
+
* (e.g., when starting playback from a time offset and discarding past breaks).
|
|
116
|
+
*
|
|
117
|
+
* @param adBreak - The ad break that is about to start.
|
|
118
|
+
*
|
|
119
|
+
* @returns
|
|
120
|
+
* - `true` → the ad break will start playback.
|
|
121
|
+
* - `false` → the ad break will be skipped.
|
|
122
|
+
*
|
|
123
|
+
* @remarks
|
|
124
|
+
* If the callback does not return within the platform's internal timeout,
|
|
125
|
+
* the ad break will play.
|
|
126
|
+
* The callback must be synchronous.
|
|
127
|
+
*
|
|
128
|
+
* @platform Android
|
|
129
|
+
*/
|
|
130
|
+
shouldPlayAdBreak?: (adBreak: AdBreak) => boolean;
|
|
111
131
|
/**
|
|
112
132
|
* Configuration to customize Google IMA SDK integration.
|
|
113
133
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advertising.d.ts","sourceRoot":"","sources":["../src/advertising.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,QAAQ,aAAa;IACrB;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,WAAW,gBAAgB;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,GAAG,EAAE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E,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,EAAE;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,GAAG,EAAE,EAAE,EAAE,CAAC;IACV;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
1
|
+
{"version":3,"file":"advertising.d.ts","sourceRoot":"","sources":["../src/advertising.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,UAAU;IACpB;;OAEG;IACH,KAAK,UAAU;IACf;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,QAAQ,aAAa;IACrB;;OAEG;IACH,GAAG,QAAQ;IACX;;OAEG;IACH,OAAO,YAAY;IACnB;;OAEG;IACH,WAAW,gBAAgB;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,C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MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,EAAE;IACjB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,GAAG,EAAE,EAAE,EAAE,CAAC;IACV;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
package/build/advertising.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advertising.js","sourceRoot":"","sources":["../src/advertising.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB;;OAEG;IACH,6BAAe,CAAA;IACf;;OAEG;IACH,qCAAuB,CAAA;IACvB;;OAEG;IACH,6BAAe,CAAA;AACjB,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB;;OAEG;IACH,qCAAqB,CAAA;IACrB;;OAEG;IACH,2BAAW,CAAA;IACX;;OAEG;IACH,mCAAmB,CAAA;IACnB;;OAEG;IACH,2CAA2B,CAAA;AAC7B,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB","sourcesContent":["/**\n * Quartiles that can be reached during an ad playback.\n */\nexport enum AdQuartile {\n /**\n * Fist ad quartile.\n */\n FIRST = 'first',\n /**\n * Mid ad quartile.\n */\n MID_POINT = 'mid_point',\n /**\n * Third ad quartile.\n */\n THIRD = 'third',\n}\n\n/**\n * The possible types an `AdSource` can be.\n */\nexport enum AdSourceType {\n /**\n * Bitmovin Advertising Module.\n */\n BITMOVIN = 'bitmovin',\n /**\n * Google Interactive Media Ads.\n */\n IMA = 'ima',\n /**\n * Unknown ad source type.\n */\n UNKNOWN = 'unknown',\n /**\n * Progressive ad type.\n */\n PROGRESSIVE = 'progressive',\n}\n\n/**\n * Represents an ad source which can be assigned to an `AdItem`. An `AdItem` can have multiple `AdSource`s\n * as waterfalling option.\n */\nexport interface AdSource {\n /**\n * The ad tag / url to the ad manifest.\n */\n tag: string;\n /**\n * The `AdSourceType` of this `AdSource`.\n */\n type: AdSourceType;\n}\n\n/**\n * Represents an ad break which can be scheduled for playback.\n *\n * One single `AdItem` can have multiple `AdSource`s where all but the first act as fallback ad sources\n * if the first one fails to load. The start and end of an ad break are signaled via `AdBreakStartedEvent`\n * and `AdBreakFinishedEvent`.\n */\nexport interface AdItem {\n /**\n * The playback position at which the ad break is scheduled to start. Default value is \"pre\".\n *\n * Possible values are:\n * • \"pre\": pre-roll ad (for VoD and Live streaming)\n * • \"post\": post-roll ad (for VoD streaming only)\n * • fractional seconds: \"10\", \"12.5\" (mid-roll ad, for VoD and Live streaming)\n * • percentage of the entire video duration: \"25%\", \"50%\" (mid-roll ad, for VoD streaming only)\n * • timecode hh:mm:ss.mmm: \"00:10:30.000\", \"01:00:00.000\" (mid-roll ad, for VoD streaming only)\n */\n position?: string;\n /**\n * The `AdSource`s that make up this `AdItem`. The first ad source in this array is used as the main ad.\n * Subsequent ad sources act as a fallback, meaning that if the main ad source does not provide a\n * valid response, the subsequent ad sources will be utilized one after another.\n *\n * The fallback ad sources need to have the same `AdSourceType` as the main ad source.\n */\n sources: AdSource[];\n\n /**\n * The amount of seconds the ad manifest is loaded in advance\n * compared to when the ad break is scheduled for playback.\n *\n * Default value is 0.0\n *\n * @platform Android\n */\n preloadOffset?: number;\n}\n\n/**\n * Contains configuration values regarding the ads which should be played back by the player.\n */\nexport interface AdvertisingConfig {\n /**\n * The ad items that are scheduled when a new playback session is started via `Player.load()`.\n */\n schedule: AdItem[];\n /**\n * Called right before an ad item begins loading.\n *\n * Use this callback to conditionally allow or skip individual ad items\n * based on runtime logic (e.g., user state, targeting rules, frequency caps).\n *\n * @param adItem - The ad item that is about to be loaded.\n *\n * @returns\n * - `true` → the ad item will proceed to load as scheduled.\n * - `false` → the ad item will be skipped and removed from the playback schedule.\n */\n shouldLoadAdItem?: (adItem: AdItem) => boolean;\n /**\n * Configuration to customize Google IMA SDK integration.\n */\n ima?: ImaAdvertisingConfig;\n}\n\n/**\n * Configuration options applied to Google IMA SDK before initialization.\n */\nexport interface ImaAdvertisingConfig {\n /**\n * Invoked before the IMA SDK initializes, allowing mutation of the SDK settings.\n *\n * @param settings - Current IMA settings received from the native SDK.\n * @returns The settings object to apply. If omitted, the (mutated) `settings` argument is used.\n */\n beforeInitialization?: (settings: ImaSettings) => ImaSettings | void;\n}\n\n/**\n * Represents Google IMA SDK wide settings.\n */\nexport interface ImaSettings {\n /**\n * Publisher Provided Identification (PPID) sent with ad requests.\n */\n ppid?: string;\n /**\n * Language identifier in IETF BCP 47 format.\n */\n language: string;\n /**\n * Maximum allowed wrapper redirects. Default is `4`.\n */\n maxRedirects: number;\n /**\n * Enables background audio playback. Defaults to `false`.\n *\n * @platform iOS, tvOS\n */\n enableBackgroundPlayback?: boolean;\n /**\n * Player version identifier reported to IMA.\n */\n playerVersion?: string;\n /**\n * Session identifier used for frequency capping.\n */\n sessionId?: string;\n /**\n * Controls Same App Key usage.\n *\n * @platform iOS\n */\n sameAppKeyEnabled?: boolean;\n}\n\n/**\n * Contains the base configuration options for an ad.\n */\nexport interface AdConfig {\n /**\n * Specifies how many seconds of the main video content should be replaced by ad break(s).\n */\n replaceContentDuration: number;\n}\n\n/**\n * Holds various additional ad data.\n */\nexport interface AdData {\n /**\n * The average bitrate of the progressive media file as defined in the VAST response.\n */\n bitrate?: number;\n /**\n * The maximum bitrate of the streaming media file as defined in the VAST response.\n */\n maxBitrate?: number;\n /**\n * The MIME type of the media file or creative as defined in the VAST response.\n */\n mimeType?: string;\n /**\n * The minimum bitrate of the streaming media file as defined in the VAST response.\n */\n minBitrate?: number;\n}\n\n/**\n * Defines basic properties available for every ad type.\n */\nexport interface Ad {\n /**\n * The url the user should be redirected to when clicking the ad.\n */\n clickThroughUrl?: string;\n /**\n * Holds various additional `AdData`.\n */\n data?: AdData;\n /**\n * The height of the ad.\n */\n height: number;\n /**\n * Identifier for the ad. This might be autogenerated.\n */\n id?: string;\n /**\n * Determines whether an ad is linear, i.e. playback of main content needs to be paused for the ad.\n */\n isLinear: boolean;\n /**\n * The corresponding media file url for the ad.\n */\n mediaFileUrl?: string;\n /**\n * The width of the ad.\n */\n width: number;\n}\n\n/**\n * Contains information about an ad break.\n */\nexport interface AdBreak {\n /**\n * The ads scheduled for this `AdBreak`.\n */\n ads: Ad[];\n /**\n * The id of the corresponding `AdBreakConfig`. This will be auto-generated.\n */\n id: string;\n /**\n * The time in seconds in the media timeline the `AdBreak` is scheduled for.\n */\n scheduleTime: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"advertising.js","sourceRoot":"","sources":["../src/advertising.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB;;OAEG;IACH,6BAAe,CAAA;IACf;;OAEG;IACH,qCAAuB,CAAA;IACvB;;OAEG;IACH,6BAAe,CAAA;AACjB,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,YAiBX;AAjBD,WAAY,YAAY;IACtB;;OAEG;IACH,qCAAqB,CAAA;IACrB;;OAEG;IACH,2BAAW,CAAA;IACX;;OAEG;IACH,mCAAmB,CAAA;IACnB;;OAEG;IACH,2CAA2B,CAAA;AAC7B,CAAC,EAjBW,YAAY,KAAZ,YAAY,QAiBvB","sourcesContent":["/**\n * Quartiles that can be reached during an ad playback.\n */\nexport enum AdQuartile {\n /**\n * Fist ad quartile.\n */\n FIRST = 'first',\n /**\n * Mid ad quartile.\n */\n MID_POINT = 'mid_point',\n /**\n * Third ad quartile.\n */\n THIRD = 'third',\n}\n\n/**\n * The possible types an `AdSource` can be.\n */\nexport enum AdSourceType {\n /**\n * Bitmovin Advertising Module.\n */\n BITMOVIN = 'bitmovin',\n /**\n * Google Interactive Media Ads.\n */\n IMA = 'ima',\n /**\n * Unknown ad source type.\n */\n UNKNOWN = 'unknown',\n /**\n * Progressive ad type.\n */\n PROGRESSIVE = 'progressive',\n}\n\n/**\n * Represents an ad source which can be assigned to an `AdItem`. An `AdItem` can have multiple `AdSource`s\n * as waterfalling option.\n */\nexport interface AdSource {\n /**\n * The ad tag / url to the ad manifest.\n */\n tag: string;\n /**\n * The `AdSourceType` of this `AdSource`.\n */\n type: AdSourceType;\n}\n\n/**\n * Represents an ad break which can be scheduled for playback.\n *\n * One single `AdItem` can have multiple `AdSource`s where all but the first act as fallback ad sources\n * if the first one fails to load. The start and end of an ad break are signaled via `AdBreakStartedEvent`\n * and `AdBreakFinishedEvent`.\n */\nexport interface AdItem {\n /**\n * The playback position at which the ad break is scheduled to start. Default value is \"pre\".\n *\n * Possible values are:\n * • \"pre\": pre-roll ad (for VoD and Live streaming)\n * • \"post\": post-roll ad (for VoD streaming only)\n * • fractional seconds: \"10\", \"12.5\" (mid-roll ad, for VoD and Live streaming)\n * • percentage of the entire video duration: \"25%\", \"50%\" (mid-roll ad, for VoD streaming only)\n * • timecode hh:mm:ss.mmm: \"00:10:30.000\", \"01:00:00.000\" (mid-roll ad, for VoD streaming only)\n */\n position?: string;\n /**\n * The `AdSource`s that make up this `AdItem`. The first ad source in this array is used as the main ad.\n * Subsequent ad sources act as a fallback, meaning that if the main ad source does not provide a\n * valid response, the subsequent ad sources will be utilized one after another.\n *\n * The fallback ad sources need to have the same `AdSourceType` as the main ad source.\n */\n sources: AdSource[];\n\n /**\n * The amount of seconds the ad manifest is loaded in advance\n * compared to when the ad break is scheduled for playback.\n *\n * Default value is 0.0\n *\n * @platform Android\n */\n preloadOffset?: number;\n}\n\n/**\n * Contains configuration values regarding the ads which should be played back by the player.\n */\nexport interface AdvertisingConfig {\n /**\n * The ad items that are scheduled when a new playback session is started via `Player.load()`.\n */\n schedule: AdItem[];\n /**\n * Called right before an ad item begins loading.\n *\n * Use this callback to conditionally allow or skip individual ad items\n * based on runtime logic (e.g., user state, targeting rules, frequency caps).\n *\n * @param adItem - The ad item that is about to be loaded.\n *\n * @returns\n * - `true` → the ad item will proceed to load as scheduled.\n * - `false` → the ad item will be skipped and removed from the playback schedule.\n */\n shouldLoadAdItem?: (adItem: AdItem) => boolean;\n /**\n * Called right before a scheduled ad break starts playback.\n *\n * Use this callback to conditionally allow or skip ad breaks at runtime\n * (e.g., when starting playback from a time offset and discarding past breaks).\n *\n * @param adBreak - The ad break that is about to start.\n *\n * @returns\n * - `true` → the ad break will start playback.\n * - `false` → the ad break will be skipped.\n *\n * @remarks\n * If the callback does not return within the platform's internal timeout,\n * the ad break will play.\n * The callback must be synchronous.\n *\n * @platform Android\n */\n shouldPlayAdBreak?: (adBreak: AdBreak) => boolean;\n /**\n * Configuration to customize Google IMA SDK integration.\n */\n ima?: ImaAdvertisingConfig;\n}\n\n/**\n * Configuration options applied to Google IMA SDK before initialization.\n */\nexport interface ImaAdvertisingConfig {\n /**\n * Invoked before the IMA SDK initializes, allowing mutation of the SDK settings.\n *\n * @param settings - Current IMA settings received from the native SDK.\n * @returns The settings object to apply. If omitted, the (mutated) `settings` argument is used.\n */\n beforeInitialization?: (settings: ImaSettings) => ImaSettings | void;\n}\n\n/**\n * Represents Google IMA SDK wide settings.\n */\nexport interface ImaSettings {\n /**\n * Publisher Provided Identification (PPID) sent with ad requests.\n */\n ppid?: string;\n /**\n * Language identifier in IETF BCP 47 format.\n */\n language: string;\n /**\n * Maximum allowed wrapper redirects. Default is `4`.\n */\n maxRedirects: number;\n /**\n * Enables background audio playback. Defaults to `false`.\n *\n * @platform iOS, tvOS\n */\n enableBackgroundPlayback?: boolean;\n /**\n * Player version identifier reported to IMA.\n */\n playerVersion?: string;\n /**\n * Session identifier used for frequency capping.\n */\n sessionId?: string;\n /**\n * Controls Same App Key usage.\n *\n * @platform iOS\n */\n sameAppKeyEnabled?: boolean;\n}\n\n/**\n * Contains the base configuration options for an ad.\n */\nexport interface AdConfig {\n /**\n * Specifies how many seconds of the main video content should be replaced by ad break(s).\n */\n replaceContentDuration: number;\n}\n\n/**\n * Holds various additional ad data.\n */\nexport interface AdData {\n /**\n * The average bitrate of the progressive media file as defined in the VAST response.\n */\n bitrate?: number;\n /**\n * The maximum bitrate of the streaming media file as defined in the VAST response.\n */\n maxBitrate?: number;\n /**\n * The MIME type of the media file or creative as defined in the VAST response.\n */\n mimeType?: string;\n /**\n * The minimum bitrate of the streaming media file as defined in the VAST response.\n */\n minBitrate?: number;\n}\n\n/**\n * Defines basic properties available for every ad type.\n */\nexport interface Ad {\n /**\n * The url the user should be redirected to when clicking the ad.\n */\n clickThroughUrl?: string;\n /**\n * Holds various additional `AdData`.\n */\n data?: AdData;\n /**\n * The height of the ad.\n */\n height: number;\n /**\n * Identifier for the ad. This might be autogenerated.\n */\n id?: string;\n /**\n * Determines whether an ad is linear, i.e. playback of main content needs to be paused for the ad.\n */\n isLinear: boolean;\n /**\n * The corresponding media file url for the ad.\n */\n mediaFileUrl?: string;\n /**\n * The width of the ad.\n */\n width: number;\n}\n\n/**\n * Contains information about an ad break.\n */\nexport interface AdBreak {\n /**\n * The ads scheduled for this `AdBreak`.\n */\n ads: Ad[];\n /**\n * The id of the corresponding `AdBreakConfig`. This will be auto-generated.\n */\n id: string;\n /**\n * The time in seconds in the media timeline the `AdBreak` is scheduled for.\n */\n scheduleTime: number;\n}\n"]}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { NativeModule } from 'expo-modules-core';
|
|
2
|
-
import { AdItem, ImaSettings } from '../advertising';
|
|
2
|
+
import { AdBreak, AdItem, ImaSettings } from '../advertising';
|
|
3
3
|
export type PlayerModuleEvents = {
|
|
4
4
|
onShouldLoadAdItem: ({ nativeId, id, adItem, }: {
|
|
5
5
|
nativeId: string;
|
|
6
6
|
id: number;
|
|
7
7
|
adItem: AdItem;
|
|
8
8
|
}) => void;
|
|
9
|
+
onShouldPlayAdBreak: ({ nativeId, id, adBreak, }: {
|
|
10
|
+
nativeId: string;
|
|
11
|
+
id: number;
|
|
12
|
+
adBreak: AdBreak;
|
|
13
|
+
}) => void;
|
|
9
14
|
onImaBeforeInitialization: ({ nativeId, id, settings, }: {
|
|
10
15
|
nativeId: string;
|
|
11
16
|
id: number;
|
|
@@ -133,6 +138,10 @@ declare class PlayerModule extends NativeModule<PlayerModuleEvents> {
|
|
|
133
138
|
* Applies the JS decision for an ad item load callback.
|
|
134
139
|
*/
|
|
135
140
|
setShouldLoadAdItem(id: number, shouldLoad: boolean): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Applies the JS decision for an ad break playback callback.
|
|
143
|
+
*/
|
|
144
|
+
setShouldPlayAdBreak(id: number, shouldPlay: boolean): Promise<void>;
|
|
136
145
|
/**
|
|
137
146
|
* Applies the JS-updated IMA settings for a before-initialization callback.
|
|
138
147
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerModule.d.ts","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PlayerModule.d.ts","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,OAAO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GAAG,IAAI,CAAC;IAEvD;;OAEG;IACH,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEvD;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEzE;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1E;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAEjE;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE5D;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACpE;;AAED,wBAAiE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerModule.js","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PlayerModule.js","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAsStE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport { AdBreak, AdItem, ImaSettings } from '../advertising';\n\nexport type PlayerModuleEvents = {\n onShouldLoadAdItem: ({\n nativeId,\n id,\n adItem,\n }: {\n nativeId: string;\n id: number;\n adItem: AdItem;\n }) => void;\n onShouldPlayAdBreak: ({\n nativeId,\n id,\n adBreak,\n }: {\n nativeId: string;\n id: number;\n adBreak: AdBreak;\n }) => void;\n onImaBeforeInitialization: ({\n nativeId,\n id,\n settings,\n }: {\n nativeId: string;\n id: number;\n settings: ImaSettings;\n }) => void;\n};\n\ndeclare class PlayerModule extends NativeModule<PlayerModuleEvents> {\n /**\n * Call .play() on nativeId's player.\n */\n play(nativeId: string): Promise<void>;\n\n /**\n * Call .pause() on nativeId's player.\n */\n pause(nativeId: string): Promise<void>;\n\n /**\n * Call .mute() on nativeId's player.\n */\n mute(nativeId: string): Promise<void>;\n\n /**\n * Call .unmute() on nativeId's player.\n */\n unmute(nativeId: string): Promise<void>;\n\n /**\n * Call .seek(time) on nativeId's player.\n */\n seek(nativeId: string, time: number): Promise<void>;\n\n /**\n * Sets timeShift on nativeId's player.\n */\n timeShift(nativeId: string, offset: number): Promise<void>;\n\n /**\n * Call .destroy() on nativeId's player and remove from registry.\n */\n destroy(nativeId: string): Promise<void>;\n\n /**\n * Call .setVolume(volume) on nativeId's player.\n */\n setVolume(nativeId: string, volume: number): Promise<void>;\n\n /**\n * Resolve nativeId's current volume.\n */\n getVolume(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current time.\n */\n currentTime(nativeId: string, mode?: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current playing state.\n */\n isPlaying(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's current paused state.\n */\n isPaused(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's active source duration.\n */\n duration(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current muted state.\n */\n isMuted(nativeId: string): Promise<boolean | null>;\n\n /**\n * Call .unload() on nativeId's player.\n */\n unload(nativeId: string): Promise<void>;\n\n /**\n * Resolve nativeId's current time shift value.\n */\n getTimeShift(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's live stream state.\n */\n isLive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's maximum time shift value.\n */\n getMaxTimeShift(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current playback speed.\n */\n getPlaybackSpeed(nativeId: string): Promise<number | null>;\n\n /**\n * Set playback speed for nativeId's player.\n */\n setPlaybackSpeed(nativeId: string, playbackSpeed: number): Promise<void>;\n\n /**\n * Resolve nativeId's current ad state.\n */\n isAd(nativeId: string): Promise<boolean | null>;\n\n /**\n * Set maximum selectable bitrate for nativeId's player.\n */\n setMaxSelectableBitrate(nativeId: string, maxBitrate: number): Promise<void>;\n\n /**\n * Resolve nativeId's AirPlay activation state (iOS only).\n */\n isAirPlayActive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's AirPlay availability state (iOS only).\n */\n isAirPlayAvailable(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's cast availability state.\n */\n isCastAvailable(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's current casting state.\n */\n isCasting(nativeId: string): Promise<boolean | null>;\n\n /**\n * Initiate casting for nativeId's player.\n */\n castVideo(nativeId: string): Promise<void>;\n\n /**\n * Stop casting for nativeId's player.\n */\n castStop(nativeId: string): Promise<void>;\n\n /**\n * Skip current ad for nativeId's player.\n */\n skipAd(nativeId: string): Promise<void>;\n\n /**\n * Applies the JS decision for an ad item load callback.\n */\n setShouldLoadAdItem(id: number, shouldLoad: boolean): Promise<void>;\n\n /**\n * Applies the JS decision for an ad break playback callback.\n */\n setShouldPlayAdBreak(id: number, shouldPlay: boolean): Promise<void>;\n\n /**\n * Applies the JS-updated IMA settings for a before-initialization callback.\n */\n setPreparedImaSettings(id: number, settings: ImaSettings): Promise<void>;\n\n /**\n * Check if player can play at specified playback speed (iOS only).\n */\n canPlayAtPlaybackSpeed(\n nativeId: string,\n playbackSpeed: number\n ): Promise<boolean | null>;\n\n /**\n * Creates a new Player instance using the provided config.\n */\n initializeWithConfig(\n nativeId: string,\n config?: Record<string, any>,\n networkNativeId?: string,\n decoderNativeId?: string\n ): Promise<void>;\n\n /**\n * Creates a new analytics-enabled Player instance.\n */\n initializeWithAnalyticsConfig(\n nativeId: string,\n analyticsConfig: Record<string, any>,\n config?: Record<string, any>,\n networkNativeId?: string,\n decoderNativeId?: string\n ): Promise<void>;\n\n /**\n * Load source into the player.\n * Requires SourceModule dependency.\n */\n loadSource(nativeId: string, sourceNativeId: string): Promise<void>;\n\n /**\n * Load offline content into the player.\n */\n loadOfflineContent(\n nativeId: string,\n offlineContentId: string,\n options?: Record<string, any>\n ): Promise<void>;\n\n /**\n * Get current audio track.\n */\n getAudioTrack(nativeId: string): Promise<any | null>;\n\n /**\n * Get available audio tracks.\n */\n getAvailableAudioTracks(nativeId: string): Promise<any[]>;\n\n /**\n * Set audio track.\n */\n setAudioTrack(nativeId: string, trackId: string): Promise<void>;\n\n /**\n * Get current subtitle track.\n */\n getSubtitleTrack(nativeId: string): Promise<any | null>;\n\n /**\n * Get available subtitle tracks.\n */\n getAvailableSubtitles(nativeId: string): Promise<any[]>;\n\n /**\n * Set subtitle track.\n */\n setSubtitleTrack(nativeId: string, trackId: string | null): Promise<void>;\n\n /**\n * Schedule an ad.\n */\n scheduleAd(nativeId: string, adConfig: Record<string, any>): Promise<void>;\n\n /**\n * Get thumbnail for time position.\n */\n getThumbnail(nativeId: string, time: number): Promise<any | null>;\n\n /**\n * Get current video quality.\n */\n getVideoQuality(nativeId: string): Promise<any | null>;\n\n /**\n * Get available video qualities.\n */\n getAvailableVideoQualities(nativeId: string): Promise<any[]>;\n\n /**\n * Set video quality.\n */\n setVideoQuality(nativeId: string, qualityId: string): Promise<void>;\n}\n\nexport default requireNativeModule<PlayerModule>('PlayerModule');\n"]}
|
package/build/player.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare class Player extends NativeInstance<PlayerConfig> {
|
|
|
44
44
|
private network?;
|
|
45
45
|
private decoderConfig?;
|
|
46
46
|
private onShouldLoadAdItemSubscription?;
|
|
47
|
+
private onShouldPlayAdBreakSubscription?;
|
|
47
48
|
private onImaBeforeInitializationSubscription?;
|
|
48
49
|
/**
|
|
49
50
|
* Allocates the native `Player` instance and its resources natively.
|
|
@@ -112,6 +113,7 @@ export declare class Player extends NativeInstance<PlayerConfig> {
|
|
|
112
113
|
* @param volume - The volume level to set.
|
|
113
114
|
*/
|
|
114
115
|
setVolume: (volume: number) => void;
|
|
116
|
+
private ensureShouldPlayAdBreakListener;
|
|
115
117
|
private ensureImaBeforeInitializationListener;
|
|
116
118
|
/**
|
|
117
119
|
* @returns The player's current volume level.
|
package/build/player.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../src/player.ts"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../src/player.ts"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAA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CAY5B;CACH"}
|
package/build/player.js
CHANGED
|
@@ -41,6 +41,7 @@ export class Player extends NativeInstance {
|
|
|
41
41
|
network;
|
|
42
42
|
decoderConfig;
|
|
43
43
|
onShouldLoadAdItemSubscription;
|
|
44
|
+
onShouldPlayAdBreakSubscription;
|
|
44
45
|
onImaBeforeInitializationSubscription;
|
|
45
46
|
/**
|
|
46
47
|
* Allocates the native `Player` instance and its resources natively.
|
|
@@ -48,6 +49,7 @@ export class Player extends NativeInstance {
|
|
|
48
49
|
initialize = async () => {
|
|
49
50
|
if (!this.isInitialized) {
|
|
50
51
|
this.ensureShouldLoadAdItemListener();
|
|
52
|
+
this.ensureShouldPlayAdBreakListener();
|
|
51
53
|
this.ensureImaBeforeInitializationListener();
|
|
52
54
|
if (this.config?.networkConfig) {
|
|
53
55
|
this.network = new Network(this.config.networkConfig);
|
|
@@ -76,8 +78,10 @@ export class Player extends NativeInstance {
|
|
|
76
78
|
void this.network?.destroy();
|
|
77
79
|
void this.decoderConfig?.destroy();
|
|
78
80
|
this.onShouldLoadAdItemSubscription?.remove();
|
|
81
|
+
this.onShouldPlayAdBreakSubscription?.remove();
|
|
79
82
|
this.onImaBeforeInitializationSubscription?.remove();
|
|
80
83
|
this.onShouldLoadAdItemSubscription = undefined;
|
|
84
|
+
this.onShouldPlayAdBreakSubscription = undefined;
|
|
81
85
|
this.onImaBeforeInitializationSubscription = undefined;
|
|
82
86
|
this.isDestroyed = true;
|
|
83
87
|
}
|
|
@@ -193,6 +197,40 @@ export class Player extends NativeInstance {
|
|
|
193
197
|
setVolume = (volume) => {
|
|
194
198
|
void PlayerModule.setVolume(this.nativeId, volume);
|
|
195
199
|
};
|
|
200
|
+
ensureShouldPlayAdBreakListener = () => {
|
|
201
|
+
if (Platform.OS !== 'android') {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const callback = this.config?.advertisingConfig?.shouldPlayAdBreak;
|
|
205
|
+
if (!callback) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (this.onShouldPlayAdBreakSubscription) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
this.onShouldPlayAdBreakSubscription = PlayerModule.addListener('onShouldPlayAdBreak', ({ nativeId, id, adBreak }) => {
|
|
212
|
+
if (nativeId !== this.nativeId) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const cloned = {
|
|
216
|
+
...adBreak,
|
|
217
|
+
ads: adBreak.ads.map((ad) => ({
|
|
218
|
+
...ad,
|
|
219
|
+
data: ad.data ? { ...ad.data } : undefined,
|
|
220
|
+
})),
|
|
221
|
+
};
|
|
222
|
+
let shouldPlay = true;
|
|
223
|
+
try {
|
|
224
|
+
const shouldPlayResult = callback(cloned);
|
|
225
|
+
shouldPlay =
|
|
226
|
+
typeof shouldPlayResult === 'boolean' ? shouldPlayResult : true;
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
shouldPlay = true;
|
|
230
|
+
}
|
|
231
|
+
void PlayerModule.setShouldPlayAdBreak(id, shouldPlay);
|
|
232
|
+
});
|
|
233
|
+
};
|
|
196
234
|
ensureImaBeforeInitializationListener = () => {
|
|
197
235
|
const callback = this.config?.advertisingConfig?.ima?.beforeInitialization;
|
|
198
236
|
if (!callback) {
|
package/build/player.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"player.js","sourceRoot":"","sources":["../src/player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAgB,MAAM,UAAU,CAAC;AAKhD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO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E,CAAC,CAAC;IAEF;;;OAGG;IACH,gBAAgB,GAAG,KAAK,IAAqB,EAAE;QAC7C,OAAO,CAAC,MAAM,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF;;;;;OAKG;IACH,sBAAsB,GAAG,KAAK,EAC5B,aAAqB,EACS,EAAE;QAChC,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CACV,WAAW,IAAI,CAAC,QAAQ,0FAA0F,CACnH,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,CACL,CAAC,MAAM,YAAY,CAAC,sBAAsB,CACxC,IAAI,CAAC,QAAQ,EACb,aAAa,CACd,CAAC,IAAI,KAAK,CACZ,CAAC;IACJ,CAAC,CAAC;IAEM,sBAAsB,GAAG,GAAG,EAAE;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,IAAI,IAAI,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAC1C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CACzC,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport { Platform } from 'react-native';\nimport PlayerModule from './modules/PlayerModule';\nimport NativeInstance from './nativeInstance';\nimport { Source, SourceConfig } from './source';\nimport { AudioTrack } from './audioTrack';\nimport { SubtitleTrack } from './subtitleTrack';\nimport { OfflineContentManager, OfflineSourceOptions } from './offline';\nimport { Thumbnail } from './thumbnail';\nimport { AnalyticsApi } from './analytics/player';\nimport { PlayerConfig } from './playerConfig';\nimport { AdItem, ImaSettings } from './advertising';\nimport { BufferApi } from './bufferApi';\nimport { VideoQuality } from './media';\nimport { Network } from './network';\nimport { DecoderConfigBridge } from './decoder';\n\n/**\n * Loads, controls and renders audio and video content represented through {@link Source}s. A player\n * instance can be created via the {@link usePlayer} hook and will idle until one or more {@link Source}s are\n * loaded. Once {@link Player.load} or {@link Player.loadSource} is called, the player becomes active and initiates necessary downloads to\n * start playback of the loaded source(s).\n *\n * Can be attached to {@link PlayerView} component in order to use Bitmovin's Player Web UI.\n * @see PlayerView\n */\nexport class Player extends NativeInstance<PlayerConfig> {\n /**\n * Whether the native `Player` object has been created.\n */\n isInitialized = false;\n /**\n * Whether the native `Player` object has been disposed.\n */\n isDestroyed = false;\n /**\n * Currently active source, or `null` if none is active.\n */\n source?: Source;\n /**\n * The `AnalyticsApi` for interactions regarding the `Player`'s analytics.\n *\n * `undefined` if the player was created without analytics support.\n */\n analytics?: AnalyticsApi = undefined;\n /**\n * The {@link BufferApi} for interactions regarding the buffer.\n */\n buffer: BufferApi = new BufferApi(this.nativeId);\n\n private network?: Network;\n\n private decoderConfig?: DecoderConfigBridge;\n private onShouldLoadAdItemSubscription?: EventSubscription;\n private onImaBeforeInitializationSubscription?: EventSubscription;\n /**\n * Allocates the native `Player` instance and its resources natively.\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized) {\n this.ensureShouldLoadAdItemListener();\n this.ensureImaBeforeInitializationListener();\n if (this.config?.networkConfig) {\n this.network = new Network(this.config.networkConfig);\n await this.network.initialize();\n }\n await this.maybeInitDecoderConfig();\n const analyticsConfig = this.config?.analyticsConfig;\n if (analyticsConfig) {\n await PlayerModule.initializeWithAnalyticsConfig(\n this.nativeId,\n analyticsConfig,\n this.config,\n this.network?.nativeId,\n this.decoderConfig?.nativeId\n );\n this.analytics = new AnalyticsApi(this.nativeId);\n } else {\n await PlayerModule.initializeWithConfig(\n this.nativeId,\n this.config,\n this.network?.nativeId,\n this.decoderConfig?.nativeId\n );\n }\n\n this.isInitialized = true;\n }\n return Promise.resolve();\n };\n\n /**\n * Destroys the native `Player` and releases all of its allocated resources.\n */\n destroy = () => {\n if (!this.isDestroyed) {\n void PlayerModule.destroy(this.nativeId);\n void this.source?.destroy();\n void this.network?.destroy();\n void this.decoderConfig?.destroy();\n this.onShouldLoadAdItemSubscription?.remove();\n this.onImaBeforeInitializationSubscription?.remove();\n this.onShouldLoadAdItemSubscription = undefined;\n this.onImaBeforeInitializationSubscription = undefined;\n this.isDestroyed = true;\n }\n };\n\n private ensureShouldLoadAdItemListener = () => {\n const callback = this.config?.advertisingConfig?.shouldLoadAdItem;\n if (!callback) {\n return;\n }\n if (this.onShouldLoadAdItemSubscription) {\n return;\n }\n this.onShouldLoadAdItemSubscription = PlayerModule.addListener(\n 'onShouldLoadAdItem',\n ({ nativeId, id, adItem }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n const cloned: AdItem = {\n ...adItem,\n sources: adItem.sources.map((source) => ({ ...source })),\n };\n let shouldLoad = true;\n try {\n const shouldLoadResult = callback(cloned);\n shouldLoad =\n typeof shouldLoadResult === 'boolean' ? shouldLoadResult : true;\n } catch {\n shouldLoad = true;\n }\n void PlayerModule.setShouldLoadAdItem(id, shouldLoad);\n }\n );\n };\n\n /**\n * Loads a new {@link Source} from `sourceConfig` into the player.\n */\n load = (sourceConfig: SourceConfig) => {\n this.loadSource(new Source(sourceConfig));\n };\n\n /**\n * Loads the downloaded content from {@link OfflineContentManager} into the player.\n */\n loadOfflineContent = (\n offlineContentManager: OfflineContentManager,\n options?: OfflineSourceOptions\n ) => {\n void PlayerModule.loadOfflineContent(\n this.nativeId,\n offlineContentManager.nativeId,\n options\n );\n };\n\n /**\n * Loads the given {@link Source} into the player.\n */\n loadSource = (source: Source) => {\n this.source = source;\n void source\n .initialize()\n .then(() => PlayerModule.loadSource(this.nativeId, source.nativeId));\n };\n\n /**\n * Unloads all {@link Source}s from the player.\n */\n unload = () => {\n void PlayerModule.unload(this.nativeId);\n };\n\n /**\n * Starts or resumes playback after being paused. Has no effect if the player is already playing.\n */\n play = () => {\n void PlayerModule.play(this.nativeId);\n };\n\n /**\n * Pauses the video if it is playing. Has no effect if the player is already paused.\n */\n pause = () => {\n void PlayerModule.pause(this.nativeId);\n };\n\n /**\n * Seeks to the given playback time specified by the parameter `time` in seconds. Must not be\n * greater than the total duration of the video. Has no effect when watching a live stream since\n * seeking is not possible.\n *\n * @param time - The time to seek to in seconds.\n */\n seek = (time: number) => {\n void PlayerModule.seek(this.nativeId, time);\n };\n\n /**\n * Shifts the time to the given `offset` in seconds from the live edge. The resulting offset has to be within the\n * timeShift window as specified by `maxTimeShift` (which is a negative value) and 0. When the provided `offset` is\n * positive, it will be interpreted as a UNIX timestamp in seconds and converted to fit into the timeShift window.\n * When the provided `offset` is negative, but lower than `maxTimeShift`, then it will be clamped to `maxTimeShift`.\n * Has no effect for VoD.\n *\n * Has no effect if no sources are loaded.\n *\n * @param offset - Target offset from the live edge in seconds.\n */\n timeShift = (offset: number) => {\n void PlayerModule.timeShift(this.nativeId, offset);\n };\n\n /**\n * Mutes the player if an audio track is available. Has no effect if the player is already muted.\n */\n mute = () => {\n void PlayerModule.mute(this.nativeId);\n };\n\n /**\n * Unmutes the player if it is muted. Has no effect if the player is already unmuted.\n */\n unmute = () => {\n void PlayerModule.unmute(this.nativeId);\n };\n\n /**\n * Sets the player's volume between 0 (silent) and 100 (max volume).\n *\n * @param volume - The volume level to set.\n */\n setVolume = (volume: number) => {\n void PlayerModule.setVolume(this.nativeId, volume);\n };\n\n private ensureImaBeforeInitializationListener = () => {\n const callback = this.config?.advertisingConfig?.ima?.beforeInitialization;\n if (!callback) {\n return;\n }\n if (this.onImaBeforeInitializationSubscription) {\n return;\n }\n this.onImaBeforeInitializationSubscription = PlayerModule.addListener(\n 'onImaBeforeInitialization',\n ({ nativeId, id, settings }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n const cloned: ImaSettings = { ...settings };\n let prepared = cloned;\n try {\n const result = callback(cloned);\n prepared =\n result && typeof result === 'object'\n ? { ...cloned, ...result }\n : cloned;\n } catch {\n prepared = cloned;\n }\n void PlayerModule.setPreparedImaSettings(id, prepared);\n }\n );\n };\n\n /**\n * @returns The player's current volume level.\n */\n getVolume = async (): Promise<number> => {\n return (await PlayerModule.getVolume(this.nativeId)) ?? 0;\n };\n\n /**\n * @returns The current playback time in seconds.\n *\n * For VoD streams the returned time ranges between 0 and the duration of the asset.\n *\n * For live streams it can be specified if an absolute UNIX timestamp or a value\n * relative to the playback start should be returned.\n *\n * @param mode - The time mode to specify: an absolute UNIX timestamp ('absolute') or relative time ('relative').\n */\n getCurrentTime = async (\n mode: 'relative' | 'absolute' = 'absolute'\n ): Promise<number> => {\n return (await PlayerModule.currentTime(this.nativeId, mode)) ?? 0;\n };\n\n /**\n * @returns The total duration in seconds of the current video or INFINITY if it’s a live stream.\n */\n getDuration = async (): Promise<number> => {\n return (await PlayerModule.duration(this.nativeId)) ?? 0;\n };\n\n /**\n * @returns `true` if the player is muted.\n */\n isMuted = async (): Promise<boolean> => {\n return (await PlayerModule.isMuted(this.nativeId)) ?? false;\n };\n\n /**\n * @returns `true` if the player is currently playing, i.e. has started and is not paused.\n */\n isPlaying = async (): Promise<boolean> => {\n return (await PlayerModule.isPlaying(this.nativeId)) ?? false;\n };\n\n /**\n * @returns `true` if the player has started playback but it's currently paused.\n */\n isPaused = async (): Promise<boolean> => {\n return (await PlayerModule.isPaused(this.nativeId)) ?? false;\n };\n\n /**\n * @returns `true` if the displayed video is a live stream.\n */\n isLive = async (): Promise<boolean> => {\n return (await PlayerModule.isLive(this.nativeId)) ?? false;\n };\n\n /**\n * @platform iOS\n * @returns `true` when media is played externally using AirPlay.\n */\n isAirPlayActive = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method isAirPlayActive is not available for Android. Only iOS devices.`\n );\n return false;\n }\n return (await PlayerModule.isAirPlayActive(this.nativeId)) ?? false;\n };\n\n /**\n * @platform iOS\n * @returns `true` when AirPlay is available.\n */\n isAirPlayAvailable = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method isAirPlayAvailable is not available for Android. Only iOS devices.`\n );\n return false;\n }\n return (await PlayerModule.isAirPlayAvailable(this.nativeId)) ?? false;\n };\n\n /**\n * @returns The currently selected audio track or `null`.\n */\n getAudioTrack = async (): Promise<AudioTrack | null> => {\n return PlayerModule.getAudioTrack(this.nativeId);\n };\n\n /**\n * @returns An array containing {@link AudioTrack} objects for all available audio tracks.\n */\n getAvailableAudioTracks = async (): Promise<AudioTrack[]> => {\n return PlayerModule.getAvailableAudioTracks(this.nativeId);\n };\n\n /**\n * Sets the audio track to the ID specified by trackIdentifier. A list can be retrieved by calling getAvailableAudioTracks.\n *\n * @param trackIdentifier - The {@link AudioTrack.identifier} to be set.\n */\n setAudioTrack = async (trackIdentifier: string): Promise<void> => {\n return PlayerModule.setAudioTrack(this.nativeId, trackIdentifier);\n };\n\n /**\n * @returns The currently selected {@link SubtitleTrack} or `null`.\n */\n getSubtitleTrack = async (): Promise<SubtitleTrack | null> => {\n return PlayerModule.getSubtitleTrack(this.nativeId);\n };\n\n /**\n * @returns An array containing SubtitleTrack objects for all available subtitle tracks.\n */\n getAvailableSubtitles = async (): Promise<SubtitleTrack[]> => {\n return PlayerModule.getAvailableSubtitles(this.nativeId);\n };\n\n /**\n * Sets the subtitle track to the ID specified by trackIdentifier. A list can be retrieved by calling getAvailableSubtitles.\n * Pass `undefined` to disable subtitles.\n *\n * @param trackIdentifier - The {@link SubtitleTrack.identifier} to be set.\n */\n setSubtitleTrack = async (\n trackIdentifier: string | undefined\n ): Promise<void> => {\n return PlayerModule.setSubtitleTrack(\n this.nativeId,\n trackIdentifier ?? null\n );\n };\n\n /**\n * Dynamically schedules the {@link AdItem} for playback.\n * Has no effect if there is no active playback session.\n *\n * @param adItem - Ad to be scheduled for playback.\n *\n * @platform iOS, Android\n */\n scheduleAd = (adItem: AdItem) => {\n void PlayerModule.scheduleAd(this.nativeId, adItem);\n };\n\n /**\n * Skips the current ad.\n * Has no effect if the current ad is not skippable or if no ad is being played back.\n *\n * @platform iOS, Android\n */\n skipAd = () => {\n void PlayerModule.skipAd(this.nativeId);\n };\n\n /**\n * @returns `true` while an ad is being played back or when main content playback has been paused for ad playback.\n * @platform iOS, Android\n */\n isAd = async (): Promise<boolean> => {\n return (await PlayerModule.isAd(this.nativeId)) ?? false;\n };\n\n /**\n * The current time shift of the live stream in seconds. This value is always 0 if the active {@link Source} is not a\n * live stream or no sources are loaded.\n */\n getTimeShift = async (): Promise<number> => {\n return (await PlayerModule.getTimeShift(this.nativeId)) ?? 0;\n };\n\n /**\n * The limit in seconds for time shifting. This value is either negative or 0 and it is always 0 if the active\n * {@link Source} is not a live stream or no sources are loaded.\n */\n getMaxTimeShift = async (): Promise<number> => {\n return (await PlayerModule.getMaxTimeShift(this.nativeId)) ?? 0;\n };\n\n /**\n * Sets the upper bitrate boundary for video qualities. All qualities with a bitrate\n * that is higher than this threshold will not be eligible for automatic quality selection.\n *\n * Can be set to `null` for no limitation.\n */\n setMaxSelectableBitrate = (bitrate: number | null) => {\n void PlayerModule.setMaxSelectableBitrate(this.nativeId, bitrate || -1);\n };\n\n /**\n * @returns a {@link Thumbnail} for the specified playback time for the currently active source if available.\n * Supported thumbnail formats are:\n * - `WebVtt` configured via {@link SourceConfig.thumbnailTrack}, on all supported platforms\n * - HLS `Image Media Playlist` in the multivariant playlist, Android-only\n * - DASH `Image Adaptation Set` as specified in DASH-IF IOP, Android-only\n * If a `WebVtt` thumbnail track is provided, any potential in-manifest thumbnails are ignored on Android.\n *\n * @param time - The time in seconds for which to retrieve the thumbnail.\n */\n getThumbnail = async (time: number): Promise<Thumbnail | null> => {\n return PlayerModule.getThumbnail(this.nativeId, time);\n };\n\n /**\n * Whether casting to a cast-compatible remote device is available. {@link CastAvailableEvent} signals when\n * casting becomes available.\n *\n * @platform iOS, Android\n */\n isCastAvailable = async (): Promise<boolean> => {\n return (await PlayerModule.isCastAvailable(this.nativeId)) ?? false;\n };\n\n /**\n * Whether video is currently being casted to a remote device and not played locally.\n *\n * @platform iOS, Android\n */\n isCasting = async (): Promise<boolean> => {\n return (await PlayerModule.isCasting(this.nativeId)) ?? false;\n };\n\n /**\n * Initiates casting the current video to a cast-compatible remote device. The user has to choose to which device it\n * should be sent.\n *\n * @platform iOS, Android\n */\n castVideo = () => {\n void PlayerModule.castVideo(this.nativeId);\n };\n\n /**\n * Stops casting the current video. Has no effect if {@link Player.isCasting} is `false`.\n *\n * @platform iOS, Android\n */\n castStop = () => {\n void PlayerModule.castStop(this.nativeId);\n };\n\n /**\n * Returns the currently selected video quality.\n * @returns The currently selected video quality.\n */\n getVideoQuality = async (): Promise<VideoQuality> => {\n return PlayerModule.getVideoQuality(this.nativeId);\n };\n\n /**\n * Returns an array containing all available video qualities the player can adapt between.\n * @returns An array containing all available video qualities the player can adapt between.\n */\n getAvailableVideoQualities = async (): Promise<VideoQuality[]> => {\n return PlayerModule.getAvailableVideoQualities(this.nativeId);\n };\n\n /**\n * Sets the video quality.\n * @platform Android\n *\n * @param qualityId value obtained from {@link VideoQuality}'s `id` property, which can be obtained via `Player.getAvailableVideoQualities()` to select a specific quality. To use automatic quality selection, 'auto' can be passed here.\n */\n setVideoQuality = (qualityId: string) => {\n if (Platform.OS !== 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method setVideoQuality is not available for iOS and tvOS devices. Only Android devices.`\n );\n return;\n }\n void PlayerModule.setVideoQuality(this.nativeId, qualityId);\n };\n\n /**\n * Sets the playback speed of the player. Fast forward, slow motion and reverse playback are supported.\n * @remarks\n * Platform: iOS, tvOS\n *\n * - Slow motion is indicated by values between `0` and `1`.\n * - Fast forward by values greater than `1`.\n * - Slow reverse is used by values between `0` and `-1`, and fast reverse is used by values less than `-1`. iOS and tvOS only.\n * - Negative values are ignored during Casting and on Android.\n * - During reverse playback the playback will continue until the beginning of the active source is\n * reached. When reaching the beginning of the source, playback will be paused and the playback\n * speed will be reset to its default value of `1`. No {@link PlaybackFinishedEvent} will be\n * emitted in this case.\n *\n * @param playbackSpeed - The playback speed to set.\n */\n setPlaybackSpeed = (playbackSpeed: number) => {\n void PlayerModule.setPlaybackSpeed(this.nativeId, playbackSpeed);\n };\n\n /**\n * @see {@link setPlaybackSpeed} for details on which values playback speed can assume.\n * @returns The player's current playback speed.\n */\n getPlaybackSpeed = async (): Promise<number> => {\n return (await PlayerModule.getPlaybackSpeed(this.nativeId)) ?? 0;\n };\n\n /**\n * Checks the possibility to play the media at specified playback speed.\n * @param playbackSpeed - The playback speed to check.\n * @returns `true` if it's possible to play the media at the specified playback speed, otherwise `false`. On Android it always returns `undefined`.\n * @platform iOS, tvOS\n */\n canPlayAtPlaybackSpeed = async (\n playbackSpeed: number\n ): Promise<boolean | undefined> => {\n if (Platform.OS === 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method canPlayAtPlaybackSpeed is not available for Android. Only iOS and tvOS devices.`\n );\n return undefined;\n }\n return (\n (await PlayerModule.canPlayAtPlaybackSpeed(\n this.nativeId,\n playbackSpeed\n )) ?? false\n );\n };\n\n private maybeInitDecoderConfig = () => {\n if (this.config?.playbackConfig?.decoderConfig == null) {\n return;\n }\n if (Platform.OS === 'ios') {\n return;\n }\n\n this.decoderConfig = new DecoderConfigBridge(\n this.config.playbackConfig.decoderConfig\n );\n this.decoderConfig.initialize();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"player.js","sourceRoot":"","sources":["../src/player.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAClD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAgB,MAAM,UAAU,CAAC;AAKhD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM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AAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC9D,CAAC,CAAC;IAEF;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,GAAG,CAAC,aAAqB,EAAE,EAAE;QAC3C,KAAK,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF;;;OAGG;IACH,gBAAgB,GAAG,KAAK,IAAqB,EAAE;QAC7C,OAAO,CAAC,MAAM,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF;;;;;OAKG;IACH,sBAAsB,GAAG,KAAK,EAC5B,aAAqB,EACS,EAAE;QAChC,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,CAAC,IAAI,CACV,WAAW,IAAI,CAAC,QAAQ,0FAA0F,CACnH,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,CACL,CAAC,MAAM,YAAY,CAAC,sBAAsB,CACxC,IAAI,CAAC,QAAQ,EACb,aAAa,CACd,CAAC,IAAI,KAAK,CACZ,CAAC;IACJ,CAAC,CAAC;IAEM,sBAAsB,GAAG,GAAG,EAAE;QACpC,IAAI,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,aAAa,IAAI,IAAI,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAC1C,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,aAAa,CACzC,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport { Platform } from 'react-native';\nimport PlayerModule from './modules/PlayerModule';\nimport NativeInstance from './nativeInstance';\nimport { Source, SourceConfig } from './source';\nimport { AudioTrack } from './audioTrack';\nimport { SubtitleTrack } from './subtitleTrack';\nimport { OfflineContentManager, OfflineSourceOptions } from './offline';\nimport { Thumbnail } from './thumbnail';\nimport { AnalyticsApi } from './analytics/player';\nimport { PlayerConfig } from './playerConfig';\nimport { AdBreak, AdItem, ImaSettings } from './advertising';\nimport { BufferApi } from './bufferApi';\nimport { VideoQuality } from './media';\nimport { Network } from './network';\nimport { DecoderConfigBridge } from './decoder';\n\n/**\n * Loads, controls and renders audio and video content represented through {@link Source}s. A player\n * instance can be created via the {@link usePlayer} hook and will idle until one or more {@link Source}s are\n * loaded. Once {@link Player.load} or {@link Player.loadSource} is called, the player becomes active and initiates necessary downloads to\n * start playback of the loaded source(s).\n *\n * Can be attached to {@link PlayerView} component in order to use Bitmovin's Player Web UI.\n * @see PlayerView\n */\nexport class Player extends NativeInstance<PlayerConfig> {\n /**\n * Whether the native `Player` object has been created.\n */\n isInitialized = false;\n /**\n * Whether the native `Player` object has been disposed.\n */\n isDestroyed = false;\n /**\n * Currently active source, or `null` if none is active.\n */\n source?: Source;\n /**\n * The `AnalyticsApi` for interactions regarding the `Player`'s analytics.\n *\n * `undefined` if the player was created without analytics support.\n */\n analytics?: AnalyticsApi = undefined;\n /**\n * The {@link BufferApi} for interactions regarding the buffer.\n */\n buffer: BufferApi = new BufferApi(this.nativeId);\n\n private network?: Network;\n\n private decoderConfig?: DecoderConfigBridge;\n private onShouldLoadAdItemSubscription?: EventSubscription;\n private onShouldPlayAdBreakSubscription?: EventSubscription;\n private onImaBeforeInitializationSubscription?: EventSubscription;\n /**\n * Allocates the native `Player` instance and its resources natively.\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized) {\n this.ensureShouldLoadAdItemListener();\n this.ensureShouldPlayAdBreakListener();\n this.ensureImaBeforeInitializationListener();\n if (this.config?.networkConfig) {\n this.network = new Network(this.config.networkConfig);\n await this.network.initialize();\n }\n await this.maybeInitDecoderConfig();\n const analyticsConfig = this.config?.analyticsConfig;\n if (analyticsConfig) {\n await PlayerModule.initializeWithAnalyticsConfig(\n this.nativeId,\n analyticsConfig,\n this.config,\n this.network?.nativeId,\n this.decoderConfig?.nativeId\n );\n this.analytics = new AnalyticsApi(this.nativeId);\n } else {\n await PlayerModule.initializeWithConfig(\n this.nativeId,\n this.config,\n this.network?.nativeId,\n this.decoderConfig?.nativeId\n );\n }\n\n this.isInitialized = true;\n }\n return Promise.resolve();\n };\n\n /**\n * Destroys the native `Player` and releases all of its allocated resources.\n */\n destroy = () => {\n if (!this.isDestroyed) {\n void PlayerModule.destroy(this.nativeId);\n void this.source?.destroy();\n void this.network?.destroy();\n void this.decoderConfig?.destroy();\n this.onShouldLoadAdItemSubscription?.remove();\n this.onShouldPlayAdBreakSubscription?.remove();\n this.onImaBeforeInitializationSubscription?.remove();\n this.onShouldLoadAdItemSubscription = undefined;\n this.onShouldPlayAdBreakSubscription = undefined;\n this.onImaBeforeInitializationSubscription = undefined;\n this.isDestroyed = true;\n }\n };\n\n private ensureShouldLoadAdItemListener = () => {\n const callback = this.config?.advertisingConfig?.shouldLoadAdItem;\n if (!callback) {\n return;\n }\n if (this.onShouldLoadAdItemSubscription) {\n return;\n }\n this.onShouldLoadAdItemSubscription = PlayerModule.addListener(\n 'onShouldLoadAdItem',\n ({ nativeId, id, adItem }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n const cloned: AdItem = {\n ...adItem,\n sources: adItem.sources.map((source) => ({ ...source })),\n };\n let shouldLoad = true;\n try {\n const shouldLoadResult = callback(cloned);\n shouldLoad =\n typeof shouldLoadResult === 'boolean' ? shouldLoadResult : true;\n } catch {\n shouldLoad = true;\n }\n void PlayerModule.setShouldLoadAdItem(id, shouldLoad);\n }\n );\n };\n\n /**\n * Loads a new {@link Source} from `sourceConfig` into the player.\n */\n load = (sourceConfig: SourceConfig) => {\n this.loadSource(new Source(sourceConfig));\n };\n\n /**\n * Loads the downloaded content from {@link OfflineContentManager} into the player.\n */\n loadOfflineContent = (\n offlineContentManager: OfflineContentManager,\n options?: OfflineSourceOptions\n ) => {\n void PlayerModule.loadOfflineContent(\n this.nativeId,\n offlineContentManager.nativeId,\n options\n );\n };\n\n /**\n * Loads the given {@link Source} into the player.\n */\n loadSource = (source: Source) => {\n this.source = source;\n void source\n .initialize()\n .then(() => PlayerModule.loadSource(this.nativeId, source.nativeId));\n };\n\n /**\n * Unloads all {@link Source}s from the player.\n */\n unload = () => {\n void PlayerModule.unload(this.nativeId);\n };\n\n /**\n * Starts or resumes playback after being paused. Has no effect if the player is already playing.\n */\n play = () => {\n void PlayerModule.play(this.nativeId);\n };\n\n /**\n * Pauses the video if it is playing. Has no effect if the player is already paused.\n */\n pause = () => {\n void PlayerModule.pause(this.nativeId);\n };\n\n /**\n * Seeks to the given playback time specified by the parameter `time` in seconds. Must not be\n * greater than the total duration of the video. Has no effect when watching a live stream since\n * seeking is not possible.\n *\n * @param time - The time to seek to in seconds.\n */\n seek = (time: number) => {\n void PlayerModule.seek(this.nativeId, time);\n };\n\n /**\n * Shifts the time to the given `offset` in seconds from the live edge. The resulting offset has to be within the\n * timeShift window as specified by `maxTimeShift` (which is a negative value) and 0. When the provided `offset` is\n * positive, it will be interpreted as a UNIX timestamp in seconds and converted to fit into the timeShift window.\n * When the provided `offset` is negative, but lower than `maxTimeShift`, then it will be clamped to `maxTimeShift`.\n * Has no effect for VoD.\n *\n * Has no effect if no sources are loaded.\n *\n * @param offset - Target offset from the live edge in seconds.\n */\n timeShift = (offset: number) => {\n void PlayerModule.timeShift(this.nativeId, offset);\n };\n\n /**\n * Mutes the player if an audio track is available. Has no effect if the player is already muted.\n */\n mute = () => {\n void PlayerModule.mute(this.nativeId);\n };\n\n /**\n * Unmutes the player if it is muted. Has no effect if the player is already unmuted.\n */\n unmute = () => {\n void PlayerModule.unmute(this.nativeId);\n };\n\n /**\n * Sets the player's volume between 0 (silent) and 100 (max volume).\n *\n * @param volume - The volume level to set.\n */\n setVolume = (volume: number) => {\n void PlayerModule.setVolume(this.nativeId, volume);\n };\n\n private ensureShouldPlayAdBreakListener = () => {\n if (Platform.OS !== 'android') {\n return;\n }\n const callback = this.config?.advertisingConfig?.shouldPlayAdBreak;\n if (!callback) {\n return;\n }\n if (this.onShouldPlayAdBreakSubscription) {\n return;\n }\n this.onShouldPlayAdBreakSubscription = PlayerModule.addListener(\n 'onShouldPlayAdBreak',\n ({ nativeId, id, adBreak }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n const cloned: AdBreak = {\n ...adBreak,\n ads: adBreak.ads.map((ad) => ({\n ...ad,\n data: ad.data ? { ...ad.data } : undefined,\n })),\n };\n let shouldPlay = true;\n try {\n const shouldPlayResult = callback(cloned);\n shouldPlay =\n typeof shouldPlayResult === 'boolean' ? shouldPlayResult : true;\n } catch {\n shouldPlay = true;\n }\n void PlayerModule.setShouldPlayAdBreak(id, shouldPlay);\n }\n );\n };\n\n private ensureImaBeforeInitializationListener = () => {\n const callback = this.config?.advertisingConfig?.ima?.beforeInitialization;\n if (!callback) {\n return;\n }\n if (this.onImaBeforeInitializationSubscription) {\n return;\n }\n this.onImaBeforeInitializationSubscription = PlayerModule.addListener(\n 'onImaBeforeInitialization',\n ({ nativeId, id, settings }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n const cloned: ImaSettings = { ...settings };\n let prepared = cloned;\n try {\n const result = callback(cloned);\n prepared =\n result && typeof result === 'object'\n ? { ...cloned, ...result }\n : cloned;\n } catch {\n prepared = cloned;\n }\n void PlayerModule.setPreparedImaSettings(id, prepared);\n }\n );\n };\n\n /**\n * @returns The player's current volume level.\n */\n getVolume = async (): Promise<number> => {\n return (await PlayerModule.getVolume(this.nativeId)) ?? 0;\n };\n\n /**\n * @returns The current playback time in seconds.\n *\n * For VoD streams the returned time ranges between 0 and the duration of the asset.\n *\n * For live streams it can be specified if an absolute UNIX timestamp or a value\n * relative to the playback start should be returned.\n *\n * @param mode - The time mode to specify: an absolute UNIX timestamp ('absolute') or relative time ('relative').\n */\n getCurrentTime = async (\n mode: 'relative' | 'absolute' = 'absolute'\n ): Promise<number> => {\n return (await PlayerModule.currentTime(this.nativeId, mode)) ?? 0;\n };\n\n /**\n * @returns The total duration in seconds of the current video or INFINITY if it’s a live stream.\n */\n getDuration = async (): Promise<number> => {\n return (await PlayerModule.duration(this.nativeId)) ?? 0;\n };\n\n /**\n * @returns `true` if the player is muted.\n */\n isMuted = async (): Promise<boolean> => {\n return (await PlayerModule.isMuted(this.nativeId)) ?? false;\n };\n\n /**\n * @returns `true` if the player is currently playing, i.e. has started and is not paused.\n */\n isPlaying = async (): Promise<boolean> => {\n return (await PlayerModule.isPlaying(this.nativeId)) ?? false;\n };\n\n /**\n * @returns `true` if the player has started playback but it's currently paused.\n */\n isPaused = async (): Promise<boolean> => {\n return (await PlayerModule.isPaused(this.nativeId)) ?? false;\n };\n\n /**\n * @returns `true` if the displayed video is a live stream.\n */\n isLive = async (): Promise<boolean> => {\n return (await PlayerModule.isLive(this.nativeId)) ?? false;\n };\n\n /**\n * @platform iOS\n * @returns `true` when media is played externally using AirPlay.\n */\n isAirPlayActive = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method isAirPlayActive is not available for Android. Only iOS devices.`\n );\n return false;\n }\n return (await PlayerModule.isAirPlayActive(this.nativeId)) ?? false;\n };\n\n /**\n * @platform iOS\n * @returns `true` when AirPlay is available.\n */\n isAirPlayAvailable = async (): Promise<boolean> => {\n if (Platform.OS === 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method isAirPlayAvailable is not available for Android. Only iOS devices.`\n );\n return false;\n }\n return (await PlayerModule.isAirPlayAvailable(this.nativeId)) ?? false;\n };\n\n /**\n * @returns The currently selected audio track or `null`.\n */\n getAudioTrack = async (): Promise<AudioTrack | null> => {\n return PlayerModule.getAudioTrack(this.nativeId);\n };\n\n /**\n * @returns An array containing {@link AudioTrack} objects for all available audio tracks.\n */\n getAvailableAudioTracks = async (): Promise<AudioTrack[]> => {\n return PlayerModule.getAvailableAudioTracks(this.nativeId);\n };\n\n /**\n * Sets the audio track to the ID specified by trackIdentifier. A list can be retrieved by calling getAvailableAudioTracks.\n *\n * @param trackIdentifier - The {@link AudioTrack.identifier} to be set.\n */\n setAudioTrack = async (trackIdentifier: string): Promise<void> => {\n return PlayerModule.setAudioTrack(this.nativeId, trackIdentifier);\n };\n\n /**\n * @returns The currently selected {@link SubtitleTrack} or `null`.\n */\n getSubtitleTrack = async (): Promise<SubtitleTrack | null> => {\n return PlayerModule.getSubtitleTrack(this.nativeId);\n };\n\n /**\n * @returns An array containing SubtitleTrack objects for all available subtitle tracks.\n */\n getAvailableSubtitles = async (): Promise<SubtitleTrack[]> => {\n return PlayerModule.getAvailableSubtitles(this.nativeId);\n };\n\n /**\n * Sets the subtitle track to the ID specified by trackIdentifier. A list can be retrieved by calling getAvailableSubtitles.\n * Pass `undefined` to disable subtitles.\n *\n * @param trackIdentifier - The {@link SubtitleTrack.identifier} to be set.\n */\n setSubtitleTrack = async (\n trackIdentifier: string | undefined\n ): Promise<void> => {\n return PlayerModule.setSubtitleTrack(\n this.nativeId,\n trackIdentifier ?? null\n );\n };\n\n /**\n * Dynamically schedules the {@link AdItem} for playback.\n * Has no effect if there is no active playback session.\n *\n * @param adItem - Ad to be scheduled for playback.\n *\n * @platform iOS, Android\n */\n scheduleAd = (adItem: AdItem) => {\n void PlayerModule.scheduleAd(this.nativeId, adItem);\n };\n\n /**\n * Skips the current ad.\n * Has no effect if the current ad is not skippable or if no ad is being played back.\n *\n * @platform iOS, Android\n */\n skipAd = () => {\n void PlayerModule.skipAd(this.nativeId);\n };\n\n /**\n * @returns `true` while an ad is being played back or when main content playback has been paused for ad playback.\n * @platform iOS, Android\n */\n isAd = async (): Promise<boolean> => {\n return (await PlayerModule.isAd(this.nativeId)) ?? false;\n };\n\n /**\n * The current time shift of the live stream in seconds. This value is always 0 if the active {@link Source} is not a\n * live stream or no sources are loaded.\n */\n getTimeShift = async (): Promise<number> => {\n return (await PlayerModule.getTimeShift(this.nativeId)) ?? 0;\n };\n\n /**\n * The limit in seconds for time shifting. This value is either negative or 0 and it is always 0 if the active\n * {@link Source} is not a live stream or no sources are loaded.\n */\n getMaxTimeShift = async (): Promise<number> => {\n return (await PlayerModule.getMaxTimeShift(this.nativeId)) ?? 0;\n };\n\n /**\n * Sets the upper bitrate boundary for video qualities. All qualities with a bitrate\n * that is higher than this threshold will not be eligible for automatic quality selection.\n *\n * Can be set to `null` for no limitation.\n */\n setMaxSelectableBitrate = (bitrate: number | null) => {\n void PlayerModule.setMaxSelectableBitrate(this.nativeId, bitrate || -1);\n };\n\n /**\n * @returns a {@link Thumbnail} for the specified playback time for the currently active source if available.\n * Supported thumbnail formats are:\n * - `WebVtt` configured via {@link SourceConfig.thumbnailTrack}, on all supported platforms\n * - HLS `Image Media Playlist` in the multivariant playlist, Android-only\n * - DASH `Image Adaptation Set` as specified in DASH-IF IOP, Android-only\n * If a `WebVtt` thumbnail track is provided, any potential in-manifest thumbnails are ignored on Android.\n *\n * @param time - The time in seconds for which to retrieve the thumbnail.\n */\n getThumbnail = async (time: number): Promise<Thumbnail | null> => {\n return PlayerModule.getThumbnail(this.nativeId, time);\n };\n\n /**\n * Whether casting to a cast-compatible remote device is available. {@link CastAvailableEvent} signals when\n * casting becomes available.\n *\n * @platform iOS, Android\n */\n isCastAvailable = async (): Promise<boolean> => {\n return (await PlayerModule.isCastAvailable(this.nativeId)) ?? false;\n };\n\n /**\n * Whether video is currently being casted to a remote device and not played locally.\n *\n * @platform iOS, Android\n */\n isCasting = async (): Promise<boolean> => {\n return (await PlayerModule.isCasting(this.nativeId)) ?? false;\n };\n\n /**\n * Initiates casting the current video to a cast-compatible remote device. The user has to choose to which device it\n * should be sent.\n *\n * @platform iOS, Android\n */\n castVideo = () => {\n void PlayerModule.castVideo(this.nativeId);\n };\n\n /**\n * Stops casting the current video. Has no effect if {@link Player.isCasting} is `false`.\n *\n * @platform iOS, Android\n */\n castStop = () => {\n void PlayerModule.castStop(this.nativeId);\n };\n\n /**\n * Returns the currently selected video quality.\n * @returns The currently selected video quality.\n */\n getVideoQuality = async (): Promise<VideoQuality> => {\n return PlayerModule.getVideoQuality(this.nativeId);\n };\n\n /**\n * Returns an array containing all available video qualities the player can adapt between.\n * @returns An array containing all available video qualities the player can adapt between.\n */\n getAvailableVideoQualities = async (): Promise<VideoQuality[]> => {\n return PlayerModule.getAvailableVideoQualities(this.nativeId);\n };\n\n /**\n * Sets the video quality.\n * @platform Android\n *\n * @param qualityId value obtained from {@link VideoQuality}'s `id` property, which can be obtained via `Player.getAvailableVideoQualities()` to select a specific quality. To use automatic quality selection, 'auto' can be passed here.\n */\n setVideoQuality = (qualityId: string) => {\n if (Platform.OS !== 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method setVideoQuality is not available for iOS and tvOS devices. Only Android devices.`\n );\n return;\n }\n void PlayerModule.setVideoQuality(this.nativeId, qualityId);\n };\n\n /**\n * Sets the playback speed of the player. Fast forward, slow motion and reverse playback are supported.\n * @remarks\n * Platform: iOS, tvOS\n *\n * - Slow motion is indicated by values between `0` and `1`.\n * - Fast forward by values greater than `1`.\n * - Slow reverse is used by values between `0` and `-1`, and fast reverse is used by values less than `-1`. iOS and tvOS only.\n * - Negative values are ignored during Casting and on Android.\n * - During reverse playback the playback will continue until the beginning of the active source is\n * reached. When reaching the beginning of the source, playback will be paused and the playback\n * speed will be reset to its default value of `1`. No {@link PlaybackFinishedEvent} will be\n * emitted in this case.\n *\n * @param playbackSpeed - The playback speed to set.\n */\n setPlaybackSpeed = (playbackSpeed: number) => {\n void PlayerModule.setPlaybackSpeed(this.nativeId, playbackSpeed);\n };\n\n /**\n * @see {@link setPlaybackSpeed} for details on which values playback speed can assume.\n * @returns The player's current playback speed.\n */\n getPlaybackSpeed = async (): Promise<number> => {\n return (await PlayerModule.getPlaybackSpeed(this.nativeId)) ?? 0;\n };\n\n /**\n * Checks the possibility to play the media at specified playback speed.\n * @param playbackSpeed - The playback speed to check.\n * @returns `true` if it's possible to play the media at the specified playback speed, otherwise `false`. On Android it always returns `undefined`.\n * @platform iOS, tvOS\n */\n canPlayAtPlaybackSpeed = async (\n playbackSpeed: number\n ): Promise<boolean | undefined> => {\n if (Platform.OS === 'android') {\n console.warn(\n `[Player ${this.nativeId}] Method canPlayAtPlaybackSpeed is not available for Android. Only iOS and tvOS devices.`\n );\n return undefined;\n }\n return (\n (await PlayerModule.canPlayAtPlaybackSpeed(\n this.nativeId,\n playbackSpeed\n )) ?? false\n );\n };\n\n private maybeInitDecoderConfig = () => {\n if (this.config?.playbackConfig?.decoderConfig == null) {\n return;\n }\n if (Platform.OS === 'ios') {\n return;\n }\n\n this.decoderConfig = new DecoderConfigBridge(\n this.config.playbackConfig.decoderConfig\n );\n this.decoderConfig.initialize();\n };\n}\n"]}
|
|
@@ -28,7 +28,7 @@ Pod::Spec.new do |s|
|
|
|
28
28
|
s.static_framework = true
|
|
29
29
|
|
|
30
30
|
s.dependency 'ExpoModulesCore'
|
|
31
|
-
s.dependency "BitmovinPlayer", "3.
|
|
31
|
+
s.dependency "BitmovinPlayer", "3.113.0"
|
|
32
32
|
s.ios.dependency "GoogleAds-IMA-iOS-SDK", "3.26.1"
|
|
33
33
|
s.tvos.dependency "GoogleAds-IMA-tvOS-SDK", "4.15.1"
|
|
34
34
|
|
package/package.json
CHANGED
package/src/advertising.ts
CHANGED
|
@@ -113,6 +113,26 @@ export interface AdvertisingConfig {
|
|
|
113
113
|
* - `false` → the ad item will be skipped and removed from the playback schedule.
|
|
114
114
|
*/
|
|
115
115
|
shouldLoadAdItem?: (adItem: AdItem) => boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Called right before a scheduled ad break starts playback.
|
|
118
|
+
*
|
|
119
|
+
* Use this callback to conditionally allow or skip ad breaks at runtime
|
|
120
|
+
* (e.g., when starting playback from a time offset and discarding past breaks).
|
|
121
|
+
*
|
|
122
|
+
* @param adBreak - The ad break that is about to start.
|
|
123
|
+
*
|
|
124
|
+
* @returns
|
|
125
|
+
* - `true` → the ad break will start playback.
|
|
126
|
+
* - `false` → the ad break will be skipped.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* If the callback does not return within the platform's internal timeout,
|
|
130
|
+
* the ad break will play.
|
|
131
|
+
* The callback must be synchronous.
|
|
132
|
+
*
|
|
133
|
+
* @platform Android
|
|
134
|
+
*/
|
|
135
|
+
shouldPlayAdBreak?: (adBreak: AdBreak) => boolean;
|
|
116
136
|
/**
|
|
117
137
|
* Configuration to customize Google IMA SDK integration.
|
|
118
138
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NativeModule, requireNativeModule } from 'expo-modules-core';
|
|
2
|
-
import { AdItem, ImaSettings } from '../advertising';
|
|
2
|
+
import { AdBreak, AdItem, ImaSettings } from '../advertising';
|
|
3
3
|
|
|
4
4
|
export type PlayerModuleEvents = {
|
|
5
5
|
onShouldLoadAdItem: ({
|
|
@@ -11,6 +11,15 @@ export type PlayerModuleEvents = {
|
|
|
11
11
|
id: number;
|
|
12
12
|
adItem: AdItem;
|
|
13
13
|
}) => void;
|
|
14
|
+
onShouldPlayAdBreak: ({
|
|
15
|
+
nativeId,
|
|
16
|
+
id,
|
|
17
|
+
adBreak,
|
|
18
|
+
}: {
|
|
19
|
+
nativeId: string;
|
|
20
|
+
id: number;
|
|
21
|
+
adBreak: AdBreak;
|
|
22
|
+
}) => void;
|
|
14
23
|
onImaBeforeInitialization: ({
|
|
15
24
|
nativeId,
|
|
16
25
|
id,
|
|
@@ -173,6 +182,11 @@ declare class PlayerModule extends NativeModule<PlayerModuleEvents> {
|
|
|
173
182
|
*/
|
|
174
183
|
setShouldLoadAdItem(id: number, shouldLoad: boolean): Promise<void>;
|
|
175
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Applies the JS decision for an ad break playback callback.
|
|
187
|
+
*/
|
|
188
|
+
setShouldPlayAdBreak(id: number, shouldPlay: boolean): Promise<void>;
|
|
189
|
+
|
|
176
190
|
/**
|
|
177
191
|
* Applies the JS-updated IMA settings for a before-initialization callback.
|
|
178
192
|
*/
|
package/src/player.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { OfflineContentManager, OfflineSourceOptions } from './offline';
|
|
|
9
9
|
import { Thumbnail } from './thumbnail';
|
|
10
10
|
import { AnalyticsApi } from './analytics/player';
|
|
11
11
|
import { PlayerConfig } from './playerConfig';
|
|
12
|
-
import { AdItem, ImaSettings } from './advertising';
|
|
12
|
+
import { AdBreak, AdItem, ImaSettings } from './advertising';
|
|
13
13
|
import { BufferApi } from './bufferApi';
|
|
14
14
|
import { VideoQuality } from './media';
|
|
15
15
|
import { Network } from './network';
|
|
@@ -52,6 +52,7 @@ export class Player extends NativeInstance<PlayerConfig> {
|
|
|
52
52
|
|
|
53
53
|
private decoderConfig?: DecoderConfigBridge;
|
|
54
54
|
private onShouldLoadAdItemSubscription?: EventSubscription;
|
|
55
|
+
private onShouldPlayAdBreakSubscription?: EventSubscription;
|
|
55
56
|
private onImaBeforeInitializationSubscription?: EventSubscription;
|
|
56
57
|
/**
|
|
57
58
|
* Allocates the native `Player` instance and its resources natively.
|
|
@@ -59,6 +60,7 @@ export class Player extends NativeInstance<PlayerConfig> {
|
|
|
59
60
|
initialize = async (): Promise<void> => {
|
|
60
61
|
if (!this.isInitialized) {
|
|
61
62
|
this.ensureShouldLoadAdItemListener();
|
|
63
|
+
this.ensureShouldPlayAdBreakListener();
|
|
62
64
|
this.ensureImaBeforeInitializationListener();
|
|
63
65
|
if (this.config?.networkConfig) {
|
|
64
66
|
this.network = new Network(this.config.networkConfig);
|
|
@@ -99,8 +101,10 @@ export class Player extends NativeInstance<PlayerConfig> {
|
|
|
99
101
|
void this.network?.destroy();
|
|
100
102
|
void this.decoderConfig?.destroy();
|
|
101
103
|
this.onShouldLoadAdItemSubscription?.remove();
|
|
104
|
+
this.onShouldPlayAdBreakSubscription?.remove();
|
|
102
105
|
this.onImaBeforeInitializationSubscription?.remove();
|
|
103
106
|
this.onShouldLoadAdItemSubscription = undefined;
|
|
107
|
+
this.onShouldPlayAdBreakSubscription = undefined;
|
|
104
108
|
this.onImaBeforeInitializationSubscription = undefined;
|
|
105
109
|
this.isDestroyed = true;
|
|
106
110
|
}
|
|
@@ -238,6 +242,43 @@ export class Player extends NativeInstance<PlayerConfig> {
|
|
|
238
242
|
void PlayerModule.setVolume(this.nativeId, volume);
|
|
239
243
|
};
|
|
240
244
|
|
|
245
|
+
private ensureShouldPlayAdBreakListener = () => {
|
|
246
|
+
if (Platform.OS !== 'android') {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const callback = this.config?.advertisingConfig?.shouldPlayAdBreak;
|
|
250
|
+
if (!callback) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (this.onShouldPlayAdBreakSubscription) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
this.onShouldPlayAdBreakSubscription = PlayerModule.addListener(
|
|
257
|
+
'onShouldPlayAdBreak',
|
|
258
|
+
({ nativeId, id, adBreak }) => {
|
|
259
|
+
if (nativeId !== this.nativeId) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const cloned: AdBreak = {
|
|
263
|
+
...adBreak,
|
|
264
|
+
ads: adBreak.ads.map((ad) => ({
|
|
265
|
+
...ad,
|
|
266
|
+
data: ad.data ? { ...ad.data } : undefined,
|
|
267
|
+
})),
|
|
268
|
+
};
|
|
269
|
+
let shouldPlay = true;
|
|
270
|
+
try {
|
|
271
|
+
const shouldPlayResult = callback(cloned);
|
|
272
|
+
shouldPlay =
|
|
273
|
+
typeof shouldPlayResult === 'boolean' ? shouldPlayResult : true;
|
|
274
|
+
} catch {
|
|
275
|
+
shouldPlay = true;
|
|
276
|
+
}
|
|
277
|
+
void PlayerModule.setShouldPlayAdBreak(id, shouldPlay);
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
|
|
241
282
|
private ensureImaBeforeInitializationListener = () => {
|
|
242
283
|
const callback = this.config?.advertisingConfig?.ima?.beforeInitialization;
|
|
243
284
|
if (!callback) {
|