bitmovin-player-react-native 0.44.1-alpha.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +11 -0
- package/.eslintrc.js +7 -0
- package/.gitattributes +3 -0
- package/.prettierignore +11 -0
- package/.ruby-version +1 -0
- package/.swiftlint.yml +171 -0
- package/Brewfile +2 -0
- package/CHANGELOG.md +627 -0
- package/CONTRIBUTING.md +255 -0
- package/TODO.md +0 -0
- package/android/.editorconfig +8 -0
- package/android/build.gradle +78 -75
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +1 -0
- package/android/gradlew +248 -0
- package/android/gradlew.bat +92 -0
- package/android/ktlint.gradle +31 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/ActivityLifecycleListener.kt +51 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/BitmovinCastManagerModule.kt +32 -55
- package/android/src/main/java/com/bitmovin/player/reactnative/BufferModule.kt +33 -45
- package/android/src/main/java/com/bitmovin/player/reactnative/CustomMessageHandlerModule.kt +84 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/DebugModule.kt +6 -14
- package/android/src/main/java/com/bitmovin/player/reactnative/DecoderConfigModule.kt +89 -44
- package/android/src/main/java/com/bitmovin/player/reactnative/DrmModule.kt +80 -99
- package/android/src/main/java/com/bitmovin/player/reactnative/EventSubscription.kt +22 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/FullscreenHandlerModule.kt +100 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/MediaSessionPlaybackManager.kt +5 -5
- package/android/src/main/java/com/bitmovin/player/reactnative/NetworkModule.kt +98 -56
- package/android/src/main/java/com/bitmovin/player/reactnative/OfflineModule.kt +132 -186
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerAnalyticsModule.kt +37 -36
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +252 -528
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerPackage.kt +11 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt +558 -213
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewManager.kt +99 -286
- package/android/src/main/java/com/bitmovin/player/reactnative/ResultWaiter.kt +58 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/SourceModule.kt +77 -151
- package/android/src/main/java/com/bitmovin/player/reactnative/Types.kt +44 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/UuidModule.kt +12 -15
- package/android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt +296 -456
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ListExtension.kt +89 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/MapExtension.kt +95 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/offline/OfflineContentManagerBridge.kt +20 -52
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/CustomMessageHandlerBridge.kt +10 -20
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/FullscreenHandlerBridge.kt +4 -9
- package/app.plugin.js +21 -0
- package/build/BitmovinPlayerReactNative.types.d.ts +18 -0
- package/build/BitmovinPlayerReactNative.types.d.ts.map +1 -0
- package/build/BitmovinPlayerReactNative.types.js +2 -0
- package/build/BitmovinPlayerReactNative.types.js.map +1 -0
- package/build/adaptationConfig.d.ts +18 -0
- package/build/adaptationConfig.d.ts.map +1 -0
- package/build/adaptationConfig.js +2 -0
- package/build/adaptationConfig.js.map +1 -0
- package/build/advertising.d.ts +175 -0
- package/build/advertising.d.ts.map +1 -0
- package/build/advertising.js +37 -0
- package/build/advertising.js.map +1 -0
- package/build/analytics/config.d.ts +194 -0
- package/build/analytics/config.d.ts.map +1 -0
- package/build/analytics/config.js +2 -0
- package/build/analytics/config.js.map +1 -0
- package/build/analytics/index.d.ts +3 -0
- package/build/analytics/index.d.ts.map +1 -0
- package/build/analytics/index.js +3 -0
- package/build/analytics/index.js.map +1 -0
- package/build/analytics/player.d.ts +24 -0
- package/build/analytics/player.d.ts.map +1 -0
- package/build/analytics/player.js +30 -0
- package/build/analytics/player.js.map +1 -0
- package/build/analytics/playerAnalyticsModule.d.ts +13 -0
- package/build/analytics/playerAnalyticsModule.d.ts.map +1 -0
- package/build/analytics/playerAnalyticsModule.js +3 -0
- package/build/analytics/playerAnalyticsModule.js.map +1 -0
- package/build/audioSession.d.ts +33 -0
- package/build/audioSession.d.ts.map +1 -0
- package/build/audioSession.js +21 -0
- package/build/audioSession.js.map +1 -0
- package/build/audioTrack.d.ts +39 -0
- package/build/audioTrack.d.ts.map +1 -0
- package/build/audioTrack.js +2 -0
- package/build/audioTrack.js.map +1 -0
- package/build/bitmovinCastManager.d.ts +58 -0
- package/build/bitmovinCastManager.d.ts.map +1 -0
- package/build/bitmovinCastManager.js +64 -0
- package/build/bitmovinCastManager.js.map +1 -0
- package/build/bufferApi.d.ts +85 -0
- package/build/bufferApi.d.ts.map +1 -0
- package/build/bufferApi.js +60 -0
- package/build/bufferApi.js.map +1 -0
- package/build/bufferConfig.d.ts +42 -0
- package/build/bufferConfig.d.ts.map +1 -0
- package/build/bufferConfig.js +2 -0
- package/build/bufferConfig.js.map +1 -0
- package/build/components/PlayerView/events.d.ts +310 -0
- package/build/components/PlayerView/events.d.ts.map +1 -0
- package/build/components/PlayerView/events.js +2 -0
- package/build/components/PlayerView/events.js.map +1 -0
- package/build/components/PlayerView/index.d.ts +10 -0
- package/build/components/PlayerView/index.d.ts.map +1 -0
- package/build/components/PlayerView/index.js +72 -0
- package/build/components/PlayerView/index.js.map +1 -0
- package/build/components/PlayerView/native.d.ts +30 -0
- package/build/components/PlayerView/native.d.ts.map +1 -0
- package/build/components/PlayerView/native.js +6 -0
- package/build/components/PlayerView/native.js.map +1 -0
- package/build/components/PlayerView/nativeEvents.d.ts +437 -0
- package/build/components/PlayerView/nativeEvents.d.ts.map +1 -0
- package/build/components/PlayerView/nativeEvents.js +2 -0
- package/build/components/PlayerView/nativeEvents.js.map +1 -0
- package/build/components/PlayerView/pictureInPictureConfig.d.ts +22 -0
- package/build/components/PlayerView/pictureInPictureConfig.d.ts.map +1 -0
- package/build/components/PlayerView/pictureInPictureConfig.js +2 -0
- package/build/components/PlayerView/pictureInPictureConfig.js.map +1 -0
- package/build/components/PlayerView/playerViewConfig.d.ts +111 -0
- package/build/components/PlayerView/playerViewConfig.d.ts.map +1 -0
- package/build/components/PlayerView/playerViewConfig.js +51 -0
- package/build/components/PlayerView/playerViewConfig.js.map +1 -0
- package/build/components/PlayerView/properties.d.ts +61 -0
- package/build/components/PlayerView/properties.d.ts.map +1 -0
- package/build/components/PlayerView/properties.js +2 -0
- package/build/components/PlayerView/properties.js.map +1 -0
- package/build/components/index.d.ts +5 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +5 -0
- package/build/components/index.js.map +1 -0
- package/build/debug.d.ts +46 -0
- package/build/debug.d.ts.map +1 -0
- package/build/debug.js +52 -0
- package/build/debug.js.map +1 -0
- package/build/decoder/decoderConfig.d.ts +96 -0
- package/build/decoder/decoderConfig.d.ts.map +1 -0
- package/build/decoder/decoderConfig.js +6 -0
- package/build/decoder/decoderConfig.js.map +1 -0
- package/build/decoder/decoderConfigModule.d.ts +14 -0
- package/build/decoder/decoderConfigModule.d.ts.map +1 -0
- package/build/decoder/decoderConfigModule.js +31 -0
- package/build/decoder/decoderConfigModule.js.map +1 -0
- package/build/decoder/index.d.ts +26 -0
- package/build/decoder/index.d.ts.map +1 -0
- package/build/decoder/index.js +50 -0
- package/build/decoder/index.js.map +1 -0
- package/build/drm/drmModule.d.ts +55 -0
- package/build/drm/drmModule.d.ts.map +1 -0
- package/build/drm/drmModule.js +3 -0
- package/build/drm/drmModule.js.map +1 -0
- package/build/drm/fairplayConfig.d.ts +91 -0
- package/build/drm/fairplayConfig.d.ts.map +1 -0
- package/build/drm/fairplayConfig.js +2 -0
- package/build/drm/fairplayConfig.js.map +1 -0
- package/build/drm/index.d.ts +112 -0
- package/build/drm/index.d.ts.map +1 -0
- package/build/drm/index.js +191 -0
- package/build/drm/index.js.map +1 -0
- package/build/drm/widevineConfig.d.ts +58 -0
- package/build/drm/widevineConfig.d.ts.map +1 -0
- package/build/drm/widevineConfig.js +2 -0
- package/build/drm/widevineConfig.js.map +1 -0
- package/build/events.d.ts +692 -0
- package/build/events.d.ts.map +1 -0
- package/build/events.js +2 -0
- package/build/events.js.map +1 -0
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.d.ts.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -0
- package/build/hooks/usePlayer.d.ts +8 -0
- package/build/hooks/usePlayer.d.ts.map +1 -0
- package/build/hooks/usePlayer.js +10 -0
- package/build/hooks/usePlayer.js.map +1 -0
- package/build/hooks/useProxy.d.ts +18 -0
- package/build/hooks/useProxy.d.ts.map +1 -0
- package/build/hooks/useProxy.js +16 -0
- package/build/hooks/useProxy.js.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +32 -0
- package/build/index.js.map +1 -0
- package/build/liveConfig.d.ts +13 -0
- package/build/liveConfig.d.ts.map +1 -0
- package/build/liveConfig.js +2 -0
- package/build/liveConfig.js.map +1 -0
- package/build/media.d.ts +85 -0
- package/build/media.d.ts.map +1 -0
- package/build/media.js +2 -0
- package/build/media.js.map +1 -0
- package/build/mediaControlConfig.d.ts +62 -0
- package/build/mediaControlConfig.d.ts.map +1 -0
- package/build/mediaControlConfig.js +2 -0
- package/build/mediaControlConfig.js.map +1 -0
- package/build/mediaTrackRole.d.ts +28 -0
- package/build/mediaTrackRole.d.ts.map +1 -0
- package/build/mediaTrackRole.js +2 -0
- package/build/mediaTrackRole.js.map +1 -0
- package/build/modules/AudioSessionModule.d.ts +8 -0
- package/build/modules/AudioSessionModule.d.ts.map +1 -0
- package/build/modules/AudioSessionModule.js +7 -0
- package/build/modules/AudioSessionModule.js.map +1 -0
- package/build/modules/BitmovinCastManagerModule.d.ts +11 -0
- package/build/modules/BitmovinCastManagerModule.d.ts.map +1 -0
- package/build/modules/BitmovinCastManagerModule.js +3 -0
- package/build/modules/BitmovinCastManagerModule.js.map +1 -0
- package/build/modules/BufferModule.d.ts +16 -0
- package/build/modules/BufferModule.d.ts.map +1 -0
- package/build/modules/BufferModule.js +3 -0
- package/build/modules/BufferModule.js.map +1 -0
- package/build/modules/DebugModule.d.ts +8 -0
- package/build/modules/DebugModule.d.ts.map +1 -0
- package/build/modules/DebugModule.js +3 -0
- package/build/modules/DebugModule.js.map +1 -0
- package/build/modules/PlayerModule.d.ts +188 -0
- package/build/modules/PlayerModule.d.ts.map +1 -0
- package/build/modules/PlayerModule.js +3 -0
- package/build/modules/PlayerModule.js.map +1 -0
- package/build/modules/SourceModule.d.ts +51 -0
- package/build/modules/SourceModule.d.ts.map +1 -0
- package/build/modules/SourceModule.js +3 -0
- package/build/modules/SourceModule.js.map +1 -0
- package/build/modules/UuidModule.d.ts +8 -0
- package/build/modules/UuidModule.d.ts.map +1 -0
- package/build/modules/UuidModule.js +3 -0
- package/build/modules/UuidModule.js.map +1 -0
- package/build/nativeInstance.d.ts +49 -0
- package/build/nativeInstance.d.ts.map +1 -0
- package/build/nativeInstance.js +20 -0
- package/build/nativeInstance.js.map +1 -0
- package/build/network/index.d.ts +50 -0
- package/build/network/index.d.ts.map +1 -0
- package/build/network/index.js +102 -0
- package/build/network/index.js.map +1 -0
- package/build/network/networkConfig.d.ts +151 -0
- package/build/network/networkConfig.d.ts.map +1 -0
- package/build/network/networkConfig.js +21 -0
- package/build/network/networkConfig.js.map +1 -0
- package/build/network/networkModule.d.ts +29 -0
- package/build/network/networkModule.d.ts.map +1 -0
- package/build/network/networkModule.js +3 -0
- package/build/network/networkModule.js.map +1 -0
- package/build/offline/index.d.ts +8 -0
- package/build/offline/index.d.ts.map +1 -0
- package/build/offline/index.js +8 -0
- package/build/offline/index.js.map +1 -0
- package/build/offline/offlineContentConfig.d.ts +18 -0
- package/build/offline/offlineContentConfig.d.ts.map +1 -0
- package/build/offline/offlineContentConfig.js +2 -0
- package/build/offline/offlineContentConfig.js.map +1 -0
- package/build/offline/offlineContentManager.d.ts +90 -0
- package/build/offline/offlineContentManager.d.ts.map +1 -0
- package/build/offline/offlineContentManager.js +177 -0
- package/build/offline/offlineContentManager.js.map +1 -0
- package/build/offline/offlineContentManagerListener.d.ts +174 -0
- package/build/offline/offlineContentManagerListener.d.ts.map +1 -0
- package/build/offline/offlineContentManagerListener.js +17 -0
- package/build/offline/offlineContentManagerListener.js.map +1 -0
- package/build/offline/offlineContentOptions.d.ts +29 -0
- package/build/offline/offlineContentOptions.d.ts.map +1 -0
- package/build/offline/offlineContentOptions.js +2 -0
- package/build/offline/offlineContentOptions.js.map +1 -0
- package/build/offline/offlineDownloadRequest.d.ts +19 -0
- package/build/offline/offlineDownloadRequest.d.ts.map +1 -0
- package/build/offline/offlineDownloadRequest.js +2 -0
- package/build/offline/offlineDownloadRequest.js.map +1 -0
- package/build/offline/offlineModule.d.ts +32 -0
- package/build/offline/offlineModule.d.ts.map +1 -0
- package/build/offline/offlineModule.js +3 -0
- package/build/offline/offlineModule.js.map +1 -0
- package/build/offline/offlineSourceOptions.d.ts +12 -0
- package/build/offline/offlineSourceOptions.d.ts.map +1 -0
- package/build/offline/offlineSourceOptions.js +2 -0
- package/build/offline/offlineSourceOptions.js.map +1 -0
- package/build/offline/offlineState.d.ts +23 -0
- package/build/offline/offlineState.d.ts.map +1 -0
- package/build/offline/offlineState.js +24 -0
- package/build/offline/offlineState.js.map +1 -0
- package/build/playbackConfig.d.ts +88 -0
- package/build/playbackConfig.d.ts.map +1 -0
- package/build/playbackConfig.js +2 -0
- package/build/playbackConfig.js.map +1 -0
- package/build/player.d.ts +308 -0
- package/build/player.d.ts.map +1 -0
- package/build/player.js +445 -0
- package/build/player.js.map +1 -0
- package/build/playerConfig.d.ts +83 -0
- package/build/playerConfig.d.ts.map +1 -0
- package/build/playerConfig.js +2 -0
- package/build/playerConfig.js.map +1 -0
- package/build/remoteControlConfig.d.ts +38 -0
- package/build/remoteControlConfig.d.ts.map +1 -0
- package/build/remoteControlConfig.js +2 -0
- package/build/remoteControlConfig.js.map +1 -0
- package/build/source.d.ts +216 -0
- package/build/source.d.ts.map +1 -0
- package/build/source.js +167 -0
- package/build/source.js.map +1 -0
- package/build/styleConfig.d.ts +120 -0
- package/build/styleConfig.d.ts.map +1 -0
- package/build/styleConfig.js +38 -0
- package/build/styleConfig.js.map +1 -0
- package/build/subtitleFormat.d.ts +27 -0
- package/build/subtitleFormat.d.ts.map +1 -0
- package/build/subtitleFormat.js +28 -0
- package/build/subtitleFormat.js.map +1 -0
- package/build/subtitleTrack.d.ts +55 -0
- package/build/subtitleTrack.d.ts.map +1 -0
- package/build/subtitleTrack.js +2 -0
- package/build/subtitleTrack.js.map +1 -0
- package/build/thumbnail.d.ts +38 -0
- package/build/thumbnail.d.ts.map +1 -0
- package/build/thumbnail.js +2 -0
- package/build/thumbnail.js.map +1 -0
- package/build/tweaksConfig.d.ts +197 -0
- package/build/tweaksConfig.d.ts.map +1 -0
- package/build/tweaksConfig.js +25 -0
- package/build/tweaksConfig.js.map +1 -0
- package/build/ui/customMessageHandlerModule.d.ts +27 -0
- package/build/ui/customMessageHandlerModule.d.ts.map +1 -0
- package/build/ui/customMessageHandlerModule.js +3 -0
- package/build/ui/customMessageHandlerModule.js.map +1 -0
- package/build/ui/custommessagehandler.d.ts +56 -0
- package/build/ui/custommessagehandler.d.ts.map +1 -0
- package/build/ui/custommessagehandler.js +54 -0
- package/build/ui/custommessagehandler.js.map +1 -0
- package/build/ui/custommessagehandlerbridge.d.ts +33 -0
- package/build/ui/custommessagehandlerbridge.d.ts.map +1 -0
- package/build/ui/custommessagehandlerbridge.js +72 -0
- package/build/ui/custommessagehandlerbridge.js.map +1 -0
- package/build/ui/custommessagesender.d.ts +5 -0
- package/build/ui/custommessagesender.d.ts.map +1 -0
- package/build/ui/custommessagesender.js +2 -0
- package/build/ui/custommessagesender.js.map +1 -0
- package/build/ui/fullscreenHandlerModule.d.ts +20 -0
- package/build/ui/fullscreenHandlerModule.d.ts.map +1 -0
- package/build/ui/fullscreenHandlerModule.js +3 -0
- package/build/ui/fullscreenHandlerModule.js.map +1 -0
- package/build/ui/fullscreenhandler.d.ts +18 -0
- package/build/ui/fullscreenhandler.d.ts.map +1 -0
- package/build/ui/fullscreenhandler.js +2 -0
- package/build/ui/fullscreenhandler.js.map +1 -0
- package/build/ui/fullscreenhandlerbridge.d.ts +26 -0
- package/build/ui/fullscreenhandlerbridge.d.ts.map +1 -0
- package/build/ui/fullscreenhandlerbridge.js +67 -0
- package/build/ui/fullscreenhandlerbridge.js.map +1 -0
- package/build/ui/index.d.ts +3 -0
- package/build/ui/index.d.ts.map +1 -0
- package/build/ui/index.js +3 -0
- package/build/ui/index.js.map +1 -0
- package/expo-module.config.json +40 -0
- package/ios/AppLifecycleDelegate.swift +25 -0
- package/ios/AudioSessionModule.swift +14 -40
- package/ios/BitmovinCastManagerModule.swift +30 -69
- package/ios/BufferModule.swift +26 -62
- package/ios/CustomMessageHandlerBridge.swift +11 -18
- package/ios/CustomMessageHandlerModule.swift +61 -63
- package/ios/DebugModule.swift +6 -27
- package/ios/DrmModule.swift +105 -379
- package/ios/Event+JSON.swift +1 -0
- package/ios/FullscreenHandlerBridge.swift +12 -5
- package/ios/FullscreenHandlerModule.swift +73 -57
- package/ios/LockedBox.swift +21 -0
- package/ios/ModuleRegistry+Generics.swift +11 -0
- package/ios/NetworkModule.swift +78 -82
- package/ios/OfflineContentManagerBridge.swift +11 -38
- package/ios/OfflineModule.swift +136 -454
- package/ios/PlayerAnalyticsModule.swift +24 -52
- package/ios/PlayerModule.swift +192 -770
- package/ios/RCTConvert+BitmovinPlayer.swift +38 -312
- package/ios/RNBitmovinPlayer.h +1 -8
- package/ios/RNBitmovinPlayer.podspec +47 -0
- package/ios/RNPlayerView.swift +600 -77
- package/ios/RNPlayerViewManager.swift +96 -210
- package/ios/Registry.swift +2 -2
- package/ios/ResultWaiter.swift +66 -0
- package/ios/SourceModule.swift +104 -223
- package/ios/UuidModule.swift +9 -18
- package/package.json +67 -71
- package/plugin/build/FeatureFlags.d.ts +24 -0
- package/plugin/build/FeatureFlags.js +2 -0
- package/plugin/build/index.d.ts +7 -0
- package/plugin/build/index.js +10 -0
- package/plugin/build/withAppGradleDependencies.d.ts +7 -0
- package/plugin/build/withAppGradleDependencies.js +49 -0
- package/plugin/build/withBitmovinAndroidConfig.d.ts +7 -0
- package/plugin/build/withBitmovinAndroidConfig.js +159 -0
- package/plugin/build/withBitmovinConfig.d.ts +7 -0
- package/plugin/build/withBitmovinConfig.js +21 -0
- package/plugin/build/withBitmovinIosConfig.d.ts +7 -0
- package/plugin/build/withBitmovinIosConfig.js +53 -0
- package/plugin/src/FeatureFlags.ts +21 -0
- package/plugin/src/index.ts +9 -0
- package/plugin/src/withAppGradleDependencies.ts +80 -0
- package/plugin/src/withBitmovinAndroidConfig.ts +224 -0
- package/plugin/src/withBitmovinConfig.ts +24 -0
- package/plugin/src/withBitmovinIosConfig.ts +71 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/prettier.config.js +7 -0
- package/scripts/format-android.sh +2 -0
- package/scripts/format-swift.sh +3 -0
- package/scripts/lint-android.sh +2 -0
- package/scripts/lint-swift.sh +3 -0
- package/scripts/pre-commit.sh +14 -0
- package/scripts/setup-hooks.sh +58 -0
- package/src/BitmovinPlayerReactNative.types.ts +19 -0
- package/src/adaptationConfig.ts +1 -1
- package/src/advertising.ts +1 -1
- package/src/analytics/config.ts +4 -4
- package/src/analytics/player.ts +4 -6
- package/src/analytics/playerAnalyticsModule.ts +19 -0
- package/src/audioSession.ts +4 -6
- package/src/audioTrack.ts +1 -1
- package/src/bitmovinCastManager.ts +14 -10
- package/src/bufferApi.ts +1 -3
- package/src/bufferConfig.ts +2 -2
- package/src/components/PlayerView/events.ts +92 -94
- package/src/components/PlayerView/index.tsx +109 -159
- package/src/components/PlayerView/native.ts +24 -11
- package/src/components/PlayerView/nativeEvents.ts +113 -94
- package/src/components/PlayerView/pictureInPictureConfig.ts +1 -1
- package/src/components/PlayerView/playerViewConfig.ts +4 -8
- package/src/components/PlayerView/properties.ts +23 -22
- package/src/debug.ts +1 -3
- package/src/decoder/decoderConfig.ts +3 -3
- package/src/decoder/decoderConfigModule.ts +62 -0
- package/src/decoder/index.ts +32 -16
- package/src/drm/drmModule.ts +84 -0
- package/src/drm/fairplayConfig.ts +1 -1
- package/src/drm/index.ts +130 -40
- package/src/drm/widevineConfig.ts +5 -5
- package/src/events.ts +47 -41
- package/src/hooks/useProxy.ts +13 -20
- package/src/mediaControlConfig.ts +1 -1
- package/src/modules/AudioSessionModule.ts +13 -0
- package/src/modules/BitmovinCastManagerModule.ts +14 -0
- package/src/modules/BufferModule.ts +18 -0
- package/src/modules/DebugModule.ts +9 -0
- package/src/modules/PlayerModule.ts +251 -0
- package/src/modules/SourceModule.ts +74 -0
- package/src/modules/UuidModule.ts +9 -0
- package/src/nativeInstance.ts +3 -3
- package/src/network/index.ts +42 -15
- package/src/network/networkConfig.ts +3 -3
- package/src/network/networkModule.ts +51 -0
- package/src/offline/offlineContentConfig.ts +1 -1
- package/src/offline/offlineContentManager.ts +15 -50
- package/src/offline/offlineContentManagerListener.ts +20 -23
- package/src/offline/offlineContentOptions.ts +2 -2
- package/src/offline/offlineDownloadRequest.ts +1 -1
- package/src/offline/offlineModule.ts +46 -0
- package/src/offline/offlineSourceOptions.ts +2 -2
- package/src/offline/offlineState.ts +1 -1
- package/src/playbackConfig.ts +5 -6
- package/src/player.ts +53 -48
- package/src/source.ts +15 -14
- package/src/styleConfig.ts +5 -5
- package/src/subtitleFormat.ts +5 -5
- package/src/subtitleTrack.ts +1 -1
- package/src/tweaksConfig.ts +16 -16
- package/src/ui/customMessageHandlerModule.ts +46 -0
- package/src/ui/custommessagehandlerbridge.ts +45 -18
- package/src/ui/fullscreenHandlerModule.ts +35 -0
- package/src/ui/fullscreenhandlerbridge.ts +35 -15
- package/tsconfig.json +9 -0
- package/typedoc.json +23 -0
- package/RNBitmovinPlayer.podspec +0 -26
- package/android/src/main/java/com/bitmovin/player/reactnative/BitmovinBaseModule.kt +0 -114
- package/android/src/main/java/com/bitmovin/player/reactnative/EventRelay.kt +0 -47
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewPackage.kt +0 -48
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReactContextExtension.kt +0 -24
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableArray.kt +0 -20
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableMap.kt +0 -15
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableMapExtension.kt +0 -57
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/WritableMap.kt +0 -27
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/CustomMessageHandlerModule.kt +0 -86
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/FullscreenHandlerModule.kt +0 -78
- package/ios/AudioSessionModule.m +0 -10
- package/ios/BitmovinCastManagerModule.m +0 -14
- package/ios/BufferModule.m +0 -8
- package/ios/CustomMessageHandlerModule.m +0 -10
- package/ios/DebugModule.m +0 -7
- package/ios/DrmModule.m +0 -16
- package/ios/FullscreenHandlerModule.m +0 -10
- package/ios/NetworkModule.m +0 -10
- package/ios/OfflineModule.m +0 -19
- package/ios/PlayerAnalyticsModule.m +0 -8
- package/ios/PlayerModule.m +0 -130
- package/ios/PreprocessHttpRequestDelegateBridge.swift +0 -30
- package/ios/RCTBridge+Generics.swift +0 -6
- package/ios/RNBitmovinPlayer.xcodeproj/project.pbxproj +0 -303
- package/ios/RNPlayerView+PlayerListener.swift +0 -229
- package/ios/RNPlayerView+UserInterfaceListener.swift +0 -35
- package/ios/RNPlayerViewManager.m +0 -79
- package/ios/SourceModule.m +0 -42
- package/ios/UuidModule.m +0 -9
- package/lib/index.d.mts +0 -4303
- package/lib/index.d.ts +0 -4303
- package/lib/index.js +0 -1895
- package/lib/index.mjs +0 -1836
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
package com.bitmovin.player.reactnative
|
|
2
|
+
|
|
3
|
+
import androidx.core.os.bundleOf
|
|
4
|
+
import com.bitmovin.player.reactnative.ui.CustomMessageHandlerBridge
|
|
5
|
+
import expo.modules.kotlin.modules.Module
|
|
6
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Expo module for CustomMessageHandler management with bidirectional communication.
|
|
10
|
+
* Handles synchronous and asynchronous message handling between native code and JavaScript.
|
|
11
|
+
*/
|
|
12
|
+
class CustomMessageHandlerModule : Module() {
|
|
13
|
+
/**
|
|
14
|
+
* In-memory mapping from `nativeId`s to `CustomMessageHandlerBridge` instances.
|
|
15
|
+
*/
|
|
16
|
+
private val customMessageHandlers: Registry<CustomMessageHandlerBridge> = mutableMapOf()
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* ResultWaiter for synchronous message handling
|
|
20
|
+
*/
|
|
21
|
+
private val synchronousMessageWaiter = ResultWaiter<String?>()
|
|
22
|
+
|
|
23
|
+
override fun definition() = ModuleDefinition {
|
|
24
|
+
Name("CustomMessageHandlerModule")
|
|
25
|
+
|
|
26
|
+
OnDestroy {
|
|
27
|
+
customMessageHandlers.clear()
|
|
28
|
+
synchronousMessageWaiter.clear()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Events("onReceivedSynchronousMessage", "onReceivedAsynchronousMessage")
|
|
32
|
+
|
|
33
|
+
AsyncFunction("registerHandler") { nativeId: NativeId ->
|
|
34
|
+
val customMessageHandler = customMessageHandlers[nativeId] ?: CustomMessageHandlerBridge(
|
|
35
|
+
nativeId,
|
|
36
|
+
this@CustomMessageHandlerModule,
|
|
37
|
+
)
|
|
38
|
+
customMessageHandlers[nativeId] = customMessageHandler
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
AsyncFunction("destroy") { nativeId: NativeId ->
|
|
42
|
+
customMessageHandlers.remove(nativeId)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
AsyncFunction("onReceivedSynchronousMessageResult") { id: Int, result: String? ->
|
|
46
|
+
synchronousMessageWaiter.complete(id, result)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
AsyncFunction("sendMessage") { nativeId: NativeId, message: String, data: String? ->
|
|
50
|
+
customMessageHandlers[nativeId]?.sendMessage(message, data)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
fun getInstance(nativeId: NativeId?): CustomMessageHandlerBridge? = customMessageHandlers[nativeId]
|
|
55
|
+
|
|
56
|
+
fun receivedSynchronousMessage(nativeId: NativeId, message: String, data: String?): String? {
|
|
57
|
+
val (id, wait) = synchronousMessageWaiter.make(5000) // 5 second timeout
|
|
58
|
+
|
|
59
|
+
// Send event to TypeScript using Expo module event system
|
|
60
|
+
sendEvent(
|
|
61
|
+
"onReceivedSynchronousMessage",
|
|
62
|
+
bundleOf(
|
|
63
|
+
"nativeId" to nativeId,
|
|
64
|
+
"id" to id,
|
|
65
|
+
"message" to message,
|
|
66
|
+
"data" to data,
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
return wait()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fun receivedAsynchronousMessage(nativeId: NativeId, message: String, data: String?) {
|
|
74
|
+
// Send event to TypeScript using Expo module event system
|
|
75
|
+
sendEvent(
|
|
76
|
+
"onReceivedAsynchronousMessage",
|
|
77
|
+
bundleOf(
|
|
78
|
+
"nativeId" to nativeId,
|
|
79
|
+
"message" to message,
|
|
80
|
+
"data" to data,
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
package com.bitmovin.player.reactnative
|
|
2
2
|
|
|
3
3
|
import com.bitmovin.player.api.DebugConfig
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
class DebugModule : Module() {
|
|
8
|
+
override fun definition() = ModuleDefinition {
|
|
9
|
+
Name("DebugModule")
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
class DebugModule(context: ReactApplicationContext) : BitmovinBaseModule(context) {
|
|
11
|
-
override fun getName() = MODULE_NAME
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Enable/disable verbose logging for the console logger.
|
|
15
|
-
* @param enabled Whether to set verbose logging as enabled or disabled.
|
|
16
|
-
*/
|
|
17
|
-
@ReactMethod
|
|
18
|
-
fun setDebugLoggingEnabled(enabled: Boolean, promise: Promise) {
|
|
19
|
-
promise.unit.resolveOnUiThread {
|
|
11
|
+
AsyncFunction("setDebugLoggingEnabled") { enabled: Boolean ->
|
|
20
12
|
DebugConfig.isLoggingEnabled = enabled
|
|
21
13
|
}
|
|
22
14
|
}
|
|
@@ -1,60 +1,95 @@
|
|
|
1
1
|
package com.bitmovin.player.reactnative
|
|
2
2
|
|
|
3
3
|
import androidx.concurrent.futures.CallbackToFutureAdapter
|
|
4
|
+
import androidx.core.os.bundleOf
|
|
4
5
|
import com.bitmovin.player.api.decoder.DecoderConfig
|
|
5
6
|
import com.bitmovin.player.api.decoder.DecoderPriorityProvider
|
|
6
7
|
import com.bitmovin.player.api.decoder.MediaCodecInfo
|
|
7
8
|
import com.bitmovin.player.reactnative.converter.toJson
|
|
8
9
|
import com.bitmovin.player.reactnative.converter.toMediaCodecInfoList
|
|
9
|
-
import
|
|
10
|
-
import
|
|
10
|
+
import expo.modules.kotlin.exception.CodedException
|
|
11
|
+
import expo.modules.kotlin.modules.Module
|
|
12
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
11
13
|
import java.util.concurrent.ConcurrentHashMap
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@ReactModule(name = MODULE_NAME)
|
|
16
|
-
class DecoderConfigModule(context: ReactApplicationContext) : BitmovinBaseModule(context) {
|
|
17
|
-
override fun getName() = MODULE_NAME
|
|
15
|
+
class DecoderConfigModule : Module() {
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* In-memory mapping from `nativeId`s to `DecoderConfig` instances.
|
|
19
|
+
* This must match the Registry pattern from legacy DecoderConfigModule
|
|
21
20
|
*/
|
|
22
21
|
private val decoderConfigs: Registry<DecoderConfig> = mutableMapOf()
|
|
23
22
|
private val overrideDecoderPriorityProviderCompleters =
|
|
24
|
-
ConcurrentHashMap<
|
|
23
|
+
ConcurrentHashMap<String, CallbackToFutureAdapter.Completer<List<MediaCodecInfo>>>()
|
|
24
|
+
|
|
25
|
+
override fun definition() = ModuleDefinition {
|
|
26
|
+
Name("DecoderConfigModule")
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Events("onOverrideDecodersPriority")
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (decoderConfigs.containsKey(nativeId)) {
|
|
31
|
-
return
|
|
30
|
+
OnCreate {
|
|
31
|
+
// Module initialization
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
|
|
34
|
+
OnDestroy {
|
|
35
|
+
decoderConfigs.clear()
|
|
36
|
+
overrideDecoderPriorityProviderCompleters.clear()
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new `DecoderConfig` instance inside the internal decoder configs using the provided `config` object.
|
|
41
|
+
*/
|
|
42
|
+
AsyncFunction("initializeWithConfig") { nativeId: NativeId, config: Map<String, Any?> ->
|
|
43
|
+
if (decoderConfigs.containsKey(nativeId)) {
|
|
44
|
+
return@AsyncFunction
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
val playbackConfig = config["playbackConfig"] as? Map<String, Any?>
|
|
48
|
+
if (playbackConfig?.containsKey("decoderConfig") != true) {
|
|
49
|
+
return@AsyncFunction
|
|
50
|
+
}
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
val decoderConfig = DecoderConfig(
|
|
53
|
+
decoderPriorityProvider = object : DecoderPriorityProvider {
|
|
54
|
+
override fun overrideDecodersPriority(
|
|
55
|
+
context: DecoderPriorityProvider.DecoderContext,
|
|
56
|
+
preferredDecoders: List<MediaCodecInfo>,
|
|
57
|
+
): List<MediaCodecInfo> {
|
|
58
|
+
return overrideDecoderPriorityProvider(nativeId, context, preferredDecoders)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
)
|
|
62
|
+
decoderConfigs[nativeId] = decoderConfig
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Completes the decoder priority provider override process
|
|
67
|
+
*/
|
|
68
|
+
AsyncFunction("overrideDecoderPriorityProviderComplete") { nativeId: NativeId,
|
|
69
|
+
response: List<Map<String, Any?>>, ->
|
|
70
|
+
val completer = overrideDecoderPriorityProviderCompleters[nativeId]
|
|
71
|
+
?: throw DecoderConfigException.NoCompleterFound(nativeId)
|
|
72
|
+
|
|
73
|
+
val mediaCodecInfoList = response.toMediaCodecInfoList()
|
|
74
|
+
completer.set(mediaCodecInfoList)
|
|
75
|
+
overrideDecoderPriorityProviderCompleters.remove(nativeId)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Destroys the `DecoderConfig` instance referenced by `nativeId`
|
|
80
|
+
*/
|
|
81
|
+
AsyncFunction("destroy") { nativeId: NativeId ->
|
|
82
|
+
decoderConfigs.remove(nativeId)
|
|
83
|
+
// Remove all completers that start with this nativeId
|
|
84
|
+
overrideDecoderPriorityProviderCompleters.keys.filter { it.startsWith(nativeId) }.forEach {
|
|
85
|
+
overrideDecoderPriorityProviderCompleters.remove(it)
|
|
86
|
+
}
|
|
55
87
|
}
|
|
56
88
|
}
|
|
57
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Helper function to handle decoder priority provider override
|
|
92
|
+
*/
|
|
58
93
|
private fun overrideDecoderPriorityProvider(
|
|
59
94
|
nativeId: NativeId,
|
|
60
95
|
context: DecoderPriorityProvider.DecoderContext,
|
|
@@ -62,20 +97,30 @@ class DecoderConfigModule(context: ReactApplicationContext) : BitmovinBaseModule
|
|
|
62
97
|
): List<MediaCodecInfo> {
|
|
63
98
|
return CallbackToFutureAdapter.getFuture { completer ->
|
|
64
99
|
overrideDecoderPriorityProviderCompleters[nativeId] = completer
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
100
|
+
// Send event to TypeScript with decoder context and preferred decoders
|
|
101
|
+
sendEvent(
|
|
102
|
+
"onOverrideDecodersPriority",
|
|
103
|
+
bundleOf(
|
|
104
|
+
"nativeId" to nativeId,
|
|
105
|
+
"context" to context.toJson(),
|
|
106
|
+
"preferredDecoders" to preferredDecoders.map { it.toJson() },
|
|
107
|
+
),
|
|
72
108
|
)
|
|
109
|
+
|
|
110
|
+
"overrideDecoderPriorityProvider"
|
|
73
111
|
}.get()
|
|
74
112
|
}
|
|
75
113
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
114
|
+
val decoderConfig: DecoderConfig?
|
|
115
|
+
get() = decoderConfigs.values.firstOrNull()
|
|
116
|
+
|
|
117
|
+
fun getDecoderConfig(nativeId: NativeId): DecoderConfig? = decoderConfigs[nativeId]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// MARK: - Exception Definitions
|
|
121
|
+
|
|
122
|
+
sealed class DecoderConfigException(message: String) : CodedException(message) {
|
|
123
|
+
class NoCompleterFound(nativeId: NativeId) : DecoderConfigException(
|
|
124
|
+
"No completer found for decoder config: $nativeId",
|
|
125
|
+
)
|
|
81
126
|
}
|
|
@@ -1,136 +1,113 @@
|
|
|
1
1
|
package com.bitmovin.player.reactnative
|
|
2
2
|
|
|
3
3
|
import android.util.Base64
|
|
4
|
+
import androidx.core.os.bundleOf
|
|
4
5
|
import com.bitmovin.player.api.drm.PrepareLicenseCallback
|
|
5
6
|
import com.bitmovin.player.api.drm.PrepareMessageCallback
|
|
6
7
|
import com.bitmovin.player.api.drm.WidevineConfig
|
|
7
8
|
import com.bitmovin.player.reactnative.converter.toWidevineConfig
|
|
8
|
-
import
|
|
9
|
-
import
|
|
9
|
+
import expo.modules.kotlin.Promise
|
|
10
|
+
import expo.modules.kotlin.modules.Module
|
|
11
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
10
12
|
import java.security.InvalidParameterException
|
|
11
|
-
import java.util.concurrent.locks.Condition
|
|
12
|
-
import java.util.concurrent.locks.ReentrantLock
|
|
13
|
-
import kotlin.concurrent.withLock
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Represents some operation that transforms data as bytes.
|
|
17
16
|
*/
|
|
18
17
|
typealias PrepareCallback = (ByteArray) -> ByteArray
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Expo module for DRM configuration management with Widevine DRM support.
|
|
21
|
+
* Handles bidirectional communication for DRM preparation callbacks.
|
|
22
|
+
*/
|
|
23
|
+
class DrmModule : Module() {
|
|
24
24
|
/**
|
|
25
25
|
* In-memory mapping from `nativeId`s to `WidevineConfig` instances.
|
|
26
26
|
*/
|
|
27
27
|
private val drmConfigs: Registry<WidevineConfig> = mutableMapOf()
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Shared ResultWaiter for all DRM callbacks
|
|
31
31
|
*/
|
|
32
|
-
private val
|
|
32
|
+
private val waiter = ResultWaiter<String>()
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
private val preparedMessages: Registry<String> = mutableMapOf()
|
|
34
|
+
override fun definition() = ModuleDefinition {
|
|
35
|
+
Name("DrmModule")
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
OnDestroy {
|
|
38
|
+
drmConfigs.clear()
|
|
39
|
+
waiter.clear()
|
|
40
|
+
}
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
* Mapping between an object's `nativeId` and the value that'll be returned by its `prepareLicense` callback.
|
|
46
|
-
*/
|
|
47
|
-
private val preparedLicenses: Registry<String> = mutableMapOf()
|
|
42
|
+
Events("onPrepareMessage", "onPrepareLicense")
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
AsyncFunction("initializeWithConfig") { nativeId: NativeId, config: Map<String, Any?>, promise: Promise ->
|
|
45
|
+
if (drmConfigs.containsKey(nativeId)) {
|
|
46
|
+
promise.reject("DrmError", "NativeId already exists $nativeId", null)
|
|
47
|
+
return@AsyncFunction
|
|
48
|
+
}
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
try {
|
|
51
|
+
val widevineConfig = config.toWidevineConfig() ?: throw InvalidParameterException(
|
|
52
|
+
"Invalid widevine config",
|
|
53
|
+
)
|
|
54
|
+
widevineConfig.prepareMessageCallback = buildPrepareMessageCallback(nativeId, config)
|
|
55
|
+
widevineConfig.prepareLicenseCallback = buildPrepareLicense(nativeId, config)
|
|
56
|
+
drmConfigs[nativeId] = widevineConfig
|
|
57
|
+
promise.resolve(null)
|
|
58
|
+
} catch (e: Exception) {
|
|
59
|
+
promise.reject("DrmError", "Failed to initialize DRM config", e)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* @param nativeId `WidevineConfig` instance ID.
|
|
62
|
-
* @return The associated `WidevineConfig` instance or `null`.
|
|
63
|
-
*/
|
|
64
|
-
fun getConfig(nativeId: NativeId?): WidevineConfig? {
|
|
65
|
-
if (nativeId == null) {
|
|
66
|
-
return null
|
|
63
|
+
AsyncFunction("destroy") { nativeId: NativeId ->
|
|
64
|
+
drmConfigs.remove(nativeId)
|
|
67
65
|
}
|
|
68
|
-
return drmConfigs[nativeId]
|
|
69
|
-
}
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* @param nativeId ID to associate with the `WidevineConfig` instance.
|
|
74
|
-
* @param config `DrmConfig` object received from JS.
|
|
75
|
-
*/
|
|
76
|
-
@ReactMethod
|
|
77
|
-
fun initWithConfig(nativeId: NativeId, config: ReadableMap, promise: Promise) {
|
|
78
|
-
promise.unit.resolveOnUiThread {
|
|
79
|
-
if (drmConfigs.containsKey(nativeId)) {
|
|
80
|
-
throw InvalidParameterException("NativeId already exists $nativeId")
|
|
81
|
-
}
|
|
82
|
-
val widevineConfig = config.toWidevineConfig() ?: throw InvalidParameterException("Invalid widevine config")
|
|
83
|
-
widevineConfig.prepareMessageCallback = buildPrepareMessageCallback(nativeId, config)
|
|
84
|
-
widevineConfig.prepareLicenseCallback = buildPrepareLicense(nativeId, config)
|
|
85
|
-
drmConfigs[nativeId] = widevineConfig
|
|
67
|
+
Function("setPreparedMessage") { id: Int, message: String ->
|
|
68
|
+
waiter.complete(id, message)
|
|
86
69
|
}
|
|
87
|
-
}
|
|
88
70
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
@ReactMethod
|
|
94
|
-
fun destroy(nativeId: NativeId) {
|
|
95
|
-
drmConfigs.remove(nativeId)
|
|
96
|
-
}
|
|
71
|
+
Function("setPreparedLicense") { id: Int, license: String ->
|
|
72
|
+
waiter.complete(id, license)
|
|
73
|
+
}
|
|
97
74
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
75
|
+
// iOS-specific methods that return null on Android for compatibility
|
|
76
|
+
AsyncFunction("setPreparedCertificate") { _: String, _: String -> // No-op on Android
|
|
77
|
+
}
|
|
78
|
+
AsyncFunction("setPreparedSyncMessage") { _: String, _: String -> // No-op on Android
|
|
79
|
+
}
|
|
80
|
+
AsyncFunction("setPreparedLicenseServerUrl") { _: String, _: String -> // No-op on Android
|
|
81
|
+
}
|
|
82
|
+
AsyncFunction("setPreparedContentId") { _: String, _: String -> // No-op on Android
|
|
106
83
|
}
|
|
107
84
|
}
|
|
108
85
|
|
|
109
86
|
/**
|
|
110
|
-
*
|
|
87
|
+
* Fetches the `WidevineConfig` instance associated with `nativeId` from internal drmConfigs.
|
|
88
|
+
* @param nativeId `WidevineConfig` instance ID.
|
|
89
|
+
* @return The associated `WidevineConfig` instance or `null`.
|
|
111
90
|
*/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
preparedLicenses[nativeId] = license
|
|
116
|
-
preparedLicensesCondition.signal()
|
|
91
|
+
fun getConfig(nativeId: NativeId?): WidevineConfig? {
|
|
92
|
+
if (nativeId == null) {
|
|
93
|
+
return null
|
|
117
94
|
}
|
|
95
|
+
return drmConfigs[nativeId]
|
|
118
96
|
}
|
|
119
97
|
|
|
120
98
|
/**
|
|
121
99
|
* Initialize the `prepareMessage` block in the [widevineConfig]
|
|
122
|
-
* @param
|
|
100
|
+
* @param nativeId Instance ID.
|
|
123
101
|
* @param config `DrmConfig` config object sent from JS.
|
|
124
102
|
*/
|
|
125
|
-
private fun buildPrepareMessageCallback(nativeId: NativeId, config:
|
|
126
|
-
if (config
|
|
103
|
+
private fun buildPrepareMessageCallback(nativeId: NativeId, config: Map<String, Any?>): PrepareMessageCallback? {
|
|
104
|
+
if ((config["widevine"] as? Map<*, *>)?.containsKey("prepareMessage") != true) {
|
|
127
105
|
return null
|
|
128
106
|
}
|
|
129
107
|
val prepareMessageCallback = createPrepareCallback(
|
|
130
108
|
nativeId,
|
|
131
109
|
"onPrepareMessage",
|
|
132
|
-
|
|
133
|
-
preparedMessagesCondition,
|
|
110
|
+
waiter,
|
|
134
111
|
)
|
|
135
112
|
return PrepareMessageCallback(prepareMessageCallback)
|
|
136
113
|
}
|
|
@@ -140,15 +117,14 @@ class DrmModule(context: ReactApplicationContext) : BitmovinBaseModule(context)
|
|
|
140
117
|
* @param nativeId Instance ID.
|
|
141
118
|
* @param config `DrmConfig` config object sent from JS.
|
|
142
119
|
*/
|
|
143
|
-
private fun buildPrepareLicense(nativeId: NativeId, config:
|
|
144
|
-
if (config
|
|
120
|
+
private fun buildPrepareLicense(nativeId: NativeId, config: Map<String, Any?>): PrepareLicenseCallback? {
|
|
121
|
+
if ((config["widevine"] as? Map<*, *>)?.containsKey("prepareLicense") != true) {
|
|
145
122
|
return null
|
|
146
123
|
}
|
|
147
124
|
val prepareLicense = createPrepareCallback(
|
|
148
125
|
nativeId,
|
|
149
126
|
"onPrepareLicense",
|
|
150
|
-
|
|
151
|
-
preparedLicensesCondition,
|
|
127
|
+
waiter,
|
|
152
128
|
)
|
|
153
129
|
return PrepareLicenseCallback(prepareLicense)
|
|
154
130
|
}
|
|
@@ -157,22 +133,27 @@ class DrmModule(context: ReactApplicationContext) : BitmovinBaseModule(context)
|
|
|
157
133
|
* Creates the body of a preparation callback e.g. `prepareMessage`, `prepareLicense`, etc.
|
|
158
134
|
* @param nativeId Instance ID.
|
|
159
135
|
* @param method JS prepare callback name.
|
|
160
|
-
* @param
|
|
136
|
+
* @param waiter ResultWaiter for handling async response.
|
|
161
137
|
* @return The preparation callback function.
|
|
162
138
|
*/
|
|
163
139
|
private fun createPrepareCallback(
|
|
164
140
|
nativeId: NativeId,
|
|
165
141
|
method: String,
|
|
166
|
-
|
|
167
|
-
registryCondition: Condition,
|
|
142
|
+
waiter: ResultWaiter<String>,
|
|
168
143
|
): PrepareCallback = {
|
|
169
|
-
val
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
144
|
+
val (id, wait) = waiter.make(5000) // 5 second timeout
|
|
145
|
+
|
|
146
|
+
// Send event to TypeScript using Expo module event system
|
|
147
|
+
sendEvent(
|
|
148
|
+
method,
|
|
149
|
+
bundleOf(
|
|
150
|
+
"nativeId" to nativeId,
|
|
151
|
+
"id" to id,
|
|
152
|
+
"data" to Base64.encodeToString(it, Base64.NO_WRAP),
|
|
153
|
+
),
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
val result = wait() ?: ""
|
|
157
|
+
Base64.decode(result, Base64.NO_WRAP)
|
|
177
158
|
}
|
|
178
159
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.bitmovin.player.reactnative
|
|
2
|
+
|
|
3
|
+
import com.bitmovin.player.api.event.Event
|
|
4
|
+
import com.bitmovin.player.api.event.EventListener
|
|
5
|
+
import kotlin.reflect.KClass
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Data class representing an event subscription for Bitmovin Player events.
|
|
9
|
+
* This class encapsulates the event class type and the corresponding action to be executed
|
|
10
|
+
* when the event is triggered.
|
|
11
|
+
*
|
|
12
|
+
* @param eventClass The KClass of the event to subscribe to
|
|
13
|
+
* @param action The function to execute when the event is triggered
|
|
14
|
+
*/
|
|
15
|
+
data class EventSubscription<E : Event> (
|
|
16
|
+
val eventClass: KClass<out E>,
|
|
17
|
+
val action: (E) -> Unit,
|
|
18
|
+
) : EventListener<E> {
|
|
19
|
+
override fun onEvent(event: E) {
|
|
20
|
+
action(event)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
package com.bitmovin.player.reactnative
|
|
2
|
+
|
|
3
|
+
import com.bitmovin.player.reactnative.ui.FullscreenHandlerBridge
|
|
4
|
+
import expo.modules.kotlin.modules.Module
|
|
5
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Expo module for FullscreenHandler management with bidirectional communication.
|
|
9
|
+
* Handles synchronous fullscreen state changes between native code and JavaScript.
|
|
10
|
+
*/
|
|
11
|
+
class FullscreenHandlerModule : Module() {
|
|
12
|
+
/**
|
|
13
|
+
* In-memory mapping from `nativeId`s to `FullscreenHandlerBridge` instances.
|
|
14
|
+
*/
|
|
15
|
+
private val fullscreenHandlers: Registry<FullscreenHandlerBridge> = mutableMapOf()
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* ResultWaiter used for blocking thread while waiting for fullscreen state change
|
|
19
|
+
*/
|
|
20
|
+
private val waiter = ResultWaiter<Boolean>()
|
|
21
|
+
|
|
22
|
+
override fun definition() = ModuleDefinition {
|
|
23
|
+
Name("FullscreenHandlerModule")
|
|
24
|
+
|
|
25
|
+
OnDestroy {
|
|
26
|
+
fullscreenHandlers.clear()
|
|
27
|
+
waiter.clear()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Events("onEnterFullscreen", "onExitFullscreen")
|
|
31
|
+
|
|
32
|
+
AsyncFunction("registerHandler") { nativeId: NativeId ->
|
|
33
|
+
if (fullscreenHandlers[nativeId] == null) {
|
|
34
|
+
fullscreenHandlers[nativeId] = FullscreenHandlerBridge(nativeId, this@FullscreenHandlerModule)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
AsyncFunction("destroy") { nativeId: NativeId ->
|
|
39
|
+
fullscreenHandlers.remove(nativeId)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
AsyncFunction("notifyFullscreenChanged") { id: Int, isFullscreenEnabled: Boolean ->
|
|
43
|
+
waiter.complete(id, isFullscreenEnabled)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
AsyncFunction("setIsFullscreenActive") { nativeId: NativeId, isFullscreenActive: Boolean ->
|
|
47
|
+
fullscreenHandlers[nativeId]?.isFullscreen = isFullscreenActive
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Retrieves the FullscreenHandlerBridge instance for the given nativeId.
|
|
53
|
+
* This method maintains the same static access pattern as the legacy module.
|
|
54
|
+
*/
|
|
55
|
+
fun getInstance(nativeId: NativeId?): FullscreenHandlerBridge? = fullscreenHandlers[nativeId]
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Handles fullscreen enter request from native code.
|
|
59
|
+
* Called by FullscreenHandlerBridge when fullscreen should be entered.
|
|
60
|
+
*/
|
|
61
|
+
fun requestEnterFullscreen(nativeId: NativeId) {
|
|
62
|
+
val handler = getInstance(nativeId) ?: return
|
|
63
|
+
|
|
64
|
+
val (id, wait) = waiter.make(250) // 250ms timeout
|
|
65
|
+
|
|
66
|
+
// Send event to JavaScript
|
|
67
|
+
sendEvent(
|
|
68
|
+
"onEnterFullscreen",
|
|
69
|
+
mapOf(
|
|
70
|
+
"nativeId" to nativeId,
|
|
71
|
+
"id" to id,
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
val result = wait() ?: return
|
|
76
|
+
handler.isFullscreen = result
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Handles fullscreen exit request from native code.
|
|
81
|
+
* Called by FullscreenHandlerBridge when fullscreen should be exited.
|
|
82
|
+
*/
|
|
83
|
+
fun requestExitFullscreen(nativeId: NativeId) {
|
|
84
|
+
val handler = getInstance(nativeId) ?: return
|
|
85
|
+
|
|
86
|
+
val (id, wait) = waiter.make(250) // 250ms timeout
|
|
87
|
+
|
|
88
|
+
// Send event to JavaScript
|
|
89
|
+
sendEvent(
|
|
90
|
+
"onExitFullscreen",
|
|
91
|
+
mapOf(
|
|
92
|
+
"nativeId" to nativeId,
|
|
93
|
+
"id" to id,
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
val result = wait() ?: return
|
|
98
|
+
handler.isFullscreen = result
|
|
99
|
+
}
|
|
100
|
+
}
|