From 90084423436d7562ce0c3705559b6686cabd4475 Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Mon, 19 Feb 2024 11:20:40 +0100 Subject: [PATCH 1/5] Rename native player modules --- src/internal/adapter/THEOplayerAdapter.ts | 36 ++++++++------- src/internal/adapter/abr/AbrAdapter.ts | 4 +- .../adapter/ads/THEOplayerNativeAdsAdapter.ts | 14 +++--- .../adapter/ads/THEOplayerNativeGoogleDAI.ts | 10 ++-- .../broadcast/EventBroadcastAdapter.ts | 4 +- .../adapter/cast/THEOplayerNativeAirplay.ts | 10 ++-- .../cast/THEOplayerNativeChromecast.ts | 14 +++--- .../adapter/track/TextTrackStyleAdapter.ts | 21 +++++---- src/internal/cache/MediaCache.ts | 8 ++-- .../cache/NativeCachingTaskAdapter.ts | 10 ++-- src/internal/drm/ContentProtectionRegistry.ts | 46 ++++++++++--------- 11 files changed, 99 insertions(+), 78 deletions(-) diff --git a/src/internal/adapter/THEOplayerAdapter.ts b/src/internal/adapter/THEOplayerAdapter.ts index 2a6a1728f..92152a4e1 100644 --- a/src/internal/adapter/THEOplayerAdapter.ts +++ b/src/internal/adapter/THEOplayerAdapter.ts @@ -51,6 +51,8 @@ import { TextTrackStyleAdapter } from './track/TextTrackStyleAdapter'; import type { NativePlayerState } from './NativePlayerState'; import { EventBroadcastAdapter } from './broadcast/EventBroadcastAdapter'; +const NativePlayerModule = NativeModules.THEORCTPlayerModule; + const defaultPlayerState: NativePlayerState = { source: undefined, autoplay: false, @@ -281,7 +283,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set preload(type: PreloadType) { this._state.preload = type; - NativeModules.PlayerModule.setPreload(this._view.nativeHandle, type); + NativePlayerModule.setPreload(this._view.nativeHandle, type); } get preload(): PreloadType { @@ -325,7 +327,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im } this._state.currentTime = seekTime; - NativeModules.PlayerModule.setCurrentTime(this._view.nativeHandle, seekTime); + NativePlayerModule.setCurrentTime(this._view.nativeHandle, seekTime); } get duration(): number { @@ -338,7 +340,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set pipConfiguration(pipConfiguration: PiPConfiguration) { this._state.pipConfig = pipConfiguration; - NativeModules.PlayerModule.setPipConfig(this._view.nativeHandle, pipConfiguration); + NativePlayerModule.setPipConfig(this._view.nativeHandle, pipConfiguration); } get backgroundAudioConfiguration(): BackgroundAudioConfiguration { @@ -347,7 +349,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set backgroundAudioConfiguration(backgroundAudioConfiguration: BackgroundAudioConfiguration) { this._state.backgroundAudioConfig = backgroundAudioConfiguration; - NativeModules.PlayerModule.setBackgroundAudioConfig(this._view.nativeHandle, backgroundAudioConfiguration); + NativePlayerModule.setBackgroundAudioConfig(this._view.nativeHandle, backgroundAudioConfiguration); } get presentationMode(): PresentationMode { @@ -356,7 +358,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set presentationMode(presentationMode: PresentationMode) { this._state.presentationMode = presentationMode; - NativeModules.PlayerModule.setPresentationMode(this._view.nativeHandle, presentationMode); + NativePlayerModule.setPresentationMode(this._view.nativeHandle, presentationMode); } get muted(): boolean { @@ -365,7 +367,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set muted(muted: boolean) { this._state.muted = muted; - NativeModules.PlayerModule.setMuted(this._view.nativeHandle, muted); + NativePlayerModule.setMuted(this._view.nativeHandle, muted); } get seeking(): boolean { @@ -382,7 +384,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set playbackRate(playbackRate: number) { this._state.playbackRate = playbackRate; - NativeModules.PlayerModule.setPlaybackRate(this._view.nativeHandle, playbackRate); + NativePlayerModule.setPlaybackRate(this._view.nativeHandle, playbackRate); } get audioTracks(): MediaTrack[] { @@ -398,7 +400,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im return; } this._state.selectedAudioTrack = trackUid; - NativeModules.PlayerModule.setSelectedAudioTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1); + NativePlayerModule.setSelectedAudioTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1); } get videoTracks(): MediaTrack[] { @@ -415,7 +417,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im } this._state.selectedVideoTrack = trackUid; this._state.targetVideoQuality = undefined; - NativeModules.PlayerModule.setSelectedVideoTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1); + NativePlayerModule.setSelectedVideoTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1); } get textTracks(): TextTrack[] { @@ -438,7 +440,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im track.mode = TextTrackMode.disabled; } }); - NativeModules.PlayerModule.setSelectedTextTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1); + NativePlayerModule.setSelectedTextTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1); } get textTrackStyle(): TextTrackStyle { @@ -453,7 +455,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im // This is to correctly reset autoplay during a source change. this.pause(); this._state.source = source; - NativeModules.PlayerModule.setSource(this._view.nativeHandle, source); + NativePlayerModule.setSource(this._view.nativeHandle, source); // Reset state for play-out of new source Object.assign(this._state, { playbackRate: 1, @@ -486,7 +488,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im if (track) { Object.assign(track, { ...track, targetQuality: this._state.targetVideoQuality }); } - NativeModules.PlayerModule.setTargetVideoQuality(this._view.nativeHandle, this._state.targetVideoQuality); + NativePlayerModule.setTargetVideoQuality(this._view.nativeHandle, this._state.targetVideoQuality); } get volume(): number { @@ -495,7 +497,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set volume(volume: number) { this._state.volume = volume; - NativeModules.PlayerModule.setVolume(this._view.nativeHandle, volume); + NativePlayerModule.setVolume(this._view.nativeHandle, volume); } get aspectRatio(): AspectRatio { @@ -504,7 +506,7 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set aspectRatio(ratio: AspectRatio) { this._state.aspectRatio = ratio; - NativeModules.PlayerModule.setAspectRatio(this._view.nativeHandle, ratio); + NativePlayerModule.setAspectRatio(this._view.nativeHandle, ratio); } get keepScreenOn(): boolean { @@ -514,21 +516,21 @@ export class THEOplayerAdapter extends DefaultEventDispatcher im set keepScreenOn(value: boolean) { this._state.keepScreenOn = value; if (Platform.OS === 'android') { - NativeModules.PlayerModule.setKeepScreenOn(this._view.nativeHandle, value); + NativePlayerModule.setKeepScreenOn(this._view.nativeHandle, value); } } pause(): void { if (this.hasValidSource()) { this._state.paused = true; - NativeModules.PlayerModule.setPaused(this._view.nativeHandle, true); + NativePlayerModule.setPaused(this._view.nativeHandle, true); } } play(): void { if (this.hasValidSource()) { this._state.paused = false; - NativeModules.PlayerModule.setPaused(this._view.nativeHandle, false); + NativePlayerModule.setPaused(this._view.nativeHandle, false); } } diff --git a/src/internal/adapter/abr/AbrAdapter.ts b/src/internal/adapter/abr/AbrAdapter.ts index f66730cfa..a3c3d661f 100644 --- a/src/internal/adapter/abr/AbrAdapter.ts +++ b/src/internal/adapter/abr/AbrAdapter.ts @@ -1,6 +1,8 @@ import type { ABRConfiguration, ABRStrategy, THEOplayerView } from 'react-native-theoplayer'; import { NativeModules } from 'react-native'; +const NativePlayerModule = NativeModules.THEORCTPlayerModule; + export class AbrAdapter implements ABRConfiguration { private readonly _view: THEOplayerView; private _strategy: ABRStrategy | undefined; @@ -29,7 +31,7 @@ export class AbrAdapter implements ABRConfiguration { } private updateConfig() { - NativeModules.PlayerModule.setABRConfig(this._view.nativeHandle, { + NativePlayerModule.setABRConfig(this._view.nativeHandle, { targetBuffer: this._targetBuffer, strategy: this._strategy, }); diff --git a/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts b/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts index 2b62422c3..839d6e116 100644 --- a/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts +++ b/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts @@ -2,6 +2,8 @@ import type { Ad, AdBreak, AdDescription, AdsAPI, GoogleDAI, THEOplayerView } fr import { NativeModules } from 'react-native'; import { THEOplayerNativeGoogleDAI } from './THEOplayerNativeGoogleDAI'; +const NativeAdsModule = NativeModules.THEORCTAdsModule; + export class THEOplayerNativeAdsAdapter implements AdsAPI { private readonly _dai: GoogleDAI; @@ -10,27 +12,27 @@ export class THEOplayerNativeAdsAdapter implements AdsAPI { } playing(): Promise { - return NativeModules.AdsModule.playing(this._player.nativeHandle); + return NativeAdsModule.playing(this._player.nativeHandle); } skip(): void { - NativeModules.AdsModule.skip(this._player.nativeHandle); + NativeAdsModule.skip(this._player.nativeHandle); } currentAdBreak(): Promise { - return NativeModules.AdsModule.currentAdBreak(this._player.nativeHandle); + return NativeAdsModule.currentAdBreak(this._player.nativeHandle); } currentAds(): Promise { - return NativeModules.AdsModule.currentAds(this._player.nativeHandle); + return NativeAdsModule.currentAds(this._player.nativeHandle); } scheduledAdBreaks(): Promise { - return NativeModules.AdsModule.scheduledAdBreaks(this._player.nativeHandle); + return NativeAdsModule.scheduledAdBreaks(this._player.nativeHandle); } schedule(ad: AdDescription): void { - NativeModules.AdsModule.schedule(this._player.nativeHandle, ad); + NativeAdsModule.schedule(this._player.nativeHandle, ad); } get dai(): GoogleDAI | undefined { diff --git a/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts b/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts index 4ea1f4689..0fb66d76e 100644 --- a/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts +++ b/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts @@ -1,22 +1,24 @@ import type { GoogleDAI, THEOplayerView } from 'react-native-theoplayer'; import { NativeModules } from 'react-native'; +const NativeAdsModule = NativeModules.THEORCTAdsModule; + export class THEOplayerNativeGoogleDAI implements GoogleDAI { public constructor(private readonly _player: THEOplayerView) {} get snapback(): Promise { - return NativeModules.AdsModule.daiSnapback(this._player.nativeHandle); + return NativeAdsModule.daiSnapback(this._player.nativeHandle); } setSnapback(enabled: boolean): void { - NativeModules.AdsModule.daiSetSnapback(this._player.nativeHandle, enabled); + NativeAdsModule.daiSetSnapback(this._player.nativeHandle, enabled); } contentTimeForStreamTime(time: number): Promise { - return NativeModules.AdsModule.daiContentTimeForStreamTime(this._player.nativeHandle, time); + return NativeAdsModule.daiContentTimeForStreamTime(this._player.nativeHandle, time); } streamTimeForContentTime(time: number): Promise { - return NativeModules.AdsModule.daiStreamTimeForContentTime(this._player.nativeHandle, time); + return NativeAdsModule.daiStreamTimeForContentTime(this._player.nativeHandle, time); } } diff --git a/src/internal/adapter/broadcast/EventBroadcastAdapter.ts b/src/internal/adapter/broadcast/EventBroadcastAdapter.ts index 5dcad953c..c357f69db 100644 --- a/src/internal/adapter/broadcast/EventBroadcastAdapter.ts +++ b/src/internal/adapter/broadcast/EventBroadcastAdapter.ts @@ -3,6 +3,8 @@ import { NativeModules } from 'react-native'; import type { THEOplayerAdapter } from '../THEOplayerAdapter'; import type { StringKeyOf } from '../../../api/event/EventDispatcher'; +const NativeEventBroadcastModule = NativeModules.THEORCTEventBroadcastModule; + export class EventBroadcastAdapter implements EventBroadcastAPI { constructor(private _player: THEOplayer) {} @@ -12,7 +14,7 @@ export class EventBroadcastAdapter implements EventBroadcastAPI { try { // Broadcast native event. - NativeModules.EventBroadcastModule.broadcastEvent(this._player.nativeHandle, Object.freeze(event)); + NativeEventBroadcastModule.broadcastEvent(this._player.nativeHandle, Object.freeze(event)); } catch (e) { console.warn(`EventBroadcastModule not available: ${e}`); } diff --git a/src/internal/adapter/cast/THEOplayerNativeAirplay.ts b/src/internal/adapter/cast/THEOplayerNativeAirplay.ts index 607df01b7..3a5ecc7ef 100644 --- a/src/internal/adapter/cast/THEOplayerNativeAirplay.ts +++ b/src/internal/adapter/cast/THEOplayerNativeAirplay.ts @@ -2,6 +2,8 @@ import type { Airplay } from 'react-native-theoplayer'; import { CastEvent, CastEventType, CastState, PlayerEventType, THEOplayer } from 'react-native-theoplayer'; import { NativeModules } from 'react-native'; +const NativeCastModule = NativeModules.THEORCTCastModule; + export class THEOplayerNativeAirplay implements Airplay { private readonly _player: THEOplayer; @@ -14,8 +16,8 @@ export class THEOplayerNativeAirplay implements Airplay { } async init_(): Promise { - this._casting = await NativeModules.CastModule.airplayCasting(this._player.nativeHandle); - this._state = await NativeModules.CastModule.airplayState(this._player.nativeHandle); + this._casting = await NativeCastModule.airplayCasting(this._player.nativeHandle); + this._state = await NativeCastModule.airplayState(this._player.nativeHandle); } private readonly _onCastStateChange = (event: CastEvent) => { @@ -34,11 +36,11 @@ export class THEOplayerNativeAirplay implements Airplay { } start(): void { - NativeModules.CastModule.airplayStart(this._player.nativeHandle); + NativeCastModule.airplayStart(this._player.nativeHandle); } stop(): void { - NativeModules.CastModule.airplayStop(this._player.nativeHandle); + NativeCastModule.airplayStop(this._player.nativeHandle); } unload_(): void { diff --git a/src/internal/adapter/cast/THEOplayerNativeChromecast.ts b/src/internal/adapter/cast/THEOplayerNativeChromecast.ts index 86a344de1..7bca9729b 100644 --- a/src/internal/adapter/cast/THEOplayerNativeChromecast.ts +++ b/src/internal/adapter/cast/THEOplayerNativeChromecast.ts @@ -2,6 +2,8 @@ import type { CastEvent, Chromecast, THEOplayerView } from 'react-native-theopla import { CastEventType, CastState, PlayerEventType, THEOplayer } from 'react-native-theoplayer'; import { NativeModules } from 'react-native'; +const NativeCastModule = NativeModules.THEORCTCastModule; + export class THEOplayerNativeChromecast implements Chromecast { private readonly _player: THEOplayer; private readonly _view: THEOplayerView; @@ -16,8 +18,8 @@ export class THEOplayerNativeChromecast implements Chromecast { } async init_(): Promise { - this._casting = await NativeModules.CastModule.chromecastCasting(this._view.nativeHandle); - this._state = await NativeModules.CastModule.chromecastState(this._view.nativeHandle); + this._casting = await NativeCastModule.chromecastCasting(this._view.nativeHandle); + this._state = await NativeCastModule.chromecastState(this._view.nativeHandle); } private readonly _onCastStateChange = (event: CastEvent) => { @@ -36,19 +38,19 @@ export class THEOplayerNativeChromecast implements Chromecast { } start(): void { - NativeModules.CastModule.chromecastStart(this._view.nativeHandle); + NativeCastModule.chromecastStart(this._view.nativeHandle); } stop(): void { - NativeModules.CastModule.chromecastStop(this._view.nativeHandle); + NativeCastModule.chromecastStop(this._view.nativeHandle); } join(): void { - NativeModules.CastModule.chromecastJoin(this._view.nativeHandle); + NativeCastModule.chromecastJoin(this._view.nativeHandle); } leave(): void { - NativeModules.CastModule.chromecastLeave(this._view.nativeHandle); + NativeCastModule.chromecastLeave(this._view.nativeHandle); } unload_(): void { diff --git a/src/internal/adapter/track/TextTrackStyleAdapter.ts b/src/internal/adapter/track/TextTrackStyleAdapter.ts index 4d78371f3..31f0b3c7c 100644 --- a/src/internal/adapter/track/TextTrackStyleAdapter.ts +++ b/src/internal/adapter/track/TextTrackStyleAdapter.ts @@ -3,6 +3,7 @@ import { NativeModules } from 'react-native'; import NamedColors from './NamedColors.json'; const namedColorsMap = NamedColors as { [name: string]: string }; +const NativePlayerModule = NativeModules.THEORCTPlayerModule; export class TextTrackStyleAdapter implements TextTrackStyle { private _backgroundColor: string | undefined = undefined; @@ -24,7 +25,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set backgroundColor(color: string | undefined) { this._backgroundColor = color; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { backgroundColor: convertColorToRGBA(color), }); } @@ -35,7 +36,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set edgeStyle(style: EdgeStyle | undefined) { this._edgeStyle = style; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { edgeStyle: style, }); } @@ -46,7 +47,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set fontColor(color: string | undefined) { this._fontColor = color; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { fontColor: convertColorToRGBA(color), }); } @@ -57,7 +58,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set fontFamily(family: string | undefined) { this._fontFamily = family; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { fontFamily: family, }); } @@ -68,7 +69,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set fontSize(size: string | undefined) { this._fontSize = size; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { fontSize: fromPercentage(size), }); } @@ -79,7 +80,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set windowColor(color: string | undefined) { this._windowColor = color; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { windowColor: convertColorToRGBA(color), }); } @@ -90,7 +91,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set marginBottom(margin: number | undefined) { this._marginBottom = margin; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { marginBottom: margin, }); } @@ -101,7 +102,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set marginLeft(margin: number | undefined) { this._marginLeft = margin; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { marginLeft: margin, }); } @@ -112,7 +113,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set marginRight(margin: number | undefined) { this._marginRight = margin; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { marginRight: margin, }); } @@ -123,7 +124,7 @@ export class TextTrackStyleAdapter implements TextTrackStyle { set marginTop(margin: number | undefined) { this._marginTop = margin; - NativeModules.PlayerModule.setTextTrackStyle(this._view.nativeHandle, { + NativePlayerModule.setTextTrackStyle(this._view.nativeHandle, { marginTop: margin, }); } diff --git a/src/internal/cache/MediaCache.ts b/src/internal/cache/MediaCache.ts index 43b1f6e5e..ff41208e1 100644 --- a/src/internal/cache/MediaCache.ts +++ b/src/internal/cache/MediaCache.ts @@ -13,6 +13,8 @@ import { toNativeCachingTaskParameters } from "./NativeCachingTaskParametersAdap const TAG = "NativeMediaCache"; +const NativeCacheModule = NativeModules.THEORCTCacheModule; + interface NativeCachingStatusChangeEvent { readonly id: string; readonly status: CacheTaskStatus; @@ -43,7 +45,7 @@ interface NativeCachingTaskProgressEvent { } export class NativeMediaCache extends DefaultEventDispatcher implements MediaCacheAPI { - private _emitter: NativeEventEmitter = new NativeEventEmitter(NativeModules.CacheModule); + private _emitter: NativeEventEmitter = new NativeEventEmitter(NativeCacheModule); private _status: CacheStatus = CacheStatus.uninitialised; private _tasks: NativeCachingTaskAdapter[] = []; @@ -58,7 +60,7 @@ export class NativeMediaCache extends DefaultEventDispatcher impl } async createTask(source: SourceDescription, parameters: CachingTaskParameters): Promise { - return NativeModules.CacheModule.createTask(source, toNativeCachingTaskParameters(parameters)); + return NativeCacheModule.createTask(source, toNativeCachingTaskParameters(parameters)); } get status(): CacheStatus { @@ -81,7 +83,7 @@ export class NativeMediaCache extends DefaultEventDispatcher impl } private async getInitialState(): Promise { - const initialState = await NativeModules.CacheModule.getInitialState(); + const initialState = await NativeCacheModule.getInitialState(); this._status = initialState.status; this._tasks = initialState.tasks.map((task: NativeCachingTask) => new NativeCachingTaskAdapter(task)); } diff --git a/src/internal/cache/NativeCachingTaskAdapter.ts b/src/internal/cache/NativeCachingTaskAdapter.ts index 6280e55b6..4891e7089 100644 --- a/src/internal/cache/NativeCachingTaskAdapter.ts +++ b/src/internal/cache/NativeCachingTaskAdapter.ts @@ -12,6 +12,8 @@ import { NativeModules } from 'react-native'; import type { DRMConfiguration } from 'react-native-theoplayer'; import { fromNativeCachingTaskParameters, NativeCachingTaskParameters } from "./NativeCachingTaskParametersAdapter"; +const NativeCacheModule = NativeModules.THEORCTCacheModule; + export interface NativeCachingTask { readonly id: string; @@ -56,7 +58,7 @@ export class NativeCachingTaskAdapter extends DefaultEventDispatcher { const { requestId, integrationId, keySystemId, drmConfig } = event; - console.log('ContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`); + console.log('NativeContentProtectionModule', `onBuildIntegrationRequest ${integrationId} ${keySystemId}`); const factory = this.getFactory(integrationId, keySystemId); if (factory) { this.currentIntegration = { @@ -74,9 +76,9 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI { keySystemId, integration: factory.build(drmConfig), }; - NativeModules.ContentProtectionModule.onBuildProcessed({ requestId, resultString: 'success' }); + NativeContentProtectionModule.onBuildProcessed({ requestId, resultString: 'success' }); } else { - NativeModules.ContentProtectionModule.onBuildProcessed({ + NativeContentProtectionModule.onBuildProcessed({ requestId, resultString: 'failed', }); @@ -85,40 +87,40 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI { private onCertificateRequest = async (request: NativeCertificateRequest) => { const { requestId, integrationId, keySystemId } = request; - console.log('ContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`); + console.log('NativeContentProtectionModule', `onCertificateRequest ${integrationId} ${keySystemId}`); const integration = this.getIntegration(integrationId, keySystemId); if (integration?.onCertificateRequest) { const result = await integration.onCertificateRequest(fromNativeCertificateRequest(request)); // TODO: we also want to support ArrayBufferView results if (isBufferSource(result)) { const nativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer); - NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse); + NativeContentProtectionModule.onCertificateRequestProcessedAsCertificate(nativeResponse); } else if (result as CertificateRequest) { const modifiedNativeRequest = toNativeCertificateRequest(requestId, integrationId, keySystemId, result as CertificateRequest); - NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest); + NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(modifiedNativeRequest); } } else { - NativeModules.ContentProtectionModule.onCertificateRequestProcessedAsRequest(request); + NativeContentProtectionModule.onCertificateRequestProcessedAsRequest(request); } }; private onCertificateResponse = async (response: NativeCertificateResponse) => { const { requestId, integrationId, keySystemId } = response; - console.log('ContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`); + console.log('NativeContentProtectionModule', `onCertificateResponse ${integrationId} ${keySystemId}`); const integration = this.getIntegration(integrationId, keySystemId); if (integration?.onCertificateResponse) { const responseResult = await integration.onCertificateResponse(fromNativeCertificateResponse(response)); // TODO: we also want to support ArrayBufferView results const modifiedNativeResponse = toNativeCertificateResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer); - NativeModules.ContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse); + NativeContentProtectionModule.onCertificateResponseProcessed(modifiedNativeResponse); } else { - NativeModules.ContentProtectionModule.onCertificateResponseProcessed(response); + NativeContentProtectionModule.onCertificateResponseProcessed(response); } }; private onLicenseRequest = async (request: NativeLicenseRequest) => { const { requestId, integrationId, keySystemId } = request; - console.log('ContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`); + console.log('NativeContentProtectionModule', `onLicenseRequest ${integrationId} ${keySystemId}`); const integration = this.getIntegration(integrationId, keySystemId); // Optionally let the custom integration modify the request. if (integration?.onLicenseRequest) { @@ -126,43 +128,43 @@ export class NativeContentProtectionRegistry implements ContentProtectionAPI { // TODO: we also want to support ArrayBufferView results if (isBufferSource(result)) { const nativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, result as ArrayBuffer); - NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse); + NativeContentProtectionModule.onLicenseRequestProcessedAsLicense(nativeResponse); } else if (result as LicenseRequest) { const modifiedNativeRequest = toNativeLicenseRequest(requestId, integrationId, keySystemId, result as LicenseRequest); - NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest); + NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(modifiedNativeRequest); } } else { - NativeModules.ContentProtectionModule.onLicenseRequestProcessedAsRequest(request); + NativeContentProtectionModule.onLicenseRequestProcessedAsRequest(request); } }; private onLicenseResponse = async (response: NativeLicenseResponse) => { const { requestId, integrationId, keySystemId } = response; - console.log('ContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`); + console.log('NativeContentProtectionModule', `onLicenseResponse ${integrationId} ${keySystemId}`); const integration = this.getIntegration(integrationId, keySystemId); if (integration?.onLicenseResponse) { const responseResult = await integration.onLicenseResponse(fromNativeLicenseResponse(response)); // TODO: we also want to support ArrayBufferView results const modifiedNativeResponse = toNativeLicenseResponseResult(requestId, integrationId, keySystemId, responseResult as ArrayBuffer); - NativeModules.ContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse); + NativeContentProtectionModule.onLicenseResponseProcessed(modifiedNativeResponse); } else { - NativeModules.ContentProtectionModule.onLicenseResponseProcessed(response); + NativeContentProtectionModule.onLicenseResponseProcessed(response); } }; private onExtractFairplayContentId = async (event: ExtractFaiplayContentIdEvent) => { const { integrationId, keySystemId, fairplaySkdUrl, requestId } = event; - console.log('ContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`); + console.log('NativeContentProtectionModule', `onExtractFairplayContentId ${integrationId} ${keySystemId}`); const integration = this.getIntegration(integrationId, keySystemId); if (integration?.extractFairplayContentId) { const contentId = await integration.extractFairplayContentId(fairplaySkdUrl); - NativeModules.ContentProtectionModule.onExtractFairplayContentIdProcessed({ + NativeContentProtectionModule.onExtractFairplayContentIdProcessed({ requestId, contentId, }); } else { const contentId = fairplaySkdUrl; - NativeModules.ContentProtectionModule.onExtractFairplayContentIdProcessed({ + NativeContentProtectionModule.onExtractFairplayContentIdProcessed({ requestId, contentId, }); From 437773168188c192b51949189f28205fc966eeff Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Mon, 19 Feb 2024 11:21:02 +0100 Subject: [PATCH 2/5] Match native module naming on Android --- android/src/main/java/com/theoplayer/ads/AdsModule.kt | 2 +- .../main/java/com/theoplayer/broadcast/EventBroadcastModule.kt | 2 +- android/src/main/java/com/theoplayer/cache/CacheModule.kt | 2 +- android/src/main/java/com/theoplayer/cast/CastModule.kt | 2 +- .../src/main/java/com/theoplayer/drm/ContentProtectionModule.kt | 2 +- android/src/main/java/com/theoplayer/player/PlayerModule.kt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/com/theoplayer/ads/AdsModule.kt b/android/src/main/java/com/theoplayer/ads/AdsModule.kt index a5596804c..9e3cb3387 100644 --- a/android/src/main/java/com/theoplayer/ads/AdsModule.kt +++ b/android/src/main/java/com/theoplayer/ads/AdsModule.kt @@ -9,7 +9,7 @@ import com.theoplayer.util.ViewResolver import com.theoplayer.ReactTHEOplayerView import com.theoplayer.android.api.error.THEOplayerException -private const val TAG = "AdsModule" +private const val TAG = "THEORCTAdsModule" class AdsModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) { private val sourceHelper = SourceAdapter() diff --git a/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt b/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt index 2ffa6c39d..5c1cf8c75 100644 --- a/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt +++ b/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt @@ -9,7 +9,7 @@ import com.facebook.react.module.annotations.ReactModule import com.theoplayer.ReactTHEOplayerView import com.theoplayer.util.ViewResolver -private const val TAG = "EventBroadcastModule" +private const val TAG = "THEORCTEventBroadcastModule" @ReactModule(name = TAG) class EventBroadcastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) { diff --git a/android/src/main/java/com/theoplayer/cache/CacheModule.kt b/android/src/main/java/com/theoplayer/cache/CacheModule.kt index 93a5bef08..4d8081c31 100644 --- a/android/src/main/java/com/theoplayer/cache/CacheModule.kt +++ b/android/src/main/java/com/theoplayer/cache/CacheModule.kt @@ -30,7 +30,7 @@ import com.theoplayer.source.SourceAdapter import org.json.JSONException import org.json.JSONObject -private const val TAG = "CacheModule" +private const val TAG = "THEORCTCacheModule" private const val PROP_STATUS = "status" private const val PROP_ID = "id" diff --git a/android/src/main/java/com/theoplayer/cast/CastModule.kt b/android/src/main/java/com/theoplayer/cast/CastModule.kt index 23fd68576..f93e374d4 100644 --- a/android/src/main/java/com/theoplayer/cast/CastModule.kt +++ b/android/src/main/java/com/theoplayer/cast/CastModule.kt @@ -14,7 +14,7 @@ class CastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule( private val viewResolver: ViewResolver = ViewResolver(context) override fun getName(): String { - return "CastModule" + return "THEORCTCastModule" } @ReactMethod diff --git a/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt b/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt index 0315b3591..a2b842c15 100644 --- a/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +++ b/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt @@ -19,7 +19,7 @@ data class BridgeRequest( val onTimeout: Runnable ) -private const val TAG = "ContentProtectionModule" +private const val TAG = "THEORCTContentProtectionModule" private const val EVENT_CERTIFICATE_REQUEST = "onCertificateRequest" private const val EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_REQUEST = "onCertificateRequestProcessedAsRequest" diff --git a/android/src/main/java/com/theoplayer/player/PlayerModule.kt b/android/src/main/java/com/theoplayer/player/PlayerModule.kt index 08c02347f..113bfae92 100644 --- a/android/src/main/java/com/theoplayer/player/PlayerModule.kt +++ b/android/src/main/java/com/theoplayer/player/PlayerModule.kt @@ -14,7 +14,7 @@ import com.theoplayer.presentation.PipConfigAdapter import com.theoplayer.track.TextTrackStyleAdapter import com.theoplayer.util.ViewResolver -private const val TAG = "PlayerModule" +private const val TAG = "THEORCTPlayerModule" @Suppress("unused") class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) { From 524d1f6b975ed341413e85f2fafc4bb44eef4abb Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Mon, 19 Feb 2024 11:28:43 +0100 Subject: [PATCH 3/5] Match native module naming on iOS --- ios/THEOplayerRCTPlayerAPI.swift | 50 ++++++++-------- ios/ads/THEOplayerRCTAdsAPI.swift | 34 +++++------ ios/cache/THEOplayerRCTCacheAPI.swift | 58 +++++++++---------- ios/casting/THEOplayerRCTCastAPI.swift | 18 +++--- .../THEOplayerRCTContentProtectionAPI.swift | 44 +++++++------- .../THEOplayerRCTEventBroadcastAPI.swift | 10 ++-- 6 files changed, 107 insertions(+), 107 deletions(-) diff --git a/ios/THEOplayerRCTPlayerAPI.swift b/ios/THEOplayerRCTPlayerAPI.swift index 275c6d3e1..8b5aa19f5 100644 --- a/ios/THEOplayerRCTPlayerAPI.swift +++ b/ios/THEOplayerRCTPlayerAPI.swift @@ -28,15 +28,15 @@ let TTS_PROP_COLOR_A = "a" @objc(THEOplayerRCTPlayerAPI) class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { @objc var bridge: RCTBridge! - + static func moduleName() -> String! { - return "PlayerModule" + return "THEORCTPlayerModule" } - + static func requiresMainQueueSetup() -> Bool { return false } - + @objc(setPaused:paused:) func setPaused(_ node: NSNumber, paused: Bool) -> Void { DispatchQueue.main.async { @@ -52,7 +52,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setSource:src:) func setSource(_ node: NSNumber, src: NSDictionary) -> Void { DispatchQueue.main.async { @@ -71,7 +71,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + private func setNewSourceDescription(player: THEOplayer, srcDescription: SourceDescription) { if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting new source on TheoPlayer") } #if canImport(THEOplayerConnectorSideloadedSubtitle) @@ -80,12 +80,12 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { player.source = srcDescription #endif } - + @objc(setABRConfig:abrConfig:) func setABRConfig(_ node: NSNumber, setABRConfig: NSDictionary) -> Void { if DEBUG_PLAYER_API { print(ERROR_MESSAGE_PLAYER_ABR_UNSUPPORTED_FEATURE) } } - + @objc(setCurrentTime:time:) func setCurrentTime(_ node: NSNumber, time: NSNumber) -> Void { DispatchQueue.main.async { @@ -97,7 +97,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setMuted:muted:) func setMuted(_ node: NSNumber, muted: Bool) -> Void { DispatchQueue.main.async { @@ -110,12 +110,12 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setVolume:volume:) func setVolume(_ node: NSNumber, volume: NSNumber) -> Void { if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting volume: TheoPlayer does not handle volume changes for iOS. This is handled by the device.") } } - + @objc(setPlaybackRate:playbackRate:) func setPlaybackRate(_ node: NSNumber, playbackRate: NSNumber) -> Void { DispatchQueue.main.async { @@ -129,7 +129,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setPresentationMode:presentationMode:) func setPresentationMode(_ node: NSNumber, presentationMode: String) -> Void { DispatchQueue.main.async { @@ -139,7 +139,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setAspectRatio:ratio:) func setAspectRatio(_ node: NSNumber, ratio: String) -> Void { DispatchQueue.main.async { @@ -153,7 +153,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setPipConfig:pipConfig:) func setPipConfig(_ node: NSNumber, pipConfig: NSDictionary) -> Void { DispatchQueue.main.async { @@ -163,13 +163,13 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + private func parsePipConfig(configDict: NSDictionary) -> PipConfig { var pipConfig = PipConfig() pipConfig.canStartPictureInPictureAutomaticallyFromInline = configDict["startsAutomatically"] as? Bool ?? false return pipConfig } - + @objc(setBackgroundAudioConfig:backgroundAudioConfig:) func setBackgroundAudioConfig(_ node: NSNumber, backgroundAudioConfig: NSDictionary) -> Void { DispatchQueue.main.async { @@ -179,13 +179,13 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + private func parseBackgroundAudioConfig(configDict: NSDictionary) -> BackgroundAudioConfig { var backgroundAudio = BackgroundAudioConfig() backgroundAudio.enabled = configDict["enabled"] as? Bool ?? false return backgroundAudio } - + @objc(setSelectedTextTrack:uid:) func setSelectedTextTrack(_ node: NSNumber, uid: NSNumber) -> Void { DispatchQueue.main.async { @@ -203,12 +203,12 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { textTrack.mode = TextTrackMode.showing } else if textTrack.mode == TextTrackMode.showing { textTrack.mode = TextTrackMode.disabled - } + } } } } } - + @objc(setSelectedAudioTrack:uid:) func setSelectedAudioTrack(_ node: NSNumber, uid: NSNumber) -> Void { DispatchQueue.main.async { @@ -227,7 +227,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setSelectedVideoTrack:uid:) func setSelectedVideoTrack(_ node: NSNumber, uid: NSNumber) -> Void { DispatchQueue.main.async { @@ -246,13 +246,13 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setTargetVideoQuality:uid:) func setTargetVideoQuality(_ node: NSNumber, uid: [NSNumber]) -> Void { if DEBUG_PLAYER_API { print(ERROR_MESSAGE_PLAYER_QUALITY_UNSUPPORTED_FEATURE) } return } - + @objc(setPreload:type:) func setPreload(_ node: NSNumber, type: String) -> Void { DispatchQueue.main.async { @@ -266,7 +266,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + @objc(setTextTrackStyle:textTrackStyle:) func setTextTrackStyle(_ node: NSNumber, textTrackStyle: NSDictionary) -> Void { DispatchQueue.main.async { @@ -306,5 +306,5 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule { } } } - + } diff --git a/ios/ads/THEOplayerRCTAdsAPI.swift b/ios/ads/THEOplayerRCTAdsAPI.swift index 02aea724a..e91d289e6 100644 --- a/ios/ads/THEOplayerRCTAdsAPI.swift +++ b/ios/ads/THEOplayerRCTAdsAPI.swift @@ -25,11 +25,11 @@ let ERROR_MESSAGE_ADS_GET_SCHEDULED_ADBREAKS_UNDEFINED = "Undefined adbreaks arr @objc(THEOplayerRCTAdsAPI) class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { @objc var bridge: RCTBridge! - + static func moduleName() -> String! { - return "AdsModule" + return "THEORCTAdsModule" } - + static func requiresMainQueueSetup() -> Bool { return false } @@ -37,7 +37,7 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { #if (GOOGLE_IMA || GOOGLE_DAI) || canImport(THEOplayerGoogleIMAIntegration) @objc(skip:) func skip(_ node: NSNumber) -> Void { - + DispatchQueue.main.async { let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView if let ads = theView.ads() { @@ -47,7 +47,7 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { } } } - + @objc(playing:resolver:rejecter:) func playing(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { DispatchQueue.main.async { @@ -60,7 +60,7 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { } } } - + @objc(currentAdBreak:resolver:rejecter:) func currentAdBreak(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { DispatchQueue.main.async { @@ -74,7 +74,7 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { } } } - + @objc(currentAds:resolver:rejecter:) func currentAds(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { DispatchQueue.main.async { @@ -92,7 +92,7 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { } } } - + @objc(scheduledAdBreaks:resolver:rejecter:) func scheduledAdBreaks(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { DispatchQueue.main.async { @@ -110,7 +110,7 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { } } } - + @objc(schedule:ad:) func schedule(_ node: NSNumber, adDict: NSDictionary) -> Void { DispatchQueue.main.async { @@ -124,46 +124,46 @@ class THEOplayerRCTAdsAPI: NSObject, RCTBridgeModule { } } } - + #else - + @objc(skip:) func skip(_ node: NSNumber) -> Void { if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) } return } - + @objc(playing:resolver:rejecter:) func playing(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) } resolve(false) } - + @objc(currentAdBreak:resolver:rejecter:) func currentAdBreak(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) } resolve([:]) } - + @objc(currentAds:resolver:rejecter:) func currentAds(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) } resolve([]) } - + @objc(scheduledAdBreaks:resolver:rejecter:) func scheduledAdBreaks(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) } resolve([]) // TODO: handle request for scheduled adbreaks. Awaiting iOS SDK implementation } - + @objc(schedule:ad:) func schedule(_ node: NSNumber, adDict: NSDictionary) -> Void { if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) } return } - + #endif } diff --git a/ios/cache/THEOplayerRCTCacheAPI.swift b/ios/cache/THEOplayerRCTCacheAPI.swift index 996818e44..bd6862b9c 100644 --- a/ios/cache/THEOplayerRCTCacheAPI.swift +++ b/ios/cache/THEOplayerRCTCacheAPI.swift @@ -22,19 +22,19 @@ let ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE = "Cache API is not supported fo class THEOplayerRCTCacheAPI: RCTEventEmitter { // MARK: Cache Listeners private var cacheStatusListener: EventListener? - + // MARK: CacheTask listeners (attached dynamically to new tasks) private var taskStateChangeListeners: [String:EventListener] = [:] // key is CacheTask.id private var taskProgressListeners: [String:EventListener] = [:] // key is CacheTask.id - + override static func moduleName() -> String! { - return "CacheModule" + return "THEORCTCacheModule" } - + override static func requiresMainQueueSetup() -> Bool { return false } - + override func supportedEvents() -> [String]! { return [ "onCacheStatusChange", @@ -44,18 +44,18 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { "onCachingTaskStatusChangeEvent" ] } - + override init() { super.init() - + // attach listeners self.attachCacheListeners() } - + deinit { self.detachCacheListeners() } - + // MARK: - attach/dettach cache Listeners private func attachCacheListeners() { #if os(iOS) @@ -67,14 +67,14 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { ]) } if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] StateChange listener attached to THEOplayer.cache") } - + // Attach listeners to all task currently known to cache for cachingTask in THEOplayer.cache.tasks { self.attachTaskListenersToTask(cachingTask) } #endif } - + private func detachCacheListeners() { #if os(iOS) // STATE_CHANGE @@ -84,7 +84,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { } #endif } - + #if os(iOS) private func attachTaskListenersToTask(_ newTask: CachingTask) { // add STATE_CHANGE listeners to newly created task @@ -94,7 +94,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { CACHETASK_PROP_ID: newTask.id, CACHE_EVENT_PROP_STATUS: THEOplayerRCTTypeUtils.cachingTaskStatusToString(newTask.status) ]) - + if let errorEvent = event as? CachingTaskErrorStateChangeEvent, let error = errorEvent.error { if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] STATE_CHANGE_ERROR event for task with id \(newTask.id): [error] \(error.code):\(error.category) - \(error.message)") } @@ -103,7 +103,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { } } if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] StateChange listener attached to task with id \(newTask.id).") } - + // add PROGRESS listeners to newly created task self.taskProgressListeners[newTask.id] = newTask.addEventListener(type: CachingTaskEventTypes.PROGRESS) { [weak self] event in if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received PROGRESS event from task with id \(newTask.id): progress is \(newTask.percentageCached * 100.0)% of \(newTask.duration) sec.") } @@ -114,7 +114,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { } if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Progress listener attached to task with id \(newTask.id).") } } - + private func detachTaskListenersFromTask(_ task: CachingTask) { // STATE_CHANGE if let taskStateChangeListener = self.taskStateChangeListeners[task.id] { @@ -128,7 +128,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { } } #endif - + // MARK: API #if os(iOS) @@ -139,7 +139,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { CACHE_EVENT_PROP_TASKS: THEOplayerRCTCacheAggregator.aggregateCacheTasks(tasks: THEOplayer.cache.tasks) ] as [String : Any]) } - + @objc(createTask:params:) func createTask(_ src: NSDictionary, params: NSDictionary) -> Void { if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] createTask triggered on Cache API.") } @@ -148,17 +148,17 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { if let srcDescription = sourceDescription, let newTask = THEOplayer.cache.createTask(source: srcDescription, parameters: params) { if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] New cache task created with id \(newTask.id)") } - + // emit onAddCachingTaskEvent self.sendEvent(withName: "onAddCachingTaskEvent", body: [ CACHE_EVENT_PROP_TASK: THEOplayerRCTCacheAggregator.aggregateCacheTask(task: newTask) ]) - + // attach the state and progress listeners to the new task self.attachTaskListenersToTask(newTask) } } - + @objc(startCachingTask:) func startCachingTask(_ id: NSString) -> Void { if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Start task triggered on Cache API for task with id \(id).") } @@ -166,7 +166,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { task.start() } } - + @objc(pauseCachingTask:) func pauseCachingTask(_ id: NSString) -> Void { if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Pause task triggered on Cache API for task with id \(id).") } @@ -174,7 +174,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { task.pause() } } - + @objc(removeCachingTask:) func removeCachingTask(_ id: NSString) -> Void { if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Remove task triggered on Cache API for task with id \(id).") } @@ -185,7 +185,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { self.detachTaskListenersFromTask(task) } } - + @objc(renewLicense:drmConfig:) func renewLicense(_ id: NSString, drmConfig: NSDictionary) -> Void { if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Renew license triggered on Cache API for task with id \(id).") } @@ -203,7 +203,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { } } } - + private func taskById(_ id: String) -> CachingTask? { return THEOplayer.cache.tasks.first { cachingTask in cachingTask.id == id @@ -218,27 +218,27 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter { CACHE_EVENT_PROP_TASKS: [] ] as [String : Any]) } - + @objc(createTask:params:) func createTask(_ src: NSDictionary, params: NSDictionary) -> Void { if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) } } - + @objc(startCachingTask:) func startCachingTask(_ id: NSString) -> Void { if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) } } - + @objc(pauseCachingTask:) func pauseCachingTask(_ id: NSString) -> Void { if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) } } - + @objc(removeCachingTask:) func removeCachingTask(_ id: NSString) -> Void { if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) } } - + @objc(renewLicense:drmConfig:) func renewLicense(_ id: NSString, drmConfig: NSDictionary) -> Void { if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) } diff --git a/ios/casting/THEOplayerRCTCastAPI.swift b/ios/casting/THEOplayerRCTCastAPI.swift index 79008acfd..66e0cb595 100644 --- a/ios/casting/THEOplayerRCTCastAPI.swift +++ b/ios/casting/THEOplayerRCTCastAPI.swift @@ -12,18 +12,18 @@ let ERROR_MESSAGE_CAST_ACCESS_FAILURE = "Could not access THEOplayer Cast Module @objc(THEOplayerRCTCastAPI) class THEOplayerRCTCastAPI: NSObject, RCTBridgeModule { @objc var bridge: RCTBridge! - + static func moduleName() -> String! { - return "CastModule" + return "THEORCTCastModule" } - + static func requiresMainQueueSetup() -> Bool { return false } - + // MARK: CHROMECAST AND AIRPLAY #if os(iOS) - + @objc(casting:resolver:rejecter:) func casting(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { DispatchQueue.main.async { @@ -36,15 +36,15 @@ class THEOplayerRCTCastAPI: NSObject, RCTBridgeModule { } } } - + #else - + @objc(casting:resolver:rejecter:) func casting(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { if DEBUG_CAST_API { print(ERROR_MESSAGE_CASTING_UNSUPPORTED_FEATURE) } resolve(false) } - + #endif - + } diff --git a/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift b/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift index ee242332c..2e51781c5 100644 --- a/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +++ b/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift @@ -18,7 +18,7 @@ let BRIDGE_REQUEST_TIMEOUT = 10.0 @objc(THEOplayerRCTContentProtectionAPI) class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { - + private var buildIntegrationCompletions: THEOplayerRCTSafeMap Void> = THEOplayerRCTSafeMap Void>() // [requestId : completion] private var certificateRequestCompletions: THEOplayerRCTSafeMap Void> = THEOplayerRCTSafeMap Void>() // [requestId : completion] private var certificateResponseCompletions: THEOplayerRCTSafeMap Void> = THEOplayerRCTSafeMap Void>() // [requestId : completion] @@ -28,15 +28,15 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { private var requestTimers: THEOplayerRCTSafeMap = THEOplayerRCTSafeMap() // [requestId : Timer] private var requestIntegrationIds: THEOplayerRCTSafeMap = THEOplayerRCTSafeMap() // [requestId : integrationId] private var requestKeySystemIds: THEOplayerRCTSafeMap = THEOplayerRCTSafeMap() // [requestId : keySystemId] - + override static func moduleName() -> String! { - return "ContentProtectionModule" + return "THEORCTContentProtectionModule" } - + override static func requiresMainQueueSetup() -> Bool { return false } - + override func supportedEvents() -> [String]! { return ["onBuildIntegration", "onCertificateRequest", @@ -46,14 +46,14 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { "onExtractFairplayContentId" ] } - + private func invalidateRequestWithId(_ requestId: String) { if let timer = self.requestTimers[requestId] { timer.invalidate() _ = self.requestTimers.removeValue(forKey: requestId) } } - + // MARK: Module actions func handleBuildIntegration(integrationId: String, keySystemId: String, drmConfig: DRMConfiguration, completion: @escaping (Bool) -> Void) { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleBuildIntegration.") } @@ -70,7 +70,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { _ = self.buildIntegrationCompletions.removeValue(forKey: requestId) }) } - + func handleCertificateRequest(integrationId: String, keySystemId: String, certificateRequest: CertificateRequest, completion: @escaping (Data?, Error?) -> Void) { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleCertificateRequest.") } let requestId = UUID().uuidString @@ -90,7 +90,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { _ = self.certificateRequestCompletions.removeValue(forKey: requestId) }) } - + func handleCertificateResponse(integrationId: String, keySystemId: String, certificateResponse: CertificateResponse, completion: @escaping (Data?, Error?) -> Void) { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleCertificateResponse.") } let requestId = UUID().uuidString @@ -106,7 +106,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { _ = self.certificateResponseCompletions.removeValue(forKey: requestId) }) } - + func handleLicenseRequest(integrationId: String, keySystemId: String, licenseRequest: LicenseRequest, completion: @escaping (Data?, Error?) -> Void) { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleLicenseRequest.") } let requestId = UUID().uuidString @@ -126,7 +126,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { _ = self.licenseRequestCompletions.removeValue(forKey: requestId) }) } - + func handleLicenseResponse(integrationId: String, keySystemId: String, licenseResponse: LicenseResponse, completion: @escaping (Data?, Error?) -> Void) { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleLicenseResponse.") } let requestId = UUID().uuidString @@ -142,7 +142,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { _ = self.licenseResponseCompletions.removeValue(forKey: requestId) }) } - + func handleExtractFairplayContentId(integrationId: String, keySystemId: String, skdUrl: String, completion: @escaping (String, Error?) -> Void) { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleExtractFairplayContentId.") } let requestId = UUID().uuidString @@ -159,7 +159,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { _ = self.extractFairplayCompletions.removeValue(forKey: requestId) }) } - + // MARK: Incoming JS Notifications @objc(registerContentProtectionIntegration:keySystemId:) func registerContentProtectionIntegration(_ integrationId: String, keySystemId: String) -> Void { @@ -178,7 +178,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "Prevented registering ContentProtectionIntegration for \(integrationId) - \(keySystemId)") } } } - + @objc(onBuildProcessed:) func onBuildProcessed(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onBuildProcessed.") } @@ -191,7 +191,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process buildIntegration result") } } - + @objc(onCertificateRequestProcessedAsRequest:) func onCertificateRequestProcessedAsRequest(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateRequestProcessedAsRequest.") } @@ -228,7 +228,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process certificate request as request") } } - + @objc(onCertificateRequestProcessedAsCertificate:) func onCertificateRequestProcessedAsCertificate(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateRequestProcessedAsCertificate.") } @@ -244,7 +244,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process certificate request as certificate") } } - + @objc(onCertificateResponseProcessed:) func onCertificateResponseProcessed(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateResponseProcessed.") } @@ -260,7 +260,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process certificate response") } } - + @objc(onLicenseRequestProcessedAsRequest:) func onLicenseRequestProcessedAsRequest(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseRequestProcessedAsRequest.") } @@ -297,7 +297,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process license request as request") } } - + @objc(onLicenseRequestProcessedAsLicense:) func onLicenseRequestProcessedAsLicense(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseRequestProcessedAsLicense.") } @@ -313,7 +313,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process license request as license") } } - + @objc(onLicenseResponseProcessed:) func onLicenseResponseProcessed(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseResponseProcessed.") } @@ -329,7 +329,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process license response") } } - + @objc(onExtractFairplayContentIdProcessed:) func onExtractFairplayContentIdProcessed(_ result: NSDictionary) -> Void { if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onExtractFairplayContentIdProcessed.") } @@ -342,7 +342,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter { print(CPI_TAG, "Failed to process extracted contentId result") } } - + // MARK: Helpers private func keySystemFromString(_ keySystemIdString: String) -> THEOplayerSDK.KeySystemId { switch keySystemIdString.lowercased() { diff --git a/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift b/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift index 01c99758b..faf87c0c6 100644 --- a/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift +++ b/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift @@ -12,16 +12,16 @@ protocol EventReceiver { @objc(THEOplayerRCTEventBroadcastAPI) class THEOplayerRCTBroadcastAPI: NSObject, RCTBridgeModule { @objc var bridge: RCTBridge! - - + + static func moduleName() -> String! { - return "EventBroadcastModule" + return "THEORCTEventBroadcastModule" } - + static func requiresMainQueueSetup() -> Bool { return false } - + @objc(broadcastEvent:event:) func broadcastEvent(_ node: NSNumber, event: NSDictionary) -> Void { DispatchQueue.main.async { From 166c4f7d3f96d51f5c6d4abb9579bddf24f55b6e Mon Sep 17 00:00:00 2001 From: Tom Van Laerhoven Date: Mon, 19 Feb 2024 11:30:10 +0100 Subject: [PATCH 4/5] Add changelog entry --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2497f97da..1d1364c40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Renamed native modules to avoid name collisions with external packages. + ## [3.7.1] - 24-02-09 ### Fixed From 56a3a3ce5416f767fe3223b4dbe7008475aa3e93 Mon Sep 17 00:00:00 2001 From: William Van Haevre Date: Tue, 20 Feb 2024 18:48:35 +0100 Subject: [PATCH 5/5] Use new module names on bridge definitions for iOS --- ios/THEOplayerRCTBridge.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/THEOplayerRCTBridge.m b/ios/THEOplayerRCTBridge.m index a43a1d233..d6137cfef 100644 --- a/ios/THEOplayerRCTBridge.m +++ b/ios/THEOplayerRCTBridge.m @@ -57,7 +57,7 @@ @interface RCT_EXTERN_MODULE(THEOplayerRCTViewManager, RCTViewManager) // ---------------------------------------------------------------------------- // Player Module // ---------------------------------------------------------------------------- -@interface RCT_EXTERN_REMAP_MODULE(PlayerModule, THEOplayerRCTPlayerAPI, NSObject) +@interface RCT_EXTERN_REMAP_MODULE(THEORCTPlayerModule, THEOplayerRCTPlayerAPI, NSObject) RCT_EXTERN_METHOD(setPaused:(nonnull NSNumber *)node paused:(BOOL)paused) @@ -116,7 +116,7 @@ @interface RCT_EXTERN_REMAP_MODULE(PlayerModule, THEOplayerRCTPlayerAPI, NSObjec // Ads Module // ---------------------------------------------------------------------------- -@interface RCT_EXTERN_REMAP_MODULE(AdsModule, THEOplayerRCTAdsAPI, NSObject) +@interface RCT_EXTERN_REMAP_MODULE(THEORCTAdsModule, THEOplayerRCTAdsAPI, NSObject) RCT_EXTERN_METHOD(skip:(nonnull NSNumber *)node) @@ -161,7 +161,7 @@ @interface RCT_EXTERN_REMAP_MODULE(AdsModule, THEOplayerRCTAdsAPI, NSObject) // ---------------------------------------------------------------------------- // ContentProtection Module // ---------------------------------------------------------------------------- -@interface RCT_EXTERN_REMAP_MODULE(ContentProtectionModule, THEOplayerRCTContentProtectionAPI, RCTEventEmitter) +@interface RCT_EXTERN_REMAP_MODULE(THEORCTContentProtectionModule, THEOplayerRCTContentProtectionAPI, RCTEventEmitter) RCT_EXTERN_METHOD(onBuildProcessed:(NSDictionary)result) RCT_EXTERN_METHOD(onCertificateRequestProcessedAsRequest:(NSDictionary)result) @@ -180,7 +180,7 @@ @interface RCT_EXTERN_REMAP_MODULE(ContentProtectionModule, THEOplayerRCTContent // Cast Module // ---------------------------------------------------------------------------- -@interface RCT_EXTERN_REMAP_MODULE(CastModule, THEOplayerRCTCastAPI, NSObject) +@interface RCT_EXTERN_REMAP_MODULE(THEORCTCastModule, THEOplayerRCTCastAPI, NSObject) RCT_EXTERN_METHOD(casting:(nonnull NSNumber *)node resolver:(RCTPromiseResolveBlock)resolve @@ -221,7 +221,7 @@ @interface RCT_EXTERN_REMAP_MODULE(CastModule, THEOplayerRCTCastAPI, NSObject) // ---------------------------------------------------------------------------- // Cache Module // ---------------------------------------------------------------------------- -@interface RCT_EXTERN_REMAP_MODULE(CacheModule, THEOplayerRCTCacheAPI, RCTEventEmitter) +@interface RCT_EXTERN_REMAP_MODULE(THEORCTCacheModule, THEOplayerRCTCacheAPI, RCTEventEmitter) RCT_EXTERN_METHOD(getInitialState:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) @@ -243,7 +243,7 @@ @interface RCT_EXTERN_REMAP_MODULE(CacheModule, THEOplayerRCTCacheAPI, RCTEventE // ---------------------------------------------------------------------------- // Broadcast Module // ---------------------------------------------------------------------------- -@interface RCT_EXTERN_REMAP_MODULE(EventBroadcastModule, THEOplayerRCTEventBroadcastAPI, NSObject) +@interface RCT_EXTERN_REMAP_MODULE(THEORCTEventBroadcastModule, THEOplayerRCTEventBroadcastAPI, NSObject) RCT_EXTERN_METHOD(broadcastEvent:(nonnull NSNumber *)node event:(NSDictionary)event)