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,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
4
|
+
const defaultProps = {
|
|
5
|
+
spacing: ' ',
|
|
6
|
+
dependencies: [],
|
|
7
|
+
};
|
|
8
|
+
const withAppGradleDependencies = (config, props) => {
|
|
9
|
+
const combinedProps = { ...defaultProps, ...(props || {}) };
|
|
10
|
+
config = (0, config_plugins_1.withAppBuildGradle)(config, (config) => {
|
|
11
|
+
if (config.modResults.language !== 'groovy') {
|
|
12
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('withAppGradleDependencies', `Cannot automatically configure app/build.gradle if it's not groovy`);
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
const deduplicatedDependencies = Array.from(new Set(combinedProps.dependencies));
|
|
16
|
+
const filteredDependencies = deduplicatedDependencies.filter((dep) => {
|
|
17
|
+
return config.modResults.contents.indexOf(dep) === -1;
|
|
18
|
+
});
|
|
19
|
+
if (filteredDependencies.length === 0) {
|
|
20
|
+
return config;
|
|
21
|
+
}
|
|
22
|
+
const dependenciesBlockStart = config.modResults.contents.search(/^dependencies \{$/m);
|
|
23
|
+
if (dependenciesBlockStart === -1) {
|
|
24
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('withAppGradleDependencies', `Cannot configure app/build.gradle as no dependency block start was found`);
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
const fromDependencies = config.modResults.contents.substring(dependenciesBlockStart);
|
|
28
|
+
const dependenciesBlockEnd = fromDependencies.search(/^\}$/m);
|
|
29
|
+
if (dependenciesBlockEnd === -1) {
|
|
30
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('withAppGradleDependencies', `Cannot configure app/build.gradle as no dependency block end was found`);
|
|
31
|
+
return config;
|
|
32
|
+
}
|
|
33
|
+
const position = dependenciesBlockStart + dependenciesBlockEnd;
|
|
34
|
+
let insertedDependencies = [];
|
|
35
|
+
insertedDependencies.push('\n');
|
|
36
|
+
filteredDependencies.forEach((dependency) => {
|
|
37
|
+
insertedDependencies.push(`${combinedProps.spacing}implementation '${dependency}'\n`);
|
|
38
|
+
});
|
|
39
|
+
insertedDependencies.push('\n');
|
|
40
|
+
config.modResults.contents = [
|
|
41
|
+
config.modResults.contents.slice(0, position),
|
|
42
|
+
...insertedDependencies,
|
|
43
|
+
config.modResults.contents.slice(position),
|
|
44
|
+
].join('');
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
return config;
|
|
48
|
+
};
|
|
49
|
+
exports.default = withAppGradleDependencies;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
7
|
+
const withAppGradleDependencies_1 = __importDefault(require("./withAppGradleDependencies"));
|
|
8
|
+
const withBitmovinAndroidConfig = (config, { playerLicenseKey, features }) => {
|
|
9
|
+
const offlineFeatureConfig = typeof features.offline === 'object'
|
|
10
|
+
? features.offline
|
|
11
|
+
: {
|
|
12
|
+
android: {
|
|
13
|
+
isEnabled: !!features.offline,
|
|
14
|
+
externalStoragePermission: false,
|
|
15
|
+
},
|
|
16
|
+
ios: { isEnabled: !!features.offline },
|
|
17
|
+
};
|
|
18
|
+
if (features.backgroundPlayback) {
|
|
19
|
+
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
|
20
|
+
'android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK',
|
|
21
|
+
'android.permission.FOREGROUND_SERVICE',
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
if (offlineFeatureConfig.android?.isEnabled) {
|
|
25
|
+
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
|
26
|
+
'android.permission.ACCESS_NETWORK_STATE',
|
|
27
|
+
'android.permission.FOREGROUND_SERVICE',
|
|
28
|
+
'android.permission.FOREGROUND_SERVICE_DATA_SYNC',
|
|
29
|
+
'android.permission.POST_NOTIFICATIONS',
|
|
30
|
+
]);
|
|
31
|
+
if (offlineFeatureConfig.android?.externalStoragePermission) {
|
|
32
|
+
config = config_plugins_1.AndroidConfig.Permissions.withPermissions(config, [
|
|
33
|
+
'android.permission.WRITE_EXTERNAL_STORAGE',
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
|
|
38
|
+
const mainApplication = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
|
|
39
|
+
config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, 'BITMOVIN_PLAYER_LICENSE_KEY', playerLicenseKey);
|
|
40
|
+
config.modResults.manifest['uses-permission'] =
|
|
41
|
+
config.modResults.manifest['uses-permission'] || [];
|
|
42
|
+
// Configure Picture-in-Picture support
|
|
43
|
+
if (features.pictureInPicture) {
|
|
44
|
+
const mainActivity = config_plugins_1.AndroidConfig.Manifest.getMainActivityOrThrow(config.modResults);
|
|
45
|
+
// Add PiP support attribute
|
|
46
|
+
mainActivity.$['android:supportsPictureInPicture'] = 'true';
|
|
47
|
+
// Enhance configChanges to handle PiP transitions properly
|
|
48
|
+
const currentConfigChanges = mainActivity.$['android:configChanges'] || '';
|
|
49
|
+
const requiredConfigChanges = [
|
|
50
|
+
'keyboard',
|
|
51
|
+
'keyboardHidden',
|
|
52
|
+
'orientation',
|
|
53
|
+
'screenLayout',
|
|
54
|
+
'screenSize',
|
|
55
|
+
'smallestScreenSize',
|
|
56
|
+
'uiMode',
|
|
57
|
+
];
|
|
58
|
+
const existingChanges = currentConfigChanges.split('|').filter(Boolean);
|
|
59
|
+
const allChanges = [
|
|
60
|
+
...new Set([...existingChanges, ...requiredConfigChanges]),
|
|
61
|
+
];
|
|
62
|
+
mainActivity.$['android:configChanges'] = allChanges.join('|');
|
|
63
|
+
}
|
|
64
|
+
if (features.backgroundPlayback) {
|
|
65
|
+
mainApplication.service = mainApplication.service || [];
|
|
66
|
+
if (!mainApplication.service.find((s) => s.$['android:name'] ===
|
|
67
|
+
'com.bitmovin.player.reactnative.services.MediaSessionPlaybackService')) {
|
|
68
|
+
mainApplication.service.push({
|
|
69
|
+
'$': {
|
|
70
|
+
'android:name': 'com.bitmovin.player.reactnative.services.MediaSessionPlaybackService',
|
|
71
|
+
'android:exported': 'true',
|
|
72
|
+
'android:foregroundServiceType': 'mediaPlayback',
|
|
73
|
+
},
|
|
74
|
+
'intent-filter': [
|
|
75
|
+
{
|
|
76
|
+
action: [
|
|
77
|
+
{
|
|
78
|
+
$: {
|
|
79
|
+
'android:name': 'androidx.media3.session.MediaSessionService',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (features.googleCastSDK) {
|
|
89
|
+
const expandedControllerActivity = {
|
|
90
|
+
'$': {
|
|
91
|
+
'android:name': 'com.bitmovin.player.casting.ExpandedControllerActivity',
|
|
92
|
+
'android:exported': 'true',
|
|
93
|
+
'android:label': '@string/app_name',
|
|
94
|
+
'android:launchMode': 'singleTask',
|
|
95
|
+
'android:screenOrientation': 'portrait',
|
|
96
|
+
},
|
|
97
|
+
'intent-filter': [
|
|
98
|
+
{
|
|
99
|
+
action: [
|
|
100
|
+
{
|
|
101
|
+
$: { 'android:name': 'android.intent.action.MAIN' },
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
'meta-data': [
|
|
107
|
+
{
|
|
108
|
+
$: {
|
|
109
|
+
'android:name': 'android.support.PARENT_ACTIVITY',
|
|
110
|
+
'android:value': '.MainActivity', // maybe needs to be taken from main activity
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
mainApplication.activity = mainApplication.activity || [];
|
|
116
|
+
if (!mainApplication.activity.find((a) => a.$['android:name'] === expandedControllerActivity.$['android:name'])) {
|
|
117
|
+
mainApplication.activity.push(expandedControllerActivity);
|
|
118
|
+
}
|
|
119
|
+
config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, 'com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME', 'com.bitmovin.player.casting.BitmovinCastOptionsProvider');
|
|
120
|
+
}
|
|
121
|
+
return config;
|
|
122
|
+
});
|
|
123
|
+
const dependencies = [];
|
|
124
|
+
if (features.offline) {
|
|
125
|
+
dependencies.push('androidx.localbroadcastmanager:localbroadcastmanager:1.1.0');
|
|
126
|
+
}
|
|
127
|
+
if (features.googleCastSDK?.android) {
|
|
128
|
+
const castSdkVersion = typeof features.googleCastSDK.android === 'string'
|
|
129
|
+
? features.googleCastSDK.android
|
|
130
|
+
: features.googleCastSDK.android.version;
|
|
131
|
+
if (!castSdkVersion) {
|
|
132
|
+
throw new Error('Google Cast SDK version is not specified in feature flags.');
|
|
133
|
+
}
|
|
134
|
+
dependencies.push(`com.google.android.gms:play-services-cast-framework:${castSdkVersion}`);
|
|
135
|
+
}
|
|
136
|
+
config = (0, withAppGradleDependencies_1.default)(config, { dependencies });
|
|
137
|
+
config = (0, config_plugins_1.withGradleProperties)(config, (config) => {
|
|
138
|
+
const properties = config.modResults;
|
|
139
|
+
const existingEntry = properties.find((item) => item.type === 'property' &&
|
|
140
|
+
item.key === 'android.extraMavenRepos' &&
|
|
141
|
+
item.value);
|
|
142
|
+
if (existingEntry) {
|
|
143
|
+
properties.splice(config.modResults.indexOf(existingEntry), 1);
|
|
144
|
+
}
|
|
145
|
+
const mavenRepos = JSON.parse(existingEntry?.type == 'property' ? existingEntry.value : '[]');
|
|
146
|
+
mavenRepos.push({
|
|
147
|
+
url: 'https://artifacts.bitmovin.com/artifactory/public-releases',
|
|
148
|
+
});
|
|
149
|
+
properties.push({
|
|
150
|
+
type: 'property',
|
|
151
|
+
key: 'android.extraMavenRepos',
|
|
152
|
+
value: JSON.stringify(mavenRepos),
|
|
153
|
+
});
|
|
154
|
+
config.modResults = properties;
|
|
155
|
+
return config;
|
|
156
|
+
});
|
|
157
|
+
return config;
|
|
158
|
+
};
|
|
159
|
+
exports.default = withBitmovinAndroidConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const withBitmovinIosConfig_1 = __importDefault(require("./withBitmovinIosConfig"));
|
|
7
|
+
const withBitmovinAndroidConfig_1 = __importDefault(require("./withBitmovinAndroidConfig"));
|
|
8
|
+
const defaultFeatureFlags = {
|
|
9
|
+
airPlay: false,
|
|
10
|
+
backgroundPlayback: false,
|
|
11
|
+
googleCastSDK: undefined,
|
|
12
|
+
offline: false,
|
|
13
|
+
pictureInPicture: false,
|
|
14
|
+
};
|
|
15
|
+
const withBitmovinConfig = (config, { playerLicenseKey, featureFlags }) => {
|
|
16
|
+
const features = { ...defaultFeatureFlags, ...(featureFlags || {}) };
|
|
17
|
+
config = (0, withBitmovinIosConfig_1.default)(config, { playerLicenseKey, features });
|
|
18
|
+
config = (0, withBitmovinAndroidConfig_1.default)(config, { playerLicenseKey, features });
|
|
19
|
+
return config;
|
|
20
|
+
};
|
|
21
|
+
exports.default = withBitmovinConfig;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
4
|
+
const withBitmovinIosConfig = (config, { playerLicenseKey, features }) => {
|
|
5
|
+
const offlineFeatureConfig = typeof features.offline === 'object'
|
|
6
|
+
? features.offline
|
|
7
|
+
: {
|
|
8
|
+
android: {
|
|
9
|
+
isEnabled: !!features.offline,
|
|
10
|
+
externalStoragePermission: false,
|
|
11
|
+
},
|
|
12
|
+
ios: { isEnabled: !!features.offline },
|
|
13
|
+
};
|
|
14
|
+
const googleCastIosConfig = features.googleCastSDK?.ios
|
|
15
|
+
? typeof features.googleCastSDK.ios === 'string'
|
|
16
|
+
? { version: features.googleCastSDK.ios }
|
|
17
|
+
: features.googleCastSDK.ios
|
|
18
|
+
: null;
|
|
19
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
20
|
+
config.modResults['BitmovinPlayerLicenseKey'] = playerLicenseKey;
|
|
21
|
+
if (features.backgroundPlayback ||
|
|
22
|
+
features.airPlay ||
|
|
23
|
+
features.pictureInPicture) {
|
|
24
|
+
let backgroundModes = new Set(config.modResults['UIBackgroundModes'] || []);
|
|
25
|
+
backgroundModes.add('audio');
|
|
26
|
+
config.modResults['UIBackgroundModes'] = Array.from(backgroundModes);
|
|
27
|
+
}
|
|
28
|
+
if (offlineFeatureConfig?.ios?.isEnabled) {
|
|
29
|
+
config.modResults['BitmovinPlayerOfflineSupportEnabled'] = true;
|
|
30
|
+
}
|
|
31
|
+
if (googleCastIosConfig) {
|
|
32
|
+
const appId = googleCastIosConfig.appId || 'FFE417E5';
|
|
33
|
+
const localNetworkUsageDescription = googleCastIosConfig.localNetworkUsageDescription ||
|
|
34
|
+
'${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi network.';
|
|
35
|
+
config.modResults['NSBonjourServices'] = [
|
|
36
|
+
'_googlecast._tcp',
|
|
37
|
+
`_${appId}._googlecast._tcp`,
|
|
38
|
+
];
|
|
39
|
+
config.modResults['NSLocalNetworkUsageDescription'] =
|
|
40
|
+
localNetworkUsageDescription;
|
|
41
|
+
}
|
|
42
|
+
return config;
|
|
43
|
+
});
|
|
44
|
+
config = (0, config_plugins_1.withPodfileProperties)(config, (config) => {
|
|
45
|
+
if (googleCastIosConfig) {
|
|
46
|
+
config.modResults['BITMOVIN_GOOGLE_CAST_SDK_VERSION'] =
|
|
47
|
+
googleCastIosConfig.version;
|
|
48
|
+
}
|
|
49
|
+
return config;
|
|
50
|
+
});
|
|
51
|
+
return config;
|
|
52
|
+
};
|
|
53
|
+
exports.default = withBitmovinIosConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default interface FeatureFlags {
|
|
2
|
+
airPlay?: boolean;
|
|
3
|
+
backgroundPlayback?: boolean;
|
|
4
|
+
googleCastSDK?: {
|
|
5
|
+
android: string | { version: string };
|
|
6
|
+
ios:
|
|
7
|
+
| string
|
|
8
|
+
| {
|
|
9
|
+
version: string;
|
|
10
|
+
appId?: string;
|
|
11
|
+
localNetworkUsageDescription?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
offline?:
|
|
15
|
+
| boolean
|
|
16
|
+
| {
|
|
17
|
+
android?: { isEnabled: boolean; externalStoragePermission?: boolean };
|
|
18
|
+
ios?: { isEnabled: boolean };
|
|
19
|
+
};
|
|
20
|
+
pictureInPicture?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRunOncePlugin } from 'expo/config-plugins';
|
|
2
|
+
import withBitmovinConfig from './withBitmovinConfig';
|
|
3
|
+
import FeatureFlags from './FeatureFlags';
|
|
4
|
+
|
|
5
|
+
// Keeping the name, and version in sync with it's package.
|
|
6
|
+
const pkg = require('../../package.json');
|
|
7
|
+
|
|
8
|
+
export { FeatureFlags };
|
|
9
|
+
export default createRunOncePlugin(withBitmovinConfig, pkg.name, pkg.version);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigPlugin,
|
|
3
|
+
withAppBuildGradle,
|
|
4
|
+
WarningAggregator,
|
|
5
|
+
} from 'expo/config-plugins';
|
|
6
|
+
|
|
7
|
+
export type PluginProps = {
|
|
8
|
+
spacing?: string;
|
|
9
|
+
dependencies?: string[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const defaultProps: PluginProps = {
|
|
13
|
+
spacing: ' ',
|
|
14
|
+
dependencies: [],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const withAppGradleDependencies: ConfigPlugin<PluginProps> = (
|
|
18
|
+
config,
|
|
19
|
+
props: PluginProps
|
|
20
|
+
) => {
|
|
21
|
+
const combinedProps = { ...defaultProps, ...(props || {}) };
|
|
22
|
+
config = withAppBuildGradle(config, (config) => {
|
|
23
|
+
if (config.modResults.language !== 'groovy') {
|
|
24
|
+
WarningAggregator.addWarningAndroid(
|
|
25
|
+
'withAppGradleDependencies',
|
|
26
|
+
`Cannot automatically configure app/build.gradle if it's not groovy`
|
|
27
|
+
);
|
|
28
|
+
return config;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const deduplicatedDependencies = Array.from(
|
|
32
|
+
new Set(combinedProps.dependencies)
|
|
33
|
+
);
|
|
34
|
+
const filteredDependencies = deduplicatedDependencies.filter((dep) => {
|
|
35
|
+
return config.modResults.contents.indexOf(dep) === -1;
|
|
36
|
+
});
|
|
37
|
+
if (filteredDependencies.length === 0) {
|
|
38
|
+
return config;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const dependenciesBlockStart =
|
|
42
|
+
config.modResults.contents.search(/^dependencies \{$/m);
|
|
43
|
+
if (dependenciesBlockStart === -1) {
|
|
44
|
+
WarningAggregator.addWarningAndroid(
|
|
45
|
+
'withAppGradleDependencies',
|
|
46
|
+
`Cannot configure app/build.gradle as no dependency block start was found`
|
|
47
|
+
);
|
|
48
|
+
return config;
|
|
49
|
+
}
|
|
50
|
+
const fromDependencies = config.modResults.contents.substring(
|
|
51
|
+
dependenciesBlockStart
|
|
52
|
+
);
|
|
53
|
+
const dependenciesBlockEnd = fromDependencies.search(/^\}$/m);
|
|
54
|
+
if (dependenciesBlockEnd === -1) {
|
|
55
|
+
WarningAggregator.addWarningAndroid(
|
|
56
|
+
'withAppGradleDependencies',
|
|
57
|
+
`Cannot configure app/build.gradle as no dependency block end was found`
|
|
58
|
+
);
|
|
59
|
+
return config;
|
|
60
|
+
}
|
|
61
|
+
const position = dependenciesBlockStart + dependenciesBlockEnd;
|
|
62
|
+
let insertedDependencies: string[] = [];
|
|
63
|
+
insertedDependencies.push('\n');
|
|
64
|
+
filteredDependencies.forEach((dependency) => {
|
|
65
|
+
insertedDependencies.push(
|
|
66
|
+
`${combinedProps.spacing}implementation '${dependency}'\n`
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
insertedDependencies.push('\n');
|
|
70
|
+
config.modResults.contents = [
|
|
71
|
+
config.modResults.contents.slice(0, position),
|
|
72
|
+
...insertedDependencies,
|
|
73
|
+
config.modResults.contents.slice(position),
|
|
74
|
+
].join('');
|
|
75
|
+
return config;
|
|
76
|
+
});
|
|
77
|
+
return config;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default withAppGradleDependencies;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AndroidConfig,
|
|
3
|
+
ConfigPlugin,
|
|
4
|
+
withAndroidManifest,
|
|
5
|
+
withGradleProperties,
|
|
6
|
+
} from 'expo/config-plugins';
|
|
7
|
+
import FeatureFlags from './FeatureFlags';
|
|
8
|
+
import withAppGradleDependencies from './withAppGradleDependencies';
|
|
9
|
+
|
|
10
|
+
type ManifestActivity = AndroidConfig.Manifest.ManifestActivity;
|
|
11
|
+
|
|
12
|
+
const withBitmovinAndroidConfig: ConfigPlugin<{
|
|
13
|
+
playerLicenseKey: string;
|
|
14
|
+
features: FeatureFlags;
|
|
15
|
+
}> = (config, { playerLicenseKey, features }) => {
|
|
16
|
+
const offlineFeatureConfig =
|
|
17
|
+
typeof features.offline === 'object'
|
|
18
|
+
? features.offline
|
|
19
|
+
: {
|
|
20
|
+
android: {
|
|
21
|
+
isEnabled: !!features.offline,
|
|
22
|
+
externalStoragePermission: false,
|
|
23
|
+
},
|
|
24
|
+
ios: { isEnabled: !!features.offline },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (features.backgroundPlayback) {
|
|
28
|
+
config = AndroidConfig.Permissions.withPermissions(config, [
|
|
29
|
+
'android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK',
|
|
30
|
+
'android.permission.FOREGROUND_SERVICE',
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (offlineFeatureConfig.android?.isEnabled) {
|
|
35
|
+
config = AndroidConfig.Permissions.withPermissions(config, [
|
|
36
|
+
'android.permission.ACCESS_NETWORK_STATE',
|
|
37
|
+
'android.permission.FOREGROUND_SERVICE',
|
|
38
|
+
'android.permission.FOREGROUND_SERVICE_DATA_SYNC',
|
|
39
|
+
'android.permission.POST_NOTIFICATIONS',
|
|
40
|
+
]);
|
|
41
|
+
if (offlineFeatureConfig.android?.externalStoragePermission) {
|
|
42
|
+
config = AndroidConfig.Permissions.withPermissions(config, [
|
|
43
|
+
'android.permission.WRITE_EXTERNAL_STORAGE',
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
config = withAndroidManifest(config, (config) => {
|
|
49
|
+
const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(
|
|
50
|
+
config.modResults
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
AndroidConfig.Manifest.addMetaDataItemToMainApplication(
|
|
54
|
+
mainApplication,
|
|
55
|
+
'BITMOVIN_PLAYER_LICENSE_KEY',
|
|
56
|
+
playerLicenseKey
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
config.modResults.manifest['uses-permission'] =
|
|
60
|
+
config.modResults.manifest['uses-permission'] || [];
|
|
61
|
+
|
|
62
|
+
// Configure Picture-in-Picture support
|
|
63
|
+
if (features.pictureInPicture) {
|
|
64
|
+
const mainActivity = AndroidConfig.Manifest.getMainActivityOrThrow(
|
|
65
|
+
config.modResults
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// Add PiP support attribute
|
|
69
|
+
mainActivity.$['android:supportsPictureInPicture'] = 'true';
|
|
70
|
+
|
|
71
|
+
// Enhance configChanges to handle PiP transitions properly
|
|
72
|
+
const currentConfigChanges =
|
|
73
|
+
mainActivity.$['android:configChanges'] || '';
|
|
74
|
+
const requiredConfigChanges = [
|
|
75
|
+
'keyboard',
|
|
76
|
+
'keyboardHidden',
|
|
77
|
+
'orientation',
|
|
78
|
+
'screenLayout',
|
|
79
|
+
'screenSize',
|
|
80
|
+
'smallestScreenSize',
|
|
81
|
+
'uiMode',
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const existingChanges = currentConfigChanges.split('|').filter(Boolean);
|
|
85
|
+
const allChanges = [
|
|
86
|
+
...new Set([...existingChanges, ...requiredConfigChanges]),
|
|
87
|
+
];
|
|
88
|
+
mainActivity.$['android:configChanges'] = allChanges.join('|');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (features.backgroundPlayback) {
|
|
92
|
+
mainApplication.service = mainApplication.service || [];
|
|
93
|
+
if (
|
|
94
|
+
!mainApplication.service.find(
|
|
95
|
+
(s) =>
|
|
96
|
+
s.$['android:name'] ===
|
|
97
|
+
'com.bitmovin.player.reactnative.services.MediaSessionPlaybackService'
|
|
98
|
+
)
|
|
99
|
+
) {
|
|
100
|
+
mainApplication.service.push({
|
|
101
|
+
'$': {
|
|
102
|
+
'android:name':
|
|
103
|
+
'com.bitmovin.player.reactnative.services.MediaSessionPlaybackService',
|
|
104
|
+
'android:exported': 'true',
|
|
105
|
+
'android:foregroundServiceType': 'mediaPlayback',
|
|
106
|
+
},
|
|
107
|
+
'intent-filter': [
|
|
108
|
+
{
|
|
109
|
+
action: [
|
|
110
|
+
{
|
|
111
|
+
$: {
|
|
112
|
+
'android:name':
|
|
113
|
+
'androidx.media3.session.MediaSessionService',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (features.googleCastSDK) {
|
|
124
|
+
const expandedControllerActivity = {
|
|
125
|
+
'$': {
|
|
126
|
+
'android:name':
|
|
127
|
+
'com.bitmovin.player.casting.ExpandedControllerActivity',
|
|
128
|
+
'android:exported': 'true',
|
|
129
|
+
'android:label': '@string/app_name',
|
|
130
|
+
'android:launchMode': 'singleTask',
|
|
131
|
+
'android:screenOrientation': 'portrait',
|
|
132
|
+
},
|
|
133
|
+
'intent-filter': [
|
|
134
|
+
{
|
|
135
|
+
action: [
|
|
136
|
+
{
|
|
137
|
+
$: { 'android:name': 'android.intent.action.MAIN' },
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
'meta-data': [
|
|
143
|
+
{
|
|
144
|
+
$: {
|
|
145
|
+
'android:name': 'android.support.PARENT_ACTIVITY',
|
|
146
|
+
'android:value': '.MainActivity', // maybe needs to be taken from main activity
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
} as ManifestActivity;
|
|
151
|
+
mainApplication.activity = mainApplication.activity || [];
|
|
152
|
+
if (
|
|
153
|
+
!mainApplication.activity.find(
|
|
154
|
+
(a) =>
|
|
155
|
+
a.$['android:name'] === expandedControllerActivity.$['android:name']
|
|
156
|
+
)
|
|
157
|
+
) {
|
|
158
|
+
mainApplication.activity.push(expandedControllerActivity);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
AndroidConfig.Manifest.addMetaDataItemToMainApplication(
|
|
162
|
+
mainApplication,
|
|
163
|
+
'com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME',
|
|
164
|
+
'com.bitmovin.player.casting.BitmovinCastOptionsProvider'
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return config;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const dependencies: string[] = [];
|
|
172
|
+
if (features.offline) {
|
|
173
|
+
dependencies.push(
|
|
174
|
+
'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (features.googleCastSDK?.android) {
|
|
179
|
+
const castSdkVersion =
|
|
180
|
+
typeof features.googleCastSDK.android === 'string'
|
|
181
|
+
? features.googleCastSDK.android
|
|
182
|
+
: features.googleCastSDK.android.version;
|
|
183
|
+
if (!castSdkVersion) {
|
|
184
|
+
throw new Error(
|
|
185
|
+
'Google Cast SDK version is not specified in feature flags.'
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
dependencies.push(
|
|
189
|
+
`com.google.android.gms:play-services-cast-framework:${castSdkVersion}`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
config = withAppGradleDependencies(config, { dependencies });
|
|
194
|
+
|
|
195
|
+
config = withGradleProperties(config, (config) => {
|
|
196
|
+
const properties = config.modResults;
|
|
197
|
+
const existingEntry = properties.find(
|
|
198
|
+
(item) =>
|
|
199
|
+
item.type === 'property' &&
|
|
200
|
+
item.key === 'android.extraMavenRepos' &&
|
|
201
|
+
item.value
|
|
202
|
+
);
|
|
203
|
+
if (existingEntry) {
|
|
204
|
+
properties.splice(config.modResults.indexOf(existingEntry), 1);
|
|
205
|
+
}
|
|
206
|
+
const mavenRepos = JSON.parse(
|
|
207
|
+
existingEntry?.type == 'property' ? existingEntry.value : '[]'
|
|
208
|
+
);
|
|
209
|
+
mavenRepos.push({
|
|
210
|
+
url: 'https://artifacts.bitmovin.com/artifactory/public-releases',
|
|
211
|
+
});
|
|
212
|
+
properties.push({
|
|
213
|
+
type: 'property',
|
|
214
|
+
key: 'android.extraMavenRepos',
|
|
215
|
+
value: JSON.stringify(mavenRepos),
|
|
216
|
+
});
|
|
217
|
+
config.modResults = properties;
|
|
218
|
+
return config;
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
return config;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export default withBitmovinAndroidConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigPlugin } from 'expo/config-plugins';
|
|
2
|
+
import withBitmovinIosConfig from './withBitmovinIosConfig';
|
|
3
|
+
import FeatureFlags from './FeatureFlags';
|
|
4
|
+
import withBitmovinAndroidConfig from './withBitmovinAndroidConfig';
|
|
5
|
+
|
|
6
|
+
const defaultFeatureFlags: FeatureFlags = {
|
|
7
|
+
airPlay: false,
|
|
8
|
+
backgroundPlayback: false,
|
|
9
|
+
googleCastSDK: undefined,
|
|
10
|
+
offline: false,
|
|
11
|
+
pictureInPicture: false,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const withBitmovinConfig: ConfigPlugin<{
|
|
15
|
+
playerLicenseKey: string;
|
|
16
|
+
featureFlags: FeatureFlags;
|
|
17
|
+
}> = (config, { playerLicenseKey, featureFlags }) => {
|
|
18
|
+
const features = { ...defaultFeatureFlags, ...(featureFlags || {}) };
|
|
19
|
+
config = withBitmovinIosConfig(config, { playerLicenseKey, features });
|
|
20
|
+
config = withBitmovinAndroidConfig(config, { playerLicenseKey, features });
|
|
21
|
+
return config;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default withBitmovinConfig;
|