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,188 @@
|
|
|
1
|
+
import { NativeModule } from 'expo-modules-core';
|
|
2
|
+
export type PlayerModuleEvents = Record<string, any>;
|
|
3
|
+
declare class PlayerModule extends NativeModule<PlayerModuleEvents> {
|
|
4
|
+
/**
|
|
5
|
+
* Call .play() on nativeId's player.
|
|
6
|
+
*/
|
|
7
|
+
play(nativeId: string): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Call .pause() on nativeId's player.
|
|
10
|
+
*/
|
|
11
|
+
pause(nativeId: string): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Call .mute() on nativeId's player.
|
|
14
|
+
*/
|
|
15
|
+
mute(nativeId: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Call .unmute() on nativeId's player.
|
|
18
|
+
*/
|
|
19
|
+
unmute(nativeId: string): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Call .seek(time) on nativeId's player.
|
|
22
|
+
*/
|
|
23
|
+
seek(nativeId: string, time: number): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Sets timeShift on nativeId's player.
|
|
26
|
+
*/
|
|
27
|
+
timeShift(nativeId: string, offset: number): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Call .destroy() on nativeId's player and remove from registry.
|
|
30
|
+
*/
|
|
31
|
+
destroy(nativeId: string): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Call .setVolume(volume) on nativeId's player.
|
|
34
|
+
*/
|
|
35
|
+
setVolume(nativeId: string, volume: number): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve nativeId's current volume.
|
|
38
|
+
*/
|
|
39
|
+
getVolume(nativeId: string): Promise<number | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve nativeId's current time.
|
|
42
|
+
*/
|
|
43
|
+
currentTime(nativeId: string, mode?: string): Promise<number | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve nativeId's current playing state.
|
|
46
|
+
*/
|
|
47
|
+
isPlaying(nativeId: string): Promise<boolean | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve nativeId's current paused state.
|
|
50
|
+
*/
|
|
51
|
+
isPaused(nativeId: string): Promise<boolean | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve nativeId's active source duration.
|
|
54
|
+
*/
|
|
55
|
+
duration(nativeId: string): Promise<number | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve nativeId's current muted state.
|
|
58
|
+
*/
|
|
59
|
+
isMuted(nativeId: string): Promise<boolean | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Call .unload() on nativeId's player.
|
|
62
|
+
*/
|
|
63
|
+
unload(nativeId: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve nativeId's current time shift value.
|
|
66
|
+
*/
|
|
67
|
+
getTimeShift(nativeId: string): Promise<number | null>;
|
|
68
|
+
/**
|
|
69
|
+
* Resolve nativeId's live stream state.
|
|
70
|
+
*/
|
|
71
|
+
isLive(nativeId: string): Promise<boolean | null>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve nativeId's maximum time shift value.
|
|
74
|
+
*/
|
|
75
|
+
getMaxTimeShift(nativeId: string): Promise<number | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve nativeId's current playback speed.
|
|
78
|
+
*/
|
|
79
|
+
getPlaybackSpeed(nativeId: string): Promise<number | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Set playback speed for nativeId's player.
|
|
82
|
+
*/
|
|
83
|
+
setPlaybackSpeed(nativeId: string, playbackSpeed: number): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve nativeId's current ad state.
|
|
86
|
+
*/
|
|
87
|
+
isAd(nativeId: string): Promise<boolean | null>;
|
|
88
|
+
/**
|
|
89
|
+
* Set maximum selectable bitrate for nativeId's player.
|
|
90
|
+
*/
|
|
91
|
+
setMaxSelectableBitrate(nativeId: string, maxBitrate: number): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Resolve nativeId's AirPlay activation state (iOS only).
|
|
94
|
+
*/
|
|
95
|
+
isAirPlayActive(nativeId: string): Promise<boolean | null>;
|
|
96
|
+
/**
|
|
97
|
+
* Resolve nativeId's AirPlay availability state (iOS only).
|
|
98
|
+
*/
|
|
99
|
+
isAirPlayAvailable(nativeId: string): Promise<boolean | null>;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve nativeId's cast availability state.
|
|
102
|
+
*/
|
|
103
|
+
isCastAvailable(nativeId: string): Promise<boolean | null>;
|
|
104
|
+
/**
|
|
105
|
+
* Resolve nativeId's current casting state.
|
|
106
|
+
*/
|
|
107
|
+
isCasting(nativeId: string): Promise<boolean | null>;
|
|
108
|
+
/**
|
|
109
|
+
* Initiate casting for nativeId's player.
|
|
110
|
+
*/
|
|
111
|
+
castVideo(nativeId: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Stop casting for nativeId's player.
|
|
114
|
+
*/
|
|
115
|
+
castStop(nativeId: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Skip current ad for nativeId's player.
|
|
118
|
+
*/
|
|
119
|
+
skipAd(nativeId: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Check if player can play at specified playback speed (iOS only).
|
|
122
|
+
*/
|
|
123
|
+
canPlayAtPlaybackSpeed(nativeId: string, playbackSpeed: number): Promise<boolean | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new Player instance using the provided config.
|
|
126
|
+
*/
|
|
127
|
+
initializeWithConfig(nativeId: string, config?: Record<string, any>, networkNativeId?: string, decoderNativeId?: string): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new analytics-enabled Player instance.
|
|
130
|
+
*/
|
|
131
|
+
initializeWithAnalyticsConfig(nativeId: string, analyticsConfig: Record<string, any>, config?: Record<string, any>, networkNativeId?: string, decoderNativeId?: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Load source into the player.
|
|
134
|
+
* Requires SourceModule dependency.
|
|
135
|
+
*/
|
|
136
|
+
loadSource(nativeId: string, sourceNativeId: string): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Load offline content into the player.
|
|
139
|
+
*/
|
|
140
|
+
loadOfflineContent(nativeId: string, offlineContentId: string, options?: Record<string, any>): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Get current audio track.
|
|
143
|
+
*/
|
|
144
|
+
getAudioTrack(nativeId: string): Promise<any | null>;
|
|
145
|
+
/**
|
|
146
|
+
* Get available audio tracks.
|
|
147
|
+
*/
|
|
148
|
+
getAvailableAudioTracks(nativeId: string): Promise<any[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Set audio track.
|
|
151
|
+
*/
|
|
152
|
+
setAudioTrack(nativeId: string, trackId: string): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Get current subtitle track.
|
|
155
|
+
*/
|
|
156
|
+
getSubtitleTrack(nativeId: string): Promise<any | null>;
|
|
157
|
+
/**
|
|
158
|
+
* Get available subtitle tracks.
|
|
159
|
+
*/
|
|
160
|
+
getAvailableSubtitles(nativeId: string): Promise<any[]>;
|
|
161
|
+
/**
|
|
162
|
+
* Set subtitle track.
|
|
163
|
+
*/
|
|
164
|
+
setSubtitleTrack(nativeId: string, trackId: string): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Schedule an ad.
|
|
167
|
+
*/
|
|
168
|
+
scheduleAd(nativeId: string, adConfig: Record<string, any>): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Get thumbnail for time position.
|
|
171
|
+
*/
|
|
172
|
+
getThumbnail(nativeId: string, time: number): Promise<any | null>;
|
|
173
|
+
/**
|
|
174
|
+
* Get current video quality.
|
|
175
|
+
*/
|
|
176
|
+
getVideoQuality(nativeId: string): Promise<any | null>;
|
|
177
|
+
/**
|
|
178
|
+
* Get available video qualities.
|
|
179
|
+
*/
|
|
180
|
+
getAvailableVideoQualities(nativeId: string): Promise<any[]>;
|
|
181
|
+
/**
|
|
182
|
+
* Set video quality.
|
|
183
|
+
*/
|
|
184
|
+
setVideoQuality(nativeId: string, qualityId: string): Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
declare const _default: PlayerModule;
|
|
187
|
+
export default _default;
|
|
188
|
+
//# sourceMappingURL=PlayerModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayerModule.d.ts","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErD,OAAO,OAAO,YAAa,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IACjE;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErC;;OAEG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtC;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErC;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEvC;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnD;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1D;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAExC;;OAEG;IACH,SAAS,CAAC,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AC,GAAG,GAAG,IAAI,CAAC;IAEjE;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAEtD;;OAEG;IACH,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE5D;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CACpE;;AAED,wBAAiE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayerModule.js","sourceRoot":"","sources":["../../src/modules/PlayerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA0PtE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\n\nexport type PlayerModuleEvents = Record<string, any>;\n\ndeclare class PlayerModule extends NativeModule<PlayerModuleEvents> {\n /**\n * Call .play() on nativeId's player.\n */\n play(nativeId: string): Promise<void>;\n\n /**\n * Call .pause() on nativeId's player.\n */\n pause(nativeId: string): Promise<void>;\n\n /**\n * Call .mute() on nativeId's player.\n */\n mute(nativeId: string): Promise<void>;\n\n /**\n * Call .unmute() on nativeId's player.\n */\n unmute(nativeId: string): Promise<void>;\n\n /**\n * Call .seek(time) on nativeId's player.\n */\n seek(nativeId: string, time: number): Promise<void>;\n\n /**\n * Sets timeShift on nativeId's player.\n */\n timeShift(nativeId: string, offset: number): Promise<void>;\n\n /**\n * Call .destroy() on nativeId's player and remove from registry.\n */\n destroy(nativeId: string): Promise<void>;\n\n /**\n * Call .setVolume(volume) on nativeId's player.\n */\n setVolume(nativeId: string, volume: number): Promise<void>;\n\n /**\n * Resolve nativeId's current volume.\n */\n getVolume(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current time.\n */\n currentTime(nativeId: string, mode?: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current playing state.\n */\n isPlaying(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's current paused state.\n */\n isPaused(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's active source duration.\n */\n duration(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current muted state.\n */\n isMuted(nativeId: string): Promise<boolean | null>;\n\n /**\n * Call .unload() on nativeId's player.\n */\n unload(nativeId: string): Promise<void>;\n\n /**\n * Resolve nativeId's current time shift value.\n */\n getTimeShift(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's live stream state.\n */\n isLive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's maximum time shift value.\n */\n getMaxTimeShift(nativeId: string): Promise<number | null>;\n\n /**\n * Resolve nativeId's current playback speed.\n */\n getPlaybackSpeed(nativeId: string): Promise<number | null>;\n\n /**\n * Set playback speed for nativeId's player.\n */\n setPlaybackSpeed(nativeId: string, playbackSpeed: number): Promise<void>;\n\n /**\n * Resolve nativeId's current ad state.\n */\n isAd(nativeId: string): Promise<boolean | null>;\n\n /**\n * Set maximum selectable bitrate for nativeId's player.\n */\n setMaxSelectableBitrate(nativeId: string, maxBitrate: number): Promise<void>;\n\n /**\n * Resolve nativeId's AirPlay activation state (iOS only).\n */\n isAirPlayActive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's AirPlay availability state (iOS only).\n */\n isAirPlayAvailable(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's cast availability state.\n */\n isCastAvailable(nativeId: string): Promise<boolean | null>;\n\n /**\n * Resolve nativeId's current casting state.\n */\n isCasting(nativeId: string): Promise<boolean | null>;\n\n /**\n * Initiate casting for nativeId's player.\n */\n castVideo(nativeId: string): Promise<void>;\n\n /**\n * Stop casting for nativeId's player.\n */\n castStop(nativeId: string): Promise<void>;\n\n /**\n * Skip current ad for nativeId's player.\n */\n skipAd(nativeId: string): Promise<void>;\n\n /**\n * Check if player can play at specified playback speed (iOS only).\n */\n canPlayAtPlaybackSpeed(\n nativeId: string,\n playbackSpeed: number\n ): Promise<boolean | null>;\n\n /**\n * Creates a new Player instance using the provided config.\n */\n initializeWithConfig(\n nativeId: string,\n config?: Record<string, any>,\n networkNativeId?: string,\n decoderNativeId?: string\n ): Promise<void>;\n\n /**\n * Creates a new analytics-enabled Player instance.\n */\n initializeWithAnalyticsConfig(\n nativeId: string,\n analyticsConfig: Record<string, any>,\n config?: Record<string, any>,\n networkNativeId?: string,\n decoderNativeId?: string\n ): Promise<void>;\n\n /**\n * Load source into the player.\n * Requires SourceModule dependency.\n */\n loadSource(nativeId: string, sourceNativeId: string): Promise<void>;\n\n /**\n * Load offline content into the player.\n */\n loadOfflineContent(\n nativeId: string,\n offlineContentId: string,\n options?: Record<string, any>\n ): Promise<void>;\n\n /**\n * Get current audio track.\n */\n getAudioTrack(nativeId: string): Promise<any | null>;\n\n /**\n * Get available audio tracks.\n */\n getAvailableAudioTracks(nativeId: string): Promise<any[]>;\n\n /**\n * Set audio track.\n */\n setAudioTrack(nativeId: string, trackId: string): Promise<void>;\n\n /**\n * Get current subtitle track.\n */\n getSubtitleTrack(nativeId: string): Promise<any | null>;\n\n /**\n * Get available subtitle tracks.\n */\n getAvailableSubtitles(nativeId: string): Promise<any[]>;\n\n /**\n * Set subtitle track.\n */\n setSubtitleTrack(nativeId: string, trackId: string): Promise<void>;\n\n /**\n * Schedule an ad.\n */\n scheduleAd(nativeId: string, adConfig: Record<string, any>): Promise<void>;\n\n /**\n * Get thumbnail for time position.\n */\n getThumbnail(nativeId: string, time: number): Promise<any | null>;\n\n /**\n * Get current video quality.\n */\n getVideoQuality(nativeId: string): Promise<any | null>;\n\n /**\n * Get available video qualities.\n */\n getAvailableVideoQualities(nativeId: string): Promise<any[]>;\n\n /**\n * Set video quality.\n */\n setVideoQuality(nativeId: string, qualityId: string): Promise<void>;\n}\n\nexport default requireNativeModule<PlayerModule>('PlayerModule');\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { NativeModule } from 'expo-modules-core';
|
|
2
|
+
import { LoadingState, SourceRemoteControlConfig } from '../source';
|
|
3
|
+
import { Thumbnail } from '../thumbnail';
|
|
4
|
+
export type SourceModuleEvents = Record<string, any>;
|
|
5
|
+
declare class SourceModule extends NativeModule<SourceModuleEvents> {
|
|
6
|
+
/**
|
|
7
|
+
* Checks if the source is attached to a player.
|
|
8
|
+
*/
|
|
9
|
+
isAttachedToPlayer(nativeId: string): Promise<boolean | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the source is currently active.
|
|
12
|
+
*/
|
|
13
|
+
isActive(nativeId: string): Promise<boolean | null>;
|
|
14
|
+
/**
|
|
15
|
+
* Initializes a source with the given nativeId, optional DRM nativeId, configuration object,
|
|
16
|
+
* and remote control object.
|
|
17
|
+
*/
|
|
18
|
+
initializeWithConfig(nativeId: string, drmNativeId?: string, config?: Record<string, any>, remoteControl?: SourceRemoteControlConfig): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Initializes a source with the given nativeId, optional DRM nativeId, configuration object,
|
|
21
|
+
* remote control object, and analytics source metadata.
|
|
22
|
+
*/
|
|
23
|
+
initializeWithAnalyticsConfig(nativeId: string, drmNativeId?: string, config?: Record<string, any>, remoteControl?: SourceRemoteControlConfig, analyticsSourceMetadata?: Record<string, any>): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Destroys the source with the given nativeId.
|
|
26
|
+
*/
|
|
27
|
+
destroy(nativeId: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the native DRM config reference of the source with the given nativeId.
|
|
30
|
+
*/
|
|
31
|
+
duration(nativeId: string): Promise<number | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the current loading state of the source with the given nativeId.
|
|
34
|
+
*/
|
|
35
|
+
loadingState(nativeId: string): Promise<LoadingState | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the metadata of the source with the given nativeId.
|
|
38
|
+
*/
|
|
39
|
+
getMetadata(nativeId: string): Promise<Record<string, any> | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the metadata of the source with the given nativeId.
|
|
42
|
+
*/
|
|
43
|
+
setMetadata(nativeId: string, metadata: Record<string, any> | null): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns a thumbnail for the specified playback time.
|
|
46
|
+
*/
|
|
47
|
+
getThumbnail(nativeId: string, time: number): Promise<Thumbnail | null>;
|
|
48
|
+
}
|
|
49
|
+
declare const _default: SourceModule;
|
|
50
|
+
export default _default;
|
|
51
|
+
//# sourceMappingURL=SourceModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceModule.d.ts","sourceRoot":"","sources":["../../src/modules/SourceModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAErD,OAAO,OAAO,YAAa,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IACjE;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAE7D;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAEnD;;;OAGG;IACH,oBAAoB,CAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,aAAa,CAAC,EAAE,yBAAyB,GACxC,OAAO,CAAC,IAAI,CAAC;IAEhB;;;OAGG;IACH,6BAA6B,CAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,aAAa,CAAC,EAAE,yBAAyB,EACzC,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC5C,OAAO,CAAC,IAAI,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAExC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAClD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAE5D;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAElE;;OAEG;IACH,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GACnC,OAAO,CAAC,IAAI,CAAC;IAEhB;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;CACxE;;AAED,wBAAiE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceModule.js","sourceRoot":"","sources":["../../src/modules/SourceModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAyEtE,eAAe,mBAAmB,CAAe,cAAc,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\nimport { LoadingState, SourceRemoteControlConfig } from '../source';\nimport { Thumbnail } from '../thumbnail';\n\nexport type SourceModuleEvents = Record<string, any>;\n\ndeclare class SourceModule extends NativeModule<SourceModuleEvents> {\n /**\n * Checks if the source is attached to a player.\n */\n isAttachedToPlayer(nativeId: string): Promise<boolean | null>;\n\n /**\n * Checks if the source is currently active.\n */\n isActive(nativeId: string): Promise<boolean | null>;\n\n /**\n * Initializes a source with the given nativeId, optional DRM nativeId, configuration object,\n * and remote control object.\n */\n initializeWithConfig(\n nativeId: string,\n drmNativeId?: string,\n config?: Record<string, any>,\n remoteControl?: SourceRemoteControlConfig\n ): Promise<void>;\n\n /**\n * Initializes a source with the given nativeId, optional DRM nativeId, configuration object,\n * remote control object, and analytics source metadata.\n */\n initializeWithAnalyticsConfig(\n nativeId: string,\n drmNativeId?: string,\n config?: Record<string, any>,\n remoteControl?: SourceRemoteControlConfig,\n analyticsSourceMetadata?: Record<string, any>\n ): Promise<void>;\n\n /**\n * Destroys the source with the given nativeId.\n */\n destroy(nativeId: string): Promise<void>;\n\n /**\n * Returns the native DRM config reference of the source with the given nativeId.\n */\n duration(nativeId: string): Promise<number | null>;\n /**\n * Returns the current loading state of the source with the given nativeId.\n */\n loadingState(nativeId: string): Promise<LoadingState | null>;\n\n /**\n * Returns the metadata of the source with the given nativeId.\n */\n getMetadata(nativeId: string): Promise<Record<string, any> | null>;\n\n /**\n * Sets the metadata of the source with the given nativeId.\n */\n setMetadata(\n nativeId: string,\n metadata: Record<string, any> | null\n ): Promise<void>;\n\n /**\n * Returns a thumbnail for the specified playback time.\n */\n getThumbnail(nativeId: string, time: number): Promise<Thumbnail | null>;\n}\n\nexport default requireNativeModule<SourceModule>('SourceModule');\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NativeModule } from 'expo-modules-core';
|
|
2
|
+
export type UuidModuleEvents = Record<string, any>;
|
|
3
|
+
declare class UuidModule extends NativeModule<UuidModuleEvents> {
|
|
4
|
+
generate(): string;
|
|
5
|
+
}
|
|
6
|
+
declare const _default: UuidModule;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=UuidModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UuidModule.d.ts","sourceRoot":"","sources":["../../src/modules/UuidModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEnD,OAAO,OAAO,UAAW,SAAQ,YAAY,CAAC,gBAAgB,CAAC;IAC7D,QAAQ,IAAI,MAAM;CACnB;;AAED,wBAA6D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UuidModule.js","sourceRoot":"","sources":["../../src/modules/UuidModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQtE,eAAe,mBAAmB,CAAa,YAAY,CAAC,CAAC","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo-modules-core';\n\nexport type UuidModuleEvents = Record<string, any>;\n\ndeclare class UuidModule extends NativeModule<UuidModuleEvents> {\n generate(): string;\n}\n\nexport default requireNativeModule<UuidModule>('UuidModule');\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface NativeInstanceConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Optionally user-defined string `id` for the native instance.
|
|
4
|
+
* Used to access a certain native instance from any point in the source code then call
|
|
5
|
+
* methods/properties on it.
|
|
6
|
+
*
|
|
7
|
+
* When left empty, a random `UUIDv4` is generated for it.
|
|
8
|
+
* @example
|
|
9
|
+
* Accessing or creating the `Player` with `nativeId` equal to `my-player`:
|
|
10
|
+
* ```
|
|
11
|
+
* const player = new Player({ nativeId: 'my-player' })
|
|
12
|
+
* player.play(); // call methods and properties...
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
nativeId?: string;
|
|
16
|
+
}
|
|
17
|
+
export default abstract class NativeInstance<Config extends NativeInstanceConfig> {
|
|
18
|
+
/**
|
|
19
|
+
* Optionally user-defined string `id` for the native instance, or UUIDv4.
|
|
20
|
+
*/
|
|
21
|
+
readonly nativeId: string;
|
|
22
|
+
/**
|
|
23
|
+
* The configuration object used to initialize this instance.
|
|
24
|
+
*/
|
|
25
|
+
readonly config?: Config;
|
|
26
|
+
/**
|
|
27
|
+
* Generate UUID in case the user-defined `nativeId` is empty.
|
|
28
|
+
*/
|
|
29
|
+
constructor(config?: Config);
|
|
30
|
+
/**
|
|
31
|
+
* Flag indicating whether the native resources of this object have been created internally
|
|
32
|
+
* .i.e `initialize` has been called.
|
|
33
|
+
*/
|
|
34
|
+
abstract isInitialized: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Create the native object/resources that will be managed by this instance.
|
|
37
|
+
*/
|
|
38
|
+
abstract initialize(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Flag indicating whether the native resources of this object have been disposed .i.e
|
|
41
|
+
* `destroy` has been called.
|
|
42
|
+
*/
|
|
43
|
+
abstract isDestroyed: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Dispose the native object/resources created by this instance during `initialize`.
|
|
46
|
+
*/
|
|
47
|
+
abstract destroy(): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=nativeInstance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeInstance.d.ts","sourceRoot":"","sources":["../src/nativeInstance.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,cAAc,CAC1C,MAAM,SAAS,oBAAoB;IAEnC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;gBACS,MAAM,CAAC,EAAE,MAAM;IAK3B;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,IAAI;IAE3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;CACzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import UuidModule from './modules/UuidModule';
|
|
2
|
+
const Uuid = UuidModule;
|
|
3
|
+
export default class NativeInstance {
|
|
4
|
+
/**
|
|
5
|
+
* Optionally user-defined string `id` for the native instance, or UUIDv4.
|
|
6
|
+
*/
|
|
7
|
+
nativeId;
|
|
8
|
+
/**
|
|
9
|
+
* The configuration object used to initialize this instance.
|
|
10
|
+
*/
|
|
11
|
+
config;
|
|
12
|
+
/**
|
|
13
|
+
* Generate UUID in case the user-defined `nativeId` is empty.
|
|
14
|
+
*/
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.nativeId = config?.nativeId ?? Uuid.generate();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=nativeInstance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeInstance.js","sourceRoot":"","sources":["../src/nativeInstance.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAE9C,MAAM,IAAI,GAAG,UAAU,CAAC;AAmBxB,MAAM,CAAC,OAAO,OAAgB,cAAc;IAG1C;;OAEG;IACM,QAAQ,CAAS;IAE1B;;OAEG;IACM,MAAM,CAAU;IAEzB;;OAEG;IACH,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,MAAM,EAAE,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;IACtD,CAAC;CAuBF","sourcesContent":["import UuidModule from './modules/UuidModule';\n\nconst Uuid = UuidModule;\n\nexport interface NativeInstanceConfig {\n /**\n * Optionally user-defined string `id` for the native instance.\n * Used to access a certain native instance from any point in the source code then call\n * methods/properties on it.\n *\n * When left empty, a random `UUIDv4` is generated for it.\n * @example\n * Accessing or creating the `Player` with `nativeId` equal to `my-player`:\n * ```\n * const player = new Player({ nativeId: 'my-player' })\n * player.play(); // call methods and properties...\n * ```\n */\n nativeId?: string;\n}\n\nexport default abstract class NativeInstance<\n Config extends NativeInstanceConfig,\n> {\n /**\n * Optionally user-defined string `id` for the native instance, or UUIDv4.\n */\n readonly nativeId: string;\n\n /**\n * The configuration object used to initialize this instance.\n */\n readonly config?: Config;\n\n /**\n * Generate UUID in case the user-defined `nativeId` is empty.\n */\n constructor(config?: Config) {\n this.config = config;\n this.nativeId = config?.nativeId ?? Uuid.generate();\n }\n\n /**\n * Flag indicating whether the native resources of this object have been created internally\n * .i.e `initialize` has been called.\n */\n abstract isInitialized: boolean;\n\n /**\n * Create the native object/resources that will be managed by this instance.\n */\n abstract initialize(): void;\n\n /**\n * Flag indicating whether the native resources of this object have been disposed .i.e\n * `destroy` has been called.\n */\n abstract isDestroyed: boolean;\n\n /**\n * Dispose the native object/resources created by this instance during `initialize`.\n */\n abstract destroy(): void;\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import NativeInstance from '../nativeInstance';
|
|
2
|
+
import { HttpRequestType, HttpRequest, HttpResponse, NetworkConfig } from './networkConfig';
|
|
3
|
+
export { HttpRequestType, HttpRequest, HttpResponse, NetworkConfig };
|
|
4
|
+
/**
|
|
5
|
+
* Represents a native Network configuration object.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare class Network extends NativeInstance<NetworkConfig> {
|
|
9
|
+
/**
|
|
10
|
+
* Whether this object's native instance has been created.
|
|
11
|
+
*/
|
|
12
|
+
isInitialized: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this object's native instance has been disposed.
|
|
15
|
+
*/
|
|
16
|
+
isDestroyed: boolean;
|
|
17
|
+
private onPreprocessHttpRequestSubscription?;
|
|
18
|
+
private onPreprocessHttpResponseSubscription?;
|
|
19
|
+
/**
|
|
20
|
+
* Allocates the Network config instance and its resources natively.
|
|
21
|
+
*/
|
|
22
|
+
initialize: () => Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Destroys the native Network config and releases all of its allocated resources.
|
|
25
|
+
*/
|
|
26
|
+
destroy: () => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Applies the user-defined `preprocessHttpRequest` function to native's `type` and `request` data and store
|
|
29
|
+
* the result back in `NetworkModule`.
|
|
30
|
+
*
|
|
31
|
+
* Called from native code when `NetworkConfig.preprocessHttpRequest` is dispatched.
|
|
32
|
+
*
|
|
33
|
+
* @param requestId Passed through to identify the completion handler of the request on native.
|
|
34
|
+
* @param type Type of the request to be made.
|
|
35
|
+
* @param request The HTTP request to process.
|
|
36
|
+
*/
|
|
37
|
+
private onPreprocessHttpRequest;
|
|
38
|
+
/**
|
|
39
|
+
* Applies the user-defined `preprocessHttpResponse` function to native's `type` and `response` data and store
|
|
40
|
+
* the result back in `NetworkModule`.
|
|
41
|
+
*
|
|
42
|
+
* Called from native code when `NetworkConfig.preprocessHttpResponse` is dispatched.
|
|
43
|
+
*
|
|
44
|
+
* @param responseId Passed through to identify the completion handler of the response on native.
|
|
45
|
+
* @param type Type of the request to be made.
|
|
46
|
+
* @param response The HTTP response to process.
|
|
47
|
+
*/
|
|
48
|
+
private onPreprocessHttpResponse;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EACL,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AAErE;;;GAGG;AACH,qBAAa,OAAQ,SAAQ,cAAc,CAAC,aAAa,CAAC;IACxD;;OAEG;IACH,aAAa,UAAS;IACtB;;OAEG;IACH,WAAW,UAAS;IAEpB,OAAO,CAAC,mCAAmC,CAAC,CAAoB;IAChE,OAAO,CAAC,oCAAoC,CAAC,CAAoB;IAEjE;;OAEG;IACH,UAAU,sBAgCR;IAEF;;OAEG;IACH,OAAO,sBASL;IAEF;;;;;;;;;OASG;IACH,OAAO,CAAC,uBAAuB,CAa7B;IAEF;;;;;;;;;OASG;IACH,OAAO,CAAC,wBAAwB,CAa9B;CACH"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import NativeInstance from '../nativeInstance';
|
|
2
|
+
import NetworkModule from './networkModule';
|
|
3
|
+
import { HttpRequestType, } from './networkConfig';
|
|
4
|
+
export { HttpRequestType };
|
|
5
|
+
/**
|
|
6
|
+
* Represents a native Network configuration object.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export class Network extends NativeInstance {
|
|
10
|
+
/**
|
|
11
|
+
* Whether this object's native instance has been created.
|
|
12
|
+
*/
|
|
13
|
+
isInitialized = false;
|
|
14
|
+
/**
|
|
15
|
+
* Whether this object's native instance has been disposed.
|
|
16
|
+
*/
|
|
17
|
+
isDestroyed = false;
|
|
18
|
+
onPreprocessHttpRequestSubscription;
|
|
19
|
+
onPreprocessHttpResponseSubscription;
|
|
20
|
+
/**
|
|
21
|
+
* Allocates the Network config instance and its resources natively.
|
|
22
|
+
*/
|
|
23
|
+
initialize = async () => {
|
|
24
|
+
if (!this.isInitialized) {
|
|
25
|
+
console.log('Initializing Network config:', this.nativeId);
|
|
26
|
+
// Set up event listeners for HTTP request/response preprocessing
|
|
27
|
+
this.onPreprocessHttpRequestSubscription = NetworkModule.addListener('onPreprocessHttpRequest', ({ nativeId, requestId, type, request }) => {
|
|
28
|
+
console.log(`Received HTTP Request [${type}]:`, request);
|
|
29
|
+
if (nativeId !== this.nativeId) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
this.onPreprocessHttpRequest(requestId, type, request);
|
|
33
|
+
});
|
|
34
|
+
this.onPreprocessHttpResponseSubscription = NetworkModule.addListener('onPreprocessHttpResponse', ({ nativeId, responseId, type, response }) => {
|
|
35
|
+
console.log(`Received HTTP Response [${type}]:`, response);
|
|
36
|
+
if (nativeId !== this.nativeId) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.onPreprocessHttpResponse(responseId, type, response);
|
|
40
|
+
});
|
|
41
|
+
// Create native configuration object using Expo module
|
|
42
|
+
if (this.config) {
|
|
43
|
+
await NetworkModule.initializeWithConfig(this.nativeId, this.config);
|
|
44
|
+
}
|
|
45
|
+
this.isInitialized = true;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Destroys the native Network config and releases all of its allocated resources.
|
|
50
|
+
*/
|
|
51
|
+
destroy = async () => {
|
|
52
|
+
if (!this.isDestroyed) {
|
|
53
|
+
await NetworkModule.destroy(this.nativeId);
|
|
54
|
+
this.onPreprocessHttpRequestSubscription?.remove();
|
|
55
|
+
this.onPreprocessHttpResponseSubscription?.remove();
|
|
56
|
+
this.onPreprocessHttpRequestSubscription = undefined;
|
|
57
|
+
this.onPreprocessHttpResponseSubscription = undefined;
|
|
58
|
+
this.isDestroyed = true;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Applies the user-defined `preprocessHttpRequest` function to native's `type` and `request` data and store
|
|
63
|
+
* the result back in `NetworkModule`.
|
|
64
|
+
*
|
|
65
|
+
* Called from native code when `NetworkConfig.preprocessHttpRequest` is dispatched.
|
|
66
|
+
*
|
|
67
|
+
* @param requestId Passed through to identify the completion handler of the request on native.
|
|
68
|
+
* @param type Type of the request to be made.
|
|
69
|
+
* @param request The HTTP request to process.
|
|
70
|
+
*/
|
|
71
|
+
onPreprocessHttpRequest = (requestId, type, request) => {
|
|
72
|
+
this.config
|
|
73
|
+
?.preprocessHttpRequest?.(type, request)
|
|
74
|
+
.then((resultRequest) => {
|
|
75
|
+
NetworkModule.setPreprocessedHttpRequest(requestId, resultRequest);
|
|
76
|
+
})
|
|
77
|
+
.catch(() => {
|
|
78
|
+
NetworkModule.setPreprocessedHttpRequest(requestId, request);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Applies the user-defined `preprocessHttpResponse` function to native's `type` and `response` data and store
|
|
83
|
+
* the result back in `NetworkModule`.
|
|
84
|
+
*
|
|
85
|
+
* Called from native code when `NetworkConfig.preprocessHttpResponse` is dispatched.
|
|
86
|
+
*
|
|
87
|
+
* @param responseId Passed through to identify the completion handler of the response on native.
|
|
88
|
+
* @param type Type of the request to be made.
|
|
89
|
+
* @param response The HTTP response to process.
|
|
90
|
+
*/
|
|
91
|
+
onPreprocessHttpResponse = (responseId, type, response) => {
|
|
92
|
+
this.config
|
|
93
|
+
?.preprocessHttpResponse?.(type, response)
|
|
94
|
+
.then((resultResponse) => {
|
|
95
|
+
NetworkModule.setPreprocessedHttpResponse(responseId, resultResponse);
|
|
96
|
+
})
|
|
97
|
+
.catch(() => {
|
|
98
|
+
NetworkModule.setPreprocessedHttpResponse(responseId, response);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/network/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,eAAe,GAIhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,eAAe,EAA4C,CAAC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,cAAc,EAAE,EAAE;YACvB,aAAa,CAAC,2BAA2B,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACxE,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,aAAa,CAAC,2BAA2B,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;CACH","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport NativeInstance from '../nativeInstance';\nimport NetworkModule from './networkModule';\nimport {\n HttpRequestType,\n HttpRequest,\n HttpResponse,\n NetworkConfig,\n} from './networkConfig';\n\nexport { HttpRequestType, HttpRequest, HttpResponse, NetworkConfig };\n\n/**\n * Represents a native Network configuration object.\n * @internal\n */\nexport class Network extends NativeInstance<NetworkConfig> {\n /**\n * Whether this object's native instance has been created.\n */\n isInitialized = false;\n /**\n * Whether this object's native instance has been disposed.\n */\n isDestroyed = false;\n\n private onPreprocessHttpRequestSubscription?: EventSubscription;\n private onPreprocessHttpResponseSubscription?: EventSubscription;\n\n /**\n * Allocates the Network config instance and its resources natively.\n */\n initialize = async () => {\n if (!this.isInitialized) {\n console.log('Initializing Network config:', this.nativeId);\n // Set up event listeners for HTTP request/response preprocessing\n this.onPreprocessHttpRequestSubscription = NetworkModule.addListener(\n 'onPreprocessHttpRequest',\n ({ nativeId, requestId, type, request }) => {\n console.log(`Received HTTP Request [${type}]:`, request);\n if (nativeId !== this.nativeId) {\n return;\n }\n this.onPreprocessHttpRequest(requestId, type, request);\n }\n );\n\n this.onPreprocessHttpResponseSubscription = NetworkModule.addListener(\n 'onPreprocessHttpResponse',\n ({ nativeId, responseId, type, response }) => {\n console.log(`Received HTTP Response [${type}]:`, response);\n if (nativeId !== this.nativeId) {\n return;\n }\n this.onPreprocessHttpResponse(responseId, type, response);\n }\n );\n\n // Create native configuration object using Expo module\n if (this.config) {\n await NetworkModule.initializeWithConfig(this.nativeId, this.config);\n }\n this.isInitialized = true;\n }\n };\n\n /**\n * Destroys the native Network config and releases all of its allocated resources.\n */\n destroy = async () => {\n if (!this.isDestroyed) {\n await NetworkModule.destroy(this.nativeId);\n this.onPreprocessHttpRequestSubscription?.remove();\n this.onPreprocessHttpResponseSubscription?.remove();\n this.onPreprocessHttpRequestSubscription = undefined;\n this.onPreprocessHttpResponseSubscription = undefined;\n this.isDestroyed = true;\n }\n };\n\n /**\n * Applies the user-defined `preprocessHttpRequest` function to native's `type` and `request` data and store\n * the result back in `NetworkModule`.\n *\n * Called from native code when `NetworkConfig.preprocessHttpRequest` is dispatched.\n *\n * @param requestId Passed through to identify the completion handler of the request on native.\n * @param type Type of the request to be made.\n * @param request The HTTP request to process.\n */\n private onPreprocessHttpRequest = (\n requestId: string,\n type: HttpRequestType,\n request: HttpRequest\n ) => {\n this.config\n ?.preprocessHttpRequest?.(type, request)\n .then((resultRequest) => {\n NetworkModule.setPreprocessedHttpRequest(requestId, resultRequest);\n })\n .catch(() => {\n NetworkModule.setPreprocessedHttpRequest(requestId, request);\n });\n };\n\n /**\n * Applies the user-defined `preprocessHttpResponse` function to native's `type` and `response` data and store\n * the result back in `NetworkModule`.\n *\n * Called from native code when `NetworkConfig.preprocessHttpResponse` is dispatched.\n *\n * @param responseId Passed through to identify the completion handler of the response on native.\n * @param type Type of the request to be made.\n * @param response The HTTP response to process.\n */\n private onPreprocessHttpResponse = (\n responseId: string,\n type: HttpRequestType,\n response: HttpResponse\n ) => {\n this.config\n ?.preprocessHttpResponse?.(type, response)\n .then((resultResponse) => {\n NetworkModule.setPreprocessedHttpResponse(responseId, resultResponse);\n })\n .catch(() => {\n NetworkModule.setPreprocessedHttpResponse(responseId, response);\n });\n };\n}\n"]}
|