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
package/android/src/main/java/com/bitmovin/player/reactnative/MediaSessionPlaybackManager.kt
CHANGED
|
@@ -6,11 +6,10 @@ import android.content.Intent
|
|
|
6
6
|
import android.content.ServiceConnection
|
|
7
7
|
import android.os.IBinder
|
|
8
8
|
import com.bitmovin.player.api.Player
|
|
9
|
-
import com.bitmovin.player.reactnative.extensions.playerModule
|
|
10
9
|
import com.bitmovin.player.reactnative.services.MediaSessionPlaybackService
|
|
11
|
-
import
|
|
10
|
+
import expo.modules.kotlin.AppContext
|
|
12
11
|
|
|
13
|
-
class MediaSessionPlaybackManager(val
|
|
12
|
+
class MediaSessionPlaybackManager(val appContext: AppContext) {
|
|
14
13
|
private var serviceBinder: MediaSessionPlaybackService.ServiceBinder? = null
|
|
15
14
|
private var playerId: NativeId? = null
|
|
16
15
|
val player: Player?
|
|
@@ -33,6 +32,8 @@ class MediaSessionPlaybackManager(val context: ReactApplicationContext) {
|
|
|
33
32
|
fun setupMediaSessionPlayback(playerId: NativeId) {
|
|
34
33
|
this.playerId = playerId
|
|
35
34
|
|
|
35
|
+
val context = appContext.reactContext
|
|
36
|
+
?: throw IllegalStateException("React context is not available")
|
|
36
37
|
val intent = Intent(context, MediaSessionPlaybackService::class.java)
|
|
37
38
|
intent.action = Intent.ACTION_MEDIA_BUTTON
|
|
38
39
|
val connection: ServiceConnection = MediaSessionPlaybackServiceConnection()
|
|
@@ -49,7 +50,6 @@ class MediaSessionPlaybackManager(val context: ReactApplicationContext) {
|
|
|
49
50
|
|
|
50
51
|
private fun getPlayer(
|
|
51
52
|
nativeId: NativeId? = playerId,
|
|
52
|
-
|
|
53
|
-
): Player = nativeId?.let { playerModule?.getPlayerOrNull(nativeId) }
|
|
53
|
+
): Player = playerId?.let { appContext.registry.getModule<PlayerModule>()?.getPlayerOrNull(it) }
|
|
54
54
|
?: throw IllegalArgumentException("Invalid PlayerId $nativeId")
|
|
55
55
|
}
|
|
@@ -3,6 +3,7 @@ package com.bitmovin.player.reactnative
|
|
|
3
3
|
import android.util.Log
|
|
4
4
|
import androidx.concurrent.futures.CallbackToFutureAdapter
|
|
5
5
|
import androidx.concurrent.futures.CallbackToFutureAdapter.Completer
|
|
6
|
+
import androidx.core.os.bundleOf
|
|
6
7
|
import com.bitmovin.player.api.network.HttpRequest
|
|
7
8
|
import com.bitmovin.player.api.network.HttpRequestType
|
|
8
9
|
import com.bitmovin.player.api.network.HttpResponse
|
|
@@ -13,16 +14,17 @@ import com.bitmovin.player.reactnative.converter.toHttpRequest
|
|
|
13
14
|
import com.bitmovin.player.reactnative.converter.toHttpResponse
|
|
14
15
|
import com.bitmovin.player.reactnative.converter.toJson
|
|
15
16
|
import com.bitmovin.player.reactnative.converter.toNetworkConfig
|
|
16
|
-
import
|
|
17
|
-
import
|
|
17
|
+
import expo.modules.kotlin.Promise
|
|
18
|
+
import expo.modules.kotlin.modules.Module
|
|
19
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
18
20
|
import java.util.concurrent.ConcurrentHashMap
|
|
19
21
|
import java.util.concurrent.Future
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Expo module for NetworkConfig management with HTTP request/response preprocessing.
|
|
25
|
+
* Handles bidirectional communication between native code and JavaScript for network operations.
|
|
26
|
+
*/
|
|
27
|
+
class NetworkModule : Module() {
|
|
26
28
|
/**
|
|
27
29
|
* In-memory mapping from `nativeId`s to `NetworkConfig` instances.
|
|
28
30
|
*/
|
|
@@ -30,49 +32,84 @@ class NetworkModule(context: ReactApplicationContext) : BitmovinBaseModule(conte
|
|
|
30
32
|
private val preprocessHttpRequestCompleters = ConcurrentHashMap<String, Completer<HttpRequest>>()
|
|
31
33
|
private val preprocessHttpResponseCompleters = ConcurrentHashMap<String, Completer<HttpResponse>>()
|
|
32
34
|
|
|
33
|
-
override fun
|
|
35
|
+
override fun definition() = ModuleDefinition {
|
|
36
|
+
Name("NetworkModule")
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
OnDestroy {
|
|
39
|
+
networkConfigs.clear()
|
|
40
|
+
preprocessHttpRequestCompleters.clear()
|
|
41
|
+
preprocessHttpResponseCompleters.clear()
|
|
42
|
+
}
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
promise
|
|
44
|
+
Events("onPreprocessHttpRequest", "onPreprocessHttpResponse")
|
|
45
|
+
|
|
46
|
+
AsyncFunction("initializeWithConfig") { nativeId: NativeId, config: Map<String, Any?>, promise: Promise ->
|
|
40
47
|
if (networkConfigs.containsKey(nativeId)) {
|
|
41
|
-
|
|
48
|
+
promise.resolve(null)
|
|
49
|
+
return@AsyncFunction
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
val networkConfig = config.toNetworkConfig()
|
|
54
|
+
networkConfigs[nativeId] = networkConfig
|
|
55
|
+
initConfigBlocks(nativeId, config)
|
|
56
|
+
promise.resolve(null)
|
|
57
|
+
} catch (e: Exception) {
|
|
58
|
+
promise.reject("NetworkError", "Failed to initialize network config", e)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
AsyncFunction("destroy") { nativeId: NativeId ->
|
|
63
|
+
networkConfigs.remove(nativeId)
|
|
64
|
+
|
|
65
|
+
// Clean up completion handlers
|
|
66
|
+
preprocessHttpRequestCompleters.keys.filter { it.startsWith(nativeId) }.forEach {
|
|
67
|
+
preprocessHttpRequestCompleters.remove(it)
|
|
68
|
+
}
|
|
69
|
+
preprocessHttpResponseCompleters.keys.filter { it.startsWith(nativeId) }.forEach {
|
|
70
|
+
preprocessHttpResponseCompleters.remove(it)
|
|
42
71
|
}
|
|
43
|
-
val networkConfig = config.toNetworkConfig()
|
|
44
|
-
networkConfigs[nativeId] = networkConfig
|
|
45
|
-
initConfigBlocks(nativeId, config)
|
|
46
72
|
}
|
|
47
|
-
}
|
|
48
73
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
AsyncFunction("setPreprocessedHttpRequest") { requestId: String, request: Map<String, Any?> ->
|
|
75
|
+
val completer = preprocessHttpRequestCompleters.remove(requestId)
|
|
76
|
+
if (completer == null) {
|
|
77
|
+
Log.e("NetworkModule", "Completer is null for requestId: $requestId, this can cause stuck network requests")
|
|
78
|
+
return@AsyncFunction
|
|
79
|
+
}
|
|
80
|
+
completer.set(request.toHttpRequest())
|
|
54
81
|
}
|
|
55
|
-
|
|
56
|
-
|
|
82
|
+
|
|
83
|
+
AsyncFunction("setPreprocessedHttpResponse") { responseId: String, response: Map<String, Any?> ->
|
|
84
|
+
preprocessHttpResponseCompleters[responseId]?.set(response.toHttpResponse())
|
|
85
|
+
preprocessHttpResponseCompleters.remove(responseId)
|
|
57
86
|
}
|
|
58
87
|
}
|
|
59
88
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Retrieves the NetworkConfig instance for the given nativeId.
|
|
91
|
+
* This method maintains the same static access pattern as the legacy module.
|
|
92
|
+
*/
|
|
93
|
+
fun getConfig(nativeId: NativeId?): NetworkConfig? = nativeId?.let { networkConfigs[it] }
|
|
94
|
+
|
|
95
|
+
private fun initConfigBlocks(nativeId: NativeId, config: Map<String, Any?>) {
|
|
96
|
+
initPreprocessHttpRequest(nativeId, config)
|
|
97
|
+
initPreprocessHttpResponse(nativeId, config)
|
|
63
98
|
}
|
|
64
99
|
|
|
65
|
-
private fun initPreprocessHttpRequest(nativeId: NativeId, networkConfigJson:
|
|
100
|
+
private fun initPreprocessHttpRequest(nativeId: NativeId, networkConfigJson: Map<String, Any?>) {
|
|
66
101
|
val networkConfig = getConfig(nativeId) ?: return
|
|
67
|
-
if (!networkConfigJson.
|
|
102
|
+
if (!networkConfigJson.containsKey("preprocessHttpRequest")) return
|
|
103
|
+
|
|
68
104
|
networkConfig.preprocessHttpRequestCallback = PreprocessHttpRequestCallback { type, request ->
|
|
69
105
|
preprocessHttpRequestFromJS(nativeId, type, request)
|
|
70
106
|
}
|
|
71
107
|
}
|
|
72
108
|
|
|
73
|
-
private fun initPreprocessHttpResponse(nativeId: NativeId, networkConfigJson:
|
|
109
|
+
private fun initPreprocessHttpResponse(nativeId: NativeId, networkConfigJson: Map<String, Any?>) {
|
|
74
110
|
val networkConfig = getConfig(nativeId) ?: return
|
|
75
|
-
if (!networkConfigJson.
|
|
111
|
+
if (!networkConfigJson.containsKey("preprocessHttpResponse")) return
|
|
112
|
+
|
|
76
113
|
networkConfig.preprocessHttpResponseCallback = PreprocessHttpResponseCallback { type, response ->
|
|
77
114
|
preprocessHttpResponseFromJS(nativeId, type, response)
|
|
78
115
|
}
|
|
@@ -84,25 +121,28 @@ class NetworkModule(context: ReactApplicationContext) : BitmovinBaseModule(conte
|
|
|
84
121
|
request: HttpRequest,
|
|
85
122
|
): Future<HttpRequest> {
|
|
86
123
|
val requestId = "$nativeId@${System.identityHashCode(request)}"
|
|
87
|
-
val args =
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
124
|
+
val args = mapOf(
|
|
125
|
+
"requestId" to requestId,
|
|
126
|
+
"type" to type.toJson(),
|
|
127
|
+
"request" to request.toJson(),
|
|
128
|
+
)
|
|
91
129
|
|
|
92
130
|
return CallbackToFutureAdapter.getFuture { completer ->
|
|
93
131
|
preprocessHttpRequestCompleters[requestId] = completer
|
|
94
|
-
context.catalystInstance.callFunction("Network-$nativeId", "onPreprocessHttpRequest", args as NativeArray)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
132
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
133
|
+
// Send event to TypeScript using Expo module event system
|
|
134
|
+
sendEvent(
|
|
135
|
+
"onPreprocessHttpRequest",
|
|
136
|
+
bundleOf(
|
|
137
|
+
"nativeId" to nativeId,
|
|
138
|
+
"requestId" to requestId,
|
|
139
|
+
"type" to type.toJson(),
|
|
140
|
+
"request" to request.toJson(),
|
|
141
|
+
),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return@getFuture "NetworkModule-preprocessHttpRequest-$requestId"
|
|
104
145
|
}
|
|
105
|
-
completer.set(request.toHttpRequest())
|
|
106
146
|
}
|
|
107
147
|
|
|
108
148
|
private fun preprocessHttpResponseFromJS(
|
|
@@ -111,20 +151,22 @@ class NetworkModule(context: ReactApplicationContext) : BitmovinBaseModule(conte
|
|
|
111
151
|
response: HttpResponse,
|
|
112
152
|
): Future<HttpResponse> {
|
|
113
153
|
val responseId = "$nativeId@${System.identityHashCode(response)}"
|
|
114
|
-
val args = Arguments.createArray()
|
|
115
|
-
args.pushString(responseId)
|
|
116
|
-
args.pushString(type.toJson())
|
|
117
|
-
args.pushMap(response.toJson())
|
|
118
154
|
|
|
119
155
|
return CallbackToFutureAdapter.getFuture { completer ->
|
|
120
156
|
preprocessHttpResponseCompleters[responseId] = completer
|
|
121
|
-
context.catalystInstance.callFunction("Network-$nativeId", "onPreprocessHttpResponse", args as NativeArray)
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
157
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
158
|
+
// Send event to TypeScript using Expo module event system
|
|
159
|
+
sendEvent(
|
|
160
|
+
"onPreprocessHttpResponse",
|
|
161
|
+
bundleOf(
|
|
162
|
+
"nativeId" to nativeId,
|
|
163
|
+
"responseId" to responseId,
|
|
164
|
+
"type" to type.toJson(),
|
|
165
|
+
"response" to response.toJson(),
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
return@getFuture "NetworkModule-preprocessHttpResponse-$responseId"
|
|
170
|
+
}
|
|
129
171
|
}
|
|
130
172
|
}
|
|
@@ -2,247 +2,193 @@ package com.bitmovin.player.reactnative
|
|
|
2
2
|
|
|
3
3
|
import com.bitmovin.player.api.offline.options.OfflineOptionEntryState
|
|
4
4
|
import com.bitmovin.player.reactnative.converter.toSourceConfig
|
|
5
|
-
import com.bitmovin.player.reactnative.extensions.drmModule
|
|
6
|
-
import com.bitmovin.player.reactnative.extensions.getIntOrNull
|
|
7
|
-
import com.bitmovin.player.reactnative.extensions.getStringArray
|
|
8
5
|
import com.bitmovin.player.reactnative.offline.OfflineContentManagerBridge
|
|
9
6
|
import com.bitmovin.player.reactnative.offline.OfflineDownloadRequest
|
|
10
|
-
import
|
|
11
|
-
import
|
|
7
|
+
import expo.modules.kotlin.exception.CodedException
|
|
8
|
+
import expo.modules.kotlin.modules.Module
|
|
9
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
12
10
|
import java.security.InvalidParameterException
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@ReactModule(name = OFFLINE_MODULE)
|
|
17
|
-
class OfflineModule(context: ReactApplicationContext) : BitmovinBaseModule(context) {
|
|
12
|
+
class OfflineModule : Module() {
|
|
18
13
|
|
|
19
14
|
/**
|
|
20
|
-
* In-memory mapping from `nativeId`s to `
|
|
15
|
+
* In-memory mapping from `nativeId`s to `OfflineContentManagerBridge` instances.
|
|
16
|
+
* This must match the Registry pattern from legacy OfflineModule
|
|
21
17
|
*/
|
|
22
18
|
private val offlineContentManagerBridges: Registry<OfflineContentManagerBridge> = mutableMapOf()
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*/
|
|
27
|
-
override fun getName() = OFFLINE_MODULE
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Fetches the `OfflineManager` instance associated with `nativeId` from the internal offline managers.
|
|
31
|
-
*/
|
|
32
|
-
fun getOfflineContentManagerBridgeOrNull(
|
|
33
|
-
nativeId: NativeId,
|
|
34
|
-
): OfflineContentManagerBridge? = offlineContentManagerBridges[nativeId]
|
|
20
|
+
override fun definition() = ModuleDefinition {
|
|
21
|
+
Name("OfflineModule")
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
nativeId: NativeId,
|
|
38
|
-
): OfflineContentManagerBridge = offlineContentManagerBridges[nativeId]
|
|
39
|
-
?: throw IllegalArgumentException("No offline content manager bridge for id $nativeId")
|
|
23
|
+
Events("onBitmovinOfflineEvent")
|
|
40
24
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@ReactMethod
|
|
45
|
-
fun addListener(eventName: String?) {
|
|
46
|
-
// NO-OP
|
|
47
|
-
}
|
|
25
|
+
OnCreate {
|
|
26
|
+
// Module initialization
|
|
27
|
+
}
|
|
48
28
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
fun removeListeners(count: Int?) {
|
|
54
|
-
// NO-OP
|
|
55
|
-
}
|
|
29
|
+
OnDestroy {
|
|
30
|
+
// Clean up offline content managers
|
|
31
|
+
offlineContentManagerBridges.clear()
|
|
32
|
+
}
|
|
56
33
|
|
|
57
|
-
|
|
58
|
-
* Creates a new `OfflineManager` instance inside the internal offline managers using the provided `config` object.
|
|
59
|
-
* @param config `ReadableMap` object received from JS. Should contain a sourceConfig and location.
|
|
60
|
-
*/
|
|
61
|
-
@ReactMethod
|
|
62
|
-
fun initWithConfig(nativeId: NativeId, config: ReadableMap?, drmNativeId: NativeId?, promise: Promise) {
|
|
63
|
-
promise.unit.resolveOnUiThread {
|
|
34
|
+
AsyncFunction("initializeWithConfig") { nativeId: NativeId, config: Map<String, Any?>?, drmNativeId: NativeId? ->
|
|
64
35
|
if (offlineContentManagerBridges.containsKey(nativeId)) {
|
|
65
|
-
throw
|
|
36
|
+
throw OfflineException.ManagerAlreadyExists(nativeId)
|
|
66
37
|
}
|
|
67
|
-
val identifier = config?.getString("identifier")
|
|
68
|
-
?.takeIf { it.isNotEmpty() } ?: throw IllegalArgumentException("invalid identifier")
|
|
69
38
|
|
|
70
|
-
val
|
|
71
|
-
?: throw
|
|
39
|
+
val identifier = config?.get("identifier") as? String
|
|
40
|
+
?: throw OfflineException.InvalidIdentifier()
|
|
41
|
+
|
|
42
|
+
val sourceConfig = (config["sourceConfig"] as? Map<String, Any?>)?.toSourceConfig()
|
|
43
|
+
?: throw OfflineException.InvalidSourceConfig()
|
|
72
44
|
|
|
73
|
-
|
|
45
|
+
// Get DRM config from DrmModule if available
|
|
46
|
+
sourceConfig.drmConfig = appContext.registry.getModule<DrmModule>()?.getConfig(drmNativeId)
|
|
47
|
+
|
|
48
|
+
val context = appContext.reactContext
|
|
49
|
+
?: throw InvalidParameterException("ReactApplicationContext is not available")
|
|
74
50
|
|
|
75
51
|
offlineContentManagerBridges[nativeId] = OfflineContentManagerBridge(
|
|
76
52
|
nativeId,
|
|
77
53
|
context,
|
|
54
|
+
this@OfflineModule,
|
|
78
55
|
identifier,
|
|
79
56
|
sourceConfig,
|
|
80
|
-
|
|
57
|
+
appContext.cacheDirectory.path,
|
|
81
58
|
)
|
|
82
59
|
}
|
|
83
|
-
}
|
|
84
60
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Gets the current state of the `OfflineContentManager`
|
|
63
|
+
*/
|
|
64
|
+
AsyncFunction("getState") { nativeId: NativeId ->
|
|
65
|
+
getOfflineContentManagerBridge(nativeId).state.name
|
|
89
66
|
}
|
|
90
|
-
}
|
|
91
67
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
fun getOptions(nativeId: NativeId, promise: Promise) {
|
|
99
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
100
|
-
getOptions()
|
|
68
|
+
/**
|
|
69
|
+
* Starts the `OfflineContentManager`'s asynchronous process of fetching the `OfflineContentOptions`.
|
|
70
|
+
* When the options are loaded a device event will be fired where the event type is `BitmovinOfflineEvent` * and the data has an event type of `onOptionsAvailable`.
|
|
71
|
+
*/
|
|
72
|
+
AsyncFunction("getOptions") { nativeId: NativeId ->
|
|
73
|
+
getOfflineContentManagerBridge(nativeId).getOptions()
|
|
101
74
|
}
|
|
102
|
-
}
|
|
103
75
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
OfflineOptionEntryState.
|
|
116
|
-
OfflineOptionEntryState.Downloading, OfflineOptionEntryState.Failed -> throw IllegalStateException(
|
|
117
|
-
"Download already in progress",
|
|
118
|
-
)
|
|
119
|
-
OfflineOptionEntryState.Suspended -> throw IllegalStateException("Download is suspended")
|
|
76
|
+
/**
|
|
77
|
+
* Enqueues downloads according to the `OfflineDownloadRequest`.
|
|
78
|
+
* The promise will reject in the event of null or invalid request parameters.
|
|
79
|
+
*/
|
|
80
|
+
AsyncFunction("download") { nativeId: NativeId, request: Map<String, Any?> ->
|
|
81
|
+
val bridge = getOfflineContentManagerBridge(nativeId)
|
|
82
|
+
|
|
83
|
+
when (bridge.state) {
|
|
84
|
+
OfflineOptionEntryState.Downloaded -> throw OfflineException.DownloadAlreadyCompleted()
|
|
85
|
+
OfflineOptionEntryState.Downloading, OfflineOptionEntryState.Failed ->
|
|
86
|
+
throw OfflineException.DownloadInProgress()
|
|
87
|
+
OfflineOptionEntryState.Suspended -> throw OfflineException.DownloadSuspended()
|
|
120
88
|
else -> {}
|
|
121
89
|
}
|
|
122
|
-
|
|
123
|
-
|
|
90
|
+
|
|
91
|
+
val minimumBitRate = request["minimumBitrate"] as? Int
|
|
92
|
+
if (minimumBitRate != null && minimumBitRate < 0) {
|
|
93
|
+
throw OfflineException.InvalidRequest()
|
|
124
94
|
}
|
|
125
|
-
val audioOptionIds = request.getStringArray("audioOptionIds")?.filterNotNull()
|
|
126
|
-
val textOptionIds = request.getStringArray("textOptionIds")?.filterNotNull()
|
|
127
95
|
|
|
128
|
-
|
|
96
|
+
val audioOptionIds = (request["audioOptionIds"] as? List<*>)?.filterIsInstance<String>()
|
|
97
|
+
val textOptionIds = (request["textOptionIds"] as? List<*>)?.filterIsInstance<String>()
|
|
98
|
+
|
|
99
|
+
bridge.process(OfflineDownloadRequest(minimumBitRate, audioOptionIds, textOptionIds))
|
|
129
100
|
}
|
|
130
|
-
}
|
|
131
101
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
fun resume(nativeId: NativeId, promise: Promise) {
|
|
138
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
139
|
-
resume()
|
|
102
|
+
/**
|
|
103
|
+
* Resumes all suspended actions.
|
|
104
|
+
*/
|
|
105
|
+
AsyncFunction("resume") { nativeId: NativeId ->
|
|
106
|
+
getOfflineContentManagerBridge(nativeId).resume()
|
|
140
107
|
}
|
|
141
|
-
}
|
|
142
108
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
fun suspend(nativeId: NativeId, promise: Promise) {
|
|
149
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
150
|
-
suspend()
|
|
109
|
+
/**
|
|
110
|
+
* Suspends all active actions.
|
|
111
|
+
*/
|
|
112
|
+
AsyncFunction("suspend") { nativeId: NativeId ->
|
|
113
|
+
getOfflineContentManagerBridge(nativeId).suspend()
|
|
151
114
|
}
|
|
152
|
-
}
|
|
153
115
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
fun cancelDownload(nativeId: NativeId, promise: Promise) {
|
|
160
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
161
|
-
cancelDownload()
|
|
116
|
+
/**
|
|
117
|
+
* Cancels and deletes the current download.
|
|
118
|
+
*/
|
|
119
|
+
AsyncFunction("cancelDownload") { nativeId: NativeId ->
|
|
120
|
+
getOfflineContentManagerBridge(nativeId).cancelDownload()
|
|
162
121
|
}
|
|
163
|
-
}
|
|
164
122
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
fun usedStorage(nativeId: NativeId, promise: Promise) {
|
|
171
|
-
promise.double.resolveWithBridge(nativeId) {
|
|
172
|
-
offlineContentManager.usedStorage.toDouble()
|
|
123
|
+
/**
|
|
124
|
+
* Resolve `nativeId`'s current `usedStorage`.
|
|
125
|
+
*/
|
|
126
|
+
AsyncFunction("usedStorage") { nativeId: NativeId ->
|
|
127
|
+
getOfflineContentManagerBridge(nativeId).offlineContentManager.usedStorage.toDouble()
|
|
173
128
|
}
|
|
174
|
-
}
|
|
175
129
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
fun deleteAll(nativeId: NativeId, promise: Promise) {
|
|
182
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
183
|
-
deleteAll()
|
|
130
|
+
/**
|
|
131
|
+
* Deletes everything related to the related content ID.
|
|
132
|
+
*/
|
|
133
|
+
AsyncFunction("deleteAll") { nativeId: NativeId ->
|
|
134
|
+
getOfflineContentManagerBridge(nativeId).deleteAll()
|
|
184
135
|
}
|
|
185
|
-
}
|
|
186
136
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
@ReactMethod
|
|
194
|
-
fun downloadLicense(nativeId: NativeId, promise: Promise) {
|
|
195
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
196
|
-
downloadLicense()
|
|
137
|
+
/**
|
|
138
|
+
* Downloads the offline license.
|
|
139
|
+
* When finished successfully a device event will be fired where the event type is `BitmovinOfflineEvent` * and the data has an event type of `onDrmLicenseUpdated`.
|
|
140
|
+
*/
|
|
141
|
+
AsyncFunction("downloadLicense") { nativeId: NativeId ->
|
|
142
|
+
getOfflineContentManagerBridge(nativeId).downloadLicense()
|
|
197
143
|
}
|
|
198
|
-
}
|
|
199
144
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
@ReactMethod
|
|
207
|
-
fun releaseLicense(nativeId: NativeId, promise: Promise) {
|
|
208
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
209
|
-
releaseLicense()
|
|
145
|
+
/**
|
|
146
|
+
* Releases the currently held offline license.
|
|
147
|
+
* When finished successfully a device event will be fired where the event type is `BitmovinOfflineEvent` * and the data has an event type of `onDrmLicenseUpdated`.
|
|
148
|
+
*/
|
|
149
|
+
AsyncFunction("releaseLicense") { nativeId: NativeId ->
|
|
150
|
+
getOfflineContentManagerBridge(nativeId).releaseLicense()
|
|
210
151
|
}
|
|
211
|
-
}
|
|
212
152
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
@ReactMethod
|
|
220
|
-
fun renewOfflineLicense(nativeId: NativeId, promise: Promise) {
|
|
221
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
222
|
-
renewOfflineLicense()
|
|
153
|
+
/**
|
|
154
|
+
* Renews the already downloaded DRM license.
|
|
155
|
+
* When finished successfully a device event will be fired where the event type is `BitmovinOfflineEvent` * and the data has an event type of `onDrmLicenseUpdated`.
|
|
156
|
+
*/
|
|
157
|
+
AsyncFunction("renewOfflineLicense") { nativeId: NativeId ->
|
|
158
|
+
getOfflineContentManagerBridge(nativeId).renewOfflineLicense()
|
|
223
159
|
}
|
|
224
|
-
}
|
|
225
160
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
promise.unit.resolveWithBridge(nativeId) {
|
|
235
|
-
release()
|
|
161
|
+
/**
|
|
162
|
+
* Call `.release()` on `nativeId`'s offline manager.
|
|
163
|
+
* IMPORTANT: Call this when the component, in which it was created, is destroyed.
|
|
164
|
+
* The `OfflineManager` should not be used after calling this method.
|
|
165
|
+
*/
|
|
166
|
+
AsyncFunction("release") { nativeId: NativeId ->
|
|
167
|
+
val bridge = getOfflineContentManagerBridge(nativeId)
|
|
168
|
+
bridge.release()
|
|
236
169
|
offlineContentManagerBridges.remove(nativeId)
|
|
237
170
|
}
|
|
238
171
|
}
|
|
239
172
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
) {
|
|
244
|
-
|
|
245
|
-
getOfflineContentManagerBridge(nativeId).block()
|
|
246
|
-
}
|
|
173
|
+
/**
|
|
174
|
+
* Helper function to get OfflineContentManagerBridge with proper error handling
|
|
175
|
+
*/
|
|
176
|
+
fun getOfflineContentManagerBridge(nativeId: NativeId): OfflineContentManagerBridge {
|
|
177
|
+
return offlineContentManagerBridges[nativeId] ?: throw OfflineException.ManagerNotFound(nativeId)
|
|
247
178
|
}
|
|
248
179
|
}
|
|
180
|
+
|
|
181
|
+
// MARK: - Exception Definitions
|
|
182
|
+
|
|
183
|
+
sealed class OfflineException(message: String) : CodedException(message) {
|
|
184
|
+
class ManagerAlreadyExists(nativeId: NativeId) : OfflineException(
|
|
185
|
+
"Content manager bridge id already exists: $nativeId",
|
|
186
|
+
)
|
|
187
|
+
class ManagerNotFound(nativeId: NativeId) : OfflineException("No offline content manager bridge for id $nativeId")
|
|
188
|
+
class InvalidIdentifier : OfflineException("Invalid identifier")
|
|
189
|
+
class InvalidSourceConfig : OfflineException("Invalid source config")
|
|
190
|
+
class InvalidRequest : OfflineException("Invalid download request")
|
|
191
|
+
class DownloadAlreadyCompleted : OfflineException("Download already completed")
|
|
192
|
+
class DownloadInProgress : OfflineException("Download already in progress")
|
|
193
|
+
class DownloadSuspended : OfflineException("Download is suspended")
|
|
194
|
+
}
|