react-native-theoplayer 11.7.0 → 11.8.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +2 -2
  3. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  4. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  5. package/android/gradlew +176 -110
  6. package/android/gradlew.bat +23 -18
  7. package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +17 -5
  8. package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +61 -7
  9. package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +12 -5
  10. package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +3 -1
  11. package/android/src/main/java/com/theoplayer/theolive/EndpointAdapter.kt +33 -0
  12. package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +39 -9
  13. package/ios/contentprotection/THEOplayerRCTContentProtectionAggregator.swift +15 -11
  14. package/ios/contentprotection/THEOplayerRCTProxyContentProtectionIntegration.swift +12 -7
  15. package/ios/theolive/THEOplayerRCTTHEOliveEventAdapter.swift +21 -0
  16. package/lib/commonjs/api/player/PlayerEventMap.js +1 -1
  17. package/lib/commonjs/internal/adapter/WebEventForwarder.js +61 -10
  18. package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
  19. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +38 -12
  20. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
  21. package/lib/commonjs/manifest.json +1 -1
  22. package/lib/commonjs/plugins/typedoc-platform-icons/package-lock.json +200 -58
  23. package/lib/commonjs/plugins/typedoc-platform-icons/package.json +1 -1
  24. package/lib/commonjs/plugins/typedoc-platform-icons/tsconfig.json +2 -1
  25. package/lib/module/api/player/PlayerEventMap.js +1 -1
  26. package/lib/module/internal/adapter/WebEventForwarder.js +61 -10
  27. package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
  28. package/lib/module/internal/drm/ContentProtectionRegistry.js +38 -12
  29. package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
  30. package/lib/module/manifest.json +1 -1
  31. package/lib/module/plugins/typedoc-platform-icons/package-lock.json +200 -58
  32. package/lib/module/plugins/typedoc-platform-icons/package.json +1 -1
  33. package/lib/module/plugins/typedoc-platform-icons/tsconfig.json +2 -1
  34. package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts +2 -0
  35. package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts.map +1 -0
  36. package/lib/typescript/api/error/ChromecastError.d.ts +2 -2
  37. package/lib/typescript/api/player/PlayerEventMap.d.ts +1 -1
  38. package/lib/typescript/api/theoads/interstitial/Interstitial.d.ts +1 -1
  39. package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts +23 -5
  40. package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts.map +1 -1
  41. package/lib/typescript/api/theolive/WebrtcOptions.d.ts +1 -1
  42. package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +3 -0
  43. package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
  44. package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts +2 -2
  45. package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts.map +1 -1
  46. package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts +3 -1
  47. package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts.map +1 -1
  48. package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts +5 -0
  49. package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts.map +1 -1
  50. package/package.json +5 -6
  51. package/react-native-theoplayer.podspec +6 -6
  52. package/src/__tests__/ContentProtectionRegistry.test.ts +239 -0
  53. package/src/api/error/ChromecastError.ts +2 -2
  54. package/src/api/player/PlayerEventMap.ts +1 -1
  55. package/src/api/theoads/interstitial/Interstitial.ts +1 -1
  56. package/src/api/theolive/TheoLiveEndpoint.ts +24 -5
  57. package/src/api/theolive/WebrtcOptions.ts +1 -1
  58. package/src/internal/adapter/WebEventForwarder.ts +69 -10
  59. package/src/internal/drm/ContentProtectionRegistry.ts +35 -17
  60. package/src/internal/drm/NativeContentProtectionEvent.ts +5 -0
  61. package/src/manifest.json +1 -1
  62. package/src/plugins/typedoc-platform-icons/package-lock.json +200 -58
  63. package/src/plugins/typedoc-platform-icons/package.json +1 -1
  64. package/src/plugins/typedoc-platform-icons/tsconfig.json +2 -1
  65. package/lib/typescript/plugins/expo/Common.d.ts +0 -13
  66. package/lib/typescript/plugins/expo/Common.d.ts.map +0 -1
  67. package/lib/typescript/plugins/expo/withCustomPod.d.ts +0 -2
  68. package/lib/typescript/plugins/expo/withCustomPod.d.ts.map +0 -1
  69. package/lib/typescript/plugins/expo/withTHEOplayer.d.ts +0 -4
  70. package/lib/typescript/plugins/expo/withTHEOplayer.d.ts.map +0 -1
  71. package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts +0 -4
  72. package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts.map +0 -1
  73. package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts +0 -4
  74. package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts.map +0 -1
  75. package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts +0 -3
  76. package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts.map +0 -1
@@ -5,7 +5,7 @@
5
5
  * to increase the jitter buffer size.
6
6
  *
7
7
  * @category THEOlive
8
- * @remark This is a hint, and factors like network jitter and audio/video sync latency affect the actual delay applied.
8
+ * @remarks This is a hint, and factors like network jitter and audio/video sync latency affect the actual delay applied.
9
9
  * @public
10
10
  */
11
11
  export interface WebrtcPlayoutDelay {
@@ -3,6 +3,9 @@ import type { THEOplayerWebAdapter } from './THEOplayerWebAdapter';
3
3
  export declare class WebEventForwarder {
4
4
  private readonly _player;
5
5
  private readonly _facade;
6
+ private readonly _textTrackListeners;
7
+ private readonly _forwardedTextTrackCues;
8
+ private readonly _mediaTrackListeners;
6
9
  constructor(player: ChromelessPlayer, facade: THEOplayerWebAdapter);
7
10
  private addEventListeners;
8
11
  unload(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"WebEventForwarder.d.ts","sourceRoot":"","sources":["../../../../src/internal/adapter/WebEventForwarder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAOV,gBAAgB,EAuBjB,MAAM,YAAY,CAAC;AAmBpB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAqCnE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuB;gBAEnC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB;IAMlE,OAAO,CAAC,iBAAiB;IAiDzB,MAAM,IAAI,IAAI;IAId,OAAO,CAAC,oBAAoB;IAiD5B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAE7B;IAEF,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAEpC;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAE1B;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAE3B;IAEF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAY/B;IAEF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAOtB;IAEF,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAavC;IAEF,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAEzC;IAEF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAEzB;IAEF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAExB;IAEF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAErB;IAEF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAExB;IAEF,OAAO,CAAC,QAAQ,CAAC,O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AAC,kBAAkB,CAEjC;IAEF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAEjC;IAEF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAQjC;IAEF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAEjC;IAEF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAEjC;IAEF,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAEtC;IAEF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAEhC;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAEnC;IAEF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGxB;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAG7B;IAEF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAO7B;IAEF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAwB9B;IAEF,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAShC;IAEF,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CASnC;IAEF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAKlC;IAEF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAKjC;IAEF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAKrC;CACH"}
@@ -10,8 +10,8 @@ export declare class PlayerFacadeAdsEvents {
10
10
  private closed;
11
11
  constructor(nativeAds: PlayerFacadeAds | undefined, getIntegration: () => PlayerFacadeIntegration | undefined);
12
12
  static isAdEvent(event: PlayerFacadeEvent): event is AdEvent;
13
- readonly addEventListener: <TType extends keyof import("theoplayer/THEOplayer.common").AdsEventMap>(types: TType | readonly TType[], listener: EventListener<AdsEventMap[TType]>) => void;
14
- readonly removeEventListener: <TType extends keyof import("theoplayer/THEOplayer.common").AdsEventMap>(types: TType | readonly TType[], listener: EventListener<AdsEventMap[TType]>) => void;
13
+ readonly addEventListener: <TType extends keyof import("theoplayer").AdsEventMap>(types: TType | readonly TType[], listener: EventListener<AdsEventMap[TType]>) => void;
14
+ readonly removeEventListener: <TType extends keyof import("theoplayer").AdsEventMap>(types: TType | readonly TType[], listener: EventListener<AdsEventMap[TType]>) => void;
15
15
  private bindListener;
16
16
  rebind(): void;
17
17
  dispatch(event: AdEvent, isCurrentRegistration: () => boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerFacadeAdsEvents.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapter/web/PlayerFacadeAdsEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,IAAI,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE/I,KAAK,WAAW,GAAG,MAAM,WAAW,CAAC;AACrC,KAAK,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AA6BxC,kFAAkF;AAClF,qBAAa,qBAAqB;IAK9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IALjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwC;IACtE,OAAO,CAAC,MAAM,CAAS;gBAGJ,SAAS,EAAE,eAAe,GAAG,SAAS,EACtC,cAAc,EAAE,MAAM,uBAAuB,GAAG,SAAS;IAG5E,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,KAAK,IAAI,OAAO;IAI5D,QAAQ,CAAC,gBAAgB,4JAA8G,IAAI,CAWzI;IAEF,QAAQ,CAAC,mBAAmB,4JAA8G,IAAI,CAU5I;IAEF,OAAO,CAAC,YAAY;IAwBpB,MAAM,IAAI,IAAI;IAOd,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,GAAG,IAAI;IAQpE,KAAK,IAAI,IAAI;CAOd"}
1
+ {"version":3,"file":"PlayerFacadeAdsEvents.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapter/web/PlayerFacadeAdsEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,IAAI,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE/I,KAAK,WAAW,GAAG,MAAM,WAAW,CAAC;AACrC,KAAK,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AA6BxC,kFAAkF;AAClF,qBAAa,qBAAqB;IAK9B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IALjC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwC;IACtE,OAAO,CAAC,MAAM,CAAS;gBAGJ,SAAS,EAAE,eAAe,GAAG,SAAS,EACtC,cAAc,EAAE,MAAM,uBAAuB,GAAG,SAAS;IAG5E,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,KAAK,IAAI,OAAO;IAI5D,QAAQ,CAAC,gBAAgB,0IAA8G,IAAI,CAWzI;IAEF,QAAQ,CAAC,mBAAmB,0IAA8G,IAAI,CAU5I;IAEF,OAAO,CAAC,YAAY;IAwBpB,MAAM,IAAI,IAAI;IAOd,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,OAAO,GAAG,IAAI;IAQpE,KAAK,IAAI,IAAI;CAOd"}
@@ -4,10 +4,11 @@ import type { ContentProtectionIntegrationFactory } from 'react-native-theoplaye
4
4
  export declare class NativeContentProtectionRegistry implements ContentProtectionAPI {
5
5
  private emitter;
6
6
  private registeredFactories;
7
- private currentIntegration;
7
+ private integrations;
8
8
  constructor();
9
9
  registerContentProtectionIntegration(integrationId: string, keySystemId: KeySystemId, integrationFactory: ContentProtectionIntegrationFactory): void;
10
10
  private getFactory;
11
+ private integrationKey;
11
12
  private getIntegration;
12
13
  private onBuildIntegrationRequest;
13
14
  private onCertificateRequest;
@@ -15,6 +16,7 @@ export declare class NativeContentProtectionRegistry implements ContentProtectio
15
16
  private onLicenseRequest;
16
17
  private onLicenseResponse;
17
18
  private onExtractFairplayContentId;
19
+ private onIntegrationDisposed;
18
20
  }
19
21
  /**
20
22
  * The registry for adding custom content protection (DRM) integrations.
@@ -1 +1 @@
1
- {"version":3,"file":"ContentProtectionRegistry.d.ts","sourceRoot":"","sources":["../../../../src/internal/drm/ContentProtectionRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,oBAAoB,EAAoC,MAAM,yBAAyB,CAAC;AAC1H,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAgCnF,qBAAa,+BAAgC,YAAW,oBAAoB;IAC1E,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,mBAAmB,CAAoD;IAC/E,OAAO,CAAC,kBAAkB,CAA8D;;IAYxF,oCAAoC,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,mCAAmC;IAS7I,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,yBAAyB,CAiB/B;IAEF,OAAO,CAAC,oBAAoB,CAiB1B;IAEF,OAAO,CAAC,qBAAqB,CAY3B;IAEF,OAAO,CAAC,gBAAgB,CAkBtB;IAEF,OAAO,CAAC,iBAAiB,CAYvB;IAEF,OAAO,CAAC,0BAA0B,CAiBhC;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,oBAA4D,CAAC"}
1
+ {"version":3,"file":"ContentProtectionRegistry.d.ts","sourceRoot":"","sources":["../../../../src/internal/drm/ContentProtectionRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,oBAAoB,EAAoC,MAAM,yBAAyB,CAAC;AAC1H,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAgCnF,qBAAa,+BAAgC,YAAW,oBAAoB;IAC1E,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,mBAAmB,CAAoD;IAC/E,OAAO,CAAC,YAAY,CAA+D;;IAanF,oCAAoC,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,mCAAmC;IAc7I,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,yBAAyB,CAiB/B;IAEF,OAAO,CAAC,oBAAoB,CAiB1B;IAEF,OAAO,CAAC,qBAAqB,CAY3B;IAEF,OAAO,CAAC,gBAAgB,CAkBtB;IAEF,OAAO,CAAC,iBAAiB,CAYvB;IAEF,OAAO,CAAC,0BAA0B,CAiBhC;IAEF,OAAO,CAAC,qBAAqB,CAE3B;CACH;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,oBAA4D,CAAC"}
@@ -2,5 +2,10 @@ export interface NativeContentProtectionEvent {
2
2
  requestId: string;
3
3
  integrationId: string;
4
4
  keySystemId: string;
5
+ /**
6
+ * Unique identifier of the native content protection integration instance that emitted the event.
7
+ * Absent on events emitted by native builds predating per-instance routing.
8
+ */
9
+ integrationInstanceId?: string;
5
10
  }
6
11
  //# sourceMappingURL=NativeContentProtectionEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NativeContentProtectionEvent.d.ts","sourceRoot":"","sources":["../../../../src/internal/drm/NativeContentProtectionEvent.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"NativeContentProtectionEvent.d.ts","sourceRoot":"","sources":["../../../../src/internal/drm/NativeContentProtectionEvent.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "11.7.0",
3
+ "version": "11.8.0",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -70,17 +70,16 @@
70
70
  "react": "^19.2.3",
71
71
  "react-native": "^0.86.2",
72
72
  "react-native-builder-bob": "^0.39.1",
73
- "theoplayer": "^11.4.0",
74
- "typedoc": "^0.25.13",
75
- "typedoc-plugin-external-resolver": "^1.0.3",
76
- "typedoc-plugin-mdn-links": "^3.3.4",
73
+ "theoplayer": "^11.14.0",
74
+ "typedoc": "^0.28.20",
75
+ "typedoc-plugin-mdn-links": "^5.1.1",
77
76
  "typescript": "5.1.6",
78
77
  "typescript-eslint": "^8.30.1"
79
78
  },
80
79
  "peerDependencies": {
81
80
  "react": "*",
82
81
  "react-native": "*",
83
- "theoplayer": "^11.4.0"
82
+ "theoplayer": "^11.14.0"
84
83
  },
85
84
  "peerDependenciesMeta": {
86
85
  "theoplayer": {
@@ -43,31 +43,31 @@ Pod::Spec.new do |s|
43
43
 
44
44
  # THEOplayer Dependency
45
45
  puts "Adding THEOplayerSDK-core"
46
- s.dependency "THEOplayerSDK-core", "~> 11.9"
46
+ s.dependency "THEOplayerSDK-core", "~> 11.14"
47
47
 
48
48
  # THEOlive Dependency
49
49
  puts "Adding THEOplayer-Integration-THEOlive"
50
- s.dependency "THEOplayer-Integration-THEOlive", "~> 11.9"
50
+ s.dependency "THEOplayer-Integration-THEOlive", "~> 11.14"
51
51
 
52
52
  # Feature based integration dependencies
53
53
  if theofeatures.include?("GOOGLE_IMA")
54
54
  puts "Adding THEOplayer-Integration-GoogleIMA"
55
- s.dependency "THEOplayer-Integration-GoogleIMA", "~> 11.9"
55
+ s.dependency "THEOplayer-Integration-GoogleIMA", "~> 11.14"
56
56
  end
57
57
 
58
58
  if theofeatures.include?("CHROMECAST")
59
59
  puts "Adding THEOplayer-Integration-GoogleCast"
60
- s.ios.dependency "THEOplayer-Integration-GoogleCast", "~> 11.9"
60
+ s.ios.dependency "THEOplayer-Integration-GoogleCast", "~> 11.14"
61
61
  end
62
62
 
63
63
  if theofeatures.include?("THEO_ADS")
64
64
  puts "Adding THEOplayer-Integration-THEOads"
65
- s.dependency "THEOplayer-Integration-THEOads", "~> 11.9"
65
+ s.dependency "THEOplayer-Integration-THEOads", "~> 11.14"
66
66
  end
67
67
 
68
68
  if theofeatures.include?("MILLICAST")
69
69
  puts "Adding THEOplayer-Integration-Millicast"
70
- s.dependency "THEOplayer-Integration-Millicast", "~> 11.9"
70
+ s.dependency "THEOplayer-Integration-Millicast", "~> 11.14"
71
71
  end
72
72
 
73
73
  # Feature based connector dependencies
@@ -0,0 +1,239 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { readFileSync } from 'node:fs';
4
+ import path from 'node:path';
5
+ import ts from 'typescript';
6
+
7
+ const nativeModuleCalls: { method: string; args: unknown[] }[] = [];
8
+ const createdEmitters: { listeners: Map<string, (event: never) => void> }[] = [];
9
+
10
+ const reactNativeStub = {
11
+ NativeEventEmitter: class {
12
+ listeners = new Map<string, (event: never) => void>();
13
+ constructor() {
14
+ createdEmitters.push(this);
15
+ }
16
+ addListener(eventType: string, listener: (event: never) => void) {
17
+ this.listeners.set(eventType, listener);
18
+ return { remove: () => this.listeners.delete(eventType) };
19
+ }
20
+ },
21
+ NativeModules: {
22
+ THEORCTContentProtectionModule: new Proxy({} as Record<string, (...args: unknown[]) => void>, {
23
+ get: (target, method: string) =>
24
+ (target[method] ??= (...args: unknown[]) => {
25
+ nativeModuleCalls.push({ method, args });
26
+ }),
27
+ }),
28
+ },
29
+ };
30
+
31
+ const theoplayerStub = {
32
+ fromBase64StringToUint8Array: (str: string) => new Uint8Array(Buffer.from(str, 'base64')),
33
+ fromUint8ArrayToBase64String: (array: Uint8Array) => Buffer.from(array).toString('base64'),
34
+ };
35
+
36
+ function loadSource(file: string): object {
37
+ const compiled = ts.transpileModule(readFileSync(file, 'utf8'), {
38
+ compilerOptions: { target: ts.ScriptTarget.ES2020, module: ts.ModuleKind.CommonJS },
39
+ });
40
+ const exports = {};
41
+ new Function('exports', 'require', compiled.outputText)(exports, (specifier: string) => {
42
+ if (specifier === 'react-native') {
43
+ return reactNativeStub;
44
+ }
45
+ if (specifier === 'react-native-theoplayer') {
46
+ return theoplayerStub;
47
+ }
48
+ assert.ok(specifier.startsWith('.'), 'Registry runtime imports must remain local');
49
+ return loadSource(path.resolve(path.dirname(file), `${specifier}.ts`));
50
+ });
51
+ return exports;
52
+ }
53
+
54
+ const { NativeContentProtectionRegistry } = loadSource(
55
+ path.resolve('src/internal/drm/ContentProtectionRegistry.ts'),
56
+ ) as typeof import('../internal/drm/ContentProtectionRegistry');
57
+
58
+ function setup() {
59
+ nativeModuleCalls.length = 0;
60
+ createdEmitters.length = 0;
61
+ const registry = new NativeContentProtectionRegistry();
62
+ const emitter = createdEmitters[createdEmitters.length - 1];
63
+ const buildIntegration = (integrationId: string, keySystemId: string, integrationInstanceId?: string) =>
64
+ emitter.listeners.get('onBuildIntegration')?.({ requestId: '1', integrationId, keySystemId, integrationInstanceId, drmConfig: {} } as never);
65
+ const emit = (eventType: string, event: object): Promise<void> | void => emitter.listeners.get(eventType)?.(event as never) as Promise<void> | void;
66
+ return { registry, emitter, buildIntegration, emit };
67
+ }
68
+
69
+ const licenseRequest = (integrationId: string, keySystemId: string, integrationInstanceId?: string) => ({
70
+ requestId: 'req-1',
71
+ integrationId,
72
+ keySystemId,
73
+ integrationInstanceId,
74
+ url: 'https://license.server/',
75
+ method: 'GET',
76
+ headers: {},
77
+ base64body: null,
78
+ useCredentials: false,
79
+ fairplaySkdUrl: undefined,
80
+ });
81
+
82
+ test('registerContentProtectionIntegration replaces a factory registered for the same integration and key system', () => {
83
+ const { registry, buildIntegration } = setup();
84
+ const built: string[] = [];
85
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
86
+ build: () => {
87
+ built.push('first');
88
+ return {};
89
+ },
90
+ });
91
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
92
+ build: () => {
93
+ built.push('second');
94
+ return {};
95
+ },
96
+ });
97
+
98
+ buildIntegration('drm', 'widevine');
99
+
100
+ // The stale factory must not handle the build request.
101
+ assert.deepEqual(built, ['second']);
102
+ });
103
+
104
+ test('re-registering one key system does not affect factories for other key systems', () => {
105
+ const { registry, buildIntegration } = setup();
106
+ const built: string[] = [];
107
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
108
+ build: () => {
109
+ built.push('widevine-1');
110
+ return {};
111
+ },
112
+ });
113
+ registry.registerContentProtectionIntegration('drm', 'fairplay' as never, {
114
+ build: () => {
115
+ built.push('fairplay');
116
+ return {};
117
+ },
118
+ });
119
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
120
+ build: () => {
121
+ built.push('widevine-2');
122
+ return {};
123
+ },
124
+ });
125
+
126
+ buildIntegration('drm', 'fairplay');
127
+ buildIntegration('drm', 'widevine');
128
+
129
+ assert.deepEqual(built, ['fairplay', 'widevine-2']);
130
+ });
131
+
132
+ test('each registration is still forwarded to the native module', () => {
133
+ const { registry } = setup();
134
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, { build: () => ({}) });
135
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, { build: () => ({}) });
136
+
137
+ const registrations = nativeModuleCalls.filter((c) => c.method === 'registerContentProtectionIntegration');
138
+ assert.equal(registrations.length, 2);
139
+ });
140
+
141
+ test('callbacks are routed to the integration instance matching the event instance identifier', async () => {
142
+ const { registry, buildIntegration, emit } = setup();
143
+ const calls: string[] = [];
144
+ const handledRequest = (tag: string) => () => {
145
+ calls.push(tag);
146
+ return { url: `handled-by-${tag}`, method: 'GET', headers: {}, body: null, useCredentials: false };
147
+ };
148
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
149
+ build: () => ({ onLicenseRequest: handledRequest('instance-a') }),
150
+ });
151
+ registry.registerContentProtectionIntegration('drm', 'fairplay' as never, {
152
+ build: () => ({ onLicenseRequest: handledRequest('instance-b') }),
153
+ });
154
+
155
+ buildIntegration('drm', 'widevine', 'instance-a');
156
+ buildIntegration('drm', 'fairplay', 'instance-b');
157
+
158
+ await emit('onLicenseRequest', licenseRequest('drm', 'widevine', 'instance-a'));
159
+ await emit('onLicenseRequest', licenseRequest('drm', 'fairplay', 'instance-b'));
160
+
161
+ assert.deepEqual(calls, ['instance-a', 'instance-b']);
162
+ const processed = nativeModuleCalls.filter((c) => c.method === 'onLicenseRequestProcessedAsRequest');
163
+ assert.deepEqual(
164
+ processed.map((c) => (c.args[0] as { url: string }).url),
165
+ ['handled-by-instance-a', 'handled-by-instance-b'],
166
+ );
167
+ });
168
+
169
+ test('building a second integration for the same integration id does not replace the first', async () => {
170
+ const { registry, buildIntegration, emit } = setup();
171
+ const calls: string[] = [];
172
+ let count = 0;
173
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
174
+ build: () => {
175
+ const tag = `built-${++count}`;
176
+ return {
177
+ onLicenseRequest: () => {
178
+ calls.push(tag);
179
+ return { url: `handled-by-${tag}` };
180
+ },
181
+ };
182
+ },
183
+ });
184
+
185
+ buildIntegration('drm', 'widevine', 'instance-a');
186
+ buildIntegration('drm', 'widevine', 'instance-b');
187
+
188
+ await emit('onLicenseRequest', licenseRequest('drm', 'widevine', 'instance-a'));
189
+ await emit('onLicenseRequest', licenseRequest('drm', 'widevine', 'instance-b'));
190
+
191
+ assert.deepEqual(calls, ['built-1', 'built-2']);
192
+ });
193
+
194
+ test('disposing an integration removes it from the registry', async () => {
195
+ const { registry, buildIntegration, emit } = setup();
196
+ const calls: string[] = [];
197
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
198
+ build: () => ({
199
+ onLicenseRequest: () => {
200
+ calls.push('handled');
201
+ return { url: 'handled' };
202
+ },
203
+ }),
204
+ });
205
+ buildIntegration('drm', 'widevine', 'instance-a');
206
+ emit('onIntegrationDisposed', { integrationId: 'drm', keySystemId: 'widevine', integrationInstanceId: 'instance-a' });
207
+
208
+ await emit('onLicenseRequest', licenseRequest('drm', 'widevine', 'instance-a'));
209
+
210
+ // The disposed integration must not handle the callback; the request passes through unmodified.
211
+ assert.deepEqual(calls, []);
212
+ const processed = nativeModuleCalls.filter((c) => c.method === 'onLicenseRequestProcessedAsRequest');
213
+ assert.equal(processed.length, 1);
214
+ assert.equal((processed[0].args[0] as { url: string }).url, 'https://license.server/');
215
+ });
216
+
217
+ test('events without an instance identifier keep the single-integration behaviour', async () => {
218
+ const { registry, buildIntegration, emit } = setup();
219
+ const calls: string[] = [];
220
+ let count = 0;
221
+ registry.registerContentProtectionIntegration('drm', 'widevine' as never, {
222
+ build: () => {
223
+ const tag = `built-${++count}`;
224
+ return {
225
+ onLicenseRequest: () => {
226
+ calls.push(tag);
227
+ return { url: `handled-by-${tag}` };
228
+ },
229
+ };
230
+ },
231
+ });
232
+
233
+ buildIntegration('drm', 'widevine');
234
+ buildIntegration('drm', 'widevine');
235
+
236
+ await emit('onLicenseRequest', licenseRequest('drm', 'widevine'));
237
+
238
+ assert.deepEqual(calls, ['built-2']);
239
+ });
@@ -15,7 +15,7 @@
15
15
  * <br/> - The error codes correspond to the error codes documented in the {@link https://developers.google.com/cast/docs/reference/chrome/chrome.cast.html#.ErrorCode | Chromecast API reference}.
16
16
  *
17
17
  * @category Errors
18
- * @categort Casting
18
+ * @category Casting
19
19
  * @public
20
20
  */
21
21
  export type ChromecastErrorCode =
@@ -34,7 +34,7 @@ export type ChromecastErrorCode =
34
34
  * An error that occurred while casting or attempting to cast to Chromecast.
35
35
  *
36
36
  * @category Errors
37
- * @categort Casting
37
+ * @category Casting
38
38
  * @public
39
39
  */
40
40
  export interface ChromecastError {
@@ -25,7 +25,7 @@ import type { TheoAdsEvent } from '../event/TheoAdsEvent';
25
25
  import type { TheoLiveEvent } from '../event/TheoLiveEvent';
26
26
 
27
27
  /**
28
- * The event types dispatched by the {@link Player}.
28
+ * The event types dispatched by the {@link react-native-theoplayer!THEOplayer}.
29
29
  *
30
30
  * @category Player
31
31
  * @category Events
@@ -39,7 +39,7 @@ export interface Interstitial {
39
39
  /**
40
40
  * The ad tag parameters that are used for this specific ad break.
41
41
  * @remarks
42
- * <br/> - The set values are combined and potentially override parameters set on the {@link TheoAdDescription.adTagParameters} or through {@link TheoAds.replaceAdTagParameters}.
42
+ * <br/> - The set values are combined and potentially override parameters set on the {@link TheoAdDescription.adTagParameters} or through {@link TheoAdsAPI.replaceAdTagParameters}.
43
43
  */
44
44
  adTagParameters: Record<string, string>;
45
45
  }
@@ -24,24 +24,43 @@ export interface TheoLiveEndpoint {
24
24
  * For most endpoint types, this is the source URL string.
25
25
  * For millicast endpoints, this is a {@link EndpointMillicastSource} object.
26
26
  *
27
- * @platform web
27
+ * Undefined if the endpoint has no source.
28
+ *
29
+ * @platform android,ios,web
28
30
  */
29
31
  src?: string | EndpointMillicastSource;
30
32
 
31
33
  /**
32
- * The type of source (e.g. 'hesp', 'hls', 'hlsMpegTs', 'millicast', 'dai').
34
+ * The type of source (e.g. 'hesp', 'hls', 'hlsMpegTs', 'dash', 'millicast', 'dai').
33
35
  *
34
- * @platform web
36
+ * @remarks
37
+ * Undefined if the endpoint has no source.
38
+ * The 'dash' type is only reported on Web; Android and iOS do not support DASH endpoints.
39
+ *
40
+ * @platform android,ios,web
35
41
  */
36
42
  srcType?: string;
37
43
 
38
44
  /**
39
- * The provider of this endpoint (e.g. 'optiview').
45
+ * The provider of this endpoint (e.g. 'optiview', 'mediakind').
40
46
  *
41
- * @platform web
47
+ * @remarks
48
+ * Unknown providers are reported verbatim. Undefined if the discovery response does not specify one.
49
+ *
50
+ * @platform android,ios,web
42
51
  */
43
52
  provider?: string;
44
53
 
54
+ /**
55
+ * The ad system associated with this endpoint (e.g. 'sgai', 'mediakind', 'dai').
56
+ *
57
+ * @remarks
58
+ * Unknown ad systems are reported verbatim. Only populated for V3 distributions; undefined otherwise.
59
+ *
60
+ * @platform android,ios,web
61
+ */
62
+ adSystem?: string;
63
+
45
64
  millicastSrc?: EndpointMillicastSource;
46
65
  hespSrc?: string;
47
66
  hlsSrc?: string;
@@ -6,7 +6,7 @@
6
6
  * to increase the jitter buffer size.
7
7
  *
8
8
  * @category THEOlive
9
- * @remark This is a hint, and factors like network jitter and audio/video sync latency affect the actual delay applied.
9
+ * @remarks This is a hint, and factors like network jitter and audio/video sync latency affect the actual delay applied.
10
10
  * @public
11
11
  */
12
12
  export interface WebrtcPlayoutDelay {
@@ -87,6 +87,18 @@ import { fromNativeCue, fromNativeMediaTrack, fromNativeTextTrack } from './web/
87
87
  export class WebEventForwarder {
88
88
  private readonly _player: ChromelessPlayer;
89
89
  private readonly _facade: THEOplayerWebAdapter;
90
+ private readonly _textTrackListeners = new Map<
91
+ number,
92
+ {
93
+ track: NativeTextTrack;
94
+ addcue: (event: NativeTextTrackAddCueEvent) => void;
95
+ removecue: (event: NativeTextTrackRemoveCueEvent) => void;
96
+ entercue: (event: NativeTextTrackEnterCueEvent) => void;
97
+ exitcue: (event: NativeTextTrackExitCueEvent) => void;
98
+ }
99
+ >();
100
+ private readonly _forwardedTextTrackCues = new Map<number, Set<number>>();
101
+ private readonly _mediaTrackListeners = new Map<number, { track: NativeMediaTrack; listener: () => void }>();
90
102
 
91
103
  constructor(player: ChromelessPlayer, facade: THEOplayerWebAdapter) {
92
104
  this._player = player;
@@ -194,6 +206,20 @@ export class WebEventForwarder {
194
206
  this._player.ads?.removeEventListener(FORWARDED_ADBREAK_EVENTS, this.onAdBreakEvent);
195
207
  this._player.theoads?.removeEventListener(FORWARDED_THEOADS_EVENTS, this.onTheoAdsEvent);
196
208
  this._player.theoLive?.removeEventListener(FORWARDED_THEOLIVE_EVENTS, this.onTheoLiveEvent);
209
+
210
+ for (const listeners of this._textTrackListeners.values()) {
211
+ listeners.track.removeEventListener('addcue', listeners.addcue);
212
+ listeners.track.removeEventListener('removecue', listeners.removecue);
213
+ listeners.track.removeEventListener('entercue', listeners.entercue);
214
+ listeners.track.removeEventListener('exitcue', listeners.exitcue);
215
+ }
216
+ this._textTrackListeners.clear();
217
+ this._forwardedTextTrackCues.clear();
218
+
219
+ for (const listeners of this._mediaTrackListeners.values()) {
220
+ listeners.track.removeEventListener('activequalitychanged', listeners.listener);
221
+ }
222
+ this._mediaTrackListeners.clear();
197
223
  }
198
224
 
199
225
  private readonly onSourceChange = () => {
@@ -327,19 +353,38 @@ export class WebEventForwarder {
327
353
  if (track.kind === TextTrackKind.metadata) {
328
354
  track.mode = TextTrackMode.hidden;
329
355
  }
330
- track.addEventListener('addcue', this.onAddTextTrackCue(track));
331
- track.addEventListener('removecue', this.onRemoveTextTrackCue(track));
332
- track.addEventListener('entercue', this.onEnterTextTrackCue(track));
333
- track.addEventListener('exitcue', this.onExitTextTrackCue(track));
356
+ const listeners = {
357
+ track,
358
+ addcue: this.onAddTextTrackCue(track),
359
+ removecue: this.onRemoveTextTrackCue(track),
360
+ entercue: this.onEnterTextTrackCue(track),
361
+ exitcue: this.onExitTextTrackCue(track),
362
+ };
363
+ this._textTrackListeners.set(track.uid, listeners);
364
+ const replayedCues = new Set<number>();
365
+ track.cues?.forEach((cue) => replayedCues.add(cue.uid));
366
+ this._forwardedTextTrackCues.set(track.uid, replayedCues);
367
+ track.addEventListener('addcue', listeners.addcue);
368
+ track.addEventListener('removecue', listeners.removecue);
369
+ track.addEventListener('entercue', listeners.entercue);
370
+ track.addEventListener('exitcue', listeners.exitcue);
334
371
  this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.ADD_TRACK, fromNativeTextTrack(track)));
372
+ track.cues?.forEach((cue) => {
373
+ this._facade.dispatchEvent(new DefaultTextTrackEvent(TextTrackEventType.ADD_CUE, track.uid, fromNativeCue(cue)));
374
+ });
335
375
  };
336
376
 
337
377
  private readonly onRemoveTextTrack = (event: RemoveTrackEvent) => {
338
378
  const track = event.track as NativeTextTrack;
339
- track.removeEventListener('addcue', this.onAddTextTrackCue(track));
340
- track.removeEventListener('removecue', this.onRemoveTextTrackCue(track));
341
- track.removeEventListener('entercue', this.onEnterTextTrackCue(track));
342
- track.removeEventListener('exitcue', this.onExitTextTrackCue(track));
379
+ const listeners = this._textTrackListeners.get(track.uid);
380
+ if (listeners) {
381
+ track.removeEventListener('addcue', listeners.addcue);
382
+ track.removeEventListener('removecue', listeners.removecue);
383
+ track.removeEventListener('entercue', listeners.entercue);
384
+ track.removeEventListener('exitcue', listeners.exitcue);
385
+ this._textTrackListeners.delete(track.uid);
386
+ }
387
+ this._forwardedTextTrackCues.delete(track.uid);
343
388
  this._facade.dispatchEvent(new DefaultTextTrackListEvent(TrackListEventType.REMOVE_TRACK, fromNativeTextTrack(track)));
344
389
  };
345
390
 
@@ -357,7 +402,9 @@ export class WebEventForwarder {
357
402
 
358
403
  private readonly onAddMediaTrack = (event: AddTrackEvent, trackType: MediaTrackType) => {
359
404
  const track = event.track as NativeMediaTrack;
360
- track.addEventListener('activequalitychanged', this.onActiveQualityChanged(trackType, track));
405
+ const listener = this.onActiveQualityChanged(trackType, track);
406
+ this._mediaTrackListeners.set(track.uid, { track, listener });
407
+ track.addEventListener('activequalitychanged', listener);
361
408
  this._facade.dispatchEvent(new DefaultMediaTrackListEvent(TrackListEventType.ADD_TRACK, trackType, track as MediaTrack));
362
409
  };
363
410
 
@@ -371,7 +418,11 @@ export class WebEventForwarder {
371
418
 
372
419
  private readonly onRemoveMediaTrack = (event: RemoveTrackEvent, trackType: MediaTrackType) => {
373
420
  const track = event.track as NativeMediaTrack;
374
- track.removeEventListener('activequalitychanged', this.onActiveQualityChanged(trackType, track));
421
+ const listeners = this._mediaTrackListeners.get(track.uid);
422
+ if (listeners) {
423
+ track.removeEventListener('activequalitychanged', listeners.listener);
424
+ this._mediaTrackListeners.delete(track.uid);
425
+ }
375
426
  this._facade.dispatchEvent(new DefaultMediaTrackListEvent(TrackListEventType.REMOVE_TRACK, trackType, track as MediaTrack));
376
427
  };
377
428
 
@@ -448,6 +499,10 @@ export class WebEventForwarder {
448
499
  private readonly onAddTextTrackCue = (track: NativeTextTrack) => (event: NativeTextTrackAddCueEvent) => {
449
500
  const { cue } = event;
450
501
  if (cue) {
502
+ const replayedCues = this._forwardedTextTrackCues.get(track.uid);
503
+ if (replayedCues?.has(cue.uid)) {
504
+ return;
505
+ }
451
506
  this._facade.dispatchEvent(new DefaultTextTrackEvent(TextTrackEventType.ADD_CUE, track.uid, fromNativeCue(cue)));
452
507
  }
453
508
  };
@@ -455,6 +510,10 @@ export class WebEventForwarder {
455
510
  private readonly onRemoveTextTrackCue = (track: NativeTextTrack) => (event: NativeTextTrackRemoveCueEvent) => {
456
511
  const { cue } = event;
457
512
  if (cue) {
513
+ const replayedCues = this._forwardedTextTrackCues.get(track.uid);
514
+ if (replayedCues) {
515
+ replayedCues.delete(cue.uid);
516
+ }
458
517
  this._facade.dispatchEvent(new DefaultTextTrackEvent(TextTrackEventType.REMOVE_CUE, track.uid, fromNativeCue(cue)));
459
518
  }
460
519
  };