react-native-theoplayer 11.9.0 → 11.10.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
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [11.10.0] - 19-11-26
9
+
10
+ ### Added
11
+
12
+ - Added support for registering client-side ad integrations through the player facade's Ads API on Android.
13
+
14
+ ### Changed
15
+
16
+ - Ad integrations registered through the player facade's Ads API on Android now always register on the player, also while a player integration supplies the Ads API.
17
+
18
+ ### Fixed
19
+
20
+ - Fixed a memory leak on Android where a player destroyed during playback stayed in memory.
21
+
8
22
  ## [11.9.0] - 13-11-26
9
23
 
10
24
  ### Added
@@ -20,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
20
34
  - Fixed THEOlive events not being forwarded correctly on React Native v0.88.0+.
21
35
  - Fixed an issue on Android where `preferredKeySystems` in the content protection configuration was ignored.
22
36
  - Fixed ad-break integration identifiers being forwarded incorrectly on iOS and tvOS.
37
+ - Fixed an issue on Android where key system URNs in `preferredKeySystems` were ignored.
23
38
 
24
39
  ## [11.8.0] - 18-10-26
25
40
 
package/README.md CHANGED
@@ -33,73 +33,6 @@ by the `@theoplayer/react-native-ui` package.
33
33
  It also gives a description of the properties of the `THEOplayerView` component, and
34
34
  a list of features and known limitations.
35
35
 
36
- ### Player facade (Web and Android)
37
-
38
- Set `usePlayerFacade: true` in the player configuration at creation to enable the facade.
39
- The default is `false`; iOS and tvOS do not support this option.
40
- On Web, the facade is available at `player.nativeHandle`.
41
- Integrations can register through `registerIntegration`, dispatch THEOplayer player
42
- and ad events (including `adclicked`), and supply a clock through `getCurrentTime()` in
43
- seconds. The wrapper forwards `adclicked` to React Native's ad-event stream.
44
- Close the registration before replacing an integration. Playback engines and ad
45
- schedulers should use `facade.contentPlayer`, not the facade's overridden ad clock.
46
-
47
- Integrations can provide an `ads` object implementing the Ads API and its event
48
- subscriptions. The stable public `player.ads` delegates to that object, including
49
- scheduling queries and controls. Existing listeners migrate when an integration
50
- registers or closes; native Ads behavior returns after removal. The earlier
51
- `getAdState()` and `shouldConsumeAdEvent(event)` hooks remain available for
52
- integrations without an Ads object. The facade never reconstructs ad lifecycle.
53
-
54
- `getMuted()` / `setMuted(value)` and `getVolume()` / `setVolume(value)` route audio
55
- through an integration. Setters return `true` when handled; otherwise the facade
56
- falls back to content. Nullish getter results also fall back to content.
57
- `registration.dispatchEvent(event)` accepts typed THEOplayer player and ad events.
58
- Ad events route to `player.ads` listeners; player events such as `playing`, `waiting`,
59
- and `volumechange` route to `player` listeners. Dispatch does not emit on the content
60
- player or pass through backing-event interceptors. Closed registrations cannot emit.
61
- `registration.dispatchPlayerEvent(event)` remains a compatible player-event entry point.
62
- Playback ownership and audio synchronization remain integration responsibilities.
63
-
64
- `registration.interceptPlayerEvent(type, callback)` lets an integration inspect a
65
- backing player event once before facade listeners receive it. Return `true` to
66
- consume the event, or `false` to forward it. Raw player listeners are unaffected.
67
- The returned disposer removes the interceptor. Existing interceptors remain until
68
- disposed or the facade is destroyed, allowing an integration to drain already-queued
69
- events after unregistering; a closed registration cannot install new interceptors.
70
- `registration.interceptPlayerEvents(callback)` applies the same policy to every
71
- subscribed backing-player event, including subscriptions added later. Type-specific
72
- interceptors run first; integration-dispatched events bypass both kinds. Use a
73
- type-specific interceptor when an event must be observed even without consumers.
74
- An optional `isSeeking()` integration hook overrides the public seeking state;
75
- nullish results fall back to the backing player.
76
- Pause/seek ownership, pending transitions, lifecycle exceptions and ad lifecycle
77
- decisions belong to the integration, not the facade.
78
-
79
- On Android, implement `com.theoplayer.integration.Integration` and call
80
- `ReactTHEOplayerView.registerIntegration(integration)` after the view is initialized.
81
- The returned `IntegrationRegistration` supports the same dispatch and interception
82
- semantics using native Android SDK events. Interceptor disposers implement `Closeable`;
83
- call `close()` to remove them. Access the raw engine through
84
- `(view.player as PlayerFacade).contentPlayer`. Time values are in seconds on both platforms.
85
- Android's `getAdState()` returns a `PlayerFacadeAdState`; its nullable result delegates
86
- to native Ads. The facade permits registration during native ads and does not infer
87
- state or suppress native ad events merely because an integration is registered.
88
- Native SDK extensions (`theoAds`, `ima`, `dai`) resolve against the raw player or Ads
89
- object through the facade-aware extensions in `com.theoplayer.integration`.
90
-
91
- Custom advertising must not overlap ongoing native IMA/DAI playback on Android.
92
- Finish or reset native advertising before taking over. Replacing/filtering native
93
- ad events can suspend the RN bridge's native DAI bookkeeping, so fresh native state
94
- after hidden native playback is not guaranteed. `ReactTHEOplayerView.adsApi` remains
95
- the native source-specific adapter/event sink; use `view.player.ads` for facade state.
96
- React Native Ads queries and controls use a facade-aware bridge with native fallback.
97
-
98
- Focused facade regression tests (Node 22.18+):
99
- `node --test src/__tests__/PlayerFacade.test.ts`.
100
- Android tests, from `example/android`:
101
- `./gradlew :react-native-theoplayer:testDebugUnitTest --tests 'com.theoplayer.integration.PlayerFacade*Test' --console=plain`.
102
-
103
36
  ## Prerequisites
104
37
 
105
38
  For each platform, a dependency to the corresponding THEOplayer SDK is included through a dependency manager:
@@ -492,6 +492,7 @@ class ReactTHEOplayerContext private constructor(
492
492
  fun destroy() {
493
493
  isDestroyed = true
494
494
  removeListeners()
495
+ audioBecomingNoisyManager.setEnabled(false)
495
496
 
496
497
  // The media session can be shared with other player contexts through the playback service.
497
498
  // Determine ownership before unbinding, as that clears the binder needed to check it.
@@ -8,11 +8,11 @@ private const val ERROR_INVALID_KEYSYSTEM_ID = "Invalid KeySystemId"
8
8
 
9
9
  object KeySystemAdapter {
10
10
  fun fromString(keySystemStr: String): KeySystemId? {
11
- return when (keySystemStr) {
12
- "widevine" -> KeySystemId.WIDEVINE
13
- "playready" -> KeySystemId.PLAYREADY
14
- "fairplay" -> KeySystemId.FAIRPLAY
15
- "clearkey" -> KeySystemId.CLEAR_KEY
11
+ return when (keySystemStr.lowercase()) {
12
+ "widevine", "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" -> KeySystemId.WIDEVINE
13
+ "playready", "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" -> KeySystemId.PLAYREADY
14
+ "fairplay", "urn:uuid:94ce86fb-07bb-4b43-adb8-93d2fa968ca2" -> KeySystemId.FAIRPLAY
15
+ "clearkey", "urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e" -> KeySystemId.CLEAR_KEY
16
16
  else -> null
17
17
  }
18
18
  }
@@ -5,7 +5,6 @@ import com.theoplayer.android.api.ads.Ad
5
5
  import com.theoplayer.android.api.ads.AdBreak
6
6
  import com.theoplayer.android.api.ads.Ads
7
7
  import com.theoplayer.android.api.ads.Omid
8
- import com.theoplayer.android.api.ads.ServerSideAdIntegrationFactory
9
8
  import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration
10
9
  import com.theoplayer.android.api.ads.dai.dai as sdkDai
11
10
  import com.theoplayer.android.api.ads.ima.GoogleImaIntegration
@@ -18,6 +17,8 @@ import com.theoplayer.android.api.source.addescription.AdDescription
18
17
  /**
19
18
  * Stable advertising API whose state, controls, and event source follow the current [Integration].
20
19
  * Advertising lifecycle is owned by the integration, never inferred from dispatched events.
20
+ * Members not overridden here, including ad integration registrations, delegate to the native Ads
21
+ * API, also while an integration supplies `ads`.
21
22
  *
22
23
  * Experimental API: subject to change or removal without notice.
23
24
  */
@@ -26,7 +27,7 @@ class PlayerFacadeAds internal constructor(
26
27
  private val nativeAds: Ads,
27
28
  private val integration: () -> Integration?,
28
29
  private val events: PlayerFacadeEvents<AdEvent<*>>,
29
- ) : Ads {
30
+ ) : Ads by nativeAds {
30
31
  private val backing: Ads get() = integration()?.ads ?: nativeAds
31
32
 
32
33
  /** Native IMA integration, resolved on the raw Ads API rather than this facade. */
@@ -61,10 +62,6 @@ class PlayerFacadeAds internal constructor(
61
62
  /** Returns the Open Measurement API of the currently delegated Ads API. */
62
63
  override fun getOmid(): Omid = backing.omid
63
64
 
64
- /** Registers [factory] for [integrationId] on the currently delegated Ads API. */
65
- override fun registerServerSideIntegration(integrationId: String, factory: ServerSideAdIntegrationFactory) =
66
- backing.registerServerSideIntegration(integrationId, factory)
67
-
68
65
  /** Adds [listener] for [type], preserving the subscription across integration changes. Duplicate listeners are ignored. */
69
66
  override fun <T : AdEvent<*>> addEventListener(type: EventType<T>, listener: EventListener<in T>) = events.addEventListener(type, listener)
70
67
 
@@ -0,0 +1,30 @@
1
+ package com.theoplayer.drm
2
+
3
+ import com.theoplayer.android.api.contentprotection.KeySystemId
4
+ import org.junit.Assert.*
5
+ import org.junit.Test
6
+
7
+ class KeySystemAdapterTest {
8
+ @Test fun parsesKeySystemAliases() {
9
+ assertEquals(KeySystemId.WIDEVINE, KeySystemAdapter.fromString("widevine"))
10
+ assertEquals(KeySystemId.PLAYREADY, KeySystemAdapter.fromString("playready"))
11
+ assertEquals(KeySystemId.FAIRPLAY, KeySystemAdapter.fromString("fairplay"))
12
+ assertEquals(KeySystemId.CLEAR_KEY, KeySystemAdapter.fromString("clearkey"))
13
+ }
14
+
15
+ @Test fun parsesDashIfKeySystemUrns() {
16
+ assertEquals(KeySystemId.WIDEVINE, KeySystemAdapter.fromString("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"))
17
+ assertEquals(KeySystemId.PLAYREADY, KeySystemAdapter.fromString("urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95"))
18
+ assertEquals(KeySystemId.FAIRPLAY, KeySystemAdapter.fromString("urn:uuid:94ce86fb-07bb-4b43-adb8-93d2fa968ca2"))
19
+ assertEquals(KeySystemId.CLEAR_KEY, KeySystemAdapter.fromString("urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e"))
20
+ }
21
+
22
+ @Test fun parsesKeySystemUrnsCaseInsensitively() {
23
+ assertEquals(KeySystemId.PLAYREADY, KeySystemAdapter.fromString("URN:UUID:9A04F079-9840-4286-AB92-E65BE0885F95"))
24
+ }
25
+
26
+ @Test fun rejectsUnknownKeySystems() {
27
+ assertNull(KeySystemAdapter.fromString("urn:uuid:00000000-0000-0000-0000-000000000000"))
28
+ assertNull(KeySystemAdapter.fromString(""))
29
+ }
30
+ }
@@ -2,6 +2,7 @@ package com.theoplayer.integration
2
2
 
3
3
  import com.theoplayer.android.api.ads.Ad
4
4
  import com.theoplayer.android.api.ads.AdBreak
5
+ import com.theoplayer.android.api.ads.ServerSideAdIntegrationFactory
5
6
  import com.theoplayer.android.api.event.EventListener
6
7
  import com.theoplayer.android.api.event.ads.*
7
8
  import com.theoplayer.android.api.event.player.*
@@ -234,6 +235,23 @@ class PlayerFacadeTest {
234
235
  facade.close()
235
236
  }
236
237
 
238
+ @Test fun stableAdsRegistersAdIntegrationsOnNativeAds() {
239
+ val host = PlayerFacadeTestHost()
240
+ val integrated = PlayerFacadeTestHost()
241
+ val facade = PlayerFacade(host.player)
242
+ val factory = ServerSideAdIntegrationFactory { throw AssertionError("not built") }
243
+ facade.ads.registerServerSideIntegration("server", factory)
244
+ assertEquals(listOf("registerServerSideIntegration"), host.commands)
245
+ val registration = facade.registerIntegration(object : Integration {
246
+ override val ads = integrated.ads
247
+ })
248
+ facade.ads.registerServerSideIntegration("server", factory)
249
+ assertEquals(listOf("registerServerSideIntegration", "registerServerSideIntegration"), host.commands)
250
+ assertTrue(integrated.commands.isEmpty())
251
+ registration.close()
252
+ facade.close()
253
+ }
254
+
237
255
  @Test fun nativeAdFilteringDecidesOnceForAllListenersAndSyntheticEventsBypassIt() {
238
256
  val host = PlayerFacadeTestHost()
239
257
  val facade = PlayerFacade(host.player)
@@ -38,7 +38,7 @@ internal class PlayerFacadeTestHost {
38
38
  null
39
39
  }
40
40
  "removeEventListener" -> remove(adListeners, args)
41
- "skip", "schedule", "registerServerSideIntegration" -> { commands.add(method); null }
41
+ "skip", "schedule", "registerServerSideIntegration", "registerClientSideIntegration" -> { commands.add(method); null }
42
42
  else -> null
43
43
  }
44
44
  }
@@ -1 +1 @@
1
- {"version":"11.9.0","buildDate":"2026-11-13T14:23:07.540Z"}
1
+ {"version":"11.10.0","buildDate":"2026-11-19T18:01:17.961Z"}
@@ -1 +1 @@
1
- {"version":"11.9.0","buildDate":"2026-11-13T14:23:07.540Z"}
1
+ {"version":"11.10.0","buildDate":"2026-11-19T18:01:17.961Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "11.9.0",
3
+ "version": "11.10.0",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/manifest.json CHANGED
@@ -1 +1 @@
1
- {"version":"11.9.0","buildDate":"2026-11-13T14:23:07.540Z"}
1
+ {"version":"11.10.0","buildDate":"2026-11-19T18:01:17.961Z"}