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
|
@@ -5,6 +5,8 @@ import com.bitmovin.analytics.api.AnalyticsConfig
|
|
|
5
5
|
import com.bitmovin.analytics.api.CustomData
|
|
6
6
|
import com.bitmovin.analytics.api.DefaultMetadata
|
|
7
7
|
import com.bitmovin.analytics.api.SourceMetadata
|
|
8
|
+
import com.bitmovin.player.reactnative.extensions.get
|
|
9
|
+
import com.bitmovin.player.reactnative.extensions.set
|
|
8
10
|
import com.bitmovin.player.api.BandwidthMeterType
|
|
9
11
|
import com.bitmovin.player.api.DeviceDescription.DeviceName
|
|
10
12
|
import com.bitmovin.player.api.ForceReuseVideoCodecReason
|
|
@@ -37,7 +39,6 @@ import com.bitmovin.player.api.media.AdaptationConfig
|
|
|
37
39
|
import com.bitmovin.player.api.media.MediaTrackRole
|
|
38
40
|
import com.bitmovin.player.api.media.MediaType
|
|
39
41
|
import com.bitmovin.player.api.media.audio.AudioTrack
|
|
40
|
-
import com.bitmovin.player.api.media.audio.quality.AudioQuality
|
|
41
42
|
import com.bitmovin.player.api.media.subtitle.SubtitleTrack
|
|
42
43
|
import com.bitmovin.player.api.media.thumbnail.Thumbnail
|
|
43
44
|
import com.bitmovin.player.api.media.thumbnail.ThumbnailTrack
|
|
@@ -58,25 +59,21 @@ import com.bitmovin.player.api.ui.ScalingMode
|
|
|
58
59
|
import com.bitmovin.player.api.ui.StyleConfig
|
|
59
60
|
import com.bitmovin.player.api.ui.SurfaceType
|
|
60
61
|
import com.bitmovin.player.api.ui.UiConfig
|
|
61
|
-
import com.bitmovin.player.reactnative.BitmovinCastManagerOptions
|
|
62
62
|
import com.bitmovin.player.reactnative.PictureInPictureConfig
|
|
63
63
|
import com.bitmovin.player.reactnative.RNBufferLevels
|
|
64
64
|
import com.bitmovin.player.reactnative.RNPlayerViewConfigWrapper
|
|
65
65
|
import com.bitmovin.player.reactnative.RNStyleConfigWrapper
|
|
66
66
|
import com.bitmovin.player.reactnative.UserInterfaceType
|
|
67
|
-
import com.bitmovin.player.reactnative.extensions.
|
|
67
|
+
import com.bitmovin.player.reactnative.extensions.getArray
|
|
68
68
|
import com.bitmovin.player.reactnative.extensions.getBooleanOrNull
|
|
69
69
|
import com.bitmovin.player.reactnative.extensions.getDoubleOrNull
|
|
70
|
+
import com.bitmovin.player.reactnative.extensions.getInt
|
|
71
|
+
import com.bitmovin.player.reactnative.extensions.getMap
|
|
70
72
|
import com.bitmovin.player.reactnative.extensions.getName
|
|
71
|
-
import com.bitmovin.player.reactnative.extensions.
|
|
72
|
-
import com.bitmovin.player.reactnative.extensions.putBoolean
|
|
73
|
-
import com.bitmovin.player.reactnative.extensions.putDouble
|
|
74
|
-
import com.bitmovin.player.reactnative.extensions.putInt
|
|
75
|
-
import com.bitmovin.player.reactnative.extensions.set
|
|
73
|
+
import com.bitmovin.player.reactnative.extensions.getString
|
|
76
74
|
import com.bitmovin.player.reactnative.extensions.toBase64DataUri
|
|
77
75
|
import com.bitmovin.player.reactnative.extensions.toMap
|
|
78
76
|
import com.bitmovin.player.reactnative.extensions.toMapList
|
|
79
|
-
import com.bitmovin.player.reactnative.extensions.toReadableMap
|
|
80
77
|
import com.bitmovin.player.reactnative.extensions.withArray
|
|
81
78
|
import com.bitmovin.player.reactnative.extensions.withBoolean
|
|
82
79
|
import com.bitmovin.player.reactnative.extensions.withDouble
|
|
@@ -84,13 +81,15 @@ import com.bitmovin.player.reactnative.extensions.withInt
|
|
|
84
81
|
import com.bitmovin.player.reactnative.extensions.withMap
|
|
85
82
|
import com.bitmovin.player.reactnative.extensions.withString
|
|
86
83
|
import com.bitmovin.player.reactnative.extensions.withStringArray
|
|
87
|
-
import com.facebook.react.bridge.*
|
|
88
84
|
import java.util.UUID
|
|
89
85
|
|
|
90
86
|
/**
|
|
91
|
-
*
|
|
87
|
+
* Filters out null values from a map to ensure compatibility with Expo modules
|
|
92
88
|
*/
|
|
93
|
-
fun
|
|
89
|
+
private fun Map<String, Any?>.filterNotNullValues(): Map<String, Any> =
|
|
90
|
+
this.filterValues { it != null }.mapValues { it.value!! }
|
|
91
|
+
|
|
92
|
+
fun Map<String, Any?>.toPlayerConfig(): PlayerConfig = PlayerConfig(key = getString("licenseKey")).apply {
|
|
94
93
|
withMap("playbackConfig") { playbackConfig = it.toPlaybackConfig() }
|
|
95
94
|
withMap("styleConfig") { styleConfig = it.toStyleConfig() }
|
|
96
95
|
withMap("tweaksConfig") { tweaksConfig = it.toTweaksConfig() }
|
|
@@ -102,72 +101,48 @@ fun ReadableMap.toPlayerConfig(): PlayerConfig = PlayerConfig(key = getString("l
|
|
|
102
101
|
withMap("networkConfig") { networkConfig = it.toNetworkConfig() }
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
* Converts any JS object into a `BufferMediaTypeConfig` object.
|
|
107
|
-
*/
|
|
108
|
-
fun ReadableMap.toBufferMediaTypeConfig(): BufferMediaTypeConfig = BufferMediaTypeConfig().apply {
|
|
104
|
+
fun Map<String, Any?>.toBufferMediaTypeConfig(): BufferMediaTypeConfig = BufferMediaTypeConfig().apply {
|
|
109
105
|
withDouble("forwardDuration") { forwardDuration = it }
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
|
|
113
|
-
* Converts any JS object into a `BufferConfig` object.
|
|
114
|
-
*/
|
|
115
|
-
fun ReadableMap.toBufferConfig(): BufferConfig = BufferConfig().apply {
|
|
108
|
+
fun Map<String, Any?>.toBufferConfig(): BufferConfig = BufferConfig().apply {
|
|
116
109
|
withMap("audioAndVideo") { audioAndVideo = it.toBufferMediaTypeConfig() }
|
|
117
110
|
withDouble("restartThreshold") { restartThreshold = it }
|
|
118
111
|
withDouble("startupThreshold") { startupThreshold = it }
|
|
119
112
|
}
|
|
120
113
|
|
|
121
|
-
|
|
122
|
-
* Converts an arbitrary [ReadableMap] to a [RemoteControlConfig].
|
|
123
|
-
*/
|
|
124
|
-
private fun ReadableMap.toRemoteControlConfig(): RemoteControlConfig = RemoteControlConfig().apply {
|
|
114
|
+
private fun Map<String, Any?>.toRemoteControlConfig(): RemoteControlConfig = RemoteControlConfig().apply {
|
|
125
115
|
withString("receiverStylesheetUrl") { receiverStylesheetUrl = it }
|
|
126
|
-
withMap("customReceiverConfig") { customReceiverConfig = it.
|
|
116
|
+
withMap("customReceiverConfig") { customReceiverConfig = it.mapValues { entry -> entry.value as? String } }
|
|
127
117
|
withBoolean("isCastEnabled") { isCastEnabled = it }
|
|
128
118
|
withBoolean("sendManifestRequestsWithCredentials") { sendManifestRequestsWithCredentials = it }
|
|
129
119
|
withBoolean("sendSegmentRequestsWithCredentials") { sendSegmentRequestsWithCredentials = it }
|
|
130
120
|
withBoolean("sendDrmLicenseRequestsWithCredentials") { sendDrmLicenseRequestsWithCredentials = it }
|
|
131
121
|
}
|
|
132
122
|
|
|
133
|
-
|
|
134
|
-
* Converts an arbitrary `json` to `SourceOptions`.
|
|
135
|
-
*/
|
|
136
|
-
fun ReadableMap.toSourceOptions(): SourceOptions = SourceOptions(
|
|
123
|
+
fun Map<String, Any?>.toSourceOptions(): SourceOptions = SourceOptions(
|
|
137
124
|
startOffset = getDoubleOrNull("startOffset"),
|
|
138
125
|
startOffsetTimelineReference = getString("startOffsetTimelineReference")?.toTimelineReferencePoint(),
|
|
139
126
|
)
|
|
140
127
|
|
|
141
|
-
/**
|
|
142
|
-
* Converts an arbitrary `json` to `TimelineReferencePoint`.
|
|
143
|
-
*/
|
|
144
128
|
private fun String.toTimelineReferencePoint(): TimelineReferencePoint? = when (this) {
|
|
145
129
|
"start" -> TimelineReferencePoint.Start
|
|
146
130
|
"end" -> TimelineReferencePoint.End
|
|
147
131
|
else -> null
|
|
148
132
|
}
|
|
149
133
|
|
|
150
|
-
|
|
151
|
-
* Converts an arbitrary `json` to `AdaptationConfig`.
|
|
152
|
-
*/
|
|
153
|
-
private fun ReadableMap.toAdaptationConfig(): AdaptationConfig = AdaptationConfig().apply {
|
|
134
|
+
private fun Map<String, Any?>.toAdaptationConfig(): AdaptationConfig = AdaptationConfig().apply {
|
|
154
135
|
withInt("maxSelectableBitrate") { maxSelectableVideoBitrate = it }
|
|
155
136
|
withInt("initialBandwidthEstimateOverride") { initialBandwidthEstimateOverride = it.toLong(); }
|
|
156
137
|
}
|
|
157
138
|
|
|
158
|
-
|
|
159
|
-
* Converts any JS object into a `PlaybackConfig` object.
|
|
160
|
-
*/
|
|
161
|
-
fun ReadableMap.toPlaybackConfig(): PlaybackConfig = PlaybackConfig().apply {
|
|
139
|
+
fun Map<String, Any?>.toPlaybackConfig(): PlaybackConfig = PlaybackConfig().apply {
|
|
162
140
|
withBoolean("isAutoplayEnabled") { isAutoplayEnabled = it }
|
|
163
141
|
withBoolean("isMuted") { isMuted = it }
|
|
164
142
|
withBoolean("isTimeShiftEnabled") { isTimeShiftEnabled = it }
|
|
165
143
|
}
|
|
166
144
|
|
|
167
|
-
|
|
168
|
-
* Converts any JS object into a `StyleConfig` object.
|
|
169
|
-
*/
|
|
170
|
-
fun ReadableMap.toStyleConfig(): StyleConfig = StyleConfig().apply {
|
|
145
|
+
fun Map<String, Any?>.toStyleConfig(): StyleConfig = StyleConfig().apply {
|
|
171
146
|
withBoolean("isUiEnabled") { isUiEnabled = it }
|
|
172
147
|
getString("playerUiCss")?.takeIf { it.isNotEmpty() }?.let { playerUiCss = it }
|
|
173
148
|
getString("supplementalPlayerUiCss")?.takeIf { it.isNotEmpty() }?.let { supplementalPlayerUiCss = it }
|
|
@@ -175,9 +150,6 @@ fun ReadableMap.toStyleConfig(): StyleConfig = StyleConfig().apply {
|
|
|
175
150
|
withString("scalingMode") { scalingMode = ScalingMode.valueOf(it) }
|
|
176
151
|
}
|
|
177
152
|
|
|
178
|
-
/**
|
|
179
|
-
* Converts any JS string into an `ForceReuseVideoCodecReason` enum value.
|
|
180
|
-
*/
|
|
181
153
|
private fun String.toForceReuseVideoCodecReason(): ForceReuseVideoCodecReason? = when (this) {
|
|
182
154
|
"ColorInfoMismatch" -> ForceReuseVideoCodecReason.ColorInfoMismatch
|
|
183
155
|
"MaxInputSizeExceeded" -> ForceReuseVideoCodecReason.MaxInputSizeExceeded
|
|
@@ -185,10 +157,7 @@ private fun String.toForceReuseVideoCodecReason(): ForceReuseVideoCodecReason? =
|
|
|
185
157
|
else -> null
|
|
186
158
|
}
|
|
187
159
|
|
|
188
|
-
|
|
189
|
-
* Converts any JS object into a `TweaksConfig` object.
|
|
190
|
-
*/
|
|
191
|
-
fun ReadableMap.toTweaksConfig(): TweaksConfig = TweaksConfig().apply {
|
|
160
|
+
fun Map<String, Any?>.toTweaksConfig(): TweaksConfig = TweaksConfig().apply {
|
|
192
161
|
withDouble("timeChangedInterval") { timeChangedInterval = it }
|
|
193
162
|
withInt("bandwidthEstimateWeightLimit") {
|
|
194
163
|
bandwidthMeterType = BandwidthMeterType.Default(
|
|
@@ -217,39 +186,27 @@ fun ReadableMap.toTweaksConfig(): TweaksConfig = TweaksConfig().apply {
|
|
|
217
186
|
}
|
|
218
187
|
}
|
|
219
188
|
|
|
220
|
-
|
|
221
|
-
* Converts any JS object into an `AdvertisingConfig` object.
|
|
222
|
-
*/
|
|
223
|
-
fun ReadableMap.toAdvertisingConfig(): AdvertisingConfig? {
|
|
189
|
+
fun Map<String, Any?>.toAdvertisingConfig(): AdvertisingConfig? {
|
|
224
190
|
return AdvertisingConfig(
|
|
225
191
|
getArray("schedule")?.toMapList()?.mapNotNull { it?.toAdItem() } ?: return null,
|
|
226
192
|
)
|
|
227
193
|
}
|
|
228
194
|
|
|
229
|
-
|
|
230
|
-
* Converts any JS object into an `AdItem` object.
|
|
231
|
-
*/
|
|
232
|
-
fun ReadableMap.toAdItem(): AdItem? {
|
|
195
|
+
fun Map<String, Any?>.toAdItem(): AdItem? {
|
|
233
196
|
return AdItem(
|
|
234
|
-
sources = getArray("sources")
|
|
197
|
+
sources = getArray("sources")?.toMapList()?.mapNotNull { it?.toAdSource() }?.toTypedArray() ?: return null,
|
|
235
198
|
position = getString("position") ?: "pre",
|
|
236
199
|
preloadOffset = getDoubleOrNull("preloadOffset") ?: 0.0,
|
|
237
200
|
)
|
|
238
201
|
}
|
|
239
202
|
|
|
240
|
-
|
|
241
|
-
* Converts any JS object into an `AdSource` object.
|
|
242
|
-
*/
|
|
243
|
-
fun ReadableMap.toAdSource(): AdSource? {
|
|
203
|
+
fun Map<String, Any?>.toAdSource(): AdSource? {
|
|
244
204
|
return AdSource(
|
|
245
205
|
type = getString("type")?.toAdSourceType() ?: return null,
|
|
246
206
|
tag = getString("tag") ?: return null,
|
|
247
207
|
)
|
|
248
208
|
}
|
|
249
209
|
|
|
250
|
-
/**
|
|
251
|
-
* Converts any JS string into an `AdSourceType` enum value.
|
|
252
|
-
*/
|
|
253
210
|
private fun String.toAdSourceType(): AdSourceType? = when (this) {
|
|
254
211
|
"bitmovin" -> AdSourceType.Bitmovin
|
|
255
212
|
"ima" -> AdSourceType.Ima
|
|
@@ -258,10 +215,7 @@ private fun String.toAdSourceType(): AdSourceType? = when (this) {
|
|
|
258
215
|
else -> null
|
|
259
216
|
}
|
|
260
217
|
|
|
261
|
-
|
|
262
|
-
* Converts an arbitrary `json` to `SourceConfig`.
|
|
263
|
-
*/
|
|
264
|
-
fun ReadableMap.toSourceConfig(): SourceConfig? {
|
|
218
|
+
fun Map<String, Any?>.toSourceConfig(): SourceConfig? {
|
|
265
219
|
val url = getString("url") ?: return null
|
|
266
220
|
val type = getString("type")?.toSourceType() ?: return null
|
|
267
221
|
return SourceConfig(url, type).apply {
|
|
@@ -270,8 +224,8 @@ fun ReadableMap.toSourceConfig(): SourceConfig? {
|
|
|
270
224
|
withString("poster") { posterSource = it }
|
|
271
225
|
withBoolean("isPosterPersistent") { isPosterPersistent = it }
|
|
272
226
|
withArray("subtitleTracks") { subtitleTracks ->
|
|
273
|
-
|
|
274
|
-
subtitleTracks.getMap(
|
|
227
|
+
subtitleTracks.indices.forEach { subtitleTrack ->
|
|
228
|
+
subtitleTracks.getMap(subtitleTrack)?.toSubtitleTrack()?.let {
|
|
275
229
|
addSubtitleTrack(it)
|
|
276
230
|
}
|
|
277
231
|
}
|
|
@@ -282,9 +236,6 @@ fun ReadableMap.toSourceConfig(): SourceConfig? {
|
|
|
282
236
|
}
|
|
283
237
|
}
|
|
284
238
|
|
|
285
|
-
/**
|
|
286
|
-
* Converts an arbitrary `json` to `SourceType`.
|
|
287
|
-
*/
|
|
288
239
|
fun String.toSourceType(): SourceType? = when (this) {
|
|
289
240
|
"dash" -> SourceType.Dash
|
|
290
241
|
"hls" -> SourceType.Hls
|
|
@@ -293,293 +244,252 @@ fun String.toSourceType(): SourceType? = when (this) {
|
|
|
293
244
|
else -> null
|
|
294
245
|
}
|
|
295
246
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
putInt("loadingState", loadingState.ordinal)
|
|
304
|
-
putMap("metadata", config.metadata?.toReadableMap())
|
|
305
|
-
}
|
|
247
|
+
fun Source.toJson(): Map<String, Any> = mapOf(
|
|
248
|
+
"duration" to duration,
|
|
249
|
+
"isActive" to isActive,
|
|
250
|
+
"isAttachedToPlayer" to isAttachedToPlayer,
|
|
251
|
+
"loadingState" to loadingState.ordinal,
|
|
252
|
+
"metadata" to (config.metadata ?: emptyMap<String, Any>()),
|
|
253
|
+
).filterNotNullValues()
|
|
306
254
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
255
|
+
fun SeekPosition.toJson(): Map<String, Any> = mapOf(
|
|
256
|
+
"time" to time,
|
|
257
|
+
"source" to source.toJson(),
|
|
258
|
+
).filterNotNullValues()
|
|
259
|
+
|
|
260
|
+
fun SourceEvent.toJson(): Map<String, Any> {
|
|
261
|
+
val baseMap = mutableMapOf<String, Any?>(
|
|
262
|
+
"name" to getName(),
|
|
263
|
+
"timestamp" to timestamp.toDouble(),
|
|
264
|
+
)
|
|
314
265
|
|
|
315
|
-
/**
|
|
316
|
-
* Converts any given `SourceEvent` object into its `json` representation.
|
|
317
|
-
*/
|
|
318
|
-
fun SourceEvent.toJson(): WritableMap {
|
|
319
|
-
val json = Arguments.createMap()
|
|
320
|
-
json.putString("name", getName())
|
|
321
|
-
json.putDouble("timestamp", timestamp.toDouble())
|
|
322
266
|
when (this) {
|
|
323
267
|
is SourceEvent.Load -> {
|
|
324
|
-
|
|
268
|
+
baseMap["source"] = source.toJson()
|
|
325
269
|
}
|
|
326
270
|
|
|
327
271
|
is SourceEvent.Loaded -> {
|
|
328
|
-
|
|
272
|
+
baseMap["source"] = source.toJson()
|
|
329
273
|
}
|
|
330
274
|
|
|
331
275
|
is SourceEvent.Error -> {
|
|
332
|
-
|
|
333
|
-
|
|
276
|
+
baseMap["code"] = code.value
|
|
277
|
+
baseMap["message"] = message
|
|
334
278
|
}
|
|
335
279
|
|
|
336
280
|
is SourceEvent.Warning -> {
|
|
337
|
-
|
|
338
|
-
|
|
281
|
+
baseMap["code"] = code.value
|
|
282
|
+
baseMap["message"] = message
|
|
339
283
|
}
|
|
340
284
|
|
|
341
285
|
is SourceEvent.AudioTrackAdded -> {
|
|
342
|
-
|
|
286
|
+
baseMap["audioTrack"] = audioTrack.toJson()
|
|
343
287
|
}
|
|
344
288
|
|
|
345
289
|
is SourceEvent.AudioTrackChanged -> {
|
|
346
|
-
|
|
347
|
-
|
|
290
|
+
baseMap["oldAudioTrack"] = oldAudioTrack?.toJson()
|
|
291
|
+
baseMap["newAudioTrack"] = newAudioTrack?.toJson()
|
|
348
292
|
}
|
|
349
293
|
|
|
350
294
|
is SourceEvent.AudioTrackRemoved -> {
|
|
351
|
-
|
|
295
|
+
baseMap["audioTrack"] = audioTrack.toJson()
|
|
352
296
|
}
|
|
353
297
|
|
|
354
298
|
is SourceEvent.SubtitleTrackAdded -> {
|
|
355
|
-
|
|
299
|
+
baseMap["subtitleTrack"] = subtitleTrack.toJson()
|
|
356
300
|
}
|
|
357
301
|
|
|
358
302
|
is SourceEvent.SubtitleTrackRemoved -> {
|
|
359
|
-
|
|
303
|
+
baseMap["subtitleTrack"] = subtitleTrack.toJson()
|
|
360
304
|
}
|
|
361
305
|
|
|
362
306
|
is SourceEvent.SubtitleTrackChanged -> {
|
|
363
|
-
|
|
364
|
-
|
|
307
|
+
baseMap["oldSubtitleTrack"] = oldSubtitleTrack?.toJson()
|
|
308
|
+
baseMap["newSubtitleTrack"] = newSubtitleTrack?.toJson()
|
|
365
309
|
}
|
|
366
310
|
|
|
367
311
|
is SourceEvent.DownloadFinished -> {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
312
|
+
baseMap["downloadTime"] = downloadTime
|
|
313
|
+
baseMap["requestType"] = downloadType.toString()
|
|
314
|
+
baseMap["httpStatus"] = httpStatus
|
|
315
|
+
baseMap["isSuccess"] = isSuccess
|
|
372
316
|
lastRedirectLocation?.let {
|
|
373
|
-
|
|
317
|
+
baseMap["lastRedirectLocation"] = it
|
|
374
318
|
}
|
|
375
|
-
|
|
376
|
-
|
|
319
|
+
baseMap["size"] = size.toDouble()
|
|
320
|
+
baseMap["url"] = url
|
|
377
321
|
}
|
|
378
322
|
|
|
379
323
|
is SourceEvent.VideoDownloadQualityChanged -> {
|
|
380
|
-
|
|
381
|
-
|
|
324
|
+
baseMap["newVideoQuality"] = newVideoQuality?.toJson()
|
|
325
|
+
baseMap["oldVideoQuality"] = oldVideoQuality?.toJson()
|
|
382
326
|
}
|
|
383
327
|
|
|
384
328
|
else -> {
|
|
385
329
|
// Event is not supported yet or does not have any additional data
|
|
386
330
|
}
|
|
387
331
|
}
|
|
388
|
-
return
|
|
332
|
+
return baseMap.filterNotNullValues()
|
|
389
333
|
}
|
|
390
334
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
json.putDouble("timestamp", timestamp.toDouble())
|
|
335
|
+
fun PlayerEvent.toJson(): Map<String, Any> {
|
|
336
|
+
val baseMap = mutableMapOf<String, Any?>(
|
|
337
|
+
"name" to getName(),
|
|
338
|
+
"timestamp" to timestamp.toDouble(),
|
|
339
|
+
)
|
|
340
|
+
|
|
398
341
|
when (this) {
|
|
399
342
|
is PlayerEvent.Error -> {
|
|
400
|
-
|
|
401
|
-
|
|
343
|
+
baseMap["code"] = code.value
|
|
344
|
+
baseMap["message"] = message
|
|
402
345
|
}
|
|
403
346
|
|
|
404
347
|
is PlayerEvent.Warning -> {
|
|
405
|
-
|
|
406
|
-
|
|
348
|
+
baseMap["code"] = code.value
|
|
349
|
+
baseMap["message"] = message
|
|
407
350
|
}
|
|
408
351
|
|
|
409
352
|
is PlayerEvent.Play -> {
|
|
410
|
-
|
|
353
|
+
baseMap["time"] = time
|
|
411
354
|
}
|
|
412
355
|
|
|
413
356
|
is PlayerEvent.Playing -> {
|
|
414
|
-
|
|
357
|
+
baseMap["time"] = time
|
|
415
358
|
}
|
|
416
359
|
|
|
417
360
|
is PlayerEvent.Paused -> {
|
|
418
|
-
|
|
361
|
+
baseMap["time"] = time
|
|
419
362
|
}
|
|
420
363
|
|
|
421
364
|
is PlayerEvent.TimeChanged -> {
|
|
422
|
-
|
|
365
|
+
baseMap["currentTime"] = time
|
|
423
366
|
}
|
|
424
367
|
|
|
425
368
|
is PlayerEvent.Seek -> {
|
|
426
|
-
|
|
427
|
-
|
|
369
|
+
baseMap["from"] = from.toJson()
|
|
370
|
+
baseMap["to"] = to.toJson()
|
|
428
371
|
}
|
|
429
372
|
|
|
430
373
|
is PlayerEvent.TimeShift -> {
|
|
431
|
-
|
|
432
|
-
|
|
374
|
+
baseMap["position"] = position
|
|
375
|
+
baseMap["targetPosition"] = target
|
|
433
376
|
}
|
|
434
377
|
|
|
435
378
|
is PlayerEvent.PictureInPictureAvailabilityChanged -> {
|
|
436
|
-
|
|
379
|
+
baseMap["isPictureInPictureAvailable"] = isPictureInPictureAvailable
|
|
437
380
|
}
|
|
438
381
|
|
|
439
382
|
is PlayerEvent.AdBreakFinished -> {
|
|
440
|
-
|
|
383
|
+
baseMap["adBreak"] = adBreak?.toJson()
|
|
441
384
|
}
|
|
442
385
|
|
|
443
386
|
is PlayerEvent.AdBreakStarted -> {
|
|
444
|
-
|
|
387
|
+
baseMap["adBreak"] = adBreak?.toJson()
|
|
445
388
|
}
|
|
446
389
|
|
|
447
390
|
is PlayerEvent.AdClicked -> {
|
|
448
|
-
|
|
391
|
+
baseMap["clickThroughUrl"] = clickThroughUrl
|
|
449
392
|
}
|
|
450
393
|
|
|
451
394
|
is PlayerEvent.AdError -> {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
395
|
+
baseMap["code"] = code
|
|
396
|
+
baseMap["message"] = message
|
|
397
|
+
baseMap["adConfig"] = adConfig?.toJson()
|
|
398
|
+
baseMap["adItem"] = adItem?.toJson()
|
|
456
399
|
}
|
|
457
400
|
|
|
458
401
|
is PlayerEvent.AdFinished -> {
|
|
459
|
-
|
|
402
|
+
baseMap["ad"] = ad?.toJson()
|
|
460
403
|
}
|
|
461
404
|
|
|
462
405
|
is PlayerEvent.AdManifestLoad -> {
|
|
463
|
-
|
|
464
|
-
|
|
406
|
+
baseMap["adBreak"] = adBreak?.toJson()
|
|
407
|
+
baseMap["adConfig"] = adConfig.toJson()
|
|
465
408
|
}
|
|
466
409
|
|
|
467
410
|
is PlayerEvent.AdManifestLoaded -> {
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
411
|
+
baseMap["adBreak"] = adBreak?.toJson()
|
|
412
|
+
baseMap["adConfig"] = adConfig.toJson()
|
|
413
|
+
baseMap["downloadTime"] = downloadTime.toDouble()
|
|
471
414
|
}
|
|
472
415
|
|
|
473
416
|
is PlayerEvent.AdQuartile -> {
|
|
474
|
-
|
|
417
|
+
baseMap["quartile"] = quartile.toJson()
|
|
475
418
|
}
|
|
476
419
|
|
|
477
420
|
is PlayerEvent.AdScheduled -> {
|
|
478
|
-
|
|
421
|
+
baseMap["numberOfAds"] = numberOfAds
|
|
479
422
|
}
|
|
480
423
|
|
|
481
424
|
is PlayerEvent.AdSkipped -> {
|
|
482
|
-
|
|
425
|
+
baseMap["ad"] = ad?.toJson()
|
|
483
426
|
}
|
|
484
427
|
|
|
485
428
|
is PlayerEvent.AdStarted -> {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
429
|
+
baseMap["ad"] = ad?.toJson()
|
|
430
|
+
baseMap["clickThroughUrl"] = clickThroughUrl
|
|
431
|
+
baseMap["clientType"] = clientType?.toJson()
|
|
432
|
+
baseMap["duration"] = duration
|
|
433
|
+
baseMap["indexInQueue"] = indexInQueue
|
|
434
|
+
baseMap["position"] = position
|
|
435
|
+
baseMap["skipOffset"] = skipOffset
|
|
436
|
+
baseMap["timeOffset"] = timeOffset
|
|
494
437
|
}
|
|
495
438
|
|
|
496
439
|
is PlayerEvent.VideoPlaybackQualityChanged -> {
|
|
497
|
-
|
|
498
|
-
|
|
440
|
+
baseMap["newVideoQuality"] = newVideoQuality?.toJson()
|
|
441
|
+
baseMap["oldVideoQuality"] = oldVideoQuality?.toJson()
|
|
499
442
|
}
|
|
500
443
|
|
|
501
444
|
is PlayerEvent.CastWaitingForDevice -> {
|
|
502
|
-
|
|
445
|
+
baseMap["castPayload"] = castPayload.toJson()
|
|
503
446
|
}
|
|
504
447
|
|
|
505
448
|
is PlayerEvent.CastStarted -> {
|
|
506
|
-
|
|
449
|
+
baseMap["deviceName"] = deviceName
|
|
507
450
|
}
|
|
508
451
|
|
|
509
452
|
is PlayerEvent.CueEnter -> {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
453
|
+
baseMap["start"] = start
|
|
454
|
+
baseMap["end"] = end
|
|
455
|
+
baseMap["text"] = text
|
|
456
|
+
baseMap["image"] = image?.toBase64DataUri()
|
|
514
457
|
}
|
|
515
458
|
|
|
516
459
|
is PlayerEvent.CueExit -> {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
460
|
+
baseMap["start"] = start
|
|
461
|
+
baseMap["end"] = end
|
|
462
|
+
baseMap["text"] = text
|
|
463
|
+
baseMap["image"] = image?.toBase64DataUri()
|
|
521
464
|
}
|
|
522
465
|
|
|
523
466
|
else -> {
|
|
524
467
|
// Event is not supported yet or does not have any additional data
|
|
525
468
|
}
|
|
526
469
|
}
|
|
527
|
-
return
|
|
470
|
+
return baseMap.filterNotNullValues()
|
|
528
471
|
}
|
|
529
472
|
|
|
530
|
-
|
|
531
|
-
* Converts an arbitrary `json` into [BitmovinCastManagerOptions].
|
|
532
|
-
*/
|
|
533
|
-
fun ReadableMap.toCastOptions(): BitmovinCastManagerOptions = BitmovinCastManagerOptions(
|
|
534
|
-
applicationId = getString("applicationId"),
|
|
535
|
-
messageNamespace = getString("messageNamespace"),
|
|
536
|
-
)
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Converts an arbitrary `json` to `WidevineConfig`.
|
|
540
|
-
*/
|
|
541
|
-
fun ReadableMap.toWidevineConfig(): WidevineConfig? = getMap("widevine")?.run {
|
|
473
|
+
fun Map<String, Any?>.toWidevineConfig(): WidevineConfig? = getMap("widevine")?.run {
|
|
542
474
|
WidevineConfig(getString("licenseUrl")).apply {
|
|
543
475
|
withString("preferredSecurityLevel") { preferredSecurityLevel = it }
|
|
544
476
|
withBoolean("shouldKeepDrmSessionsAlive") { shouldKeepDrmSessionsAlive = it }
|
|
545
|
-
withMap("httpHeaders") { httpHeaders = it.
|
|
477
|
+
withMap("httpHeaders") { httpHeaders = it.mapValues { entry -> entry.value as String }.toMutableMap() }
|
|
546
478
|
}
|
|
547
479
|
}
|
|
548
480
|
|
|
549
|
-
/**
|
|
550
|
-
* Converts an `url` string into a `ThumbnailsTrack`.
|
|
551
|
-
*/
|
|
552
481
|
fun String.toThumbnailTrack(): ThumbnailTrack = ThumbnailTrack(this)
|
|
553
482
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
putString("language", language)
|
|
563
|
-
putArray("roles", roles.mapToReactArray { it.toJson() })
|
|
564
|
-
putArray("qualities", qualities.mapToReactArray { it.toJson() })
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
/**
|
|
568
|
-
* Converts any `AudioQuality` into its json representation.
|
|
569
|
-
*/
|
|
570
|
-
fun AudioQuality.toJson(): WritableMap = Arguments.createMap().apply {
|
|
571
|
-
putString("id", id)
|
|
572
|
-
putString("label", label)
|
|
573
|
-
putInt("bitrate", bitrate)
|
|
574
|
-
putInt("averageBitrate", averageBitrate)
|
|
575
|
-
putInt("peakBitrate", peakBitrate)
|
|
576
|
-
putString("codec", codec)
|
|
577
|
-
}
|
|
483
|
+
fun AudioTrack.toJson(): Map<String, Any> = mapOf(
|
|
484
|
+
"url" to url,
|
|
485
|
+
"label" to label,
|
|
486
|
+
"isDefault" to isDefault,
|
|
487
|
+
"identifier" to id,
|
|
488
|
+
"language" to language,
|
|
489
|
+
"roles" to roles.map { it.toJson() },
|
|
490
|
+
).filterNotNullValues()
|
|
578
491
|
|
|
579
|
-
|
|
580
|
-
* Converts an arbitrary `json` into a `SubtitleTrack`.
|
|
581
|
-
*/
|
|
582
|
-
fun ReadableMap.toSubtitleTrack(): SubtitleTrack? {
|
|
492
|
+
fun Map<String, Any?>.toSubtitleTrack(): SubtitleTrack? {
|
|
583
493
|
return SubtitleTrack(
|
|
584
494
|
url = getString("url") ?: return null,
|
|
585
495
|
label = getString("label") ?: return null,
|
|
@@ -591,92 +501,62 @@ fun ReadableMap.toSubtitleTrack(): SubtitleTrack? {
|
|
|
591
501
|
)
|
|
592
502
|
}
|
|
593
503
|
|
|
594
|
-
/**
|
|
595
|
-
* Converts any subtitle format name in its mime type representation.
|
|
596
|
-
*/
|
|
597
504
|
private fun String.toSubtitleMimeType(): String = when (this) {
|
|
598
505
|
"srt" -> "application/x-subrip"
|
|
599
506
|
"ttml" -> "application/ttml+xml"
|
|
600
507
|
else -> "text/$this"
|
|
601
508
|
}
|
|
602
509
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
putString("format", mimeType?.textMimeTypeToJson())
|
|
614
|
-
putArray("roles", roles.mapToReactArray { it.toJson() })
|
|
615
|
-
}
|
|
510
|
+
fun SubtitleTrack.toJson(): Map<String, Any> = mapOf(
|
|
511
|
+
"url" to url,
|
|
512
|
+
"label" to label,
|
|
513
|
+
"isDefault" to isDefault,
|
|
514
|
+
"identifier" to id,
|
|
515
|
+
"language" to language,
|
|
516
|
+
"isForced" to isForced,
|
|
517
|
+
"format" to mimeType?.textMimeTypeToJson(),
|
|
518
|
+
"roles" to roles.map { it.toJson() },
|
|
519
|
+
).filterNotNullValues()
|
|
616
520
|
|
|
617
|
-
/**
|
|
618
|
-
* Converts any subtitle track mime type into its json representation (file format value).
|
|
619
|
-
*/
|
|
620
521
|
private fun String.textMimeTypeToJson(): String = split("/").last()
|
|
621
522
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
putString("id", id)
|
|
628
|
-
putDouble("scheduleTime", scheduleTime)
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* Converts any `Ad` object into its json representation.
|
|
633
|
-
*/
|
|
634
|
-
fun Ad.toJson(): WritableMap = Arguments.createMap().apply {
|
|
635
|
-
putString("clickThroughUrl", clickThroughUrl)
|
|
636
|
-
putMap("data", data?.toJson())
|
|
637
|
-
putInt("height", height)
|
|
638
|
-
putString("id", id)
|
|
639
|
-
putBoolean("isLinear", isLinear)
|
|
640
|
-
putString("mediaFileUrl", mediaFileUrl)
|
|
641
|
-
putInt("width", width)
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Converts any `AdData` object into its json representation.
|
|
646
|
-
*/
|
|
647
|
-
fun AdData.toJson(): WritableMap = Arguments.createMap().apply {
|
|
648
|
-
putInt("bitrate", bitrate)
|
|
649
|
-
putInt("maxBitrate", maxBitrate)
|
|
650
|
-
putString("mimeType", mimeType)
|
|
651
|
-
putInt("minBitrate", minBitrate)
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Converts any `AdConfig` object into its json representation.
|
|
656
|
-
*/
|
|
657
|
-
fun AdConfig.toJson(): WritableMap = Arguments.createMap().apply {
|
|
658
|
-
putDouble("replaceContentDuration", replaceContentDuration)
|
|
659
|
-
}
|
|
523
|
+
fun AdBreak.toJson(): Map<String, Any> = mapOf(
|
|
524
|
+
"ads" to ads.map { it.toJson() },
|
|
525
|
+
"id" to id,
|
|
526
|
+
"scheduleTime" to scheduleTime,
|
|
527
|
+
)
|
|
660
528
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
529
|
+
fun Ad.toJson(): Map<String, Any> = mapOf(
|
|
530
|
+
"clickThroughUrl" to clickThroughUrl,
|
|
531
|
+
"data" to data?.toJson(),
|
|
532
|
+
"height" to height,
|
|
533
|
+
"id" to id,
|
|
534
|
+
"isLinear" to isLinear,
|
|
535
|
+
"mediaFileUrl" to mediaFileUrl,
|
|
536
|
+
"width" to width,
|
|
537
|
+
).filterNotNullValues()
|
|
538
|
+
|
|
539
|
+
fun AdData.toJson(): Map<String, Any> = mapOf<String, Any?>(
|
|
540
|
+
"bitrate" to bitrate,
|
|
541
|
+
"maxBitrate" to maxBitrate,
|
|
542
|
+
"mimeType" to mimeType,
|
|
543
|
+
"minBitrate" to minBitrate,
|
|
544
|
+
).filterNotNullValues()
|
|
545
|
+
|
|
546
|
+
fun AdConfig.toJson(): Map<String, Any> = mapOf<String, Any?>(
|
|
547
|
+
"replaceContentDuration" to replaceContentDuration,
|
|
548
|
+
).filterNotNullValues()
|
|
549
|
+
|
|
550
|
+
fun AdItem.toJson(): Map<String, Any> = mapOf(
|
|
551
|
+
"position" to position,
|
|
552
|
+
"sources" to sources.toList().map { it.toJson() },
|
|
553
|
+
)
|
|
668
554
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
putString("tag", tag)
|
|
674
|
-
putString("type", type.toJson())
|
|
675
|
-
}
|
|
555
|
+
fun AdSource.toJson(): Map<String, Any> = mapOf(
|
|
556
|
+
"tag" to tag,
|
|
557
|
+
"type" to type.toJson(),
|
|
558
|
+
)
|
|
676
559
|
|
|
677
|
-
/**
|
|
678
|
-
* Converts any `AdSourceType` value into its json representation.
|
|
679
|
-
*/
|
|
680
560
|
fun AdSourceType.toJson(): String = when (this) {
|
|
681
561
|
AdSourceType.Bitmovin -> "bitmovin"
|
|
682
562
|
AdSourceType.Ima -> "ima"
|
|
@@ -684,38 +564,26 @@ fun AdSourceType.toJson(): String = when (this) {
|
|
|
684
564
|
AdSourceType.Progressive -> "progressive"
|
|
685
565
|
}
|
|
686
566
|
|
|
687
|
-
/**
|
|
688
|
-
* Converts any `AdQuartile` value into its json representation.
|
|
689
|
-
*/
|
|
690
567
|
fun AdQuartile.toJson(): String = when (this) {
|
|
691
568
|
AdQuartile.FirstQuartile -> "first"
|
|
692
569
|
AdQuartile.MidPoint -> "mid_point"
|
|
693
570
|
AdQuartile.ThirdQuartile -> "third"
|
|
694
571
|
}
|
|
695
572
|
|
|
696
|
-
|
|
697
|
-
* Converts an arbitrary json object into a `BitmovinAnalyticsConfig`.
|
|
698
|
-
*/
|
|
699
|
-
fun ReadableMap.toAnalyticsConfig(): AnalyticsConfig? = getString("licenseKey")
|
|
573
|
+
fun Map<String, Any?>.toAnalyticsConfig(): AnalyticsConfig? = getString("licenseKey")
|
|
700
574
|
?.let { AnalyticsConfig.Builder(it) }
|
|
701
575
|
?.apply {
|
|
702
576
|
withBoolean("adTrackingDisabled") { setAdTrackingDisabled(it) }
|
|
703
577
|
withBoolean("randomizeUserId") { setRandomizeUserId(it) }
|
|
704
578
|
}?.build()
|
|
705
579
|
|
|
706
|
-
|
|
707
|
-
* Converts an arbitrary json object into an analytics `DefaultMetadata`.
|
|
708
|
-
*/
|
|
709
|
-
fun ReadableMap.toAnalyticsDefaultMetadata(): DefaultMetadata = DefaultMetadata.Builder().apply {
|
|
580
|
+
fun Map<String, Any?>.toAnalyticsDefaultMetadata(): DefaultMetadata = DefaultMetadata.Builder().apply {
|
|
710
581
|
setCustomData(toAnalyticsCustomData())
|
|
711
582
|
withString("cdnProvider") { setCdnProvider(it) }
|
|
712
583
|
withString("customUserId") { setCustomUserId(it) }
|
|
713
584
|
}.build()
|
|
714
585
|
|
|
715
|
-
|
|
716
|
-
* Converts an arbitrary json object into an analytics `CustomData`.
|
|
717
|
-
*/
|
|
718
|
-
fun ReadableMap.toAnalyticsCustomData(): CustomData = CustomData.Builder().apply {
|
|
586
|
+
fun Map<String, Any?>.toAnalyticsCustomData(): CustomData = CustomData.Builder().apply {
|
|
719
587
|
for (n in 1..30) {
|
|
720
588
|
this[n] = getString("customData$n")
|
|
721
589
|
}
|
|
@@ -724,17 +592,16 @@ fun ReadableMap.toAnalyticsCustomData(): CustomData = CustomData.Builder().apply
|
|
|
724
592
|
}
|
|
725
593
|
}.build()
|
|
726
594
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
*/
|
|
730
|
-
fun CustomData.toJson(): WritableMap = Arguments.createMap().also { json ->
|
|
595
|
+
fun CustomData.toJson(): Map<String, Any> {
|
|
596
|
+
val map = mutableMapOf<String, Any?>()
|
|
731
597
|
for (n in 1..30) {
|
|
732
|
-
|
|
598
|
+
this[n]?.let { map["customData$n"] = it }
|
|
733
599
|
}
|
|
734
|
-
|
|
600
|
+
experimentName?.let { map["experimentName"] = it }
|
|
601
|
+
return map.filterNotNullValues()
|
|
735
602
|
}
|
|
736
603
|
|
|
737
|
-
fun
|
|
604
|
+
fun Map<String, Any?>.toAnalyticsSourceMetadata(): SourceMetadata = SourceMetadata(
|
|
738
605
|
title = getString("title"),
|
|
739
606
|
videoId = getString("videoId"),
|
|
740
607
|
cdnProvider = getString("cdnProvider"),
|
|
@@ -743,59 +610,52 @@ fun ReadableMap.toAnalyticsSourceMetadata(): SourceMetadata = SourceMetadata(
|
|
|
743
610
|
customData = toAnalyticsCustomData(),
|
|
744
611
|
)
|
|
745
612
|
|
|
746
|
-
fun SourceMetadata.toJson():
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
/**
|
|
776
|
-
* Converts any `OfflineContentOptions` into its json representation.
|
|
777
|
-
*/
|
|
778
|
-
fun OfflineContentOptions.toJson(): WritableMap = Arguments.createMap().apply {
|
|
779
|
-
putArray("audioOptions", audioOptions.mapToReactArray { it.toJson() })
|
|
780
|
-
putArray("textOptions", textOptions.mapToReactArray { it.toJson() })
|
|
781
|
-
}
|
|
613
|
+
fun SourceMetadata.toJson(): Map<String, Any> {
|
|
614
|
+
val map = customData.toJson().toMutableMap<String, Any?>()
|
|
615
|
+
map["title"] = title
|
|
616
|
+
map["videoId"] = videoId
|
|
617
|
+
map["cdnProvider"] = cdnProvider
|
|
618
|
+
map["path"] = path
|
|
619
|
+
map["isLive"] = isLive
|
|
620
|
+
return map.filterNotNullValues()
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
fun VideoQuality.toJson(): Map<String, Any> = mapOf<String, Any?>(
|
|
624
|
+
"id" to id,
|
|
625
|
+
"label" to label,
|
|
626
|
+
"bitrate" to bitrate,
|
|
627
|
+
"codec" to codec,
|
|
628
|
+
"frameRate" to frameRate.toDouble(),
|
|
629
|
+
"height" to height,
|
|
630
|
+
"width" to width,
|
|
631
|
+
).filterNotNullValues()
|
|
632
|
+
|
|
633
|
+
fun OfflineOptionEntry.toJson(): Map<String, Any> = mapOf(
|
|
634
|
+
"id" to id,
|
|
635
|
+
"language" to language,
|
|
636
|
+
).filterNotNullValues()
|
|
637
|
+
|
|
638
|
+
fun OfflineContentOptions.toJson(): Map<String, Any> = mapOf(
|
|
639
|
+
"audioOptions" to audioOptions.map { it.toJson() },
|
|
640
|
+
"textOptions" to textOptions.map { it.toJson() },
|
|
641
|
+
)
|
|
782
642
|
|
|
783
|
-
fun Thumbnail.toJson():
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
643
|
+
fun Thumbnail.toJson(): Map<String, Any> = mapOf(
|
|
644
|
+
"start" to start,
|
|
645
|
+
"end" to end,
|
|
646
|
+
"text" to text,
|
|
647
|
+
"url" to uri.toString(),
|
|
648
|
+
"x" to x,
|
|
649
|
+
"y" to y,
|
|
650
|
+
"width" to width,
|
|
651
|
+
"height" to height,
|
|
652
|
+
)
|
|
793
653
|
|
|
794
|
-
fun
|
|
654
|
+
fun Map<String, Any?>.toPictureInPictureConfig(): PictureInPictureConfig = PictureInPictureConfig(
|
|
795
655
|
isEnabled = getBooleanOrNull("isEnabled") ?: false,
|
|
796
656
|
)
|
|
797
657
|
|
|
798
|
-
fun
|
|
658
|
+
fun Map<String, Any?>.toPlayerViewConfig(): PlayerViewConfig = PlayerViewConfig(
|
|
799
659
|
uiConfig = getMap("uiConfig")?.toUiConfig() ?: UiConfig.WebUi(),
|
|
800
660
|
hideFirstFrame = getBooleanOrNull("hideFirstFrame") ?: false,
|
|
801
661
|
surfaceType = getString("surfaceType")?.toSurfaceType() ?: SurfaceType.SurfaceView,
|
|
@@ -807,7 +667,7 @@ private fun String.toSurfaceType(): SurfaceType? = when (this) {
|
|
|
807
667
|
else -> null
|
|
808
668
|
}
|
|
809
669
|
|
|
810
|
-
private fun
|
|
670
|
+
private fun Map<String, Any?>.toUiConfig(): UiConfig {
|
|
811
671
|
val variant = toVariant() ?: UiConfig.WebUi.Variant.SmallScreenUi
|
|
812
672
|
val focusUiOnInitialization = getBooleanOrNull("focusUiOnInitialization")
|
|
813
673
|
val defaultFocusUiOnInitialization = variant == UiConfig.WebUi.Variant.TvUi
|
|
@@ -819,7 +679,7 @@ private fun ReadableMap.toUiConfig(): UiConfig {
|
|
|
819
679
|
)
|
|
820
680
|
}
|
|
821
681
|
|
|
822
|
-
private fun
|
|
682
|
+
private fun Map<String, Any?>.toVariant(): UiConfig.WebUi.Variant? {
|
|
823
683
|
val uiManagerFactoryFunction = getMap("variant")?.getString("uiManagerFactoryFunction") ?: return null
|
|
824
684
|
|
|
825
685
|
return when (uiManagerFactoryFunction) {
|
|
@@ -829,36 +689,36 @@ private fun ReadableMap.toVariant(): UiConfig.WebUi.Variant? {
|
|
|
829
689
|
}
|
|
830
690
|
}
|
|
831
691
|
|
|
832
|
-
private fun
|
|
692
|
+
private fun Map<String, Any?>.toUserInterfaceTypeFromPlayerConfig(): UserInterfaceType? =
|
|
833
693
|
when (getMap("styleConfig")?.getString("userInterfaceType")) {
|
|
834
694
|
"Subtitle" -> UserInterfaceType.Subtitle
|
|
835
695
|
"Bitmovin" -> UserInterfaceType.Bitmovin
|
|
836
696
|
else -> null
|
|
837
697
|
}
|
|
838
698
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
699
|
+
fun String.toUserInterfaceType(): UserInterfaceType? = when (this) {
|
|
700
|
+
"Subtitle" -> UserInterfaceType.Subtitle
|
|
701
|
+
"Bitmovin" -> UserInterfaceType.Bitmovin
|
|
702
|
+
else -> null
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
fun Map<String, Any?>.toRNPlayerViewConfigWrapper() = RNPlayerViewConfigWrapper(
|
|
843
706
|
playerViewConfig = toPlayerViewConfig(),
|
|
844
707
|
pictureInPictureConfig = getMap("pictureInPictureConfig")?.toPictureInPictureConfig(),
|
|
845
708
|
)
|
|
846
709
|
|
|
847
|
-
fun
|
|
710
|
+
fun Map<String, Any?>.toRNStyleConfigWrapperFromPlayerConfig(): RNStyleConfigWrapper? {
|
|
848
711
|
return RNStyleConfigWrapper(
|
|
849
712
|
styleConfig = toStyleConfig(),
|
|
850
713
|
userInterfaceType = toUserInterfaceTypeFromPlayerConfig() ?: return null,
|
|
851
714
|
)
|
|
852
715
|
}
|
|
853
716
|
|
|
854
|
-
|
|
855
|
-
* Converts any JS object into a [LiveConfig] object.
|
|
856
|
-
*/
|
|
857
|
-
fun ReadableMap.toLiveConfig(): LiveConfig = LiveConfig().apply {
|
|
717
|
+
fun Map<String, Any?>.toLiveConfig(): LiveConfig = LiveConfig().apply {
|
|
858
718
|
withDouble("minTimeshiftBufferDepth") { minTimeShiftBufferDepth = it }
|
|
859
719
|
}
|
|
860
720
|
|
|
861
|
-
fun
|
|
721
|
+
fun Map<String, Any?>.toHttpRequest(): HttpRequest? {
|
|
862
722
|
return HttpRequest(
|
|
863
723
|
getString("url") ?: return null,
|
|
864
724
|
getMap("headers")?.toMap(),
|
|
@@ -873,7 +733,7 @@ private fun ByteArray.toBase64String(): String {
|
|
|
873
733
|
|
|
874
734
|
private fun String.toByteArrayFromBase64(): ByteArray = Base64.decode(this, Base64.NO_WRAP)
|
|
875
735
|
|
|
876
|
-
fun
|
|
736
|
+
fun Map<String, Any?>.toHttpResponse(): HttpResponse? {
|
|
877
737
|
return HttpResponse(
|
|
878
738
|
httpRequest = getMap("request")?.toHttpRequest() ?: return null,
|
|
879
739
|
url = getString("url") ?: return null,
|
|
@@ -883,65 +743,54 @@ fun ReadableMap.toHttpResponse(): HttpResponse? {
|
|
|
883
743
|
)
|
|
884
744
|
}
|
|
885
745
|
|
|
886
|
-
fun
|
|
746
|
+
fun Map<String, Any?>.toNetworkConfig(): NetworkConfig = NetworkConfig()
|
|
887
747
|
|
|
888
|
-
fun HttpRequest.toJson():
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
748
|
+
fun HttpRequest.toJson(): Map<String, Any> = mapOf(
|
|
749
|
+
"url" to url,
|
|
750
|
+
"headers" to headers,
|
|
751
|
+
"body" to body?.toBase64String(),
|
|
752
|
+
"method" to method,
|
|
753
|
+
).filterNotNullValues()
|
|
894
754
|
|
|
895
|
-
fun HttpResponse.toJson():
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
755
|
+
fun HttpResponse.toJson(): Map<String, Any> = mapOf(
|
|
756
|
+
"request" to httpRequest.toJson(),
|
|
757
|
+
"url" to url,
|
|
758
|
+
"status" to status,
|
|
759
|
+
"headers" to headers,
|
|
760
|
+
"body" to body.toBase64String(),
|
|
761
|
+
)
|
|
902
762
|
|
|
903
763
|
fun HttpRequestType.toJson(): String = toString()
|
|
904
764
|
|
|
905
|
-
/**
|
|
906
|
-
* Converts any [MediaType] value into its json representation.
|
|
907
|
-
*/
|
|
908
765
|
fun MediaType.toJson(): String = when (this) {
|
|
909
766
|
MediaType.Audio -> "audio"
|
|
910
767
|
MediaType.Video -> "video"
|
|
911
768
|
}
|
|
912
769
|
|
|
913
|
-
/**
|
|
914
|
-
* Converts any [BufferType] value into its json representation.
|
|
915
|
-
*/
|
|
916
770
|
fun BufferType.toJson(): String = when (this) {
|
|
917
771
|
BufferType.ForwardDuration -> "forwardDuration"
|
|
918
772
|
BufferType.BackwardDuration -> "backwardDuration"
|
|
919
773
|
}
|
|
920
774
|
|
|
921
|
-
fun BufferLevel.toJson():
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
775
|
+
fun BufferLevel.toJson(): Map<String, Any> = mapOf(
|
|
776
|
+
"level" to level,
|
|
777
|
+
"targetLevel" to targetLevel,
|
|
778
|
+
"media" to media.toJson(),
|
|
779
|
+
"type" to type.toJson(),
|
|
780
|
+
)
|
|
927
781
|
|
|
928
|
-
fun RNBufferLevels.toJson():
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
782
|
+
fun RNBufferLevels.toJson(): Map<String, Any> = mapOf(
|
|
783
|
+
"audio" to audio.toJson(),
|
|
784
|
+
"video" to video.toJson(),
|
|
785
|
+
)
|
|
932
786
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
"backwardDuration" -> BufferType.BackwardDuration
|
|
939
|
-
else -> null
|
|
787
|
+
// Extension function to convert string to BufferType
|
|
788
|
+
fun String.toBufferTypeOrThrow(): BufferType = when (this.lowercase()) {
|
|
789
|
+
"forwardduration" -> BufferType.ForwardDuration
|
|
790
|
+
"backwardduration" -> BufferType.BackwardDuration
|
|
791
|
+
else -> throw IllegalArgumentException("Unknown buffer type: $this")
|
|
940
792
|
}
|
|
941
793
|
|
|
942
|
-
/**
|
|
943
|
-
* Maps a JS string into the corresponding [MediaType] value.
|
|
944
|
-
*/
|
|
945
794
|
fun String.toMediaType(): MediaType? = when (this) {
|
|
946
795
|
"audio" -> MediaType.Audio
|
|
947
796
|
"video" -> MediaType.Video
|
|
@@ -952,57 +801,48 @@ data class MediaControlConfig(
|
|
|
952
801
|
var isEnabled: Boolean = true,
|
|
953
802
|
)
|
|
954
803
|
|
|
955
|
-
fun
|
|
804
|
+
fun Map<String, Any?>.toMediaControlConfig(): MediaControlConfig = MediaControlConfig().apply {
|
|
956
805
|
withBoolean("isEnabled") { isEnabled = it }
|
|
957
806
|
}
|
|
958
807
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
putString("deviceName", deviceName)
|
|
965
|
-
putString("type", type)
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
private fun WritableMap.putStringIfNotNull(name: String, value: String?) = value?.let { putString(name, value) }
|
|
808
|
+
private fun CastPayload.toJson(): Map<String, Any> = mapOf<String, Any?>(
|
|
809
|
+
"currentTime" to currentTime,
|
|
810
|
+
"deviceName" to deviceName,
|
|
811
|
+
"type" to type,
|
|
812
|
+
).filterNotNullValues()
|
|
969
813
|
|
|
970
|
-
fun DecoderContext.toJson():
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
814
|
+
fun DecoderContext.toJson(): Map<String, Any> = mapOf(
|
|
815
|
+
"mediaType" to mediaType.name,
|
|
816
|
+
"isAd" to isAd,
|
|
817
|
+
)
|
|
974
818
|
|
|
975
|
-
fun List<MediaCodecInfo>.toJson():
|
|
976
|
-
forEach {
|
|
977
|
-
pushMap(it.toJson())
|
|
978
|
-
}
|
|
979
|
-
}
|
|
819
|
+
fun List<MediaCodecInfo>.toJson(): List<Map<String, Any>> = map { it.toJson() }
|
|
980
820
|
|
|
981
|
-
fun MediaCodecInfo.toJson():
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
821
|
+
fun MediaCodecInfo.toJson(): Map<String, Any> = mapOf(
|
|
822
|
+
"name" to name,
|
|
823
|
+
"isSoftware" to isSoftware,
|
|
824
|
+
)
|
|
985
825
|
|
|
986
|
-
fun
|
|
987
|
-
if (
|
|
826
|
+
fun List<Any?>.toMediaCodecInfoList(): List<MediaCodecInfo> {
|
|
827
|
+
if (isEmpty()) {
|
|
988
828
|
return emptyList()
|
|
989
829
|
}
|
|
990
830
|
val mediaCodecInfoList = mutableListOf<MediaCodecInfo>()
|
|
991
|
-
|
|
831
|
+
indices.forEach {
|
|
992
832
|
val info = getMap(it)?.toMediaCodecInfo() ?: return@forEach
|
|
993
833
|
mediaCodecInfoList.add(info)
|
|
994
834
|
}
|
|
995
835
|
return mediaCodecInfoList
|
|
996
836
|
}
|
|
997
837
|
|
|
998
|
-
fun
|
|
838
|
+
fun Map<String, Any?>.toMediaCodecInfo(): MediaCodecInfo? {
|
|
999
839
|
val name = getString("name") ?: return null
|
|
1000
840
|
val isSoftware = getBooleanOrNull("isSoftware") ?: return null
|
|
1001
841
|
return MediaCodecInfo(name, isSoftware)
|
|
1002
842
|
}
|
|
1003
843
|
|
|
1004
|
-
fun MediaTrackRole.toJson():
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
844
|
+
fun MediaTrackRole.toJson(): Map<String, Any> = mapOf(
|
|
845
|
+
"id" to id,
|
|
846
|
+
"schemeIdUri" to schemeIdUri,
|
|
847
|
+
"value" to value,
|
|
848
|
+
).filterNotNullValues()
|