bitmovin-player-react-native 0.44.1-alpha.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +11 -0
- package/.eslintrc.js +7 -0
- package/.gitattributes +3 -0
- package/.prettierignore +11 -0
- package/.ruby-version +1 -0
- package/.swiftlint.yml +171 -0
- package/Brewfile +2 -0
- package/CHANGELOG.md +627 -0
- package/CONTRIBUTING.md +255 -0
- package/TODO.md +0 -0
- package/android/.editorconfig +8 -0
- package/android/build.gradle +78 -75
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +1 -0
- package/android/gradlew +248 -0
- package/android/gradlew.bat +92 -0
- package/android/ktlint.gradle +31 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/ActivityLifecycleListener.kt +51 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/BitmovinCastManagerModule.kt +32 -55
- package/android/src/main/java/com/bitmovin/player/reactnative/BufferModule.kt +33 -45
- package/android/src/main/java/com/bitmovin/player/reactnative/CustomMessageHandlerModule.kt +84 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/DebugModule.kt +6 -14
- package/android/src/main/java/com/bitmovin/player/reactnative/DecoderConfigModule.kt +89 -44
- package/android/src/main/java/com/bitmovin/player/reactnative/DrmModule.kt +80 -99
- package/android/src/main/java/com/bitmovin/player/reactnative/EventSubscription.kt +22 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/FullscreenHandlerModule.kt +100 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/MediaSessionPlaybackManager.kt +5 -5
- package/android/src/main/java/com/bitmovin/player/reactnative/NetworkModule.kt +98 -56
- package/android/src/main/java/com/bitmovin/player/reactnative/OfflineModule.kt +132 -186
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerAnalyticsModule.kt +37 -36
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +252 -528
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerPackage.kt +11 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt +558 -213
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewManager.kt +99 -286
- package/android/src/main/java/com/bitmovin/player/reactnative/ResultWaiter.kt +58 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/SourceModule.kt +77 -151
- package/android/src/main/java/com/bitmovin/player/reactnative/Types.kt +44 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/UuidModule.kt +12 -15
- package/android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt +296 -456
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ListExtension.kt +89 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/MapExtension.kt +95 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/offline/OfflineContentManagerBridge.kt +20 -52
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/CustomMessageHandlerBridge.kt +10 -20
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/FullscreenHandlerBridge.kt +4 -9
- package/app.plugin.js +21 -0
- package/build/BitmovinPlayerReactNative.types.d.ts +18 -0
- package/build/BitmovinPlayerReactNative.types.d.ts.map +1 -0
- package/build/BitmovinPlayerReactNative.types.js +2 -0
- package/build/BitmovinPlayerReactNative.types.js.map +1 -0
- package/build/adaptationConfig.d.ts +18 -0
- package/build/adaptationConfig.d.ts.map +1 -0
- package/build/adaptationConfig.js +2 -0
- package/build/adaptationConfig.js.map +1 -0
- package/build/advertising.d.ts +175 -0
- package/build/advertising.d.ts.map +1 -0
- package/build/advertising.js +37 -0
- package/build/advertising.js.map +1 -0
- package/build/analytics/config.d.ts +194 -0
- package/build/analytics/config.d.ts.map +1 -0
- package/build/analytics/config.js +2 -0
- package/build/analytics/config.js.map +1 -0
- package/build/analytics/index.d.ts +3 -0
- package/build/analytics/index.d.ts.map +1 -0
- package/build/analytics/index.js +3 -0
- package/build/analytics/index.js.map +1 -0
- package/build/analytics/player.d.ts +24 -0
- package/build/analytics/player.d.ts.map +1 -0
- package/build/analytics/player.js +30 -0
- package/build/analytics/player.js.map +1 -0
- package/build/analytics/playerAnalyticsModule.d.ts +13 -0
- package/build/analytics/playerAnalyticsModule.d.ts.map +1 -0
- package/build/analytics/playerAnalyticsModule.js +3 -0
- package/build/analytics/playerAnalyticsModule.js.map +1 -0
- package/build/audioSession.d.ts +33 -0
- package/build/audioSession.d.ts.map +1 -0
- package/build/audioSession.js +21 -0
- package/build/audioSession.js.map +1 -0
- package/build/audioTrack.d.ts +39 -0
- package/build/audioTrack.d.ts.map +1 -0
- package/build/audioTrack.js +2 -0
- package/build/audioTrack.js.map +1 -0
- package/build/bitmovinCastManager.d.ts +58 -0
- package/build/bitmovinCastManager.d.ts.map +1 -0
- package/build/bitmovinCastManager.js +64 -0
- package/build/bitmovinCastManager.js.map +1 -0
- package/build/bufferApi.d.ts +85 -0
- package/build/bufferApi.d.ts.map +1 -0
- package/build/bufferApi.js +60 -0
- package/build/bufferApi.js.map +1 -0
- package/build/bufferConfig.d.ts +42 -0
- package/build/bufferConfig.d.ts.map +1 -0
- package/build/bufferConfig.js +2 -0
- package/build/bufferConfig.js.map +1 -0
- package/build/components/PlayerView/events.d.ts +310 -0
- package/build/components/PlayerView/events.d.ts.map +1 -0
- package/build/components/PlayerView/events.js +2 -0
- package/build/components/PlayerView/events.js.map +1 -0
- package/build/components/PlayerView/index.d.ts +10 -0
- package/build/components/PlayerView/index.d.ts.map +1 -0
- package/build/components/PlayerView/index.js +72 -0
- package/build/components/PlayerView/index.js.map +1 -0
- package/build/components/PlayerView/native.d.ts +30 -0
- package/build/components/PlayerView/native.d.ts.map +1 -0
- package/build/components/PlayerView/native.js +6 -0
- package/build/components/PlayerView/native.js.map +1 -0
- package/build/components/PlayerView/nativeEvents.d.ts +437 -0
- package/build/components/PlayerView/nativeEvents.d.ts.map +1 -0
- package/build/components/PlayerView/nativeEvents.js +2 -0
- package/build/components/PlayerView/nativeEvents.js.map +1 -0
- package/build/components/PlayerView/pictureInPictureConfig.d.ts +22 -0
- package/build/components/PlayerView/pictureInPictureConfig.d.ts.map +1 -0
- package/build/components/PlayerView/pictureInPictureConfig.js +2 -0
- package/build/components/PlayerView/pictureInPictureConfig.js.map +1 -0
- package/build/components/PlayerView/playerViewConfig.d.ts +111 -0
- package/build/components/PlayerView/playerViewConfig.d.ts.map +1 -0
- package/build/components/PlayerView/playerViewConfig.js +51 -0
- package/build/components/PlayerView/playerViewConfig.js.map +1 -0
- package/build/components/PlayerView/properties.d.ts +61 -0
- package/build/components/PlayerView/properties.d.ts.map +1 -0
- package/build/components/PlayerView/properties.js +2 -0
- package/build/components/PlayerView/properties.js.map +1 -0
- package/build/components/index.d.ts +5 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +5 -0
- package/build/components/index.js.map +1 -0
- package/build/debug.d.ts +46 -0
- package/build/debug.d.ts.map +1 -0
- package/build/debug.js +52 -0
- package/build/debug.js.map +1 -0
- package/build/decoder/decoderConfig.d.ts +96 -0
- package/build/decoder/decoderConfig.d.ts.map +1 -0
- package/build/decoder/decoderConfig.js +6 -0
- package/build/decoder/decoderConfig.js.map +1 -0
- package/build/decoder/decoderConfigModule.d.ts +14 -0
- package/build/decoder/decoderConfigModule.d.ts.map +1 -0
- package/build/decoder/decoderConfigModule.js +31 -0
- package/build/decoder/decoderConfigModule.js.map +1 -0
- package/build/decoder/index.d.ts +26 -0
- package/build/decoder/index.d.ts.map +1 -0
- package/build/decoder/index.js +50 -0
- package/build/decoder/index.js.map +1 -0
- package/build/drm/drmModule.d.ts +55 -0
- package/build/drm/drmModule.d.ts.map +1 -0
- package/build/drm/drmModule.js +3 -0
- package/build/drm/drmModule.js.map +1 -0
- package/build/drm/fairplayConfig.d.ts +91 -0
- package/build/drm/fairplayConfig.d.ts.map +1 -0
- package/build/drm/fairplayConfig.js +2 -0
- package/build/drm/fairplayConfig.js.map +1 -0
- package/build/drm/index.d.ts +112 -0
- package/build/drm/index.d.ts.map +1 -0
- package/build/drm/index.js +191 -0
- package/build/drm/index.js.map +1 -0
- package/build/drm/widevineConfig.d.ts +58 -0
- package/build/drm/widevineConfig.d.ts.map +1 -0
- package/build/drm/widevineConfig.js +2 -0
- package/build/drm/widevineConfig.js.map +1 -0
- package/build/events.d.ts +692 -0
- package/build/events.d.ts.map +1 -0
- package/build/events.js +2 -0
- package/build/events.js.map +1 -0
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.d.ts.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -0
- package/build/hooks/usePlayer.d.ts +8 -0
- package/build/hooks/usePlayer.d.ts.map +1 -0
- package/build/hooks/usePlayer.js +10 -0
- package/build/hooks/usePlayer.js.map +1 -0
- package/build/hooks/useProxy.d.ts +18 -0
- package/build/hooks/useProxy.d.ts.map +1 -0
- package/build/hooks/useProxy.js +16 -0
- package/build/hooks/useProxy.js.map +1 -0
- package/build/index.d.ts +32 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +32 -0
- package/build/index.js.map +1 -0
- package/build/liveConfig.d.ts +13 -0
- package/build/liveConfig.d.ts.map +1 -0
- package/build/liveConfig.js +2 -0
- package/build/liveConfig.js.map +1 -0
- package/build/media.d.ts +85 -0
- package/build/media.d.ts.map +1 -0
- package/build/media.js +2 -0
- package/build/media.js.map +1 -0
- package/build/mediaControlConfig.d.ts +62 -0
- package/build/mediaControlConfig.d.ts.map +1 -0
- package/build/mediaControlConfig.js +2 -0
- package/build/mediaControlConfig.js.map +1 -0
- package/build/mediaTrackRole.d.ts +28 -0
- package/build/mediaTrackRole.d.ts.map +1 -0
- package/build/mediaTrackRole.js +2 -0
- package/build/mediaTrackRole.js.map +1 -0
- package/build/modules/AudioSessionModule.d.ts +8 -0
- package/build/modules/AudioSessionModule.d.ts.map +1 -0
- package/build/modules/AudioSessionModule.js +7 -0
- package/build/modules/AudioSessionModule.js.map +1 -0
- package/build/modules/BitmovinCastManagerModule.d.ts +11 -0
- package/build/modules/BitmovinCastManagerModule.d.ts.map +1 -0
- package/build/modules/BitmovinCastManagerModule.js +3 -0
- package/build/modules/BitmovinCastManagerModule.js.map +1 -0
- package/build/modules/BufferModule.d.ts +16 -0
- package/build/modules/BufferModule.d.ts.map +1 -0
- package/build/modules/BufferModule.js +3 -0
- package/build/modules/BufferModule.js.map +1 -0
- package/build/modules/DebugModule.d.ts +8 -0
- package/build/modules/DebugModule.d.ts.map +1 -0
- package/build/modules/DebugModule.js +3 -0
- package/build/modules/DebugModule.js.map +1 -0
- package/build/modules/PlayerModule.d.ts +188 -0
- package/build/modules/PlayerModule.d.ts.map +1 -0
- package/build/modules/PlayerModule.js +3 -0
- package/build/modules/PlayerModule.js.map +1 -0
- package/build/modules/SourceModule.d.ts +51 -0
- package/build/modules/SourceModule.d.ts.map +1 -0
- package/build/modules/SourceModule.js +3 -0
- package/build/modules/SourceModule.js.map +1 -0
- package/build/modules/UuidModule.d.ts +8 -0
- package/build/modules/UuidModule.d.ts.map +1 -0
- package/build/modules/UuidModule.js +3 -0
- package/build/modules/UuidModule.js.map +1 -0
- package/build/nativeInstance.d.ts +49 -0
- package/build/nativeInstance.d.ts.map +1 -0
- package/build/nativeInstance.js +20 -0
- package/build/nativeInstance.js.map +1 -0
- package/build/network/index.d.ts +50 -0
- package/build/network/index.d.ts.map +1 -0
- package/build/network/index.js +102 -0
- package/build/network/index.js.map +1 -0
- package/build/network/networkConfig.d.ts +151 -0
- package/build/network/networkConfig.d.ts.map +1 -0
- package/build/network/networkConfig.js +21 -0
- package/build/network/networkConfig.js.map +1 -0
- package/build/network/networkModule.d.ts +29 -0
- package/build/network/networkModule.d.ts.map +1 -0
- package/build/network/networkModule.js +3 -0
- package/build/network/networkModule.js.map +1 -0
- package/build/offline/index.d.ts +8 -0
- package/build/offline/index.d.ts.map +1 -0
- package/build/offline/index.js +8 -0
- package/build/offline/index.js.map +1 -0
- package/build/offline/offlineContentConfig.d.ts +18 -0
- package/build/offline/offlineContentConfig.d.ts.map +1 -0
- package/build/offline/offlineContentConfig.js +2 -0
- package/build/offline/offlineContentConfig.js.map +1 -0
- package/build/offline/offlineContentManager.d.ts +90 -0
- package/build/offline/offlineContentManager.d.ts.map +1 -0
- package/build/offline/offlineContentManager.js +177 -0
- package/build/offline/offlineContentManager.js.map +1 -0
- package/build/offline/offlineContentManagerListener.d.ts +174 -0
- package/build/offline/offlineContentManagerListener.d.ts.map +1 -0
- package/build/offline/offlineContentManagerListener.js +17 -0
- package/build/offline/offlineContentManagerListener.js.map +1 -0
- package/build/offline/offlineContentOptions.d.ts +29 -0
- package/build/offline/offlineContentOptions.d.ts.map +1 -0
- package/build/offline/offlineContentOptions.js +2 -0
- package/build/offline/offlineContentOptions.js.map +1 -0
- package/build/offline/offlineDownloadRequest.d.ts +19 -0
- package/build/offline/offlineDownloadRequest.d.ts.map +1 -0
- package/build/offline/offlineDownloadRequest.js +2 -0
- package/build/offline/offlineDownloadRequest.js.map +1 -0
- package/build/offline/offlineModule.d.ts +32 -0
- package/build/offline/offlineModule.d.ts.map +1 -0
- package/build/offline/offlineModule.js +3 -0
- package/build/offline/offlineModule.js.map +1 -0
- package/build/offline/offlineSourceOptions.d.ts +12 -0
- package/build/offline/offlineSourceOptions.d.ts.map +1 -0
- package/build/offline/offlineSourceOptions.js +2 -0
- package/build/offline/offlineSourceOptions.js.map +1 -0
- package/build/offline/offlineState.d.ts +23 -0
- package/build/offline/offlineState.d.ts.map +1 -0
- package/build/offline/offlineState.js +24 -0
- package/build/offline/offlineState.js.map +1 -0
- package/build/playbackConfig.d.ts +88 -0
- package/build/playbackConfig.d.ts.map +1 -0
- package/build/playbackConfig.js +2 -0
- package/build/playbackConfig.js.map +1 -0
- package/build/player.d.ts +308 -0
- package/build/player.d.ts.map +1 -0
- package/build/player.js +445 -0
- package/build/player.js.map +1 -0
- package/build/playerConfig.d.ts +83 -0
- package/build/playerConfig.d.ts.map +1 -0
- package/build/playerConfig.js +2 -0
- package/build/playerConfig.js.map +1 -0
- package/build/remoteControlConfig.d.ts +38 -0
- package/build/remoteControlConfig.d.ts.map +1 -0
- package/build/remoteControlConfig.js +2 -0
- package/build/remoteControlConfig.js.map +1 -0
- package/build/source.d.ts +216 -0
- package/build/source.d.ts.map +1 -0
- package/build/source.js +167 -0
- package/build/source.js.map +1 -0
- package/build/styleConfig.d.ts +120 -0
- package/build/styleConfig.d.ts.map +1 -0
- package/build/styleConfig.js +38 -0
- package/build/styleConfig.js.map +1 -0
- package/build/subtitleFormat.d.ts +27 -0
- package/build/subtitleFormat.d.ts.map +1 -0
- package/build/subtitleFormat.js +28 -0
- package/build/subtitleFormat.js.map +1 -0
- package/build/subtitleTrack.d.ts +55 -0
- package/build/subtitleTrack.d.ts.map +1 -0
- package/build/subtitleTrack.js +2 -0
- package/build/subtitleTrack.js.map +1 -0
- package/build/thumbnail.d.ts +38 -0
- package/build/thumbnail.d.ts.map +1 -0
- package/build/thumbnail.js +2 -0
- package/build/thumbnail.js.map +1 -0
- package/build/tweaksConfig.d.ts +197 -0
- package/build/tweaksConfig.d.ts.map +1 -0
- package/build/tweaksConfig.js +25 -0
- package/build/tweaksConfig.js.map +1 -0
- package/build/ui/customMessageHandlerModule.d.ts +27 -0
- package/build/ui/customMessageHandlerModule.d.ts.map +1 -0
- package/build/ui/customMessageHandlerModule.js +3 -0
- package/build/ui/customMessageHandlerModule.js.map +1 -0
- package/build/ui/custommessagehandler.d.ts +56 -0
- package/build/ui/custommessagehandler.d.ts.map +1 -0
- package/build/ui/custommessagehandler.js +54 -0
- package/build/ui/custommessagehandler.js.map +1 -0
- package/build/ui/custommessagehandlerbridge.d.ts +33 -0
- package/build/ui/custommessagehandlerbridge.d.ts.map +1 -0
- package/build/ui/custommessagehandlerbridge.js +72 -0
- package/build/ui/custommessagehandlerbridge.js.map +1 -0
- package/build/ui/custommessagesender.d.ts +5 -0
- package/build/ui/custommessagesender.d.ts.map +1 -0
- package/build/ui/custommessagesender.js +2 -0
- package/build/ui/custommessagesender.js.map +1 -0
- package/build/ui/fullscreenHandlerModule.d.ts +20 -0
- package/build/ui/fullscreenHandlerModule.d.ts.map +1 -0
- package/build/ui/fullscreenHandlerModule.js +3 -0
- package/build/ui/fullscreenHandlerModule.js.map +1 -0
- package/build/ui/fullscreenhandler.d.ts +18 -0
- package/build/ui/fullscreenhandler.d.ts.map +1 -0
- package/build/ui/fullscreenhandler.js +2 -0
- package/build/ui/fullscreenhandler.js.map +1 -0
- package/build/ui/fullscreenhandlerbridge.d.ts +26 -0
- package/build/ui/fullscreenhandlerbridge.d.ts.map +1 -0
- package/build/ui/fullscreenhandlerbridge.js +67 -0
- package/build/ui/fullscreenhandlerbridge.js.map +1 -0
- package/build/ui/index.d.ts +3 -0
- package/build/ui/index.d.ts.map +1 -0
- package/build/ui/index.js +3 -0
- package/build/ui/index.js.map +1 -0
- package/expo-module.config.json +40 -0
- package/ios/AppLifecycleDelegate.swift +25 -0
- package/ios/AudioSessionModule.swift +14 -40
- package/ios/BitmovinCastManagerModule.swift +30 -69
- package/ios/BufferModule.swift +26 -62
- package/ios/CustomMessageHandlerBridge.swift +11 -18
- package/ios/CustomMessageHandlerModule.swift +61 -63
- package/ios/DebugModule.swift +6 -27
- package/ios/DrmModule.swift +105 -379
- package/ios/Event+JSON.swift +1 -0
- package/ios/FullscreenHandlerBridge.swift +12 -5
- package/ios/FullscreenHandlerModule.swift +73 -57
- package/ios/LockedBox.swift +21 -0
- package/ios/ModuleRegistry+Generics.swift +11 -0
- package/ios/NetworkModule.swift +78 -82
- package/ios/OfflineContentManagerBridge.swift +11 -38
- package/ios/OfflineModule.swift +136 -454
- package/ios/PlayerAnalyticsModule.swift +24 -52
- package/ios/PlayerModule.swift +192 -770
- package/ios/RCTConvert+BitmovinPlayer.swift +38 -312
- package/ios/RNBitmovinPlayer.h +1 -8
- package/ios/RNBitmovinPlayer.podspec +47 -0
- package/ios/RNPlayerView.swift +600 -77
- package/ios/RNPlayerViewManager.swift +96 -210
- package/ios/Registry.swift +2 -2
- package/ios/ResultWaiter.swift +66 -0
- package/ios/SourceModule.swift +104 -223
- package/ios/UuidModule.swift +9 -18
- package/package.json +67 -71
- package/plugin/build/FeatureFlags.d.ts +24 -0
- package/plugin/build/FeatureFlags.js +2 -0
- package/plugin/build/index.d.ts +7 -0
- package/plugin/build/index.js +10 -0
- package/plugin/build/withAppGradleDependencies.d.ts +7 -0
- package/plugin/build/withAppGradleDependencies.js +49 -0
- package/plugin/build/withBitmovinAndroidConfig.d.ts +7 -0
- package/plugin/build/withBitmovinAndroidConfig.js +159 -0
- package/plugin/build/withBitmovinConfig.d.ts +7 -0
- package/plugin/build/withBitmovinConfig.js +21 -0
- package/plugin/build/withBitmovinIosConfig.d.ts +7 -0
- package/plugin/build/withBitmovinIosConfig.js +53 -0
- package/plugin/src/FeatureFlags.ts +21 -0
- package/plugin/src/index.ts +9 -0
- package/plugin/src/withAppGradleDependencies.ts +80 -0
- package/plugin/src/withBitmovinAndroidConfig.ts +224 -0
- package/plugin/src/withBitmovinConfig.ts +24 -0
- package/plugin/src/withBitmovinIosConfig.ts +71 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/prettier.config.js +7 -0
- package/scripts/format-android.sh +2 -0
- package/scripts/format-swift.sh +3 -0
- package/scripts/lint-android.sh +2 -0
- package/scripts/lint-swift.sh +3 -0
- package/scripts/pre-commit.sh +14 -0
- package/scripts/setup-hooks.sh +58 -0
- package/src/BitmovinPlayerReactNative.types.ts +19 -0
- package/src/adaptationConfig.ts +1 -1
- package/src/advertising.ts +1 -1
- package/src/analytics/config.ts +4 -4
- package/src/analytics/player.ts +4 -6
- package/src/analytics/playerAnalyticsModule.ts +19 -0
- package/src/audioSession.ts +4 -6
- package/src/audioTrack.ts +1 -1
- package/src/bitmovinCastManager.ts +14 -10
- package/src/bufferApi.ts +1 -3
- package/src/bufferConfig.ts +2 -2
- package/src/components/PlayerView/events.ts +92 -94
- package/src/components/PlayerView/index.tsx +109 -159
- package/src/components/PlayerView/native.ts +24 -11
- package/src/components/PlayerView/nativeEvents.ts +113 -94
- package/src/components/PlayerView/pictureInPictureConfig.ts +1 -1
- package/src/components/PlayerView/playerViewConfig.ts +4 -8
- package/src/components/PlayerView/properties.ts +23 -22
- package/src/debug.ts +1 -3
- package/src/decoder/decoderConfig.ts +3 -3
- package/src/decoder/decoderConfigModule.ts +62 -0
- package/src/decoder/index.ts +32 -16
- package/src/drm/drmModule.ts +84 -0
- package/src/drm/fairplayConfig.ts +1 -1
- package/src/drm/index.ts +130 -40
- package/src/drm/widevineConfig.ts +5 -5
- package/src/events.ts +47 -41
- package/src/hooks/useProxy.ts +13 -20
- package/src/mediaControlConfig.ts +1 -1
- package/src/modules/AudioSessionModule.ts +13 -0
- package/src/modules/BitmovinCastManagerModule.ts +14 -0
- package/src/modules/BufferModule.ts +18 -0
- package/src/modules/DebugModule.ts +9 -0
- package/src/modules/PlayerModule.ts +251 -0
- package/src/modules/SourceModule.ts +74 -0
- package/src/modules/UuidModule.ts +9 -0
- package/src/nativeInstance.ts +3 -3
- package/src/network/index.ts +42 -15
- package/src/network/networkConfig.ts +3 -3
- package/src/network/networkModule.ts +51 -0
- package/src/offline/offlineContentConfig.ts +1 -1
- package/src/offline/offlineContentManager.ts +15 -50
- package/src/offline/offlineContentManagerListener.ts +20 -23
- package/src/offline/offlineContentOptions.ts +2 -2
- package/src/offline/offlineDownloadRequest.ts +1 -1
- package/src/offline/offlineModule.ts +46 -0
- package/src/offline/offlineSourceOptions.ts +2 -2
- package/src/offline/offlineState.ts +1 -1
- package/src/playbackConfig.ts +5 -6
- package/src/player.ts +53 -48
- package/src/source.ts +15 -14
- package/src/styleConfig.ts +5 -5
- package/src/subtitleFormat.ts +5 -5
- package/src/subtitleTrack.ts +1 -1
- package/src/tweaksConfig.ts +16 -16
- package/src/ui/customMessageHandlerModule.ts +46 -0
- package/src/ui/custommessagehandlerbridge.ts +45 -18
- package/src/ui/fullscreenHandlerModule.ts +35 -0
- package/src/ui/fullscreenhandlerbridge.ts +35 -15
- package/tsconfig.json +9 -0
- package/typedoc.json +23 -0
- package/RNBitmovinPlayer.podspec +0 -26
- package/android/src/main/java/com/bitmovin/player/reactnative/BitmovinBaseModule.kt +0 -114
- package/android/src/main/java/com/bitmovin/player/reactnative/EventRelay.kt +0 -47
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewPackage.kt +0 -48
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReactContextExtension.kt +0 -24
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableArray.kt +0 -20
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableMap.kt +0 -15
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableMapExtension.kt +0 -57
- package/android/src/main/java/com/bitmovin/player/reactnative/extensions/WritableMap.kt +0 -27
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/CustomMessageHandlerModule.kt +0 -86
- package/android/src/main/java/com/bitmovin/player/reactnative/ui/FullscreenHandlerModule.kt +0 -78
- package/ios/AudioSessionModule.m +0 -10
- package/ios/BitmovinCastManagerModule.m +0 -14
- package/ios/BufferModule.m +0 -8
- package/ios/CustomMessageHandlerModule.m +0 -10
- package/ios/DebugModule.m +0 -7
- package/ios/DrmModule.m +0 -16
- package/ios/FullscreenHandlerModule.m +0 -10
- package/ios/NetworkModule.m +0 -10
- package/ios/OfflineModule.m +0 -19
- package/ios/PlayerAnalyticsModule.m +0 -8
- package/ios/PlayerModule.m +0 -130
- package/ios/PreprocessHttpRequestDelegateBridge.swift +0 -30
- package/ios/RCTBridge+Generics.swift +0 -6
- package/ios/RNBitmovinPlayer.xcodeproj/project.pbxproj +0 -303
- package/ios/RNPlayerView+PlayerListener.swift +0 -229
- package/ios/RNPlayerView+UserInterfaceListener.swift +0 -35
- package/ios/RNPlayerViewManager.m +0 -79
- package/ios/SourceModule.m +0 -42
- package/ios/UuidModule.m +0 -9
- package/lib/index.d.mts +0 -4303
- package/lib/index.d.ts +0 -4303
- package/lib/index.js +0 -1895
- package/lib/index.mjs +0 -1836
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { NativeInstanceConfig } from '../nativeInstance';
|
|
2
|
+
/**
|
|
3
|
+
* Available HTTP request types.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum HttpRequestType {
|
|
6
|
+
ManifestDash = "manifest/dash",
|
|
7
|
+
ManifestHlsMaster = "manifest/hls/master",
|
|
8
|
+
ManifestHlsVariant = "manifest/hls/variant",
|
|
9
|
+
ManifestSmooth = "manifest/smooth",
|
|
10
|
+
MediaProgressive = "media/progressive",
|
|
11
|
+
MediaAudio = "media/audio",
|
|
12
|
+
MediaVideo = "media/video",
|
|
13
|
+
MediaSubtitles = "media/subtitles",
|
|
14
|
+
MediaThumbnails = "media/thumbnails",
|
|
15
|
+
DrmLicenseFairplay = "drm/license/fairplay",
|
|
16
|
+
DrmCertificateFairplay = "drm/certificate/fairplay",
|
|
17
|
+
DrmLicenseWidevine = "drm/license/widevine",
|
|
18
|
+
KeyHlsAes = "key/hls/aes",
|
|
19
|
+
Unknown = "unknown"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Base64-encoded string representing the HTTP request body.
|
|
23
|
+
*/
|
|
24
|
+
export type HttpRequestBody = string;
|
|
25
|
+
/** Represents an HTTP request. */
|
|
26
|
+
export interface HttpRequest {
|
|
27
|
+
/** The HTTP request body to send to the server. */
|
|
28
|
+
body?: HttpRequestBody;
|
|
29
|
+
/**
|
|
30
|
+
* The HTTP Headers of the request.
|
|
31
|
+
* Entries are expected to have the HTTP header as the key and its string content as the value.
|
|
32
|
+
*/
|
|
33
|
+
headers: Record<string, string>;
|
|
34
|
+
/** The HTTP method of the request. */
|
|
35
|
+
method: string;
|
|
36
|
+
/** The URL of the request. */
|
|
37
|
+
url: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Base64-encoded string representing the HTTP response body.
|
|
41
|
+
*/
|
|
42
|
+
export type HttpResponseBody = string;
|
|
43
|
+
/** Represents an HTTP response. */
|
|
44
|
+
export interface HttpResponse {
|
|
45
|
+
/** The HTTP response body of the response. */
|
|
46
|
+
body?: HttpResponseBody;
|
|
47
|
+
/**
|
|
48
|
+
* The HTTP Headers of the response.
|
|
49
|
+
* Entries are expected to have the HTTP header as the key and its string content as the value.
|
|
50
|
+
*/
|
|
51
|
+
headers: Record<string, string>;
|
|
52
|
+
/** The corresponding request object of the response. */
|
|
53
|
+
request: HttpRequest;
|
|
54
|
+
/** The HTTP status code of the response. */
|
|
55
|
+
status: number;
|
|
56
|
+
/** The URL of the response. May differ from {@link HttpRequest.url} when redirects have happened. */
|
|
57
|
+
url: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The network API gives the ability to influence network requests.
|
|
61
|
+
* It enables preprocessing requests and preprocessing responses.
|
|
62
|
+
*/
|
|
63
|
+
export interface NetworkConfig extends NativeInstanceConfig {
|
|
64
|
+
/**
|
|
65
|
+
* Called before an HTTP request is made.
|
|
66
|
+
* Can be used to change request parameters.
|
|
67
|
+
*
|
|
68
|
+
* @param type Type of the request to be made.
|
|
69
|
+
* @param request The HTTP request to process.
|
|
70
|
+
* @returns A Promise that resolves to an `HttpRequest` object.
|
|
71
|
+
* - If the promise resolves, the player will use the processed request.
|
|
72
|
+
* - If the promise rejects, the player will fall back to using the original request.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```
|
|
76
|
+
* const requestCallback = (type: HttpRequestType, request: HttpRequest) => {
|
|
77
|
+
* // Access current properties
|
|
78
|
+
*
|
|
79
|
+
* console.log(JSON.stringify(type));
|
|
80
|
+
* console.log(JSON.stringify(request));
|
|
81
|
+
*
|
|
82
|
+
* // Modify the request
|
|
83
|
+
*
|
|
84
|
+
* request.headers['New-Header'] = 'val';
|
|
85
|
+
* request.method = 'GET';
|
|
86
|
+
*
|
|
87
|
+
* // Return the processed request via a Promise
|
|
88
|
+
*
|
|
89
|
+
* const processed: HttpRequest = {
|
|
90
|
+
* body: request.body,
|
|
91
|
+
* headers: request.headers,
|
|
92
|
+
* method: request.method,
|
|
93
|
+
* url: request.url,
|
|
94
|
+
* };
|
|
95
|
+
* return Promise.resolve(processed);
|
|
96
|
+
* };
|
|
97
|
+
*
|
|
98
|
+
* const player = usePlayer({
|
|
99
|
+
* networkConfig: {
|
|
100
|
+
* preprocessHttpRequest: requestCallback,
|
|
101
|
+
* },
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
preprocessHttpRequest?: (type: HttpRequestType, request: HttpRequest) => Promise<HttpRequest>;
|
|
106
|
+
/**
|
|
107
|
+
* Called before an HTTP response is accessed by the player.
|
|
108
|
+
* Can be used to access or change the response.
|
|
109
|
+
*
|
|
110
|
+
* @param type Type of the corresponding request object of the response.
|
|
111
|
+
* @param response The HTTP response to process.
|
|
112
|
+
* @returns A Promise that resolves to an `HttpResponse` object.
|
|
113
|
+
* - If the promise resolves, the player will use the processed response.
|
|
114
|
+
* - If the promise rejects, the player will fall back to using the original response.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```
|
|
118
|
+
* const responseCallback = (type: HttpRequestType, response: HttpResponse) => {
|
|
119
|
+
* // Access response properties
|
|
120
|
+
*
|
|
121
|
+
* console.log(JSON.stringify(type));
|
|
122
|
+
* console.log(JSON.stringify(response));
|
|
123
|
+
*
|
|
124
|
+
* // Modify the response
|
|
125
|
+
*
|
|
126
|
+
* response.headers['New-Header'] = 'val';
|
|
127
|
+
* response.url = response.request.url; // remove eventual redirect changes
|
|
128
|
+
*
|
|
129
|
+
* // Return the processed response via a Promise
|
|
130
|
+
*
|
|
131
|
+
* const processed: HttpResponse = {
|
|
132
|
+
* body: response.body,
|
|
133
|
+
* headers: response.headers,
|
|
134
|
+
* request: response.request,
|
|
135
|
+
* status: response.status,
|
|
136
|
+
* url: response.url,
|
|
137
|
+
* };
|
|
138
|
+
* return Promise.resolve(processed);
|
|
139
|
+
* };
|
|
140
|
+
*
|
|
141
|
+
* // Properly attach the callback to the config
|
|
142
|
+
* const player = usePlayer({
|
|
143
|
+
* networkConfig: {
|
|
144
|
+
* preprocessHttpResponse: responseCallback,
|
|
145
|
+
* },
|
|
146
|
+
* });
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
preprocessHttpResponse?: (type: HttpRequestType, response: HttpResponse) => Promise<HttpResponse>;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=networkConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkConfig.d.ts","sourceRoot":"","sources":["../../src/network/networkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;GAEG;AACH,oBAAY,eAAe;IACzB,YAAY,kBAAkB;IAC9B,iBAAiB,wBAAwB;IACzC,kBAAkB,yBAAyB;IAC3C,cAAc,oBAAoB;IAClC,gBAAgB,sBAAsB;IACtC,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,cAAc,oBAAoB;IAClC,eAAe,qBAAqB;IACpC,kBAAkB,yBAAyB;IAC3C,sBAAsB,6BAA6B;IACnD,kBAAkB,yBAAyB;IAC3C,SAAS,gBAAgB;IACzB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,kCAAkC;AAClC,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEtC,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,wDAAwD;IACxD,OAAO,EAAE,WAAW,CAAC;IACrB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,qGAAqG;IACrG,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,qBAAqB,CAAC,EAAE,CACtB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,WAAW,KACjB,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,sBAAsB,CAAC,EAAE,CACvB,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,YAAY,KACnB,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available HTTP request types.
|
|
3
|
+
*/
|
|
4
|
+
export var HttpRequestType;
|
|
5
|
+
(function (HttpRequestType) {
|
|
6
|
+
HttpRequestType["ManifestDash"] = "manifest/dash";
|
|
7
|
+
HttpRequestType["ManifestHlsMaster"] = "manifest/hls/master";
|
|
8
|
+
HttpRequestType["ManifestHlsVariant"] = "manifest/hls/variant";
|
|
9
|
+
HttpRequestType["ManifestSmooth"] = "manifest/smooth";
|
|
10
|
+
HttpRequestType["MediaProgressive"] = "media/progressive";
|
|
11
|
+
HttpRequestType["MediaAudio"] = "media/audio";
|
|
12
|
+
HttpRequestType["MediaVideo"] = "media/video";
|
|
13
|
+
HttpRequestType["MediaSubtitles"] = "media/subtitles";
|
|
14
|
+
HttpRequestType["MediaThumbnails"] = "media/thumbnails";
|
|
15
|
+
HttpRequestType["DrmLicenseFairplay"] = "drm/license/fairplay";
|
|
16
|
+
HttpRequestType["DrmCertificateFairplay"] = "drm/certificate/fairplay";
|
|
17
|
+
HttpRequestType["DrmLicenseWidevine"] = "drm/license/widevine";
|
|
18
|
+
HttpRequestType["KeyHlsAes"] = "key/hls/aes";
|
|
19
|
+
HttpRequestType["Unknown"] = "unknown";
|
|
20
|
+
})(HttpRequestType || (HttpRequestType = {}));
|
|
21
|
+
//# sourceMappingURL=networkConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkConfig.js","sourceRoot":"","sources":["../../src/network/networkConfig.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB,iDAA8B,CAAA;IAC9B,4DAAyC,CAAA;IACzC,8DAA2C,CAAA;IAC3C,qDAAkC,CAAA;IAClC,yDAAsC,CAAA;IACtC,6CAA0B,CAAA;IAC1B,6CAA0B,CAAA;IAC1B,qDAAkC,CAAA;IAClC,uDAAoC,CAAA;IACpC,8DAA2C,CAAA;IAC3C,sEAAmD,CAAA;IACnD,8DAA2C,CAAA;IAC3C,4CAAyB,CAAA;IACzB,sCAAmB,CAAA;AACrB,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B","sourcesContent":["import { NativeInstanceConfig } from '../nativeInstance';\n\n/**\n * Available HTTP request types.\n */\nexport enum HttpRequestType {\n ManifestDash = 'manifest/dash',\n ManifestHlsMaster = 'manifest/hls/master',\n ManifestHlsVariant = 'manifest/hls/variant',\n ManifestSmooth = 'manifest/smooth',\n MediaProgressive = 'media/progressive',\n MediaAudio = 'media/audio',\n MediaVideo = 'media/video',\n MediaSubtitles = 'media/subtitles',\n MediaThumbnails = 'media/thumbnails',\n DrmLicenseFairplay = 'drm/license/fairplay',\n DrmCertificateFairplay = 'drm/certificate/fairplay',\n DrmLicenseWidevine = 'drm/license/widevine',\n KeyHlsAes = 'key/hls/aes',\n Unknown = 'unknown',\n}\n\n/**\n * Base64-encoded string representing the HTTP request body.\n */\nexport type HttpRequestBody = string;\n\n/** Represents an HTTP request. */\nexport interface HttpRequest {\n /** The HTTP request body to send to the server. */\n body?: HttpRequestBody;\n /**\n * The HTTP Headers of the request.\n * Entries are expected to have the HTTP header as the key and its string content as the value.\n */\n headers: Record<string, string>;\n /** The HTTP method of the request. */\n method: string;\n /** The URL of the request. */\n url: string;\n}\n\n/**\n * Base64-encoded string representing the HTTP response body.\n */\nexport type HttpResponseBody = string;\n\n/** Represents an HTTP response. */\nexport interface HttpResponse {\n /** The HTTP response body of the response. */\n body?: HttpResponseBody;\n /**\n * The HTTP Headers of the response.\n * Entries are expected to have the HTTP header as the key and its string content as the value.\n */\n headers: Record<string, string>;\n /** The corresponding request object of the response. */\n request: HttpRequest;\n /** The HTTP status code of the response. */\n status: number;\n /** The URL of the response. May differ from {@link HttpRequest.url} when redirects have happened. */\n url: string;\n}\n\n/**\n * The network API gives the ability to influence network requests.\n * It enables preprocessing requests and preprocessing responses.\n */\nexport interface NetworkConfig extends NativeInstanceConfig {\n /**\n * Called before an HTTP request is made.\n * Can be used to change request parameters.\n *\n * @param type Type of the request to be made.\n * @param request The HTTP request to process.\n * @returns A Promise that resolves to an `HttpRequest` object.\n * - If the promise resolves, the player will use the processed request.\n * - If the promise rejects, the player will fall back to using the original request.\n *\n * @example\n * ```\n * const requestCallback = (type: HttpRequestType, request: HttpRequest) => {\n * // Access current properties\n *\n * console.log(JSON.stringify(type));\n * console.log(JSON.stringify(request));\n *\n * // Modify the request\n *\n * request.headers['New-Header'] = 'val';\n * request.method = 'GET';\n *\n * // Return the processed request via a Promise\n *\n * const processed: HttpRequest = {\n * body: request.body,\n * headers: request.headers,\n * method: request.method,\n * url: request.url,\n * };\n * return Promise.resolve(processed);\n * };\n *\n * const player = usePlayer({\n * networkConfig: {\n * preprocessHttpRequest: requestCallback,\n * },\n * });\n * ```\n */\n preprocessHttpRequest?: (\n type: HttpRequestType,\n request: HttpRequest\n ) => Promise<HttpRequest>;\n /**\n * Called before an HTTP response is accessed by the player.\n * Can be used to access or change the response.\n *\n * @param type Type of the corresponding request object of the response.\n * @param response The HTTP response to process.\n * @returns A Promise that resolves to an `HttpResponse` object.\n * - If the promise resolves, the player will use the processed response.\n * - If the promise rejects, the player will fall back to using the original response.\n *\n * @example\n * ```\n * const responseCallback = (type: HttpRequestType, response: HttpResponse) => {\n * // Access response properties\n *\n * console.log(JSON.stringify(type));\n * console.log(JSON.stringify(response));\n *\n * // Modify the response\n *\n * response.headers['New-Header'] = 'val';\n * response.url = response.request.url; // remove eventual redirect changes\n *\n * // Return the processed response via a Promise\n *\n * const processed: HttpResponse = {\n * body: response.body,\n * headers: response.headers,\n * request: response.request,\n * status: response.status,\n * url: response.url,\n * };\n * return Promise.resolve(processed);\n * };\n *\n * // Properly attach the callback to the config\n * const player = usePlayer({\n * networkConfig: {\n * preprocessHttpResponse: responseCallback,\n * },\n * });\n * ```\n */\n preprocessHttpResponse?: (\n type: HttpRequestType,\n response: HttpResponse\n ) => Promise<HttpResponse>;\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NativeModule } from 'expo-modules-core';
|
|
2
|
+
import { HttpRequest, HttpResponse, NetworkConfig, HttpRequestType } from './networkConfig';
|
|
3
|
+
export type NetworkModuleEvents = {
|
|
4
|
+
onPreprocessHttpRequest: ({ nativeId, requestId, type, request, }: {
|
|
5
|
+
nativeId: string;
|
|
6
|
+
requestId: string;
|
|
7
|
+
type: HttpRequestType;
|
|
8
|
+
request: HttpRequest;
|
|
9
|
+
}) => void;
|
|
10
|
+
onPreprocessHttpResponse: ({ nativeId, responseId, type, response, }: {
|
|
11
|
+
nativeId: string;
|
|
12
|
+
responseId: string;
|
|
13
|
+
type: HttpRequestType;
|
|
14
|
+
response: HttpResponse;
|
|
15
|
+
}) => void;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Native NetworkModule using Expo modules API.
|
|
19
|
+
* Provides modern async/await interface while maintaining backward compatibility.
|
|
20
|
+
*/
|
|
21
|
+
declare class NetworkModule extends NativeModule<NetworkModuleEvents> {
|
|
22
|
+
initializeWithConfig(nativeId: string, config: NetworkConfig): Promise<void>;
|
|
23
|
+
destroy(nativeId: string): Promise<void>;
|
|
24
|
+
setPreprocessedHttpRequest(requestId: string, request: HttpRequest): Promise<void>;
|
|
25
|
+
setPreprocessedHttpResponse(responseId: string, response: HttpResponse): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
declare const _default: NetworkModule;
|
|
28
|
+
export default _default;
|
|
29
|
+
//# sourceMappingURL=networkModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkModule.d.ts","sourceRoot":"","sources":["../../src/network/networkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,uBAAuB,EAAE,CAAC,EACxB,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,OAAO,GACR,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,eAAe,CAAC;QACtB,OAAO,EAAE,WAAW,CAAC;KACtB,KAAK,IAAI,CAAC;IACX,wBAAwB,EAAE,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,eAAe,CAAC;QACtB,QAAQ,EAAE,YAAY,CAAC;KACxB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;;GAGG;AACH,OAAO,OAAO,aAAc,SAAQ,YAAY,CAAC,mBAAmB,CAAC;IACnE,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAC5E,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACxC,0BAA0B,CACxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC;IAChB,2BAA2B,CACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,IAAI,CAAC;CACjB;;AAED,wBAAmE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkModule.js","sourceRoot":"","sources":["../../src/network/networkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAkDtE,eAAe,mBAAmB,CAAgB,eAAe,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport {\n HttpRequest,\n HttpResponse,\n NetworkConfig,\n HttpRequestType,\n} from './networkConfig';\n\nexport type NetworkModuleEvents = {\n onPreprocessHttpRequest: ({\n nativeId,\n requestId,\n type,\n request,\n }: {\n nativeId: string;\n requestId: string;\n type: HttpRequestType;\n request: HttpRequest;\n }) => void;\n onPreprocessHttpResponse: ({\n nativeId,\n responseId,\n type,\n response,\n }: {\n nativeId: string;\n responseId: string;\n type: HttpRequestType;\n response: HttpResponse;\n }) => void;\n};\n\n/**\n * Native NetworkModule using Expo modules API.\n * Provides modern async/await interface while maintaining backward compatibility.\n */\ndeclare class NetworkModule extends NativeModule<NetworkModuleEvents> {\n initializeWithConfig(nativeId: string, config: NetworkConfig): Promise<void>;\n destroy(nativeId: string): Promise<void>;\n setPreprocessedHttpRequest(\n requestId: string,\n request: HttpRequest\n ): Promise<void>;\n setPreprocessedHttpResponse(\n responseId: string,\n response: HttpResponse\n ): Promise<void>;\n}\n\nexport default requireNativeModule<NetworkModule>('NetworkModule');\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './offlineState';
|
|
2
|
+
export * from './offlineDownloadRequest';
|
|
3
|
+
export * from './offlineContentConfig';
|
|
4
|
+
export * from './offlineSourceOptions';
|
|
5
|
+
export * from './offlineContentOptions';
|
|
6
|
+
export * from './offlineContentManager';
|
|
7
|
+
export * from './offlineContentManagerListener';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/offline/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './offlineState';
|
|
2
|
+
export * from './offlineDownloadRequest';
|
|
3
|
+
export * from './offlineContentConfig';
|
|
4
|
+
export * from './offlineSourceOptions';
|
|
5
|
+
export * from './offlineContentOptions';
|
|
6
|
+
export * from './offlineContentManager';
|
|
7
|
+
export * from './offlineContentManagerListener';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/offline/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './offlineState';\nexport * from './offlineDownloadRequest';\nexport * from './offlineContentConfig';\nexport * from './offlineSourceOptions';\nexport * from './offlineContentOptions';\nexport * from './offlineContentManager';\nexport * from './offlineContentManagerListener';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NativeInstanceConfig } from '../nativeInstance';
|
|
2
|
+
import { SourceConfig } from '../source';
|
|
3
|
+
/**
|
|
4
|
+
* Object used to configure a new `OfflineContentManager` instance.
|
|
5
|
+
* @remarks Platform: Android, iOS
|
|
6
|
+
*/
|
|
7
|
+
export interface OfflineContentConfig extends NativeInstanceConfig {
|
|
8
|
+
/**
|
|
9
|
+
* An identifier for this source that is unique within the location and must never change.
|
|
10
|
+
* The root folder will contain a folder based on this id.
|
|
11
|
+
*/
|
|
12
|
+
identifier: string;
|
|
13
|
+
/**
|
|
14
|
+
* The `SourceConfig` used to download the offline resources.
|
|
15
|
+
*/
|
|
16
|
+
sourceConfig: SourceConfig;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=offlineContentConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offlineContentConfig.d.ts","sourceRoot":"","sources":["../../src/offline/offlineContentConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offlineContentConfig.js","sourceRoot":"","sources":["../../src/offline/offlineContentConfig.ts"],"names":[],"mappings":"","sourcesContent":["import { NativeInstanceConfig } from '../nativeInstance';\nimport { SourceConfig } from '../source';\n\n/**\n * Object used to configure a new `OfflineContentManager` instance.\n * @remarks Platform: Android, iOS\n */\nexport interface OfflineContentConfig extends NativeInstanceConfig {\n /**\n * An identifier for this source that is unique within the location and must never change.\n * The root folder will contain a folder based on this id.\n */\n identifier: string;\n /**\n * The `SourceConfig` used to download the offline resources.\n */\n sourceConfig: SourceConfig;\n}\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import NativeInstance from '../nativeInstance';
|
|
2
|
+
import { OfflineContentManagerListener } from './offlineContentManagerListener';
|
|
3
|
+
import { OfflineContentConfig } from './offlineContentConfig';
|
|
4
|
+
import { OfflineDownloadRequest } from './offlineDownloadRequest';
|
|
5
|
+
import { OfflineState } from './offlineState';
|
|
6
|
+
/**
|
|
7
|
+
* Provides the means to download and store sources locally that can be played back with a Player
|
|
8
|
+
* without an active network connection. An OfflineContentManager instance can be created via
|
|
9
|
+
* the constructor and will be idle until initialized.
|
|
10
|
+
*
|
|
11
|
+
* @remarks Platform: Android, iOS
|
|
12
|
+
*/
|
|
13
|
+
export declare class OfflineContentManager extends NativeInstance<OfflineContentConfig> {
|
|
14
|
+
isInitialized: boolean;
|
|
15
|
+
isDestroyed: boolean;
|
|
16
|
+
private eventSubscription?;
|
|
17
|
+
private listeners;
|
|
18
|
+
private drm?;
|
|
19
|
+
/**
|
|
20
|
+
* Allocates the native `OfflineManager` instance and its resources natively.
|
|
21
|
+
* Registers the `DeviceEventEmitter` listener to receive data from the native `OfflineContentManagerListener` callbacks
|
|
22
|
+
*/
|
|
23
|
+
initialize: () => Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a listener to the receive data from the native `OfflineContentManagerListener` callbacks
|
|
26
|
+
* Returns a function that removes this listener from the `OfflineContentManager` that registered it.
|
|
27
|
+
*/
|
|
28
|
+
addListener: (listener: OfflineContentManagerListener) => (() => void);
|
|
29
|
+
/**
|
|
30
|
+
* Destroys the native `OfflineManager` and releases all of its allocated resources.
|
|
31
|
+
*/
|
|
32
|
+
destroy: () => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the current state of the `OfflineContentManager`
|
|
35
|
+
*/
|
|
36
|
+
state: () => Promise<OfflineState>;
|
|
37
|
+
/**
|
|
38
|
+
* Loads the current `OfflineContentOptions`.
|
|
39
|
+
* When the options are loaded the data will be passed to the `OfflineContentManagerListener.onOptionsAvailable`.
|
|
40
|
+
*/
|
|
41
|
+
getOptions: () => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Enqueues downloads according to the `OfflineDownloadRequest`.
|
|
44
|
+
* The promise will reject in the event of null or invalid request parameters.
|
|
45
|
+
* The promise will reject when calling this method when download has already started or is completed.
|
|
46
|
+
* The promise will resolve when the download has been queued. The download will is not finished when the promise resolves.
|
|
47
|
+
*/
|
|
48
|
+
download: (request: OfflineDownloadRequest) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Resumes all suspended actions.
|
|
51
|
+
*/
|
|
52
|
+
resume: () => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Suspends all active actions.
|
|
55
|
+
*/
|
|
56
|
+
suspend: () => Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Cancels and deletes the active download.
|
|
59
|
+
*/
|
|
60
|
+
cancelDownload: () => Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Resolves how many bytes of storage are used by the offline content.
|
|
63
|
+
*/
|
|
64
|
+
usedStorage: () => Promise<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Deletes everything related to the related content ID.
|
|
67
|
+
*/
|
|
68
|
+
deleteAll: () => Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Downloads the offline license.
|
|
71
|
+
* When finished successfully, data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
72
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
73
|
+
*/
|
|
74
|
+
downloadLicense: () => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Releases the currently held offline license.
|
|
77
|
+
* When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
78
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
79
|
+
*
|
|
80
|
+
* @remarks Platform: Android
|
|
81
|
+
*/
|
|
82
|
+
releaseLicense: () => Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Renews the already downloaded DRM license.
|
|
85
|
+
* When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
86
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
87
|
+
*/
|
|
88
|
+
renewOfflineLicense: () => Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=offlineContentManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offlineContentManager.d.ts","sourceRoot":"","sources":["../../src/offline/offlineContentManager.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAEL,6BAA6B,EAE9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAiC9C;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,oBAAoB,CAAC;IAC7E,aAAa,UAAS;IACtB,WAAW,UAAS;IACpB,OAAO,CAAC,iBAAiB,CAAC,CAAoB;IAC9C,OAAO,CAAC,SAAS,CAC0B;IAC3C,OAAO,CAAC,GAAG,CAAC,CAAM;IAElB;;;OAGG;IACH,UAAU,QAAa,OAAO,CAAC,IAAI,CAAC,CA8BlC;IAEF;;;OAGG;IACH,WAAW,GAAI,UAAU,6BAA6B,KAAG,CAAC,MAAM,IAAI,CAAC,CAMnE;IAEF;;OAEG;IACH,OAAO,QAAa,OAAO,CAAC,IAAI,CAAC,CAW/B;IAEF;;OAEG;IACH,KAAK,QAAa,OAAO,CAAC,YAAY,CAAC,CAErC;IAEF;;;OAGG;IACH,UAAU,QAAa,OAAO,CAAC,IAAI,CAAC,CAElC;IAEF;;;;;OAKG;IACH,QAAQ,GAAU,SAAS,sBAAsB,KAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAEF;;OAEG;IACH,MAAM,QAAa,OAAO,CAAC,IAAI,CAAC,CAE9B;IAEF;;OAEG;IACH,OAAO,QAAa,OAAO,CAAC,IAAI,CAAC,CAE/B;IAEF;;OAEG;IACH,cAAc,QAAa,OAAO,CAAC,IAAI,CAAC,CAEtC;IAEF;;OAEG;IACH,WAAW,QAAa,OAAO,CAAC,MAAM,CAAC,CAErC;IAEF;;OAEG;IACH,SAAS,QAAa,OAAO,CAAC,IAAI,CAAC,CAEjC;IAEF;;;;OAIG;IACH,eAAe,QAAa,OAAO,CAAC,IAAI,CAAC,CAEvC;IAEF;;;;;;OAMG;IACH,cAAc,QAAa,OAAO,CAAC,IAAI,CAAC,CAEtC;IAEF;;;;OAIG;IACH,mBAAmB,QAAa,OAAO,CAAC,IAAI,CAAC,CAE3C;CACH"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import NativeInstance from '../nativeInstance';
|
|
2
|
+
import { OfflineEventType, } from './offlineContentManagerListener';
|
|
3
|
+
import { Drm } from '../drm';
|
|
4
|
+
import OfflineModule from './offlineModule';
|
|
5
|
+
const handleBitmovinNativeOfflineEvent = (data, listeners) => {
|
|
6
|
+
listeners.forEach((listener) => {
|
|
7
|
+
if (!listener)
|
|
8
|
+
return;
|
|
9
|
+
if (data.eventType === OfflineEventType.onCompleted) {
|
|
10
|
+
listener.onCompleted?.(data);
|
|
11
|
+
}
|
|
12
|
+
else if (data.eventType === OfflineEventType.onError) {
|
|
13
|
+
listener.onError?.(data);
|
|
14
|
+
}
|
|
15
|
+
else if (data.eventType === OfflineEventType.onProgress) {
|
|
16
|
+
listener.onProgress?.(data);
|
|
17
|
+
}
|
|
18
|
+
else if (data.eventType === OfflineEventType.onOptionsAvailable) {
|
|
19
|
+
listener.onOptionsAvailable?.(data);
|
|
20
|
+
}
|
|
21
|
+
else if (data.eventType === OfflineEventType.onDrmLicenseUpdated) {
|
|
22
|
+
listener.onDrmLicenseUpdated?.(data);
|
|
23
|
+
}
|
|
24
|
+
else if (data.eventType === OfflineEventType.onDrmLicenseExpired) {
|
|
25
|
+
listener.onDrmLicenseExpired?.(data);
|
|
26
|
+
}
|
|
27
|
+
else if (data.eventType === OfflineEventType.onSuspended) {
|
|
28
|
+
listener.onSuspended?.(data);
|
|
29
|
+
}
|
|
30
|
+
else if (data.eventType === OfflineEventType.onResumed) {
|
|
31
|
+
listener.onResumed?.(data);
|
|
32
|
+
}
|
|
33
|
+
else if (data.eventType === OfflineEventType.onCanceled) {
|
|
34
|
+
listener.onCanceled?.(data);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Provides the means to download and store sources locally that can be played back with a Player
|
|
40
|
+
* without an active network connection. An OfflineContentManager instance can be created via
|
|
41
|
+
* the constructor and will be idle until initialized.
|
|
42
|
+
*
|
|
43
|
+
* @remarks Platform: Android, iOS
|
|
44
|
+
*/
|
|
45
|
+
export class OfflineContentManager extends NativeInstance {
|
|
46
|
+
isInitialized = false;
|
|
47
|
+
isDestroyed = false;
|
|
48
|
+
eventSubscription;
|
|
49
|
+
listeners = new Set();
|
|
50
|
+
drm;
|
|
51
|
+
/**
|
|
52
|
+
* Allocates the native `OfflineManager` instance and its resources natively.
|
|
53
|
+
* Registers the `DeviceEventEmitter` listener to receive data from the native `OfflineContentManagerListener` callbacks
|
|
54
|
+
*/
|
|
55
|
+
initialize = async () => {
|
|
56
|
+
if (!this.isInitialized && this.config) {
|
|
57
|
+
this.eventSubscription = OfflineModule.addListener('onBitmovinOfflineEvent', (event) => {
|
|
58
|
+
if (this.nativeId !== event.nativeId) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
handleBitmovinNativeOfflineEvent(event, this.listeners);
|
|
62
|
+
});
|
|
63
|
+
if (this.config.sourceConfig.drmConfig) {
|
|
64
|
+
this.drm = new Drm(this.config.sourceConfig.drmConfig);
|
|
65
|
+
await this.drm.initialize();
|
|
66
|
+
}
|
|
67
|
+
await OfflineModule.initializeWithConfig(this.nativeId, {
|
|
68
|
+
identifier: this.config.identifier,
|
|
69
|
+
sourceConfig: this.config.sourceConfig,
|
|
70
|
+
}, this.drm?.nativeId);
|
|
71
|
+
}
|
|
72
|
+
this.isInitialized = true;
|
|
73
|
+
return Promise.resolve();
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Adds a listener to the receive data from the native `OfflineContentManagerListener` callbacks
|
|
77
|
+
* Returns a function that removes this listener from the `OfflineContentManager` that registered it.
|
|
78
|
+
*/
|
|
79
|
+
addListener = (listener) => {
|
|
80
|
+
this.listeners.add(listener);
|
|
81
|
+
return () => {
|
|
82
|
+
this.listeners.delete(listener);
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Destroys the native `OfflineManager` and releases all of its allocated resources.
|
|
87
|
+
*/
|
|
88
|
+
destroy = async () => {
|
|
89
|
+
if (!this.isDestroyed) {
|
|
90
|
+
this.isDestroyed = true;
|
|
91
|
+
this.eventSubscription?.remove?.();
|
|
92
|
+
this.listeners.clear();
|
|
93
|
+
this.drm?.destroy();
|
|
94
|
+
return OfflineModule.release(this.nativeId);
|
|
95
|
+
}
|
|
96
|
+
return Promise.resolve();
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Gets the current state of the `OfflineContentManager`
|
|
100
|
+
*/
|
|
101
|
+
state = async () => {
|
|
102
|
+
return OfflineModule.getState(this.nativeId);
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Loads the current `OfflineContentOptions`.
|
|
106
|
+
* When the options are loaded the data will be passed to the `OfflineContentManagerListener.onOptionsAvailable`.
|
|
107
|
+
*/
|
|
108
|
+
getOptions = async () => {
|
|
109
|
+
return OfflineModule.getOptions(this.nativeId);
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Enqueues downloads according to the `OfflineDownloadRequest`.
|
|
113
|
+
* The promise will reject in the event of null or invalid request parameters.
|
|
114
|
+
* The promise will reject when calling this method when download has already started or is completed.
|
|
115
|
+
* The promise will resolve when the download has been queued. The download will is not finished when the promise resolves.
|
|
116
|
+
*/
|
|
117
|
+
download = async (request) => {
|
|
118
|
+
return OfflineModule.download(this.nativeId, request);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Resumes all suspended actions.
|
|
122
|
+
*/
|
|
123
|
+
resume = async () => {
|
|
124
|
+
return OfflineModule.resume(this.nativeId);
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Suspends all active actions.
|
|
128
|
+
*/
|
|
129
|
+
suspend = async () => {
|
|
130
|
+
return OfflineModule.suspend(this.nativeId);
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Cancels and deletes the active download.
|
|
134
|
+
*/
|
|
135
|
+
cancelDownload = async () => {
|
|
136
|
+
return OfflineModule.cancelDownload(this.nativeId);
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Resolves how many bytes of storage are used by the offline content.
|
|
140
|
+
*/
|
|
141
|
+
usedStorage = async () => {
|
|
142
|
+
return OfflineModule.usedStorage(this.nativeId);
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Deletes everything related to the related content ID.
|
|
146
|
+
*/
|
|
147
|
+
deleteAll = async () => {
|
|
148
|
+
return OfflineModule.deleteAll(this.nativeId);
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Downloads the offline license.
|
|
152
|
+
* When finished successfully, data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
153
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
154
|
+
*/
|
|
155
|
+
downloadLicense = async () => {
|
|
156
|
+
return OfflineModule.downloadLicense(this.nativeId);
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Releases the currently held offline license.
|
|
160
|
+
* When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
161
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
162
|
+
*
|
|
163
|
+
* @remarks Platform: Android
|
|
164
|
+
*/
|
|
165
|
+
releaseLicense = async () => {
|
|
166
|
+
return OfflineModule.releaseLicense(this.nativeId);
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Renews the already downloaded DRM license.
|
|
170
|
+
* When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.
|
|
171
|
+
* Errors are transmitted to the `OfflineContentManagerListener.onError`.
|
|
172
|
+
*/
|
|
173
|
+
renewOfflineLicense = async () => {
|
|
174
|
+
return OfflineModule.renewOfflineLicense(this.nativeId);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=offlineContentManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offlineContentManager.js","sourceRoot":"","sources":["../../src/offline/offlineContentManager.ts"],"names":[],"mappings":"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","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport NativeInstance from '../nativeInstance';\nimport {\n BitmovinNativeOfflineEventData,\n OfflineContentManagerListener,\n OfflineEventType,\n} from './offlineContentManagerListener';\nimport { OfflineContentConfig } from './offlineContentConfig';\nimport { OfflineDownloadRequest } from './offlineDownloadRequest';\nimport { OfflineState } from './offlineState';\nimport { Drm } from '../drm';\nimport OfflineModule from './offlineModule';\n\nconst handleBitmovinNativeOfflineEvent = (\n data: BitmovinNativeOfflineEventData,\n listeners: Set<OfflineContentManagerListener>\n) => {\n listeners.forEach((listener) => {\n if (!listener) return;\n\n if (data.eventType === OfflineEventType.onCompleted) {\n listener.onCompleted?.(data);\n } else if (data.eventType === OfflineEventType.onError) {\n listener.onError?.(data);\n } else if (data.eventType === OfflineEventType.onProgress) {\n listener.onProgress?.(data);\n } else if (data.eventType === OfflineEventType.onOptionsAvailable) {\n listener.onOptionsAvailable?.(data);\n } else if (data.eventType === OfflineEventType.onDrmLicenseUpdated) {\n listener.onDrmLicenseUpdated?.(data);\n } else if (data.eventType === OfflineEventType.onDrmLicenseExpired) {\n listener.onDrmLicenseExpired?.(data);\n } else if (data.eventType === OfflineEventType.onSuspended) {\n listener.onSuspended?.(data);\n } else if (data.eventType === OfflineEventType.onResumed) {\n listener.onResumed?.(data);\n } else if (data.eventType === OfflineEventType.onCanceled) {\n listener.onCanceled?.(data);\n }\n });\n};\n\n/**\n * Provides the means to download and store sources locally that can be played back with a Player\n * without an active network connection. An OfflineContentManager instance can be created via\n * the constructor and will be idle until initialized.\n *\n * @remarks Platform: Android, iOS\n */\nexport class OfflineContentManager extends NativeInstance<OfflineContentConfig> {\n isInitialized = false;\n isDestroyed = false;\n private eventSubscription?: EventSubscription;\n private listeners: Set<OfflineContentManagerListener> =\n new Set<OfflineContentManagerListener>();\n private drm?: Drm;\n\n /**\n * Allocates the native `OfflineManager` instance and its resources natively.\n * Registers the `DeviceEventEmitter` listener to receive data from the native `OfflineContentManagerListener` callbacks\n */\n initialize = async (): Promise<void> => {\n if (!this.isInitialized && this.config) {\n this.eventSubscription = OfflineModule.addListener(\n 'onBitmovinOfflineEvent',\n (event: BitmovinNativeOfflineEventData) => {\n if (this.nativeId !== event.nativeId) {\n return;\n }\n\n handleBitmovinNativeOfflineEvent(event, this.listeners);\n }\n );\n\n if (this.config.sourceConfig.drmConfig) {\n this.drm = new Drm(this.config.sourceConfig.drmConfig);\n await this.drm.initialize();\n }\n\n await OfflineModule.initializeWithConfig(\n this.nativeId,\n {\n identifier: this.config.identifier,\n sourceConfig: this.config.sourceConfig,\n },\n this.drm?.nativeId\n );\n }\n\n this.isInitialized = true;\n return Promise.resolve();\n };\n\n /**\n * Adds a listener to the receive data from the native `OfflineContentManagerListener` callbacks\n * Returns a function that removes this listener from the `OfflineContentManager` that registered it.\n */\n addListener = (listener: OfflineContentManagerListener): (() => void) => {\n this.listeners.add(listener);\n\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n /**\n * Destroys the native `OfflineManager` and releases all of its allocated resources.\n */\n destroy = async (): Promise<void> => {\n if (!this.isDestroyed) {\n this.isDestroyed = true;\n this.eventSubscription?.remove?.();\n this.listeners.clear();\n this.drm?.destroy();\n\n return OfflineModule.release(this.nativeId);\n }\n\n return Promise.resolve();\n };\n\n /**\n * Gets the current state of the `OfflineContentManager`\n */\n state = async (): Promise<OfflineState> => {\n return OfflineModule.getState(this.nativeId) as Promise<OfflineState>;\n };\n\n /**\n * Loads the current `OfflineContentOptions`.\n * When the options are loaded the data will be passed to the `OfflineContentManagerListener.onOptionsAvailable`.\n */\n getOptions = async (): Promise<void> => {\n return OfflineModule.getOptions(this.nativeId);\n };\n\n /**\n * Enqueues downloads according to the `OfflineDownloadRequest`.\n * The promise will reject in the event of null or invalid request parameters.\n * The promise will reject when calling this method when download has already started or is completed.\n * The promise will resolve when the download has been queued. The download will is not finished when the promise resolves.\n */\n download = async (request: OfflineDownloadRequest): Promise<void> => {\n return OfflineModule.download(this.nativeId, request);\n };\n\n /**\n * Resumes all suspended actions.\n */\n resume = async (): Promise<void> => {\n return OfflineModule.resume(this.nativeId);\n };\n\n /**\n * Suspends all active actions.\n */\n suspend = async (): Promise<void> => {\n return OfflineModule.suspend(this.nativeId);\n };\n\n /**\n * Cancels and deletes the active download.\n */\n cancelDownload = async (): Promise<void> => {\n return OfflineModule.cancelDownload(this.nativeId);\n };\n\n /**\n * Resolves how many bytes of storage are used by the offline content.\n */\n usedStorage = async (): Promise<number> => {\n return OfflineModule.usedStorage(this.nativeId);\n };\n\n /**\n * Deletes everything related to the related content ID.\n */\n deleteAll = async (): Promise<void> => {\n return OfflineModule.deleteAll(this.nativeId);\n };\n\n /**\n * Downloads the offline license.\n * When finished successfully, data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n */\n downloadLicense = async (): Promise<void> => {\n return OfflineModule.downloadLicense(this.nativeId);\n };\n\n /**\n * Releases the currently held offline license.\n * When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n *\n * @remarks Platform: Android\n */\n releaseLicense = async (): Promise<void> => {\n return OfflineModule.releaseLicense(this.nativeId);\n };\n\n /**\n * Renews the already downloaded DRM license.\n * When finished successfully data will be passed to the `OfflineContentManagerListener.onDrmLicenseUpdated`.\n * Errors are transmitted to the `OfflineContentManagerListener.onError`.\n */\n renewOfflineLicense = async (): Promise<void> => {\n return OfflineModule.renewOfflineLicense(this.nativeId);\n };\n}\n"]}
|