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/ios/OfflineModule.swift
CHANGED
|
@@ -1,476 +1,158 @@
|
|
|
1
1
|
import BitmovinPlayer
|
|
2
|
+
import ExpoModulesCore
|
|
2
3
|
import Foundation
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// swiftlint:disable:next implicitly_unwrapped_optional
|
|
7
|
-
override public static func moduleName() -> String! {
|
|
8
|
-
"BitmovinOfflineModule"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
override public static func requiresMainQueueSetup() -> Bool {
|
|
12
|
-
true
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// swiftlint:disable:next implicitly_unwrapped_optional
|
|
16
|
-
override public func supportedEvents() -> [String]! {
|
|
17
|
-
["BitmovinOfflineEvent"]
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// swiftlint:disable:next implicitly_unwrapped_optional
|
|
21
|
-
override public var methodQueue: DispatchQueue! {
|
|
22
|
-
bridge.uiManager.methodQueue
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
#if os(iOS)
|
|
5
|
+
public class OfflineModule: Module {
|
|
6
|
+
#if os(iOS)
|
|
26
7
|
private var offlineContentManagerBridges: Registry<OfflineContentManagerBridge> = [:]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
#endif
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
Creates a new `OfflineContentManager` instance inside the internal offline managers using
|
|
40
|
-
the provided config object.
|
|
41
|
-
- Parameter config: Config object received from JS. Should contain `sourceConfig` and `identifier`.
|
|
42
|
-
*/
|
|
43
|
-
@objc(initWithConfig:config:drmNativeId:resolver:rejecter:)
|
|
44
|
-
func initWithConfig(
|
|
45
|
-
_ nativeId: NativeId,
|
|
46
|
-
config: Any?,
|
|
47
|
-
drmNativeId: NativeId?,
|
|
48
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
49
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
50
|
-
) {
|
|
51
|
-
#if os(iOS)
|
|
52
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
53
|
-
guard
|
|
54
|
-
let self,
|
|
55
|
-
self.offlineContentManagerBridges[nativeId] == nil,
|
|
56
|
-
let config = config as? [String: Any?],
|
|
57
|
-
let identifier = config["identifier"] as? String
|
|
58
|
-
else {
|
|
59
|
-
reject("BitmovinOfflineModule", "Could not create an offline content manager", nil)
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let fairplayConfig = drmNativeId.flatMap { self.bridge[DrmModule.self]?.retrieve($0) }
|
|
64
|
-
guard let sourceConfig = RCTConvert.sourceConfig(config["sourceConfig"], drmConfig: fairplayConfig) else {
|
|
65
|
-
reject("BitmovinOfflineModule", "Invalid source config", nil)
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
do {
|
|
70
|
-
let offlineContentManager = try OfflineManager.sharedInstance()
|
|
71
|
-
.offlineContentManager(for: sourceConfig, id: identifier)
|
|
72
|
-
let offlineContentManagerBridge = OfflineContentManagerBridge(
|
|
73
|
-
forManager: offlineContentManager,
|
|
74
|
-
eventEmitter: self,
|
|
75
|
-
nativeId: nativeId,
|
|
76
|
-
identifier: identifier
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
self.offlineContentManagerBridges[nativeId] = offlineContentManagerBridge
|
|
80
|
-
resolve(nil)
|
|
81
|
-
} catch let error as NSError {
|
|
82
|
-
reject("BitmovinOfflineModule", "Could not create an offline content manager", error)
|
|
83
|
-
}
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
// swiftlint:disable:next function_body_length
|
|
11
|
+
public func definition() -> ModuleDefinition {
|
|
12
|
+
Name("OfflineModule")
|
|
13
|
+
Events("onBitmovinOfflineEvent")
|
|
14
|
+
OnCreate {
|
|
15
|
+
// Module initialization
|
|
84
16
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
func getState(
|
|
90
|
-
_ nativeId: NativeId,
|
|
91
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
92
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
93
|
-
) {
|
|
94
|
-
#if os(iOS)
|
|
95
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
96
|
-
guard
|
|
97
|
-
let self,
|
|
98
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
99
|
-
else {
|
|
100
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
resolve(RCTConvert.toJson(offlineState: offlineContentManagerBridge.offlineContentManager.offlineState))
|
|
17
|
+
OnDestroy {
|
|
18
|
+
#if os(iOS)
|
|
19
|
+
self.offlineContentManagerBridges.removeAll()
|
|
20
|
+
#endif
|
|
105
21
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
#
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
guard
|
|
185
|
-
let currentTrackSelection = offlineContentManagerBridge.currentTrackSelection
|
|
186
|
-
else {
|
|
187
|
-
reject("BitmovinOfflineModule", "Invalid download options", nil)
|
|
188
|
-
return
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if let audioOptionIds = request["audioOptionIds"] as? [String],
|
|
192
|
-
!audioOptionIds.isEmpty {
|
|
193
|
-
currentTrackSelection.audioTracks.forEach {
|
|
194
|
-
if audioOptionIds.contains($0.label) {
|
|
195
|
-
$0.action = .download
|
|
196
|
-
} else {
|
|
197
|
-
$0.action = .none
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if let textOptionIds = request["textOptionIds"] as? [String],
|
|
203
|
-
!textOptionIds.isEmpty {
|
|
204
|
-
currentTrackSelection.textTracks.forEach {
|
|
205
|
-
if textOptionIds.contains($0.label) {
|
|
206
|
-
$0.action = .download
|
|
207
|
-
} else {
|
|
208
|
-
$0.action = .none
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
let config = DownloadConfig()
|
|
214
|
-
|
|
215
|
-
if let minimumBitrate = request["minimumBitrate"] as? NSNumber {
|
|
216
|
-
config.minimumBitrate = minimumBitrate
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
offlineContentManagerBridge.offlineContentManager.download(
|
|
220
|
-
tracks: currentTrackSelection,
|
|
221
|
-
downloadConfig: config
|
|
222
|
-
)
|
|
223
|
-
resolve(nil)
|
|
22
|
+
AsyncFunction("initializeWithConfig") { [weak self] (nativeId: NativeId, config: [String: Any?]?, drmNativeId: NativeId?) in // swiftlint:disable:this line_length
|
|
23
|
+
#if os(iOS)
|
|
24
|
+
self?.createOfflineManager(nativeId: nativeId, config: config, drmNativeId: drmNativeId)
|
|
25
|
+
#endif
|
|
26
|
+
}.runOnQueue(.main)
|
|
27
|
+
AsyncFunction("getState") { [weak self] (nativeId: NativeId) -> String? in
|
|
28
|
+
#if os(iOS)
|
|
29
|
+
let offlineState = self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.offlineState
|
|
30
|
+
return RCTConvert.toJson(offlineState: offlineState)
|
|
31
|
+
#else
|
|
32
|
+
return nil
|
|
33
|
+
#endif
|
|
34
|
+
}.runOnQueue(.main)
|
|
35
|
+
AsyncFunction("getOptions") { [weak self] (nativeId: NativeId) in
|
|
36
|
+
#if os(iOS)
|
|
37
|
+
self?.offlineContentManagerBridges[nativeId]?.fetchAvailableTracks()
|
|
38
|
+
#endif
|
|
39
|
+
}.runOnQueue(.main)
|
|
40
|
+
AsyncFunction("usedStorage") { [weak self] (nativeId: NativeId) -> Int? in
|
|
41
|
+
#if os(iOS)
|
|
42
|
+
return self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.usedStorage
|
|
43
|
+
#else
|
|
44
|
+
return nil
|
|
45
|
+
#endif
|
|
46
|
+
}.runOnQueue(.main)
|
|
47
|
+
AsyncFunction("deleteAll") { [weak self] (nativeId: NativeId) in
|
|
48
|
+
#if os(iOS)
|
|
49
|
+
self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.deleteOfflineData()
|
|
50
|
+
#endif
|
|
51
|
+
}.runOnQueue(.main)
|
|
52
|
+
AsyncFunction("release") { [weak self] (nativeId: NativeId) in
|
|
53
|
+
#if os(iOS)
|
|
54
|
+
self?.offlineContentManagerBridges[nativeId]?.release()
|
|
55
|
+
self?.offlineContentManagerBridges[nativeId] = nil
|
|
56
|
+
#endif
|
|
57
|
+
}.runOnQueue(.main)
|
|
58
|
+
AsyncFunction("download") { [weak self] (nativeId: NativeId, request: [String: Any?]?) in
|
|
59
|
+
#if os(iOS)
|
|
60
|
+
self?.download(nativeId: nativeId, request: request)
|
|
61
|
+
#endif
|
|
62
|
+
}.runOnQueue(.main)
|
|
63
|
+
AsyncFunction("resume") { [weak self] (nativeId: NativeId) in
|
|
64
|
+
#if os(iOS)
|
|
65
|
+
self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.resumeDownload()
|
|
66
|
+
#endif
|
|
67
|
+
}.runOnQueue(.main)
|
|
68
|
+
AsyncFunction("suspend") { [weak self] (nativeId: NativeId) in
|
|
69
|
+
#if os(iOS)
|
|
70
|
+
self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.suspendDownload()
|
|
71
|
+
#endif
|
|
72
|
+
}.runOnQueue(.main)
|
|
73
|
+
AsyncFunction("cancelDownload") { [weak self] (nativeId: NativeId) in
|
|
74
|
+
#if os(iOS)
|
|
75
|
+
self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.cancelDownload()
|
|
76
|
+
#endif
|
|
77
|
+
}.runOnQueue(.main)
|
|
78
|
+
AsyncFunction("downloadLicense") { [weak self] (nativeId: NativeId) in
|
|
79
|
+
#if os(iOS)
|
|
80
|
+
self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.syncOfflineDrmLicenseInformation()
|
|
81
|
+
#endif
|
|
82
|
+
}.runOnQueue(.main)
|
|
83
|
+
AsyncFunction("renewOfflineLicense") { [weak self] (nativeId: NativeId) in
|
|
84
|
+
#if os(iOS)
|
|
85
|
+
self?.offlineContentManagerBridges[nativeId]?.offlineContentManager.renewOfflineLicense()
|
|
86
|
+
#endif
|
|
87
|
+
}.runOnQueue(.main)
|
|
88
|
+
AsyncFunction("releaseLicense") { (_: String) in
|
|
89
|
+
// No-op on iOS
|
|
90
|
+
}.runOnQueue(.main)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#if os(iOS)
|
|
94
|
+
private func createOfflineManager(nativeId: NativeId, config: [String: Any?]?, drmNativeId: NativeId?) {
|
|
95
|
+
if self.offlineContentManagerBridges[nativeId] != nil {
|
|
96
|
+
return
|
|
224
97
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
Resumes all suspended actions.
|
|
230
|
-
- Parameter nativeId: Target offline module Id
|
|
231
|
-
- Parameter resolver: JS promise resolver.
|
|
232
|
-
- Parameter rejecter: JS promise rejecter.
|
|
233
|
-
*/
|
|
234
|
-
@objc(resume:resolver:rejecter:)
|
|
235
|
-
func resume(
|
|
236
|
-
_ nativeId: NativeId,
|
|
237
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
238
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
239
|
-
) {
|
|
240
|
-
#if os(iOS)
|
|
241
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
242
|
-
guard
|
|
243
|
-
let self,
|
|
244
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
245
|
-
else {
|
|
246
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
247
|
-
return
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
offlineContentManagerBridge.offlineContentManager.resumeDownload()
|
|
251
|
-
resolve(nil)
|
|
98
|
+
guard let config, let identifier = config["identifier"] as? String else {
|
|
99
|
+
return
|
|
252
100
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
Suspends all active actions.
|
|
258
|
-
- Parameter nativeId: Target offline module Id
|
|
259
|
-
- Parameter resolver: JS promise resolver.
|
|
260
|
-
- Parameter rejecter: JS promise rejecter.
|
|
261
|
-
*/
|
|
262
|
-
@objc(suspend:resolver:rejecter:)
|
|
263
|
-
func suspend(
|
|
264
|
-
_ nativeId: NativeId,
|
|
265
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
266
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
267
|
-
) {
|
|
268
|
-
#if os(iOS)
|
|
269
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
270
|
-
guard
|
|
271
|
-
let self,
|
|
272
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
273
|
-
else {
|
|
274
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
275
|
-
return
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
offlineContentManagerBridge.offlineContentManager.suspendDownload()
|
|
279
|
-
resolve(nil)
|
|
101
|
+
let fairplayConfig = drmNativeId.flatMap { appContext?.moduleRegistry.get(DrmModule.self)?.retrieve($0) }
|
|
102
|
+
guard let sourceConfigDict = config["sourceConfig"],
|
|
103
|
+
let sourceConfig = RCTConvert.sourceConfig(sourceConfigDict, drmConfig: fairplayConfig) else {
|
|
104
|
+
return
|
|
280
105
|
}
|
|
281
|
-
|
|
106
|
+
do {
|
|
107
|
+
let offlineContentManager = try OfflineManager.sharedInstance()
|
|
108
|
+
.offlineContentManager(for: sourceConfig, id: identifier)
|
|
109
|
+
let offlineContentManagerBridge = OfflineContentManagerBridge(
|
|
110
|
+
forManager: offlineContentManager,
|
|
111
|
+
module: self,
|
|
112
|
+
nativeId: nativeId,
|
|
113
|
+
identifier: identifier
|
|
114
|
+
)
|
|
115
|
+
self.offlineContentManagerBridges[nativeId] = offlineContentManagerBridge
|
|
116
|
+
} catch {}
|
|
282
117
|
}
|
|
283
118
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
- Parameter resolver: JS promise resolver.
|
|
288
|
-
- Parameter rejecter: JS promise rejecter.
|
|
289
|
-
*/
|
|
290
|
-
@objc(cancelDownload:resolver:rejecter:)
|
|
291
|
-
func cancelDownload(
|
|
292
|
-
_ nativeId: NativeId,
|
|
293
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
294
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
295
|
-
) {
|
|
296
|
-
#if os(iOS)
|
|
297
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
298
|
-
guard
|
|
299
|
-
let self,
|
|
300
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
301
|
-
else {
|
|
302
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
303
|
-
return
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
offlineContentManagerBridge.offlineContentManager.cancelDownload()
|
|
307
|
-
resolve(nil)
|
|
119
|
+
private func download(nativeId: NativeId, request: [String: Any?]?) {
|
|
120
|
+
guard let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId], let request else {
|
|
121
|
+
return
|
|
308
122
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
Resolve `nativeId`'s current `usedStorage`.
|
|
314
|
-
- Parameter nativeId: Target offline module Id
|
|
315
|
-
- Parameter resolver: JS promise resolver.
|
|
316
|
-
- Parameter rejecter: JS promise rejecter.
|
|
317
|
-
*/
|
|
318
|
-
@objc(usedStorage:resolver:rejecter:)
|
|
319
|
-
func usedStorage(
|
|
320
|
-
_ nativeId: NativeId,
|
|
321
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
322
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
323
|
-
) {
|
|
324
|
-
#if os(iOS)
|
|
325
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
326
|
-
guard
|
|
327
|
-
let self,
|
|
328
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
329
|
-
else {
|
|
330
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
331
|
-
return
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
resolve(offlineContentManagerBridge.offlineContentManager.usedStorage)
|
|
123
|
+
guard offlineContentManagerBridge.offlineContentManager.offlineState == .notDownloaded else {
|
|
124
|
+
return
|
|
335
125
|
}
|
|
336
|
-
#endif
|
|
337
|
-
}
|
|
338
126
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
- Parameter nativeId: Target offline module Id
|
|
342
|
-
- Parameter resolver: JS promise resolver.
|
|
343
|
-
- Parameter rejecter: JS promise rejecter.
|
|
344
|
-
*/
|
|
345
|
-
@objc(deleteAll:resolver:rejecter:)
|
|
346
|
-
func deleteAll(
|
|
347
|
-
_ nativeId: NativeId,
|
|
348
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
349
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
350
|
-
) {
|
|
351
|
-
#if os(iOS)
|
|
352
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
353
|
-
guard
|
|
354
|
-
let self,
|
|
355
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
356
|
-
else {
|
|
357
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
358
|
-
return
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
offlineContentManagerBridge.offlineContentManager.deleteOfflineData()
|
|
362
|
-
resolve(nil)
|
|
127
|
+
guard let currentTrackSelection = offlineContentManagerBridge.currentTrackSelection else {
|
|
128
|
+
return
|
|
363
129
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
Downloads the offline license.
|
|
369
|
-
When finished successfully a device event will be fired where the event type is `BitmovinOfflineEvent`
|
|
370
|
-
and the data has an event type of `onDrmLicenseUpdated`.
|
|
371
|
-
Errors are transmitted by a device event will be fired where the event type is `BitmovinOfflineEvent`
|
|
372
|
-
and the data has an event type of `onError`.
|
|
373
|
-
- Parameter nativeId: Target offline module Id
|
|
374
|
-
- Parameter resolver: JS promise resolver.
|
|
375
|
-
- Parameter rejecter: JS promise rejecter.
|
|
376
|
-
*/
|
|
377
|
-
@objc(donwloadLicense:resolver:rejecter:)
|
|
378
|
-
func downloadLicense(
|
|
379
|
-
_ nativeId: NativeId,
|
|
380
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
381
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
382
|
-
) {
|
|
383
|
-
#if os(iOS)
|
|
384
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
385
|
-
guard
|
|
386
|
-
let self,
|
|
387
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
388
|
-
else {
|
|
389
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
390
|
-
return
|
|
130
|
+
if let audioOptionIds = request["audioOptionIds"] as? [String], !audioOptionIds.isEmpty {
|
|
131
|
+
currentTrackSelection.audioTracks.forEach {
|
|
132
|
+
$0.action = audioOptionIds.contains($0.label) ? .download : .none
|
|
391
133
|
}
|
|
392
|
-
|
|
393
|
-
offlineContentManagerBridge.offlineContentManager.syncOfflineDrmLicenseInformation()
|
|
394
|
-
resolve(nil)
|
|
395
134
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
Renews the already downloaded DRM license.
|
|
401
|
-
When finished successfully a device event will be fired where the event type is `BitmovinOfflineEvent`
|
|
402
|
-
and the data has an event type of `onDrmLicenseUpdated`.
|
|
403
|
-
Errors are transmitted by a device event will be fired where the event type is `BitmovinOfflineEvent`
|
|
404
|
-
and the data has an event type of `onError`.
|
|
405
|
-
- Parameter nativeId: Target offline module Id
|
|
406
|
-
- Parameter resolver: JS promise resolver.
|
|
407
|
-
- Parameter rejecter: JS promise rejecter.
|
|
408
|
-
*/
|
|
409
|
-
@objc(renewOfflineLicense:resolver:rejecter:)
|
|
410
|
-
func renewOfflineLicense(
|
|
411
|
-
_ nativeId: NativeId,
|
|
412
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
413
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
414
|
-
) {
|
|
415
|
-
#if os(iOS)
|
|
416
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
417
|
-
guard
|
|
418
|
-
let self,
|
|
419
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
420
|
-
else {
|
|
421
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
422
|
-
return
|
|
135
|
+
if let textOptionIds = request["textOptionIds"] as? [String], !textOptionIds.isEmpty {
|
|
136
|
+
currentTrackSelection.textTracks.forEach {
|
|
137
|
+
$0.action = textOptionIds.contains($0.label) ? .download : .none
|
|
423
138
|
}
|
|
424
|
-
|
|
425
|
-
offlineContentManagerBridge.offlineContentManager.renewOfflineLicense()
|
|
426
|
-
resolve(nil)
|
|
427
139
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
Removes the `OfflineContentManagerListener` for the `nativeId`'s offline content manager.
|
|
433
|
-
IMPORTANT: Call this when the component, in which it was created, is destroyed.
|
|
434
|
-
The `OfflineManager` should not be used after calling this method.
|
|
435
|
-
- Parameter nativeId: Target offline module Id
|
|
436
|
-
- Parameter resolver: JS promise resolver.
|
|
437
|
-
- Parameter rejecter: JS promise rejecter.
|
|
438
|
-
*/
|
|
439
|
-
@objc(release:resolver:rejecter:)
|
|
440
|
-
func release(
|
|
441
|
-
_ nativeId: NativeId,
|
|
442
|
-
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
443
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
444
|
-
) {
|
|
445
|
-
#if os(iOS)
|
|
446
|
-
bridge.uiManager.addUIBlock { [weak self] _, _ in
|
|
447
|
-
guard
|
|
448
|
-
let self,
|
|
449
|
-
let offlineContentManagerBridge = self.offlineContentManagerBridges[nativeId]
|
|
450
|
-
else {
|
|
451
|
-
reject("BitmovinOfflineModule", "Could not find the offline module instance", nil)
|
|
452
|
-
return
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
offlineContentManagerBridge.release()
|
|
456
|
-
self.offlineContentManagerBridges[nativeId] = nil
|
|
457
|
-
resolve(nil)
|
|
140
|
+
let config = DownloadConfig()
|
|
141
|
+
if let minimumBitrate = request["minimumBitrate"] as? NSNumber {
|
|
142
|
+
config.minimumBitrate = minimumBitrate
|
|
458
143
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
473
|
-
) {
|
|
474
|
-
resolve(nil)
|
|
144
|
+
offlineContentManagerBridge.offlineContentManager.download(
|
|
145
|
+
tracks: currentTrackSelection,
|
|
146
|
+
downloadConfig: config
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
#endif
|
|
150
|
+
|
|
151
|
+
internal func retrieve(_ nativeId: NativeId) -> OfflineContentManagerBridge? {
|
|
152
|
+
#if os(iOS)
|
|
153
|
+
return self.offlineContentManagerBridges[nativeId]
|
|
154
|
+
#else
|
|
155
|
+
return nil
|
|
156
|
+
#endif
|
|
475
157
|
}
|
|
476
158
|
}
|