bitmovin-player-react-native 1.17.0 → 1.18.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 CHANGED
@@ -1,15 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.18.0] - 2026-05-01
4
+
5
+ ### Added
6
+
7
+ - `AdvertisingConfig.shouldLoadAdItem` callback to filter ad items before they are loaded
8
+ - iOS: `PictureInPictureConfig.shouldExitOnForeground` to automatically exit PiP mode when the app transitions to the foreground
9
+
10
+ ### Changed
11
+
12
+ - Update Bitmovin's native Android SDK version to `3.151.0+jason`
13
+ - Update Bitmovin's native iOS SDK version to `3.112.0`
14
+ - Android: Kotlin version to `2.2.20`
15
+ - Update Expo SDK version to `54.0.34`
16
+
3
17
  ## [1.17.0] - 2026-04-17
4
18
 
5
19
  ### Changed
6
20
 
7
21
  - Update Bitmovin's native Android SDK version to `3.149.0+jason`
8
22
  - Update Expo SDK version to `54.0.33` and React Native version to `0.81.5`
9
- - Minimum supported Expo SDK version is now `54`
10
- - Minimum supported React Native version is now `0.81.5`
11
-
12
- ## [1.16.0] - 2026-04-10
23
+ - Minimum supported Expo SDK version is now `54`
24
+ - Minimum supported React Native version is now `0.81.5`
13
25
 
14
26
  ## [1.16.0] - 2026-04-10
15
27
 
@@ -17,10 +29,6 @@
17
29
 
18
30
  - Android: `PlayerView.isPictureInPictureEnabled` to enable or disable Picture in Picture availability dynamically after player initialization
19
31
 
20
- ### Fixed
21
-
22
- - Android: `OfflineDownloadRequest.minimumBitrate` not correctly parsed from React Native for offline rendition selection
23
-
24
32
  ### Changed
25
33
 
26
34
  - `DebugConfig.setDebugLoggingEnabled` now also controls JS-side debug logging; `console.log` calls in the `Network` and `Drm` modules are suppressed unless debug logging is enabled
@@ -28,6 +36,7 @@
28
36
 
29
37
  ### Fixed
30
38
 
39
+ - Android: `OfflineDownloadRequest.minimumBitrate` not correctly parsed from React Native for offline rendition selection
31
40
  - Android: Picture in Picture fragmented rendering when resizing the PiP window
32
41
 
33
42
  ## [1.15.0] - 2026-03-27
package/README.md CHANGED
@@ -14,7 +14,7 @@ This is an open-source project created to enable customers to integrate the Bitm
14
14
 
15
15
  ## Platform Support
16
16
 
17
- This library requires at least Expo 54+, React Native 0.79+ and React 17+ to work properly. The **officially supported** platforms are:
17
+ This library requires at least Expo 54+ and React Native 0.81.5+ to work properly, checkout our [Lifecycle policy](https://developer.bitmovin.com/playback/docs/lifecycle-policy#react-native-dependency-upgrade-and-compatibility-policy) for more details. The **officially supported** platforms are:
18
18
 
19
19
  - **iOS/iPadOS/tvOS:** 15.1+
20
20
  - **Android:** 7.0+
@@ -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.149.0+jason'
112
- implementation 'com.bitmovin.player:player-media-session:3.149.0+jason'
111
+ implementation 'com.bitmovin.player:player:3.151.0+jason'
112
+ implementation 'com.bitmovin.player:player-media-session:3.151.0+jason'
113
113
  }
@@ -1,6 +1,6 @@
1
1
  android.useAndroidX=true
2
2
  # Also update example/android/gradle.properties and integration_test/android/gradle.properties when updating kotlin version.
3
- BitmovinPlayerReactNative_kotlinVersion=1.9.21
3
+ BitmovinPlayerReactNative_kotlinVersion=2.2.20
4
4
  BitmovinPlayerReactNative_minSdkVersion=24
5
5
  BitmovinPlayerReactNative_targetSdkVersion=35
6
6
  BitmovinPlayerReactNative_compileSdkVersion=35
@@ -23,6 +23,7 @@ import expo.modules.kotlin.modules.ModuleDefinition
23
23
  class PlayerModule : Module() {
24
24
 
25
25
  val mediaSessionPlaybackManager by lazy { MediaSessionPlaybackManager(appContext) }
26
+ private val shouldLoadAdItemWaiter = ResultWaiter<Boolean>()
26
27
  private val imaSettingsWaiter = ResultWaiter<Map<String, Any?>>()
27
28
 
28
29
  override fun definition() = ModuleDefinition {
@@ -41,11 +42,12 @@ class PlayerModule : Module() {
41
42
  // Log but don't crash on cleanup
42
43
  }
43
44
  }
45
+ shouldLoadAdItemWaiter.clear()
44
46
  imaSettingsWaiter.clear()
45
47
  PlayerRegistry.clear()
46
48
  }
47
49
 
48
- Events("onImaBeforeInitialization")
50
+ Events("onShouldLoadAdItem", "onImaBeforeInitialization")
49
51
 
50
52
  AsyncFunction("play") { nativeId: NativeId ->
51
53
  val player = PlayerRegistry.getPlayer(nativeId)
@@ -279,6 +281,10 @@ class PlayerModule : Module() {
279
281
  imaSettingsWaiter.complete(id, settings ?: emptyMap())
280
282
  }
281
283
 
284
+ AsyncFunction("setShouldLoadAdItem") { id: Int, shouldLoad: Boolean ->
285
+ shouldLoadAdItemWaiter.complete(id, shouldLoad)
286
+ }
287
+
282
288
  AsyncFunction("initializeWithConfig") { nativeId: NativeId, config: Map<String, Any>?,
283
289
  networkNativeId: NativeId?, decoderNativeId: NativeId?, ->
284
290
  initializePlayer(nativeId, config, networkNativeId, decoderNativeId, null)
@@ -318,6 +324,7 @@ class PlayerModule : Module() {
318
324
  val playerConfig = config?.toPlayerConfig() ?: PlayerConfig()
319
325
  @Suppress("UNCHECKED_CAST")
320
326
  val configJson = config as? Map<String, Any?>
327
+ setupShouldLoadAdItem(nativeId, configJson, playerConfig)
321
328
  setupImaBeforeInitialization(nativeId, configJson, playerConfig)
322
329
  val enableMediaSession = config?.getMap("mediaControlConfig")
323
330
  ?.toMediaControlConfig()?.isEnabled ?: true
@@ -374,6 +381,32 @@ class PlayerModule : Module() {
374
381
  playerConfig.advertisingConfig = advertisingConfig.copy(ima = updatedIma)
375
382
  }
376
383
 
384
+ private fun setupShouldLoadAdItem(
385
+ nativeId: NativeId,
386
+ configJson: Map<String, Any?>?,
387
+ playerConfig: PlayerConfig,
388
+ ) {
389
+ val advertisingConfigJson = configJson?.getMap("advertisingConfig") ?: return
390
+ if (!advertisingConfigJson.containsKey("shouldLoadAdItem")) {
391
+ return
392
+ }
393
+ val advertisingConfig = playerConfig.advertisingConfig ?: AdvertisingConfig()
394
+ playerConfig.advertisingConfig = advertisingConfig.copy(
395
+ shouldLoadAdItem = { adItem ->
396
+ val (id, wait) = shouldLoadAdItemWaiter.make(250)
397
+ sendEvent(
398
+ "onShouldLoadAdItem",
399
+ bundleOf(
400
+ "nativeId" to nativeId,
401
+ "id" to id,
402
+ "adItem" to adItem.toJson(),
403
+ ),
404
+ )
405
+ wait() ?: true
406
+ },
407
+ )
408
+ }
409
+
377
410
  private fun createBeforeInitializationCallback(nativeId: NativeId): BeforeInitializationCallback =
378
411
  BeforeInitializationCallback { settings ->
379
412
  val (id, wait) = imaSettingsWaiter.make(250)
@@ -614,6 +614,7 @@ fun AdConfig.toJson(): Map<String, Any> = mapOf<String, Any?>(
614
614
  fun AdItem.toJson(): Map<String, Any> = mapOf(
615
615
  "position" to position,
616
616
  "sources" to sources.toList().map { it.toJson() },
617
+ "preloadOffset" to preloadOffset,
617
618
  )
618
619
 
619
620
  fun AdSource.toJson(): Map<String, Any> = mapOf(
@@ -95,6 +95,19 @@ export interface AdvertisingConfig {
95
95
  * The ad items that are scheduled when a new playback session is started via `Player.load()`.
96
96
  */
97
97
  schedule: AdItem[];
98
+ /**
99
+ * Called right before an ad item begins loading.
100
+ *
101
+ * Use this callback to conditionally allow or skip individual ad items
102
+ * based on runtime logic (e.g., user state, targeting rules, frequency caps).
103
+ *
104
+ * @param adItem - The ad item that is about to be loaded.
105
+ *
106
+ * @returns
107
+ * - `true` → the ad item will proceed to load as scheduled.
108
+ * - `false` → the ad item will be skipped and removed from the playback schedule.
109
+ */
110
+ shouldLoadAdItem?: (adItem: AdItem) => boolean;
98
111
  /**
99
112
  * Configuration to customize Google IMA SDK integration.
100
113
  */
@@ -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;;OA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;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,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,EAA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AE,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 +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 * 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 * 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"]}
@@ -20,5 +20,14 @@ export interface PictureInPictureConfig {
20
20
  * @platform iOS 14.2+, Android 8.0+
21
21
  */
22
22
  shouldEnterOnBackground?: boolean;
23
+ /**
24
+ * Defines whether Picture in Picture should exit automatically when the app transitions back to foreground.
25
+ *
26
+ * Does not have any effect when Picture in Picture is disabled.
27
+ *
28
+ * @defaultValue `false`
29
+ * @platform iOS
30
+ */
31
+ shouldExitOnForeground?: boolean;
23
32
  }
24
33
  //# sourceMappingURL=pictureInPictureConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pictureInPictureConfig.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/pictureInPictureConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC"}
1
+ {"version":3,"file":"pictureInPictureConfig.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/pictureInPictureConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"pictureInPictureConfig.js","sourceRoot":"","sources":["../../../src/components/PlayerView/pictureInPictureConfig.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Provides options to configure Picture in Picture playback.\n */\nexport interface PictureInPictureConfig {\n /**\n * Whether Picture in Picture feature is enabled or not.\n *\n * Default is `false`.\n */\n isEnabled?: boolean;\n\n /**\n * Defines whether Picture in Picture should start automatically when the app transitions to background.\n *\n * Does not have any affect when Picture in Picture is disabled.\n *\n * Default is `false`.\n *\n * On Android, this requests Picture in Picture as soon as the host activity is backgrounded.\n *\n * @platform iOS 14.2+, Android 8.0+\n */\n shouldEnterOnBackground?: boolean;\n}\n"]}
1
+ {"version":3,"file":"pictureInPictureConfig.js","sourceRoot":"","sources":["../../../src/components/PlayerView/pictureInPictureConfig.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Provides options to configure Picture in Picture playback.\n */\nexport interface PictureInPictureConfig {\n /**\n * Whether Picture in Picture feature is enabled or not.\n *\n * Default is `false`.\n */\n isEnabled?: boolean;\n\n /**\n * Defines whether Picture in Picture should start automatically when the app transitions to background.\n *\n * Does not have any affect when Picture in Picture is disabled.\n *\n * Default is `false`.\n *\n * On Android, this requests Picture in Picture as soon as the host activity is backgrounded.\n *\n * @platform iOS 14.2+, Android 8.0+\n */\n shouldEnterOnBackground?: boolean;\n\n /**\n * Defines whether Picture in Picture should exit automatically when the app transitions back to foreground.\n *\n * Does not have any effect when Picture in Picture is disabled.\n *\n * @defaultValue `false`\n * @platform iOS\n */\n shouldExitOnForeground?: boolean;\n}\n"]}
@@ -1,6 +1,11 @@
1
1
  import { NativeModule } from 'expo-modules-core';
2
- import { ImaSettings } from '../advertising';
2
+ import { AdItem, ImaSettings } from '../advertising';
3
3
  export type PlayerModuleEvents = {
4
+ onShouldLoadAdItem: ({ nativeId, id, adItem, }: {
5
+ nativeId: string;
6
+ id: number;
7
+ adItem: AdItem;
8
+ }) => void;
4
9
  onImaBeforeInitialization: ({ nativeId, id, settings, }: {
5
10
  nativeId: string;
6
11
  id: number;
@@ -124,6 +129,10 @@ declare class PlayerModule extends NativeModule<PlayerModuleEvents> {
124
129
  * Skip current ad for nativeId's player.
125
130
  */
126
131
  skipAd(nativeId: string): Promise<void>;
132
+ /**
133
+ * Applies the JS decision for an ad item load callback.
134
+ */
135
+ setShouldLoadAdItem(id: number, shouldLoad: boolean): Promise<void>;
127
136
  /**
128
137
  * Applies the JS-updated IMA settings for a before-initialization callback.
129
138
  */
@@ -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,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yBAAyB,EAAE,CAAC,EAC1B,QAAQ,EACR,EAAE,EACF,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,WAAW,CAAC;KACvB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF,OAAO,OAAO,YAAa,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IACjE;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErC;;OAEG;IACH,KAAK,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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;AA0QtE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport { ImaSettings } from '../advertising';\n\nexport type PlayerModuleEvents = {\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-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"]}
1
+ {"version":3,"file":"PlayerModule.js","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAwRtE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport { 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 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-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
@@ -43,6 +43,7 @@ export declare class Player extends NativeInstance<PlayerConfig> {
43
43
  buffer: BufferApi;
44
44
  private network?;
45
45
  private decoderConfig?;
46
+ private onShouldLoadAdItemSubscription?;
46
47
  private onImaBeforeInitializationSubscription?;
47
48
  /**
48
49
  * Allocates the native `Player` instance and its resources natively.
@@ -52,6 +53,7 @@ export declare class Player extends NativeInstance<PlayerConfig> {
52
53
  * Destroys the native `Player` and releases all of its allocated resources.
53
54
  */
54
55
  destroy: () => void;
56
+ private ensureShouldLoadAdItemListener;
55
57
  /**
56
58
  * Loads a new {@link Source} from `sourceConfig` into the player.
57
59
  */
@@ -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,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AACpD,OAAO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a,OAAO,CAAC,OAAO,CAAC,CAE/B;IAEF;;;OAGG;IACH,YAAY,QAAa,OAAO,CAAC,MAAM,CAAC,CAEtC;IAEF;;;OAGG;IACH,eAAe,QAAa,OAAO,CAAC,MAAM,CAAC,CAEzC;IAEF;;;;;OAKG;IACH,uBAAuB,GAAI,SAAS,MAAM,GAAG,IAAI,UAE/C;IAEF;;;;;;;;;OASG;IACH,YAAY,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAE5D;IAEF;;;;;OAKG;IACH,eAAe,QAAa,OAAO,CAAC,OAAO,CAAC,CAE1C;IAEF;;;;OAIG;IACH,SAAS,QAAa,OAAO,CAAC,OAAO,CAAC,CAEpC;IAEF;;;;;OAKG;IACH,SAAS,aAEP;IAEF;;;;OAIG;IACH,QAAQ,aAEN;IAEF;;;OAGG;IACH,eAAe,QAAa,OAAO,CAAC,YAAY,CAAC,CAE/C;IAEF;;;OAGG;IACH,0BAA0B,QAAa,OAAO,CAAC,YAAY,EAAE,CAAC,CAE5D;IAEF;;;;;OAKG;IACH,eAAe,GAAI,WAAW,MAAM,UAQlC;IAEF;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,GAAI,eAAe,MAAM,UAEvC;IAEF;;;OAGG;IACH,gBAAgB,QAAa,OAAO,CAAC,MAAM,CAAC,CAE1C;IAEF;;;;;OAKG;IACH,sBAAsB,GACpB,eAAe,MAAM,KACpB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAa7B;IAEF,OAAO,CAAC,sBAAsB,CAY5B;CACH"}
package/build/player.js CHANGED
@@ -40,12 +40,14 @@ export class Player extends NativeInstance {
40
40
  buffer = new BufferApi(this.nativeId);
41
41
  network;
42
42
  decoderConfig;
43
+ onShouldLoadAdItemSubscription;
43
44
  onImaBeforeInitializationSubscription;
44
45
  /**
45
46
  * Allocates the native `Player` instance and its resources natively.
46
47
  */
47
48
  initialize = async () => {
48
49
  if (!this.isInitialized) {
50
+ this.ensureShouldLoadAdItemListener();
49
51
  this.ensureImaBeforeInitializationListener();
50
52
  if (this.config?.networkConfig) {
51
53
  this.network = new Network(this.config.networkConfig);
@@ -73,11 +75,41 @@ export class Player extends NativeInstance {
73
75
  void this.source?.destroy();
74
76
  void this.network?.destroy();
75
77
  void this.decoderConfig?.destroy();
78
+ this.onShouldLoadAdItemSubscription?.remove();
76
79
  this.onImaBeforeInitializationSubscription?.remove();
80
+ this.onShouldLoadAdItemSubscription = undefined;
77
81
  this.onImaBeforeInitializationSubscription = undefined;
78
82
  this.isDestroyed = true;
79
83
  }
80
84
  };
85
+ ensureShouldLoadAdItemListener = () => {
86
+ const callback = this.config?.advertisingConfig?.shouldLoadAdItem;
87
+ if (!callback) {
88
+ return;
89
+ }
90
+ if (this.onShouldLoadAdItemSubscription) {
91
+ return;
92
+ }
93
+ this.onShouldLoadAdItemSubscription = PlayerModule.addListener('onShouldLoadAdItem', ({ nativeId, id, adItem }) => {
94
+ if (nativeId !== this.nativeId) {
95
+ return;
96
+ }
97
+ const cloned = {
98
+ ...adItem,
99
+ sources: adItem.sources.map((source) => ({ ...source })),
100
+ };
101
+ let shouldLoad = true;
102
+ try {
103
+ const shouldLoadResult = callback(cloned);
104
+ shouldLoad =
105
+ typeof shouldLoadResult === 'boolean' ? shouldLoadResult : true;
106
+ }
107
+ catch {
108
+ shouldLoad = true;
109
+ }
110
+ void PlayerModule.setShouldLoadAdItem(id, shouldLoad);
111
+ });
112
+ };
81
113
  /**
82
114
  * Loads a new {@link Source} from `sourceConfig` into the player.
83
115
  */
@@ -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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AAC,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 { 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 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.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.onImaBeforeInitializationSubscription?.remove();\n this.onImaBeforeInitializationSubscription = undefined;\n this.isDestroyed = true;\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,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,OAAO,MAAO,SAAQ,cAA4B;IACtD;;OAEG;IACH,aAAa,GAAG,KAAK,CAAC;IACtB;;OAEG;IACH,WAAW,GAAG,KAAK,CAAC;IACpB;;OAEG;IACH,MAAM,CAAU;IAChB;;;;OAIG;IACH,SAAS,GAAkB,SAAS,CAAC;IACrC;;OAEG;IACH,MAAM,GAAc,IAAI,SAAS,CAAC,IAAI,C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B,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"]}
@@ -3,6 +3,7 @@ import ExpoModulesCore
3
3
 
4
4
  // swiftlint:disable:next type_body_length
5
5
  public class PlayerModule: Module {
6
+ private let shouldLoadAdItemWaiter = ResultWaiter<Bool>()
6
7
  private let imaSettingsWaiter = ResultWaiter<[String: Any]>()
7
8
 
8
9
  // swiftlint:disable:next function_body_length
@@ -17,9 +18,10 @@ public class PlayerModule: Module {
17
18
  PlayerRegistry.getAllPlayers().forEach { $0.destroy() }
18
19
  PlayerRegistry.clear()
19
20
  }
21
+ shouldLoadAdItemWaiter.removeAll()
20
22
  imaSettingsWaiter.removeAll()
21
23
  }
22
- Events("onImaBeforeInitialization")
24
+ Events("onShouldLoadAdItem", "onImaBeforeInitialization")
23
25
  AsyncFunction("play") { (nativeId: NativeId) in
24
26
  PlayerRegistry.getPlayer(nativeId: nativeId)?.play()
25
27
  }.runOnQueue(.main)
@@ -178,6 +180,9 @@ public class PlayerModule: Module {
178
180
  AsyncFunction("setPreparedImaSettings") { [weak self] (id: Int, settings: [String: Any]?) in
179
181
  self?.imaSettingsWaiter.complete(id: id, with: settings ?? [:])
180
182
  }
183
+ AsyncFunction("setShouldLoadAdItem") { [weak self] (id: Int, shouldLoad: Bool) in
184
+ self?.shouldLoadAdItemWaiter.complete(id: id, with: shouldLoad)
185
+ }
181
186
  AsyncFunction(
182
187
  "initializeWithConfig"
183
188
  ) { [weak self] (nativeId: NativeId, config: [String: Any]?, networkNativeId: NativeId?, _: String?) in // swiftlint:disable:this line_length
@@ -189,6 +194,7 @@ public class PlayerModule: Module {
189
194
  if let networkNativeId, let networkConfig = self?.setupNetworkConfig(nativeId: networkNativeId) {
190
195
  playerConfig.networkConfig = networkConfig
191
196
  }
197
+ self?.setupShouldLoadAdItem(nativeId: nativeId, config: config, playerConfig: playerConfig)
192
198
  self?.setupImaBeforeInitialization(nativeId: nativeId, config: config, playerConfig: playerConfig)
193
199
  let player = PlayerFactory.create(playerConfig: playerConfig)
194
200
  PlayerRegistry.register(player: player, nativeId: nativeId)
@@ -205,6 +211,7 @@ public class PlayerModule: Module {
205
211
  if let networkNativeId, let networkConfig = self?.setupNetworkConfig(nativeId: networkNativeId) {
206
212
  playerConfig.networkConfig = networkConfig
207
213
  }
214
+ self?.setupShouldLoadAdItem(nativeId: nativeId, config: config, playerConfig: playerConfig)
208
215
  self?.setupImaBeforeInitialization(nativeId: nativeId, config: config, playerConfig: playerConfig)
209
216
  let defaultMetadata = RCTConvert.analyticsDefaultMetadataFromAnalyticsConfig(analyticsConfigJson)
210
217
  let player = PlayerFactory.create(
@@ -247,6 +254,33 @@ public class PlayerModule: Module {
247
254
  return networkModule.retrieve(nativeId)
248
255
  }
249
256
 
257
+ private func setupShouldLoadAdItem(
258
+ nativeId: NativeId,
259
+ config: [String: Any]?,
260
+ playerConfig: PlayerConfig
261
+ ) {
262
+ guard
263
+ let advertisingJson = config?["advertisingConfig"] as? [String: Any],
264
+ advertisingJson["shouldLoadAdItem"] != nil
265
+ else {
266
+ return
267
+ }
268
+
269
+ playerConfig.advertisingConfig.shouldLoadAdItem = { [weak self] adItem in
270
+ guard let self else { return true }
271
+ let (id, wait) = shouldLoadAdItemWaiter.make(timeout: 0.25)
272
+ self.sendEvent(
273
+ "onShouldLoadAdItem",
274
+ [
275
+ "nativeId": nativeId,
276
+ "id": id,
277
+ "adItem": RCTConvert.toJson(adItem: adItem) as Any
278
+ ]
279
+ )
280
+ return wait() ?? true
281
+ }
282
+ }
283
+
250
284
  private func setupImaBeforeInitialization(
251
285
  nativeId: NativeId,
252
286
  config: [String: Any]?,
@@ -1049,6 +1049,17 @@ extension RCTConvert {
1049
1049
  return array.compactMap(RNPictureInPictureAction.init(rawValue:))
1050
1050
  }
1051
1051
 
1052
+ static func rnPictureInPictureConfig(_ json: Any?) -> RNPictureInPictureConfig? {
1053
+ guard let json = json as? [String: Any?] else {
1054
+ return nil
1055
+ }
1056
+
1057
+ return RNPictureInPictureConfig(
1058
+ nativeConfig: pictureInPictureConfig(json),
1059
+ shouldExitOnForeground: json["shouldExitOnForeground"] as? Bool ?? false
1060
+ )
1061
+ }
1062
+
1052
1063
  static func rnPlayerViewConfig(_ json: Any?) -> RNPlayerViewConfig? {
1053
1064
  guard let json = json as? [String: Any?] else {
1054
1065
  return nil
@@ -1056,7 +1067,7 @@ extension RCTConvert {
1056
1067
 
1057
1068
  return RNPlayerViewConfig(
1058
1069
  uiConfig: json["uiConfig"].flatMap(rnUiConfig),
1059
- pictureInPictureConfig: json["pictureInPictureConfig"].flatMap(pictureInPictureConfig),
1070
+ pictureInPictureConfig: json["pictureInPictureConfig"].flatMap(rnPictureInPictureConfig),
1060
1071
  hideFirstFrame: json["hideFirstFrame"] as? Bool
1061
1072
  )
1062
1073
  }
@@ -1409,17 +1420,17 @@ internal struct RNPlayerViewConfig {
1409
1420
  let uiConfig: RNUiConfig?
1410
1421
 
1411
1422
  /**
1412
- * Picture in picture config
1423
+ * React Native specific picture in picture config.
1413
1424
  */
1414
- let pictureInPictureConfig: PictureInPictureConfig?
1425
+ let pictureInPictureConfig: RNPictureInPictureConfig?
1415
1426
 
1416
1427
  /**
1417
1428
  * PlayerView config considering all properties
1418
1429
  */
1419
1430
  var playerViewConfig: PlayerViewConfig {
1420
1431
  let config = PlayerViewConfig()
1421
- if let pictureInPictureConfig {
1422
- config.pictureInPictureConfig = pictureInPictureConfig
1432
+ if let nativePictureInPictureConfig = pictureInPictureConfig?.nativeConfig {
1433
+ config.pictureInPictureConfig = nativePictureInPictureConfig
1423
1434
  }
1424
1435
  return config
1425
1436
  }
@@ -1443,6 +1454,21 @@ internal struct RNUiConfig {
1443
1454
  let uiManagerFactoryFunction: String
1444
1455
  }
1445
1456
 
1457
+ /**
1458
+ * React Native specific PictureInPictureConfig.
1459
+ */
1460
+ internal struct RNPictureInPictureConfig {
1461
+ /**
1462
+ * Native SDK PiP configuration.
1463
+ */
1464
+ let nativeConfig: PictureInPictureConfig?
1465
+
1466
+ /**
1467
+ * Whether PiP should exit automatically when the app comes to the foreground.
1468
+ */
1469
+ let shouldExitOnForeground: Bool
1470
+ }
1471
+
1446
1472
  /**
1447
1473
  * Representation of the React Native API `BufferLevels` object.
1448
1474
  * This is necessary as we need a unified representation of the different APIs from both Android and iOS.
@@ -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.111.0"
31
+ s.dependency "BitmovinPlayer", "3.112.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
 
@@ -44,6 +44,8 @@ public class RNPlayerView: ExpoView {
44
44
  private var requestedPictureInPictureValue: Bool?
45
45
  private var isPictureInPictureEnabledValue: Bool?
46
46
  private var avPlayerViewControllerTransitionForced = false
47
+ private var shouldExitPictureInPictureOnForeground = false
48
+ private var foregroundObserver: NSObjectProtocol?
47
49
 
48
50
  let onBmpEvent = EventDispatcher()
49
51
  let onBmpPlayerActive = EventDispatcher()
@@ -119,6 +121,12 @@ public class RNPlayerView: ExpoView {
119
121
  clipsToBounds = true
120
122
  }
121
123
 
124
+ deinit {
125
+ if let foregroundObserver {
126
+ NotificationCenter.default.removeObserver(foregroundObserver)
127
+ }
128
+ }
129
+
122
130
  override public func layoutSubviews() {
123
131
  super.layoutSubviews()
124
132
  maybeFixAVPlayerViewControllerVisibility()
@@ -163,6 +171,10 @@ public class RNPlayerView: ExpoView {
163
171
  player.add(listener: self)
164
172
  playerView?.add(listener: self)
165
173
 
174
+ shouldExitPictureInPictureOnForeground =
175
+ playerViewConfigWrapper?.pictureInPictureConfig?.shouldExitOnForeground ?? false
176
+ updateForegroundObserver()
177
+
166
178
  self.maybeEmitPictureInPictureAvailabilityEvent(
167
179
  previousState: previousPictureInPictureAvailableValue
168
180
  )
@@ -253,6 +265,26 @@ private extension RNPlayerView {
253
265
  playerView.player?.remove(listener: self)
254
266
  playerView.remove(listener: self)
255
267
  playerView.player = nil
268
+ shouldExitPictureInPictureOnForeground = false
269
+ updateForegroundObserver()
270
+ }
271
+
272
+ func updateForegroundObserver() {
273
+ if let foregroundObserver {
274
+ NotificationCenter.default.removeObserver(foregroundObserver)
275
+ self.foregroundObserver = nil
276
+ }
277
+ guard shouldExitPictureInPictureOnForeground else { return }
278
+ #if os(iOS)
279
+ foregroundObserver = NotificationCenter.default.addObserver(
280
+ forName: UIApplication.didBecomeActiveNotification,
281
+ object: nil,
282
+ queue: .main
283
+ ) { [weak self] _ in
284
+ guard let self, self.playerView?.isPictureInPicture == true else { return }
285
+ self.playerView?.exitPictureInPicture()
286
+ }
287
+ #endif
256
288
  }
257
289
 
258
290
  func prepareForNewPlayerAttachment() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bitmovin-player-react-native",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "Official React Native bindings for Bitmovin's mobile Player SDKs.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -56,7 +56,7 @@
56
56
  "license": "MIT",
57
57
  "homepage": "https://bitmovin.com/video-player/react-native-sdk",
58
58
  "dependencies": {
59
- "expo-crypto": "~15.0.8",
59
+ "expo-crypto": "~15.0.9",
60
60
  "expo-keep-awake": "~15.0.8"
61
61
  },
62
62
  "devDependencies": {
@@ -66,7 +66,7 @@
66
66
  "eslint-config-expo": "~10.0.0",
67
67
  "eslint-config-prettier": "^9.1.0",
68
68
  "eslint-plugin-prettier": "^5.5.1",
69
- "expo": "~54.0.33",
69
+ "expo": "~54.0.34",
70
70
  "expo-module-scripts": "^4.1.9",
71
71
  "lint-staged": "13.0.3",
72
72
  "prettier": "^3.6.2",
@@ -100,6 +100,19 @@ export interface AdvertisingConfig {
100
100
  * The ad items that are scheduled when a new playback session is started via `Player.load()`.
101
101
  */
102
102
  schedule: AdItem[];
103
+ /**
104
+ * Called right before an ad item begins loading.
105
+ *
106
+ * Use this callback to conditionally allow or skip individual ad items
107
+ * based on runtime logic (e.g., user state, targeting rules, frequency caps).
108
+ *
109
+ * @param adItem - The ad item that is about to be loaded.
110
+ *
111
+ * @returns
112
+ * - `true` → the ad item will proceed to load as scheduled.
113
+ * - `false` → the ad item will be skipped and removed from the playback schedule.
114
+ */
115
+ shouldLoadAdItem?: (adItem: AdItem) => boolean;
103
116
  /**
104
117
  * Configuration to customize Google IMA SDK integration.
105
118
  */
@@ -21,4 +21,14 @@ export interface PictureInPictureConfig {
21
21
  * @platform iOS 14.2+, Android 8.0+
22
22
  */
23
23
  shouldEnterOnBackground?: boolean;
24
+
25
+ /**
26
+ * Defines whether Picture in Picture should exit automatically when the app transitions back to foreground.
27
+ *
28
+ * Does not have any effect when Picture in Picture is disabled.
29
+ *
30
+ * @defaultValue `false`
31
+ * @platform iOS
32
+ */
33
+ shouldExitOnForeground?: boolean;
24
34
  }
@@ -1,7 +1,16 @@
1
1
  import { NativeModule, requireNativeModule } from 'expo-modules-core';
2
- import { ImaSettings } from '../advertising';
2
+ import { AdItem, ImaSettings } from '../advertising';
3
3
 
4
4
  export type PlayerModuleEvents = {
5
+ onShouldLoadAdItem: ({
6
+ nativeId,
7
+ id,
8
+ adItem,
9
+ }: {
10
+ nativeId: string;
11
+ id: number;
12
+ adItem: AdItem;
13
+ }) => void;
5
14
  onImaBeforeInitialization: ({
6
15
  nativeId,
7
16
  id,
@@ -159,6 +168,11 @@ declare class PlayerModule extends NativeModule<PlayerModuleEvents> {
159
168
  */
160
169
  skipAd(nativeId: string): Promise<void>;
161
170
 
171
+ /**
172
+ * Applies the JS decision for an ad item load callback.
173
+ */
174
+ setShouldLoadAdItem(id: number, shouldLoad: boolean): Promise<void>;
175
+
162
176
  /**
163
177
  * Applies the JS-updated IMA settings for a before-initialization callback.
164
178
  */
package/src/player.ts CHANGED
@@ -51,12 +51,14 @@ export class Player extends NativeInstance<PlayerConfig> {
51
51
  private network?: Network;
52
52
 
53
53
  private decoderConfig?: DecoderConfigBridge;
54
+ private onShouldLoadAdItemSubscription?: EventSubscription;
54
55
  private onImaBeforeInitializationSubscription?: EventSubscription;
55
56
  /**
56
57
  * Allocates the native `Player` instance and its resources natively.
57
58
  */
58
59
  initialize = async (): Promise<void> => {
59
60
  if (!this.isInitialized) {
61
+ this.ensureShouldLoadAdItemListener();
60
62
  this.ensureImaBeforeInitializationListener();
61
63
  if (this.config?.networkConfig) {
62
64
  this.network = new Network(this.config.networkConfig);
@@ -96,12 +98,45 @@ export class Player extends NativeInstance<PlayerConfig> {
96
98
  void this.source?.destroy();
97
99
  void this.network?.destroy();
98
100
  void this.decoderConfig?.destroy();
101
+ this.onShouldLoadAdItemSubscription?.remove();
99
102
  this.onImaBeforeInitializationSubscription?.remove();
103
+ this.onShouldLoadAdItemSubscription = undefined;
100
104
  this.onImaBeforeInitializationSubscription = undefined;
101
105
  this.isDestroyed = true;
102
106
  }
103
107
  };
104
108
 
109
+ private ensureShouldLoadAdItemListener = () => {
110
+ const callback = this.config?.advertisingConfig?.shouldLoadAdItem;
111
+ if (!callback) {
112
+ return;
113
+ }
114
+ if (this.onShouldLoadAdItemSubscription) {
115
+ return;
116
+ }
117
+ this.onShouldLoadAdItemSubscription = PlayerModule.addListener(
118
+ 'onShouldLoadAdItem',
119
+ ({ nativeId, id, adItem }) => {
120
+ if (nativeId !== this.nativeId) {
121
+ return;
122
+ }
123
+ const cloned: AdItem = {
124
+ ...adItem,
125
+ sources: adItem.sources.map((source) => ({ ...source })),
126
+ };
127
+ let shouldLoad = true;
128
+ try {
129
+ const shouldLoadResult = callback(cloned);
130
+ shouldLoad =
131
+ typeof shouldLoadResult === 'boolean' ? shouldLoadResult : true;
132
+ } catch {
133
+ shouldLoad = true;
134
+ }
135
+ void PlayerModule.setShouldLoadAdItem(id, shouldLoad);
136
+ }
137
+ );
138
+ };
139
+
105
140
  /**
106
141
  * Loads a new {@link Source} from `sourceConfig` into the player.
107
142
  */