@pigeonmal/react-native-video 7.0.0-beta.2
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/LICENSE +20 -0
- package/README.md +163 -0
- package/ReactNativeVideo.podspec +59 -0
- package/android/CMakeLists.txt +29 -0
- package/android/build.gradle +255 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +13 -0
- package/android/media3-ffmpeg-decoder/build.gradle +2 -0
- package/android/media3-ffmpeg-decoder/ffmpeg.aar +0 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/twg/video/core/AudioFocusManager.kt +233 -0
- package/android/src/main/java/com/twg/video/core/VideoError.kt +105 -0
- package/android/src/main/java/com/twg/video/core/VideoManager.kt +284 -0
- package/android/src/main/java/com/twg/video/core/custom/MyRenderersFactory.java +78 -0
- package/android/src/main/java/com/twg/video/core/custom/MyTextRenderer.java +121 -0
- package/android/src/main/java/com/twg/video/core/custom/TextFilter.java +6 -0
- package/android/src/main/java/com/twg/video/core/custom/TextSynchronizer.java +7 -0
- package/android/src/main/java/com/twg/video/core/extensions/ResizeMode+AspectRatioFrameLayout.kt +20 -0
- package/android/src/main/java/com/twg/video/core/extensions/SubtitleType+toString.kt +14 -0
- package/android/src/main/java/com/twg/video/core/extensions/VideoPlaybackService+ServiceManagment.kt +59 -0
- package/android/src/main/java/com/twg/video/core/fragments/FullscreenVideoFragment.kt +265 -0
- package/android/src/main/java/com/twg/video/core/fragments/PictureInPictureHelperFragment.kt +85 -0
- package/android/src/main/java/com/twg/video/core/player/DRMManagerSpec.kt +23 -0
- package/android/src/main/java/com/twg/video/core/player/DataSourceFactoryUtils.kt +80 -0
- package/android/src/main/java/com/twg/video/core/player/MediaItemUtils.kt +152 -0
- package/android/src/main/java/com/twg/video/core/player/MediaSourceUtils.kt +85 -0
- package/android/src/main/java/com/twg/video/core/player/OnAudioFocusChangedListener.kt +25 -0
- package/android/src/main/java/com/twg/video/core/plugins/PluginsRegistry.kt +223 -0
- package/android/src/main/java/com/twg/video/core/plugins/ReactNativeVideoPlugin.kt +173 -0
- package/android/src/main/java/com/twg/video/core/recivers/AudioBecomingNoisyReceiver.kt +38 -0
- package/android/src/main/java/com/twg/video/core/services/playback/CustomMediaNotificationProvider.kt +151 -0
- package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackCallback.kt +96 -0
- package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackService.kt +219 -0
- package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackServiceConnection.kt +59 -0
- package/android/src/main/java/com/twg/video/core/utils/PictureInPictureUtils.kt +153 -0
- package/android/src/main/java/com/twg/video/core/utils/SmallVideoPlayerOptimizer.kt +157 -0
- package/android/src/main/java/com/twg/video/core/utils/SourceLoader.kt +48 -0
- package/android/src/main/java/com/twg/video/core/utils/Threading.kt +75 -0
- package/android/src/main/java/com/twg/video/core/utils/TrackUtils.kt +305 -0
- package/android/src/main/java/com/twg/video/core/utils/VideoFileHelper.kt +51 -0
- package/android/src/main/java/com/twg/video/core/utils/VideoInformationUtils.kt +67 -0
- package/android/src/main/java/com/twg/video/core/utils/VideoOrientationUtils.kt +30 -0
- package/android/src/main/java/com/twg/video/hybrids/videoplayer/HybridVideoPlayer.kt +630 -0
- package/android/src/main/java/com/twg/video/hybrids/videoplayer/HybridVideoPlayerFactory.kt +16 -0
- package/android/src/main/java/com/twg/video/hybrids/videoplayereventemitter/HybridVideoPlayerEventEmitter.kt +154 -0
- package/android/src/main/java/com/twg/video/hybrids/videoplayersource/HybridVideoPlayerSource.kt +67 -0
- package/android/src/main/java/com/twg/video/hybrids/videoplayersource/HybridVideoPlayerSourceFactory.kt +31 -0
- package/android/src/main/java/com/twg/video/hybrids/videoviewviewmanager/HybridVideoViewViewManager.kt +187 -0
- package/android/src/main/java/com/twg/video/hybrids/videoviewviewmanager/HybridVideoViewViewManagerFactory.kt +13 -0
- package/android/src/main/java/com/twg/video/react/VideoPackage.kt +26 -0
- package/android/src/main/java/com/twg/video/react/VideoViewViewManager.kt +78 -0
- package/android/src/main/java/com/twg/video/view/VideoView.kt +565 -0
- package/android/src/main/res/layout/player_view_surface.xml +14 -0
- package/android/src/main/res/layout/player_view_texture.xml +15 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNCVideoViewManagerDelegate.java +32 -0
- package/android/src/paper/java/com/facebook/react/viewmanagers/RNCVideoViewManagerInterface.java +16 -0
- package/android/src/stubs/dash/androidx/media3/exoplayer/dash/DashMediaSource.kt +35 -0
- package/android/src/stubs/dash/androidx/media3/exoplayer/dash/DashUtil.kt +11 -0
- package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/AdaptationSet.kt +9 -0
- package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/DashManifest.kt +10 -0
- package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/Period.kt +7 -0
- package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/Representation.kt +8 -0
- package/android/src/stubs/hls/androidx/media3/exoplayer/hls/HlsMediaSource.kt +33 -0
- package/android/src/stubs/subs/androidx/media3/exoplayer/text/NonFinalTextRenderer.java +583 -0
- package/app.plugin.js +1 -0
- package/ios/Video-Bridging-Header.h +1 -0
- package/ios/core/Extensions/AVAsset+estimatedMemoryUsage.swift +51 -0
- package/ios/core/Extensions/AVAssetTrack+orientation.swift +41 -0
- package/ios/core/Extensions/AVPlayerItem+externalSubtitles.swift +35 -0
- package/ios/core/Extensions/AVPlayerItem+getBufferedDurration.swift +34 -0
- package/ios/core/Extensions/AVPlayerItem+setBufferConfig.swift +37 -0
- package/ios/core/Extensions/AVPlayerViewController+Fullscreen.swift +21 -0
- package/ios/core/Extensions/AVPlayerViewController+PictureInPicture.swift +24 -0
- package/ios/core/Extensions/AVURLAsset+getAssetInformation.swift +68 -0
- package/ios/core/Extensions/NSObject+PerformIfResponds.swift +30 -0
- package/ios/core/Extensions/ResizeMode+VideoGravity.swift +24 -0
- package/ios/core/HLSSubtitleInjector.swift +381 -0
- package/ios/core/NowPlayingInfoCenterManager.swift +323 -0
- package/ios/core/Plugins/PluginsRegistry.swift +102 -0
- package/ios/core/Plugins/ReactNativeVideoPlugin.swift +91 -0
- package/ios/core/Spec/DRMManagerSpec.swift +14 -0
- package/ios/core/Spec/NativeVideoPlayerSourceSpec.swift +36 -0
- package/ios/core/Spec/NativeVideoPlayerSpec.swift +42 -0
- package/ios/core/Utils/ExternalSubtitlesUtils.swift +119 -0
- package/ios/core/Utils/HLSManifestParser.swift +170 -0
- package/ios/core/Utils/Weak.swift +26 -0
- package/ios/core/VideoError.swift +169 -0
- package/ios/core/VideoFileHelper.swift +48 -0
- package/ios/core/VideoManager.swift +412 -0
- package/ios/core/VideoPlayerObserver.swift +294 -0
- package/ios/hybrids/VideoPlayer/HybridVideoPlayer+Events.swift +198 -0
- package/ios/hybrids/VideoPlayer/HybridVideoPlayer.swift +555 -0
- package/ios/hybrids/VideoPlayer/HybridVideoPlayerFactory.swift +15 -0
- package/ios/hybrids/VideoPlayerEmitter/HybridVideoPlayerEventEmitter.swift +203 -0
- package/ios/hybrids/VideoPlayerSource/HybridVideoPlayerSource.swift +166 -0
- package/ios/hybrids/VideoPlayerSource/HybridVideoPlayerSourceFactory.swift +30 -0
- package/ios/hybrids/VideoPlayerSource/SourceLoader.swift +83 -0
- package/ios/hybrids/VideoViewViewManager/HybridVideoViewViewManager.swift +266 -0
- package/ios/hybrids/VideoViewViewManager/HybridVideoViewViewManagerFactory.swift +14 -0
- package/ios/view/VideoComponentView.swift +274 -0
- package/ios/view/VideoComponentViewObserver.swift +144 -0
- package/ios/view/fabric/RCTVideoViewComponentView.h +10 -0
- package/ios/view/fabric/RCTVideoViewComponentView.mm +94 -0
- package/ios/view/fabric/RCTVideoViewViewManager.mm +14 -0
- package/ios/view/paper/RCTVideoViewComponentView.h +9 -0
- package/ios/view/paper/RCTVideoViewComponentView.mm +45 -0
- package/ios/view/paper/RCTVideoViewViewManager.m +18 -0
- package/lib/commonjs/core/VideoPlayer.js +276 -0
- package/lib/commonjs/core/VideoPlayer.js.map +1 -0
- package/lib/commonjs/core/VideoPlayerEvents.js +87 -0
- package/lib/commonjs/core/VideoPlayerEvents.js.map +1 -0
- package/lib/commonjs/core/hooks/useEvent.js +24 -0
- package/lib/commonjs/core/hooks/useEvent.js.map +1 -0
- package/lib/commonjs/core/hooks/useManagedInstance.js +79 -0
- package/lib/commonjs/core/hooks/useManagedInstance.js.map +1 -0
- package/lib/commonjs/core/hooks/useVideoPlayer.js +62 -0
- package/lib/commonjs/core/hooks/useVideoPlayer.js.map +1 -0
- package/lib/commonjs/core/types/BufferConfig.js +2 -0
- package/lib/commonjs/core/types/BufferConfig.js.map +1 -0
- package/lib/commonjs/core/types/DrmParams.js +2 -0
- package/lib/commonjs/core/types/DrmParams.js.map +1 -0
- package/lib/commonjs/core/types/Events.js +14 -0
- package/lib/commonjs/core/types/Events.js.map +1 -0
- package/lib/commonjs/core/types/IgnoreSilentSwitchMode.js +2 -0
- package/lib/commonjs/core/types/IgnoreSilentSwitchMode.js.map +1 -0
- package/lib/commonjs/core/types/MixAudioMode.js +2 -0
- package/lib/commonjs/core/types/MixAudioMode.js.map +1 -0
- package/lib/commonjs/core/types/PlayerTrack.js +13 -0
- package/lib/commonjs/core/types/PlayerTrack.js.map +1 -0
- package/lib/commonjs/core/types/ResizeMode.js +2 -0
- package/lib/commonjs/core/types/ResizeMode.js.map +1 -0
- package/lib/commonjs/core/types/Utils.js +2 -0
- package/lib/commonjs/core/types/Utils.js.map +1 -0
- package/lib/commonjs/core/types/VideoConfig.js +6 -0
- package/lib/commonjs/core/types/VideoConfig.js.map +1 -0
- package/lib/commonjs/core/types/VideoError.js +108 -0
- package/lib/commonjs/core/types/VideoError.js.map +1 -0
- package/lib/commonjs/core/types/VideoInformation.js +6 -0
- package/lib/commonjs/core/types/VideoInformation.js.map +1 -0
- package/lib/commonjs/core/types/VideoOrientation.js +2 -0
- package/lib/commonjs/core/types/VideoOrientation.js.map +1 -0
- package/lib/commonjs/core/types/VideoPlayerBase.js +6 -0
- package/lib/commonjs/core/types/VideoPlayerBase.js.map +1 -0
- package/lib/commonjs/core/types/VideoPlayerSourceBase.js +6 -0
- package/lib/commonjs/core/types/VideoPlayerSourceBase.js.map +1 -0
- package/lib/commonjs/core/types/VideoPlayerStatus.js +2 -0
- package/lib/commonjs/core/types/VideoPlayerStatus.js.map +1 -0
- package/lib/commonjs/core/utils/playerFactory.js +30 -0
- package/lib/commonjs/core/utils/playerFactory.js.map +1 -0
- package/lib/commonjs/core/utils/sourceFactory.js +146 -0
- package/lib/commonjs/core/utils/sourceFactory.js.map +1 -0
- package/lib/commonjs/core/video-view/NativeVideoView.js +18 -0
- package/lib/commonjs/core/video-view/NativeVideoView.js.map +1 -0
- package/lib/commonjs/core/video-view/VideoView.js +208 -0
- package/lib/commonjs/core/video-view/VideoView.js.map +1 -0
- package/lib/commonjs/expo-plugins/@types.js +2 -0
- package/lib/commonjs/expo-plugins/@types.js.map +1 -0
- package/lib/commonjs/expo-plugins/getPackageInfo.js +27 -0
- package/lib/commonjs/expo-plugins/getPackageInfo.js.map +1 -0
- package/lib/commonjs/expo-plugins/withAndroidExtensions.js +40 -0
- package/lib/commonjs/expo-plugins/withAndroidExtensions.js.map +1 -0
- package/lib/commonjs/expo-plugins/withAndroidNotificationControls.js +34 -0
- package/lib/commonjs/expo-plugins/withAndroidNotificationControls.js.map +1 -0
- package/lib/commonjs/expo-plugins/withAndroidPictureInPicture.js +23 -0
- package/lib/commonjs/expo-plugins/withAndroidPictureInPicture.js.map +1 -0
- package/lib/commonjs/expo-plugins/withBackgroundAudio.js +26 -0
- package/lib/commonjs/expo-plugins/withBackgroundAudio.js.map +1 -0
- package/lib/commonjs/expo-plugins/withReactNativeVideo.js +31 -0
- package/lib/commonjs/expo-plugins/withReactNativeVideo.js.map +1 -0
- package/lib/commonjs/expo-plugins/writeToPodfile.js +59 -0
- package/lib/commonjs/expo-plugins/writeToPodfile.js.map +1 -0
- package/lib/commonjs/index.js +61 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/spec/fabric/VideoViewNativeComponent.ts +17 -0
- package/lib/commonjs/spec/nitro/VideoPlayer.nitro.js +6 -0
- package/lib/commonjs/spec/nitro/VideoPlayer.nitro.js.map +1 -0
- package/lib/commonjs/spec/nitro/VideoPlayerEventEmitter.nitro.js +6 -0
- package/lib/commonjs/spec/nitro/VideoPlayerEventEmitter.nitro.js.map +1 -0
- package/lib/commonjs/spec/nitro/VideoPlayerSource.nitro.js +6 -0
- package/lib/commonjs/spec/nitro/VideoPlayerSource.nitro.js.map +1 -0
- package/lib/commonjs/spec/nitro/VideoViewViewManager.nitro.js +6 -0
- package/lib/commonjs/spec/nitro/VideoViewViewManager.nitro.js.map +1 -0
- package/lib/module/core/VideoPlayer.js +272 -0
- package/lib/module/core/VideoPlayer.js.map +1 -0
- package/lib/module/core/VideoPlayerEvents.js +82 -0
- package/lib/module/core/VideoPlayerEvents.js.map +1 -0
- package/lib/module/core/hooks/useEvent.js +19 -0
- package/lib/module/core/hooks/useEvent.js.map +1 -0
- package/lib/module/core/hooks/useManagedInstance.js +75 -0
- package/lib/module/core/hooks/useManagedInstance.js.map +1 -0
- package/lib/module/core/hooks/useVideoPlayer.js +57 -0
- package/lib/module/core/hooks/useVideoPlayer.js.map +1 -0
- package/lib/module/core/types/BufferConfig.js +2 -0
- package/lib/module/core/types/BufferConfig.js.map +1 -0
- package/lib/module/core/types/DrmParams.js +2 -0
- package/lib/module/core/types/DrmParams.js.map +1 -0
- package/lib/module/core/types/Events.js +10 -0
- package/lib/module/core/types/Events.js.map +1 -0
- package/lib/module/core/types/IgnoreSilentSwitchMode.js +2 -0
- package/lib/module/core/types/IgnoreSilentSwitchMode.js.map +1 -0
- package/lib/module/core/types/MixAudioMode.js +2 -0
- package/lib/module/core/types/MixAudioMode.js.map +1 -0
- package/lib/module/core/types/PlayerTrack.js +9 -0
- package/lib/module/core/types/PlayerTrack.js.map +1 -0
- package/lib/module/core/types/ResizeMode.js +2 -0
- package/lib/module/core/types/ResizeMode.js.map +1 -0
- package/lib/module/core/types/Utils.js +2 -0
- package/lib/module/core/types/Utils.js.map +1 -0
- package/lib/module/core/types/VideoConfig.js +4 -0
- package/lib/module/core/types/VideoConfig.js.map +1 -0
- package/lib/module/core/types/VideoError.js +100 -0
- package/lib/module/core/types/VideoError.js.map +1 -0
- package/lib/module/core/types/VideoInformation.js +4 -0
- package/lib/module/core/types/VideoInformation.js.map +1 -0
- package/lib/module/core/types/VideoOrientation.js +2 -0
- package/lib/module/core/types/VideoOrientation.js.map +1 -0
- package/lib/module/core/types/VideoPlayerBase.js +4 -0
- package/lib/module/core/types/VideoPlayerBase.js.map +1 -0
- package/lib/module/core/types/VideoPlayerSourceBase.js +4 -0
- package/lib/module/core/types/VideoPlayerSourceBase.js.map +1 -0
- package/lib/module/core/types/VideoPlayerStatus.js +2 -0
- package/lib/module/core/types/VideoPlayerStatus.js.map +1 -0
- package/lib/module/core/utils/playerFactory.js +25 -0
- package/lib/module/core/utils/playerFactory.js.map +1 -0
- package/lib/module/core/utils/sourceFactory.js +138 -0
- package/lib/module/core/utils/sourceFactory.js.map +1 -0
- package/lib/module/core/video-view/NativeVideoView.js +13 -0
- package/lib/module/core/video-view/NativeVideoView.js.map +1 -0
- package/lib/module/core/video-view/VideoView.js +203 -0
- package/lib/module/core/video-view/VideoView.js.map +1 -0
- package/lib/module/expo-plugins/@types.js +2 -0
- package/lib/module/expo-plugins/@types.js.map +1 -0
- package/lib/module/expo-plugins/getPackageInfo.js +23 -0
- package/lib/module/expo-plugins/getPackageInfo.js.map +1 -0
- package/lib/module/expo-plugins/withAndroidExtensions.js +35 -0
- package/lib/module/expo-plugins/withAndroidExtensions.js.map +1 -0
- package/lib/module/expo-plugins/withAndroidNotificationControls.js +29 -0
- package/lib/module/expo-plugins/withAndroidNotificationControls.js.map +1 -0
- package/lib/module/expo-plugins/withAndroidPictureInPicture.js +18 -0
- package/lib/module/expo-plugins/withAndroidPictureInPicture.js.map +1 -0
- package/lib/module/expo-plugins/withBackgroundAudio.js +22 -0
- package/lib/module/expo-plugins/withBackgroundAudio.js.map +1 -0
- package/lib/module/expo-plugins/withReactNativeVideo.js +27 -0
- package/lib/module/expo-plugins/withReactNativeVideo.js.map +1 -0
- package/lib/module/expo-plugins/writeToPodfile.js +53 -0
- package/lib/module/expo-plugins/writeToPodfile.js.map +1 -0
- package/lib/module/index.js +9 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/spec/fabric/VideoViewNativeComponent.ts +17 -0
- package/lib/module/spec/nitro/VideoPlayer.nitro.js +4 -0
- package/lib/module/spec/nitro/VideoPlayer.nitro.js.map +1 -0
- package/lib/module/spec/nitro/VideoPlayerEventEmitter.nitro.js +4 -0
- package/lib/module/spec/nitro/VideoPlayerEventEmitter.nitro.js.map +1 -0
- package/lib/module/spec/nitro/VideoPlayerSource.nitro.js +4 -0
- package/lib/module/spec/nitro/VideoPlayerSource.nitro.js.map +1 -0
- package/lib/module/spec/nitro/VideoViewViewManager.nitro.js +4 -0
- package/lib/module/spec/nitro/VideoViewViewManager.nitro.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/core/VideoPlayer.d.ts +61 -0
- package/lib/typescript/commonjs/src/core/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/VideoPlayerEvents.d.ts +22 -0
- package/lib/typescript/commonjs/src/core/VideoPlayerEvents.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/hooks/useEvent.d.ts +11 -0
- package/lib/typescript/commonjs/src/core/hooks/useEvent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/hooks/useManagedInstance.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/hooks/useManagedInstance.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/hooks/useVideoPlayer.d.ts +16 -0
- package/lib/typescript/commonjs/src/core/hooks/useVideoPlayer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/BufferConfig.d.ts +97 -0
- package/lib/typescript/commonjs/src/core/types/BufferConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/DrmParams.d.ts +64 -0
- package/lib/typescript/commonjs/src/core/types/DrmParams.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/Events.d.ts +218 -0
- package/lib/typescript/commonjs/src/core/types/Events.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/IgnoreSilentSwitchMode.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/types/IgnoreSilentSwitchMode.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/MixAudioMode.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/types/MixAudioMode.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/PlayerTrack.d.ts +34 -0
- package/lib/typescript/commonjs/src/core/types/PlayerTrack.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/ResizeMode.d.ts +10 -0
- package/lib/typescript/commonjs/src/core/types/ResizeMode.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/Utils.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/types/Utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoConfig.d.ts +137 -0
- package/lib/typescript/commonjs/src/core/types/VideoConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoError.d.ts +27 -0
- package/lib/typescript/commonjs/src/core/types/VideoError.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoInformation.d.ts +37 -0
- package/lib/typescript/commonjs/src/core/types/VideoInformation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoOrientation.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/types/VideoOrientation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoPlayerBase.d.ts +165 -0
- package/lib/typescript/commonjs/src/core/types/VideoPlayerBase.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoPlayerSourceBase.d.ts +17 -0
- package/lib/typescript/commonjs/src/core/types/VideoPlayerSourceBase.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/types/VideoPlayerStatus.d.ts +9 -0
- package/lib/typescript/commonjs/src/core/types/VideoPlayerStatus.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/utils/playerFactory.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/utils/playerFactory.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/utils/sourceFactory.d.ts +29 -0
- package/lib/typescript/commonjs/src/core/utils/sourceFactory.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/video-view/NativeVideoView.d.ts +2 -0
- package/lib/typescript/commonjs/src/core/video-view/NativeVideoView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/core/video-view/VideoView.d.ts +85 -0
- package/lib/typescript/commonjs/src/core/video-view/VideoView.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/@types.d.ts +34 -0
- package/lib/typescript/commonjs/src/expo-plugins/@types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/getPackageInfo.d.ts +5 -0
- package/lib/typescript/commonjs/src/expo-plugins/getPackageInfo.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/withAndroidExtensions.d.ts +8 -0
- package/lib/typescript/commonjs/src/expo-plugins/withAndroidExtensions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/withAndroidNotificationControls.d.ts +3 -0
- package/lib/typescript/commonjs/src/expo-plugins/withAndroidNotificationControls.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/withAndroidPictureInPicture.d.ts +3 -0
- package/lib/typescript/commonjs/src/expo-plugins/withAndroidPictureInPicture.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/withBackgroundAudio.d.ts +7 -0
- package/lib/typescript/commonjs/src/expo-plugins/withBackgroundAudio.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/withReactNativeVideo.d.ts +5 -0
- package/lib/typescript/commonjs/src/expo-plugins/withReactNativeVideo.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/expo-plugins/writeToPodfile.d.ts +2 -0
- package/lib/typescript/commonjs/src/expo-plugins/writeToPodfile.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +14 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/spec/fabric/VideoViewNativeComponent.d.ts +12 -0
- package/lib/typescript/commonjs/src/spec/fabric/VideoViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoPlayer.nitro.d.ts +34 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoPlayer.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts +142 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerSource.nitro.d.ts +21 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerSource.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoViewViewManager.nitro.d.ts +2 -0
- package/lib/typescript/commonjs/src/spec/nitro/VideoViewViewManager.nitro.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/core/VideoPlayer.d.ts +61 -0
- package/lib/typescript/module/src/core/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/module/src/core/VideoPlayerEvents.d.ts +22 -0
- package/lib/typescript/module/src/core/VideoPlayerEvents.d.ts.map +1 -0
- package/lib/typescript/module/src/core/hooks/useEvent.d.ts +11 -0
- package/lib/typescript/module/src/core/hooks/useEvent.d.ts.map +1 -0
- package/lib/typescript/module/src/core/hooks/useManagedInstance.d.ts +2 -0
- package/lib/typescript/module/src/core/hooks/useManagedInstance.d.ts.map +1 -0
- package/lib/typescript/module/src/core/hooks/useVideoPlayer.d.ts +16 -0
- package/lib/typescript/module/src/core/hooks/useVideoPlayer.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/BufferConfig.d.ts +97 -0
- package/lib/typescript/module/src/core/types/BufferConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/DrmParams.d.ts +64 -0
- package/lib/typescript/module/src/core/types/DrmParams.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/Events.d.ts +218 -0
- package/lib/typescript/module/src/core/types/Events.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/IgnoreSilentSwitchMode.d.ts +2 -0
- package/lib/typescript/module/src/core/types/IgnoreSilentSwitchMode.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/MixAudioMode.d.ts +2 -0
- package/lib/typescript/module/src/core/types/MixAudioMode.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/PlayerTrack.d.ts +34 -0
- package/lib/typescript/module/src/core/types/PlayerTrack.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/ResizeMode.d.ts +10 -0
- package/lib/typescript/module/src/core/types/ResizeMode.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/Utils.d.ts +2 -0
- package/lib/typescript/module/src/core/types/Utils.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoConfig.d.ts +137 -0
- package/lib/typescript/module/src/core/types/VideoConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoError.d.ts +27 -0
- package/lib/typescript/module/src/core/types/VideoError.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoInformation.d.ts +37 -0
- package/lib/typescript/module/src/core/types/VideoInformation.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoOrientation.d.ts +2 -0
- package/lib/typescript/module/src/core/types/VideoOrientation.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoPlayerBase.d.ts +165 -0
- package/lib/typescript/module/src/core/types/VideoPlayerBase.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoPlayerSourceBase.d.ts +17 -0
- package/lib/typescript/module/src/core/types/VideoPlayerSourceBase.d.ts.map +1 -0
- package/lib/typescript/module/src/core/types/VideoPlayerStatus.d.ts +9 -0
- package/lib/typescript/module/src/core/types/VideoPlayerStatus.d.ts.map +1 -0
- package/lib/typescript/module/src/core/utils/playerFactory.d.ts +2 -0
- package/lib/typescript/module/src/core/utils/playerFactory.d.ts.map +1 -0
- package/lib/typescript/module/src/core/utils/sourceFactory.d.ts +29 -0
- package/lib/typescript/module/src/core/utils/sourceFactory.d.ts.map +1 -0
- package/lib/typescript/module/src/core/video-view/NativeVideoView.d.ts +2 -0
- package/lib/typescript/module/src/core/video-view/NativeVideoView.d.ts.map +1 -0
- package/lib/typescript/module/src/core/video-view/VideoView.d.ts +85 -0
- package/lib/typescript/module/src/core/video-view/VideoView.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/@types.d.ts +34 -0
- package/lib/typescript/module/src/expo-plugins/@types.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/getPackageInfo.d.ts +5 -0
- package/lib/typescript/module/src/expo-plugins/getPackageInfo.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/withAndroidExtensions.d.ts +8 -0
- package/lib/typescript/module/src/expo-plugins/withAndroidExtensions.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/withAndroidNotificationControls.d.ts +3 -0
- package/lib/typescript/module/src/expo-plugins/withAndroidNotificationControls.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/withAndroidPictureInPicture.d.ts +3 -0
- package/lib/typescript/module/src/expo-plugins/withAndroidPictureInPicture.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/withBackgroundAudio.d.ts +7 -0
- package/lib/typescript/module/src/expo-plugins/withBackgroundAudio.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/withReactNativeVideo.d.ts +5 -0
- package/lib/typescript/module/src/expo-plugins/withReactNativeVideo.d.ts.map +1 -0
- package/lib/typescript/module/src/expo-plugins/writeToPodfile.d.ts +2 -0
- package/lib/typescript/module/src/expo-plugins/writeToPodfile.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +14 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/spec/fabric/VideoViewNativeComponent.d.ts +12 -0
- package/lib/typescript/module/src/spec/fabric/VideoViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/spec/nitro/VideoPlayer.nitro.d.ts +34 -0
- package/lib/typescript/module/src/spec/nitro/VideoPlayer.nitro.d.ts.map +1 -0
- package/lib/typescript/module/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts +142 -0
- package/lib/typescript/module/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts.map +1 -0
- package/lib/typescript/module/src/spec/nitro/VideoPlayerSource.nitro.d.ts +21 -0
- package/lib/typescript/module/src/spec/nitro/VideoPlayerSource.nitro.d.ts.map +1 -0
- package/lib/typescript/module/src/spec/nitro/VideoViewViewManager.nitro.d.ts +2 -0
- package/lib/typescript/module/src/spec/nitro/VideoViewViewManager.nitro.d.ts.map +1 -0
- package/nitro.json +28 -0
- package/nitrogen/generated/android/ReactNativeVideo+autolinking.cmake +94 -0
- package/nitrogen/generated/android/ReactNativeVideo+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeVideoOnLoad.cpp +98 -0
- package/nitrogen/generated/android/ReactNativeVideoOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JAllPlayerTracks.hpp +125 -0
- package/nitrogen/generated/android/c++/JBandwidthData.hpp +65 -0
- package/nitrogen/generated/android/c++/JBufferConfig.hpp +101 -0
- package/nitrogen/generated/android/c++/JCustomVideoMetadata.hpp +74 -0
- package/nitrogen/generated/android/c++/JExternalAudio.hpp +80 -0
- package/nitrogen/generated/android/c++/JExternalForcedType.hpp +59 -0
- package/nitrogen/generated/android/c++/JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp +126 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_BandwidthData.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_TimedMetadata.hpp +81 -0
- package/nitrogen/generated/android/c++/JFunc_void_VideoPlayerStatus.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_onLoadData.hpp +88 -0
- package/nitrogen/generated/android/c++/JFunc_void_onLoadStartData.hpp +82 -0
- package/nitrogen/generated/android/c++/JFunc_void_onPlaybackStateChangeData.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_onProgressData.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_onVolumeChangeData.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +95 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerEventEmitterSpec.cpp +221 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerEventEmitterSpec.hpp +83 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerFactorySpec.cpp +59 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerFactorySpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceFactorySpec.cpp +113 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceFactorySpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceSpec.cpp +131 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSpec.cpp +307 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSpec.hpp +102 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.cpp +55 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerSpec.cpp +184 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerSpec.hpp +89 -0
- package/nitrogen/generated/android/c++/JIgnoreSilentSwitchMode.hpp +62 -0
- package/nitrogen/generated/android/c++/JListenerSubscription.hpp +67 -0
- package/nitrogen/generated/android/c++/JLivePlaybackParams.hpp +73 -0
- package/nitrogen/generated/android/c++/JMixAudioMode.hpp +65 -0
- package/nitrogen/generated/android/c++/JNativeDrmParams.hpp +111 -0
- package/nitrogen/generated/android/c++/JNativeExternalSubtitle.hpp +71 -0
- package/nitrogen/generated/android/c++/JNativeVideoConfig.hpp +174 -0
- package/nitrogen/generated/android/c++/JOnGetLicensePayload.hpp +69 -0
- package/nitrogen/generated/android/c++/JPlayerTrack.hpp +70 -0
- package/nitrogen/generated/android/c++/JResizeMode.hpp +65 -0
- package/nitrogen/generated/android/c++/JResolution.hpp +61 -0
- package/nitrogen/generated/android/c++/JSourceType.hpp +59 -0
- package/nitrogen/generated/android/c++/JSubtitleType.hpp +68 -0
- package/nitrogen/generated/android/c++/JSurfaceType.hpp +59 -0
- package/nitrogen/generated/android/c++/JTimedMetadata.hpp +78 -0
- package/nitrogen/generated/android/c++/JTimedMetadataObject.hpp +61 -0
- package/nitrogen/generated/android/c++/JTrackType.hpp +62 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_HybridVideoPlayerSourceSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_HybridVideoPlayerSourceSpec.hpp +72 -0
- package/nitrogen/generated/android/c++/JVideoInformation.hpp +86 -0
- package/nitrogen/generated/android/c++/JVideoOrientation.hpp +74 -0
- package/nitrogen/generated/android/c++/JVideoPlayerStatus.hpp +65 -0
- package/nitrogen/generated/android/c++/JVideoPlayerTrack.hpp +78 -0
- package/nitrogen/generated/android/c++/JonLoadData.hpp +87 -0
- package/nitrogen/generated/android/c++/JonLoadStartData.hpp +65 -0
- package/nitrogen/generated/android/c++/JonPlaybackStateChangeData.hpp +61 -0
- package/nitrogen/generated/android/c++/JonProgressData.hpp +61 -0
- package/nitrogen/generated/android/c++/JonVolumeChangeData.hpp +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/AllPlayerTracks.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/BandwidthData.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/BufferConfig.kt +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/CustomVideoMetadata.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ExternalAudio.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ExternalForcedType.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_BandwidthData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_TimedMetadata.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_VideoPlayerStatus.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_bool.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onLoadData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onLoadStartData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onPlaybackStateChangeData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onProgressData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onVolumeChangeData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_std__vector_std__string_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerEventEmitterSpec.kt +219 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerFactorySpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerSourceFactorySpec.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerSourceSpec.kt +64 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerSpec.kt +187 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoViewViewManagerFactorySpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoViewViewManagerSpec.kt +171 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/IgnoreSilentSwitchMode.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ListenerSubscription.kt +42 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/LivePlaybackParams.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/MixAudioMode.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/NativeDrmParams.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/NativeExternalSubtitle.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/NativeVideoConfig.kt +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/OnGetLicensePayload.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/PlayerTrack.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ReactNativeVideoOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ResizeMode.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Resolution.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SourceType.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SubtitleType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SurfaceType.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/TimedMetadata.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/TimedMetadataObject.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/TrackType.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Variant_NullType_HybridVideoPlayerSourceSpec.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoInformation.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoOrientation.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoPlayerStatus.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoPlayerTrack.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onLoadData.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onLoadStartData.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onPlaybackStateChangeData.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onProgressData.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onVolumeChangeData.kt +41 -0
- package/nitrogen/generated/ios/ReactNativeVideo+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeVideo-Swift-Cxx-Bridge.cpp +272 -0
- package/nitrogen/generated/ios/ReactNativeVideo-Swift-Cxx-Bridge.hpp +1119 -0
- package/nitrogen/generated/ios/ReactNativeVideo-Swift-Cxx-Umbrella.hpp +177 -0
- package/nitrogen/generated/ios/ReactNativeVideoAutolinking.mm +49 -0
- package/nitrogen/generated/ios/ReactNativeVideoAutolinking.swift +55 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerEventEmitterSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerEventEmitterSpecSwift.hpp +269 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerFactorySpecSwift.hpp +81 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceFactorySpecSwift.hpp +125 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceSpecSwift.hpp +125 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerSpecSwift.hpp +265 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerFactorySpecSwift.hpp +78 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerSpecSwift.hpp +211 -0
- package/nitrogen/generated/ios/swift/AllPlayerTracks.swift +94 -0
- package/nitrogen/generated/ios/swift/BandwidthData.swift +82 -0
- package/nitrogen/generated/ios/swift/BufferConfig.swift +278 -0
- package/nitrogen/generated/ios/swift/CustomVideoMetadata.swift +175 -0
- package/nitrogen/generated/ios/swift/ExternalAudio.swift +116 -0
- package/nitrogen/generated/ios/swift/ExternalForcedType.swift +40 -0
- package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.swift +62 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_BandwidthData.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_TimedMetadata.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_VideoInformation.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_VideoPlayerStatus.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_onLoadData.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_onLoadStartData.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_onPlaybackStateChangeData.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_onProgressData.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_onVolumeChangeData.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_std__string__.swift +67 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerEventEmitterSpec.swift +74 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerEventEmitterSpec_cxx.swift +442 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerFactorySpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerFactorySpec_cxx.swift +138 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceFactorySpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceFactorySpec_cxx.swift +149 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceSpec_cxx.swift +150 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSpec.swift +82 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSpec_cxx.swift +475 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerFactorySpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerFactorySpec_cxx.swift +134 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerSpec.swift +73 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerSpec_cxx.swift +383 -0
- package/nitrogen/generated/ios/swift/IgnoreSilentSwitchMode.swift +44 -0
- package/nitrogen/generated/ios/swift/ListenerSubscription.swift +47 -0
- package/nitrogen/generated/ios/swift/LivePlaybackParams.swift +140 -0
- package/nitrogen/generated/ios/swift/MixAudioMode.swift +48 -0
- package/nitrogen/generated/ios/swift/NativeDrmParams.swift +287 -0
- package/nitrogen/generated/ios/swift/NativeExternalSubtitle.swift +69 -0
- package/nitrogen/generated/ios/swift/NativeVideoConfig.swift +345 -0
- package/nitrogen/generated/ios/swift/OnGetLicensePayload.swift +69 -0
- package/nitrogen/generated/ios/swift/PlayerTrack.swift +88 -0
- package/nitrogen/generated/ios/swift/ResizeMode.swift +48 -0
- package/nitrogen/generated/ios/swift/Resolution.swift +47 -0
- package/nitrogen/generated/ios/swift/SourceType.swift +40 -0
- package/nitrogen/generated/ios/swift/SubtitleType.swift +52 -0
- package/nitrogen/generated/ios/swift/SurfaceType.swift +40 -0
- package/nitrogen/generated/ios/swift/TimedMetadata.swift +48 -0
- package/nitrogen/generated/ios/swift/TimedMetadataObject.swift +47 -0
- package/nitrogen/generated/ios/swift/TrackType.swift +44 -0
- package/nitrogen/generated/ios/swift/Variant_NullType__any_HybridVideoPlayerSourceSpec_.swift +18 -0
- package/nitrogen/generated/ios/swift/VideoInformation.swift +113 -0
- package/nitrogen/generated/ios/swift/VideoOrientation.swift +60 -0
- package/nitrogen/generated/ios/swift/VideoPlayerStatus.swift +48 -0
- package/nitrogen/generated/ios/swift/VideoPlayerTrack.swift +110 -0
- package/nitrogen/generated/ios/swift/onLoadData.swift +91 -0
- package/nitrogen/generated/ios/swift/onLoadStartData.swift +57 -0
- package/nitrogen/generated/ios/swift/onPlaybackStateChangeData.swift +47 -0
- package/nitrogen/generated/ios/swift/onProgressData.swift +47 -0
- package/nitrogen/generated/ios/swift/onVolumeChangeData.swift +47 -0
- package/nitrogen/generated/shared/c++/AllPlayerTracks.hpp +88 -0
- package/nitrogen/generated/shared/c++/BandwidthData.hpp +83 -0
- package/nitrogen/generated/shared/c++/BufferConfig.hpp +120 -0
- package/nitrogen/generated/shared/c++/CustomVideoMetadata.hpp +92 -0
- package/nitrogen/generated/shared/c++/ExternalAudio.hpp +85 -0
- package/nitrogen/generated/shared/c++/ExternalForcedType.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerEventEmitterSpec.cpp +39 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerEventEmitterSpec.hpp +108 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceFactorySpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceFactorySpec.hpp +69 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceSpec.hpp +69 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSpec.cpp +59 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSpec.hpp +128 -0
- package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerFactorySpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerSpec.cpp +46 -0
- package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerSpec.hpp +99 -0
- package/nitrogen/generated/shared/c++/IgnoreSilentSwitchMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/ListenerSubscription.hpp +75 -0
- package/nitrogen/generated/shared/c++/LivePlaybackParams.hpp +91 -0
- package/nitrogen/generated/shared/c++/MixAudioMode.hpp +84 -0
- package/nitrogen/generated/shared/c++/NativeDrmParams.hpp +105 -0
- package/nitrogen/generated/shared/c++/NativeExternalSubtitle.hpp +89 -0
- package/nitrogen/generated/shared/c++/NativeVideoConfig.hpp +135 -0
- package/nitrogen/generated/shared/c++/OnGetLicensePayload.hpp +87 -0
- package/nitrogen/generated/shared/c++/PlayerTrack.hpp +88 -0
- package/nitrogen/generated/shared/c++/ResizeMode.hpp +84 -0
- package/nitrogen/generated/shared/c++/Resolution.hpp +79 -0
- package/nitrogen/generated/shared/c++/SourceType.hpp +76 -0
- package/nitrogen/generated/shared/c++/SubtitleType.hpp +88 -0
- package/nitrogen/generated/shared/c++/SurfaceType.hpp +76 -0
- package/nitrogen/generated/shared/c++/TimedMetadata.hpp +77 -0
- package/nitrogen/generated/shared/c++/TimedMetadataObject.hpp +79 -0
- package/nitrogen/generated/shared/c++/TrackType.hpp +63 -0
- package/nitrogen/generated/shared/c++/VideoInformation.hpp +104 -0
- package/nitrogen/generated/shared/c++/VideoOrientation.hpp +96 -0
- package/nitrogen/generated/shared/c++/VideoPlayerStatus.hpp +84 -0
- package/nitrogen/generated/shared/c++/VideoPlayerTrack.hpp +96 -0
- package/nitrogen/generated/shared/c++/onLoadData.hpp +99 -0
- package/nitrogen/generated/shared/c++/onLoadStartData.hpp +84 -0
- package/nitrogen/generated/shared/c++/onPlaybackStateChangeData.hpp +79 -0
- package/nitrogen/generated/shared/c++/onProgressData.hpp +79 -0
- package/nitrogen/generated/shared/c++/onVolumeChangeData.hpp +79 -0
- package/package.json +155 -0
- package/react-native.config.js +19 -0
- package/src/core/VideoPlayer.ts +326 -0
- package/src/core/VideoPlayerEvents.ts +142 -0
- package/src/core/hooks/useEvent.ts +24 -0
- package/src/core/hooks/useManagedInstance.ts +96 -0
- package/src/core/hooks/useVideoPlayer.ts +73 -0
- package/src/core/types/BufferConfig.ts +103 -0
- package/src/core/types/DrmParams.ts +65 -0
- package/src/core/types/Events.ts +276 -0
- package/src/core/types/IgnoreSilentSwitchMode.ts +1 -0
- package/src/core/types/MixAudioMode.ts +1 -0
- package/src/core/types/PlayerTrack.ts +39 -0
- package/src/core/types/ResizeMode.ts +9 -0
- package/src/core/types/Utils.ts +1 -0
- package/src/core/types/VideoConfig.ts +165 -0
- package/src/core/types/VideoError.ts +174 -0
- package/src/core/types/VideoInformation.ts +44 -0
- package/src/core/types/VideoOrientation.ts +8 -0
- package/src/core/types/VideoPlayerBase.ts +193 -0
- package/src/core/types/VideoPlayerSourceBase.ts +19 -0
- package/src/core/types/VideoPlayerStatus.ts +8 -0
- package/src/core/utils/playerFactory.ts +33 -0
- package/src/core/utils/sourceFactory.ts +171 -0
- package/src/core/video-view/NativeVideoView.tsx +18 -0
- package/src/core/video-view/VideoView.tsx +406 -0
- package/src/expo-plugins/@types.ts +37 -0
- package/src/expo-plugins/getPackageInfo.ts +23 -0
- package/src/expo-plugins/withAndroidExtensions.ts +46 -0
- package/src/expo-plugins/withAndroidNotificationControls.ts +43 -0
- package/src/expo-plugins/withAndroidPictureInPicture.ts +31 -0
- package/src/expo-plugins/withBackgroundAudio.ts +26 -0
- package/src/expo-plugins/withReactNativeVideo.ts +32 -0
- package/src/expo-plugins/writeToPodfile.ts +74 -0
- package/src/index.tsx +27 -0
- package/src/spec/fabric/VideoViewNativeComponent.ts +17 -0
- package/src/spec/nitro/VideoPlayer.nitro.ts +38 -0
- package/src/spec/nitro/VideoPlayerEventEmitter.nitro.ts +196 -0
- package/src/spec/nitro/VideoPlayerSource.nitro.ts +18 -0
- package/src/spec/nitro/VideoViewViewManager.nitro.ts +92 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
package com.twg.video.core.services.playback
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.app.PendingIntent
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.util.Log
|
|
7
|
+
import androidx.annotation.OptIn
|
|
8
|
+
import androidx.media3.common.MediaMetadata
|
|
9
|
+
import androidx.media3.common.Player
|
|
10
|
+
import androidx.media3.common.util.UnstableApi
|
|
11
|
+
import androidx.media3.session.CommandButton
|
|
12
|
+
import androidx.media3.session.DefaultMediaNotificationProvider
|
|
13
|
+
import androidx.media3.session.MediaSession
|
|
14
|
+
import com.google.common.collect.ImmutableList
|
|
15
|
+
import androidx.core.os.bundleOf
|
|
16
|
+
import android.os.Bundle
|
|
17
|
+
import com.margelo.nitro.NitroModules
|
|
18
|
+
import com.twg.video.core.LibraryError
|
|
19
|
+
|
|
20
|
+
@OptIn(UnstableApi::class)
|
|
21
|
+
class CustomMediaNotificationProvider(context: Context) : DefaultMediaNotificationProvider(context) {
|
|
22
|
+
|
|
23
|
+
init {
|
|
24
|
+
setSmallIcon(androidx.media3.session.R.drawable.media3_notification_small_icon)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fun getContext(): Context {
|
|
28
|
+
return NitroModules.applicationContext ?: run {
|
|
29
|
+
throw LibraryError.ApplicationContextNotFound
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun getNotificationContentTitle(metadata: MediaMetadata): CharSequence? {
|
|
34
|
+
return metadata.title
|
|
35
|
+
?: metadata.displayTitle
|
|
36
|
+
?: metadata.subtitle
|
|
37
|
+
?: metadata.description
|
|
38
|
+
?: "${getAppName()} is playing"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun getNotificationContentText(metadata: MediaMetadata): CharSequence? {
|
|
42
|
+
return metadata.artist
|
|
43
|
+
?: metadata.subtitle
|
|
44
|
+
?: metadata.description
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
companion object {
|
|
48
|
+
private const val SEEK_INTERVAL_MS = 10000L
|
|
49
|
+
private const val TAG = "CustomMediaNotificationProvider"
|
|
50
|
+
|
|
51
|
+
enum class COMMAND(val stringValue: String) {
|
|
52
|
+
NONE("NONE"),
|
|
53
|
+
SEEK_FORWARD("COMMAND_SEEK_FORWARD"),
|
|
54
|
+
SEEK_BACKWARD("COMMAND_SEEK_BACKWARD"),
|
|
55
|
+
TOGGLE_PLAY("COMMAND_TOGGLE_PLAY"),
|
|
56
|
+
PLAY("COMMAND_PLAY"),
|
|
57
|
+
PAUSE("COMMAND_PAUSE")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
fun commandFromString(value: String): COMMAND =
|
|
61
|
+
when (value) {
|
|
62
|
+
COMMAND.SEEK_FORWARD.stringValue -> COMMAND.SEEK_FORWARD
|
|
63
|
+
COMMAND.SEEK_BACKWARD.stringValue -> COMMAND.SEEK_BACKWARD
|
|
64
|
+
COMMAND.TOGGLE_PLAY.stringValue -> COMMAND.TOGGLE_PLAY
|
|
65
|
+
COMMAND.PLAY.stringValue -> COMMAND.PLAY
|
|
66
|
+
COMMAND.PAUSE.stringValue -> COMMAND.PAUSE
|
|
67
|
+
else -> COMMAND.NONE
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
fun handleCommand(command: COMMAND, session: MediaSession) {
|
|
71
|
+
// TODO: get somehow ControlsConfig here - for now hardcoded 10000ms
|
|
72
|
+
|
|
73
|
+
when (command) {
|
|
74
|
+
COMMAND.SEEK_BACKWARD -> session.player.seekTo(session.player.contentPosition - SEEK_INTERVAL_MS)
|
|
75
|
+
COMMAND.SEEK_FORWARD -> session.player.seekTo(session.player.contentPosition + SEEK_INTERVAL_MS)
|
|
76
|
+
COMMAND.TOGGLE_PLAY -> handleCommand(if (session.player.isPlaying) COMMAND.PAUSE else COMMAND.PLAY, session)
|
|
77
|
+
COMMAND.PLAY -> session.player.play()
|
|
78
|
+
COMMAND.PAUSE -> session.player.pause()
|
|
79
|
+
else -> Log.w(TAG, "Received COMMAND.NONE - was there an error?")
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private fun getAppName(): String {
|
|
85
|
+
return try {
|
|
86
|
+
val context = getContext()
|
|
87
|
+
val applicationInfo = context.applicationInfo
|
|
88
|
+
val labelRes = applicationInfo.labelRes
|
|
89
|
+
if (labelRes != 0) {
|
|
90
|
+
context.getString(labelRes)
|
|
91
|
+
} else {
|
|
92
|
+
applicationInfo.nonLocalizedLabel?.toString() ?: context.packageManager.getApplicationLabel(applicationInfo).toString()
|
|
93
|
+
}
|
|
94
|
+
} catch (e: Exception) {
|
|
95
|
+
return "Unknown"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
override fun getMediaButtons(
|
|
100
|
+
session: MediaSession,
|
|
101
|
+
playerCommands: Player.Commands,
|
|
102
|
+
mediaButtonPreferences: ImmutableList<CommandButton>,
|
|
103
|
+
showPauseButton: Boolean
|
|
104
|
+
): ImmutableList<CommandButton> {
|
|
105
|
+
val rewind = CommandButton.Builder()
|
|
106
|
+
.setDisplayName("Rewind")
|
|
107
|
+
.setSessionCommand(androidx.media3.session.SessionCommand(
|
|
108
|
+
COMMAND.SEEK_BACKWARD.stringValue,
|
|
109
|
+
Bundle.EMPTY
|
|
110
|
+
))
|
|
111
|
+
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_back_10)
|
|
112
|
+
.setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 0))
|
|
113
|
+
.build()
|
|
114
|
+
|
|
115
|
+
val toggle = CommandButton.Builder()
|
|
116
|
+
.setDisplayName(if (showPauseButton) "Pause" else "Play")
|
|
117
|
+
.setSessionCommand(androidx.media3.session.SessionCommand(
|
|
118
|
+
COMMAND.TOGGLE_PLAY.stringValue,
|
|
119
|
+
Bundle.EMPTY
|
|
120
|
+
))
|
|
121
|
+
.setIconResId(
|
|
122
|
+
if (showPauseButton) androidx.media3.session.R.drawable.media3_icon_pause
|
|
123
|
+
else androidx.media3.session.R.drawable.media3_icon_play
|
|
124
|
+
)
|
|
125
|
+
.setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 1))
|
|
126
|
+
.build()
|
|
127
|
+
|
|
128
|
+
val forward = CommandButton.Builder()
|
|
129
|
+
.setDisplayName("Forward")
|
|
130
|
+
.setSessionCommand(androidx.media3.session.SessionCommand(
|
|
131
|
+
COMMAND.SEEK_FORWARD.stringValue,
|
|
132
|
+
Bundle.EMPTY
|
|
133
|
+
))
|
|
134
|
+
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_forward_10)
|
|
135
|
+
.setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 2))
|
|
136
|
+
.build()
|
|
137
|
+
|
|
138
|
+
return ImmutableList.of(rewind, toggle, forward)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
override fun addNotificationActions(
|
|
142
|
+
mediaSession: MediaSession,
|
|
143
|
+
mediaButtons: ImmutableList<CommandButton>,
|
|
144
|
+
builder: androidx.core.app.NotificationCompat.Builder,
|
|
145
|
+
actionFactory: androidx.media3.session.MediaNotification.ActionFactory
|
|
146
|
+
): IntArray {
|
|
147
|
+
// Use default behavior to add actions from our custom buttons and return compact indices
|
|
148
|
+
val compact = super.addNotificationActions(mediaSession, mediaButtons, builder, actionFactory)
|
|
149
|
+
return if (compact.isEmpty()) intArrayOf(0, 1, 2) else compact
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package com.twg.video.core.services.playback
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle
|
|
4
|
+
import androidx.annotation.OptIn
|
|
5
|
+
import androidx.media3.common.Player
|
|
6
|
+
import androidx.media3.common.util.UnstableApi
|
|
7
|
+
import androidx.media3.session.CommandButton
|
|
8
|
+
import androidx.media3.session.MediaSession
|
|
9
|
+
import androidx.media3.session.SessionCommand
|
|
10
|
+
import androidx.media3.session.SessionResult
|
|
11
|
+
import com.google.common.util.concurrent.ListenableFuture
|
|
12
|
+
import com.google.common.collect.ImmutableList
|
|
13
|
+
|
|
14
|
+
@OptIn(UnstableApi::class)
|
|
15
|
+
class VideoPlaybackCallback : MediaSession.Callback {
|
|
16
|
+
// For Android 13+
|
|
17
|
+
private fun buildCustomButtons(): ImmutableList<CommandButton> {
|
|
18
|
+
val rewind = CommandButton.Builder()
|
|
19
|
+
.setDisplayName("Rewind")
|
|
20
|
+
.setSessionCommand(
|
|
21
|
+
SessionCommand(
|
|
22
|
+
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
|
|
23
|
+
Bundle.EMPTY
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_back_10)
|
|
27
|
+
.build()
|
|
28
|
+
|
|
29
|
+
val forward = CommandButton.Builder()
|
|
30
|
+
.setDisplayName("Forward")
|
|
31
|
+
.setSessionCommand(
|
|
32
|
+
SessionCommand(
|
|
33
|
+
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
|
|
34
|
+
Bundle.EMPTY
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
.setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_forward_10)
|
|
38
|
+
.build()
|
|
39
|
+
|
|
40
|
+
return ImmutableList.of(rewind, forward)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override fun onConnect(session: MediaSession, controller: MediaSession.ControllerInfo): MediaSession.ConnectionResult {
|
|
44
|
+
try {
|
|
45
|
+
return MediaSession.ConnectionResult.AcceptedResultBuilder(session)
|
|
46
|
+
.setAvailablePlayerCommands(
|
|
47
|
+
MediaSession.ConnectionResult.DEFAULT_PLAYER_COMMANDS.buildUpon()
|
|
48
|
+
.add(Player.COMMAND_SEEK_FORWARD)
|
|
49
|
+
.add(Player.COMMAND_SEEK_BACK)
|
|
50
|
+
.build()
|
|
51
|
+
).setAvailableSessionCommands(
|
|
52
|
+
MediaSession.ConnectionResult.DEFAULT_SESSION_COMMANDS.buildUpon()
|
|
53
|
+
.add(
|
|
54
|
+
SessionCommand(
|
|
55
|
+
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
|
|
56
|
+
Bundle.EMPTY
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
.add(
|
|
60
|
+
SessionCommand(
|
|
61
|
+
CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
|
|
62
|
+
Bundle.EMPTY
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
.add(
|
|
66
|
+
SessionCommand(
|
|
67
|
+
CustomMediaNotificationProvider.Companion.COMMAND.TOGGLE_PLAY.stringValue,
|
|
68
|
+
Bundle.EMPTY
|
|
69
|
+
)
|
|
70
|
+
).build()
|
|
71
|
+
).build()
|
|
72
|
+
} catch (e: Exception) {
|
|
73
|
+
return MediaSession.ConnectionResult.reject()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
override fun onPostConnect(session: MediaSession, controller: MediaSession.ControllerInfo) {
|
|
78
|
+
session.setCustomLayout(buildCustomButtons())
|
|
79
|
+
super.onPostConnect(session, controller)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
override fun onCustomCommand(
|
|
83
|
+
session: MediaSession,
|
|
84
|
+
controller: MediaSession.ControllerInfo,
|
|
85
|
+
customCommand: SessionCommand,
|
|
86
|
+
args: Bundle
|
|
87
|
+
): ListenableFuture<SessionResult> {
|
|
88
|
+
CustomMediaNotificationProvider.Companion.handleCommand(
|
|
89
|
+
CustomMediaNotificationProvider.Companion.commandFromString(
|
|
90
|
+
customCommand.customAction
|
|
91
|
+
), session
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return super.onCustomCommand(session, controller, customCommand, args)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
package com.twg.video.core.services.playback
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.app.PendingIntent
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.os.Binder
|
|
7
|
+
import android.os.IBinder
|
|
8
|
+
import android.util.Log
|
|
9
|
+
import androidx.annotation.OptIn
|
|
10
|
+
import androidx.media3.common.util.BitmapLoader
|
|
11
|
+
import androidx.media3.common.util.UnstableApi
|
|
12
|
+
import androidx.media3.session.DefaultMediaNotificationProvider
|
|
13
|
+
import androidx.media3.session.SimpleBitmapLoader
|
|
14
|
+
import androidx.media3.session.MediaSession
|
|
15
|
+
import androidx.media3.session.MediaSessionService
|
|
16
|
+
import android.app.Notification
|
|
17
|
+
import android.app.NotificationChannel
|
|
18
|
+
import android.app.NotificationManager
|
|
19
|
+
import android.os.Build
|
|
20
|
+
import androidx.core.app.NotificationCompat
|
|
21
|
+
import com.margelo.nitro.NitroModules
|
|
22
|
+
import com.margelo.nitro.video.HybridVideoPlayer
|
|
23
|
+
import java.util.concurrent.ExecutorService
|
|
24
|
+
import java.util.concurrent.Executors
|
|
25
|
+
|
|
26
|
+
class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder()
|
|
27
|
+
|
|
28
|
+
@OptIn(UnstableApi::class)
|
|
29
|
+
class VideoPlaybackService : MediaSessionService() {
|
|
30
|
+
private var mediaSessionsList = mutableMapOf<HybridVideoPlayer, MediaSession>()
|
|
31
|
+
private var binder = VideoPlaybackServiceBinder(this)
|
|
32
|
+
private var sourceActivity: Class<Activity>? = null // retained for future deep-links; currently unused
|
|
33
|
+
private var isForeground = false
|
|
34
|
+
private var cachedLaunchIntent: Intent? = null
|
|
35
|
+
|
|
36
|
+
override fun onCreate() {
|
|
37
|
+
super.onCreate()
|
|
38
|
+
setMediaNotificationProvider(CustomMediaNotificationProvider(this))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
|
42
|
+
// Ensure we call startForeground quickly on newer Android versions to avoid
|
|
43
|
+
// ForegroundServiceDidNotStartInTimeException when startForegroundService(...) was used.
|
|
44
|
+
try {
|
|
45
|
+
if (!isForeground && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
46
|
+
startForeground(PLACEHOLDER_NOTIFICATION_ID, createPlaceholderNotification())
|
|
47
|
+
isForeground = true
|
|
48
|
+
}
|
|
49
|
+
} catch (_: Exception) {
|
|
50
|
+
Log.e(TAG, "Failed to start foreground service!")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return super.onStartCommand(intent, flags, startId)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Player Registry
|
|
57
|
+
fun registerPlayer(player: HybridVideoPlayer, from: Class<Activity>) {
|
|
58
|
+
if (mediaSessionsList.containsKey(player)) {
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
sourceActivity = from
|
|
62
|
+
|
|
63
|
+
val builder = MediaSession.Builder(this, player.player)
|
|
64
|
+
.setId("RNVideoPlaybackService_" + player.hashCode())
|
|
65
|
+
.setCallback(VideoPlaybackCallback())
|
|
66
|
+
|
|
67
|
+
// Ensure tapping the notification opens the app via sessionActivity
|
|
68
|
+
try {
|
|
69
|
+
var launchIntent = cachedLaunchIntent
|
|
70
|
+
if (launchIntent == null) {
|
|
71
|
+
launchIntent = packageManager.getLaunchIntentForPackage(packageName)
|
|
72
|
+
cachedLaunchIntent = launchIntent
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (launchIntent != null) {
|
|
76
|
+
// Clone the intent before modifying it to avoid mutating the cached instance
|
|
77
|
+
val intentToUse = launchIntent.clone() as Intent
|
|
78
|
+
intentToUse.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
|
79
|
+
val contentIntent = PendingIntent.getActivity(
|
|
80
|
+
this,
|
|
81
|
+
0,
|
|
82
|
+
intentToUse,
|
|
83
|
+
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
|
84
|
+
)
|
|
85
|
+
builder.setSessionActivity(contentIntent)
|
|
86
|
+
}
|
|
87
|
+
} catch (_: Exception) {}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
val mediaSession = builder.build()
|
|
91
|
+
|
|
92
|
+
mediaSessionsList[player] = mediaSession
|
|
93
|
+
addSession(mediaSession)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
fun unregisterPlayer(player: HybridVideoPlayer) {
|
|
97
|
+
val session = mediaSessionsList.remove(player)
|
|
98
|
+
session?.release()
|
|
99
|
+
stopIfNoPlayers()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
fun updatePlayerPreferences(player: HybridVideoPlayer) {
|
|
103
|
+
val session = mediaSessionsList[player]
|
|
104
|
+
if (session == null) {
|
|
105
|
+
// If not registered but now needs it, register
|
|
106
|
+
if (player.playInBackground || player.showNotificationControls) {
|
|
107
|
+
val activity = try { NitroModules.applicationContext?.currentActivity } catch (_: Exception) { null }
|
|
108
|
+
if (activity != null) registerPlayer(player, activity.javaClass)
|
|
109
|
+
}
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// If no longer needs registration, unregister and possibly stop service
|
|
114
|
+
if (!player.playInBackground && !player.showNotificationControls) {
|
|
115
|
+
unregisterPlayer(player)
|
|
116
|
+
stopIfNoPlayers()
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Callbacks
|
|
122
|
+
|
|
123
|
+
override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaSession? = null
|
|
124
|
+
|
|
125
|
+
override fun onBind(intent: Intent?): IBinder {
|
|
126
|
+
super.onBind(intent)
|
|
127
|
+
return binder
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
override fun onTaskRemoved(rootIntent: Intent?) {
|
|
131
|
+
stopForegroundSafely()
|
|
132
|
+
cleanup()
|
|
133
|
+
stopSelf()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
override fun onDestroy() {
|
|
137
|
+
stopForegroundSafely()
|
|
138
|
+
cleanup()
|
|
139
|
+
super.onDestroy()
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private fun stopForegroundSafely() {
|
|
143
|
+
try {
|
|
144
|
+
stopForeground(STOP_FOREGROUND_REMOVE)
|
|
145
|
+
} catch (_: Exception) {
|
|
146
|
+
Log.e(TAG, "Failed to stop foreground service!")
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private fun cleanup() {
|
|
151
|
+
stopForegroundSafely()
|
|
152
|
+
stopSelf()
|
|
153
|
+
mediaSessionsList.forEach { (_, session) ->
|
|
154
|
+
session.release()
|
|
155
|
+
}
|
|
156
|
+
mediaSessionsList.clear()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Stop the service if there are no active media sessions (no players need it)
|
|
160
|
+
fun stopIfNoPlayers() {
|
|
161
|
+
if (mediaSessionsList.isEmpty()) {
|
|
162
|
+
// Remove placeholder notification and stop the service when no active players exist
|
|
163
|
+
try {
|
|
164
|
+
if (isForeground) {
|
|
165
|
+
stopForegroundSafely()
|
|
166
|
+
isForeground = false
|
|
167
|
+
}
|
|
168
|
+
} catch (_: Exception) {
|
|
169
|
+
Log.e(TAG, "Failed to stop foreground service!")
|
|
170
|
+
}
|
|
171
|
+
cleanup()
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
companion object {
|
|
176
|
+
const val TAG = "VideoPlaybackService"
|
|
177
|
+
const val VIDEO_PLAYBACK_SERVICE_INTERFACE = SERVICE_INTERFACE
|
|
178
|
+
private const val PLACEHOLDER_NOTIFICATION_ID = 1729
|
|
179
|
+
private const val NOTIFICATION_CHANNEL_ID = "twg_video_playback"
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private fun createPlaceholderNotification(): Notification {
|
|
183
|
+
val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
|
184
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
185
|
+
try {
|
|
186
|
+
if (nm.getNotificationChannel(NOTIFICATION_CHANNEL_ID) == null) {
|
|
187
|
+
val channel = NotificationChannel(
|
|
188
|
+
NOTIFICATION_CHANNEL_ID,
|
|
189
|
+
"Media playback",
|
|
190
|
+
NotificationManager.IMPORTANCE_LOW
|
|
191
|
+
)
|
|
192
|
+
channel.setShowBadge(false)
|
|
193
|
+
nm.createNotificationChannel(channel)
|
|
194
|
+
}
|
|
195
|
+
} catch (_: Exception) {
|
|
196
|
+
Log.e(TAG, "Failed to create notification channel!")
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
val appName = try {
|
|
201
|
+
val labelRes = applicationInfo.labelRes
|
|
202
|
+
if (labelRes != 0) {
|
|
203
|
+
getString(labelRes)
|
|
204
|
+
} else {
|
|
205
|
+
applicationInfo.nonLocalizedLabel?.toString() ?: applicationInfo.loadLabel(packageManager).toString()
|
|
206
|
+
}
|
|
207
|
+
} catch (_: Exception) {
|
|
208
|
+
"Media Playback"
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
|
|
212
|
+
.setSmallIcon(android.R.drawable.ic_media_play)
|
|
213
|
+
.setContentTitle(appName)
|
|
214
|
+
.setContentText("")
|
|
215
|
+
.setOngoing(true)
|
|
216
|
+
.setCategory(Notification.CATEGORY_SERVICE)
|
|
217
|
+
.build()
|
|
218
|
+
}
|
|
219
|
+
}
|
package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackServiceConnection.kt
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package com.twg.video.core.services.playback
|
|
2
|
+
|
|
3
|
+
import android.content.ComponentName
|
|
4
|
+
import android.content.ServiceConnection
|
|
5
|
+
import android.os.IBinder
|
|
6
|
+
import android.util.Log
|
|
7
|
+
import androidx.annotation.OptIn
|
|
8
|
+
import androidx.media3.common.util.UnstableApi
|
|
9
|
+
import com.margelo.nitro.NitroModules
|
|
10
|
+
import com.margelo.nitro.video.HybridVideoPlayer
|
|
11
|
+
import java.lang.ref.WeakReference
|
|
12
|
+
|
|
13
|
+
@OptIn(UnstableApi::class)
|
|
14
|
+
class VideoPlaybackServiceConnection (private val player: WeakReference<HybridVideoPlayer>) :
|
|
15
|
+
ServiceConnection {
|
|
16
|
+
var serviceBinder: VideoPlaybackServiceBinder? = null
|
|
17
|
+
|
|
18
|
+
override fun onServiceConnected(componentName: ComponentName?, binder: IBinder?) {
|
|
19
|
+
val player = player.get() ?: return
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
val activity = NitroModules.Companion.applicationContext?.currentActivity ?: run {
|
|
23
|
+
Log.e("VideoPlaybackServiceConnection", "Activity is null")
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
serviceBinder = binder as? VideoPlaybackServiceBinder
|
|
28
|
+
// Only register when the player actually needs background service/notification
|
|
29
|
+
if (player.playInBackground || player.showNotificationControls) {
|
|
30
|
+
serviceBinder?.service?.registerPlayer(player, activity.javaClass)
|
|
31
|
+
}
|
|
32
|
+
} catch (err: Exception) {
|
|
33
|
+
Log.e("VideoPlaybackServiceConnection", "Could not bind to playback service", err)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun onServiceDisconnected(componentName: ComponentName?) {
|
|
38
|
+
player.get()?.let {
|
|
39
|
+
unregisterPlayer(it)
|
|
40
|
+
}
|
|
41
|
+
serviceBinder = null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override fun onNullBinding(componentName: ComponentName?) {
|
|
45
|
+
Log.e(
|
|
46
|
+
"VideoPlaybackServiceConnection",
|
|
47
|
+
"Could not bind to playback service - there can be issues with background playback" +
|
|
48
|
+
"and notification controls"
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
fun unregisterPlayer(player: HybridVideoPlayer) {
|
|
53
|
+
try {
|
|
54
|
+
if (serviceBinder?.service != null) {
|
|
55
|
+
serviceBinder?.service?.unregisterPlayer(player)
|
|
56
|
+
}
|
|
57
|
+
} catch (_: Exception) {}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
package com.twg.video.core.utils
|
|
2
|
+
|
|
3
|
+
import android.app.PictureInPictureParams
|
|
4
|
+
import android.content.pm.PackageManager
|
|
5
|
+
import android.graphics.Rect
|
|
6
|
+
import android.os.Build
|
|
7
|
+
import android.util.Log
|
|
8
|
+
import android.util.Rational
|
|
9
|
+
import android.view.View
|
|
10
|
+
import androidx.annotation.OptIn
|
|
11
|
+
import androidx.annotation.RequiresApi
|
|
12
|
+
import androidx.media3.common.util.UnstableApi
|
|
13
|
+
import com.margelo.nitro.NitroModules
|
|
14
|
+
import com.twg.video.view.VideoView
|
|
15
|
+
|
|
16
|
+
@OptIn(UnstableApi::class)
|
|
17
|
+
object PictureInPictureUtils {
|
|
18
|
+
private const val TAG = "PictureInPictureUtils"
|
|
19
|
+
|
|
20
|
+
fun canEnterPictureInPicture(): Boolean {
|
|
21
|
+
val applicationContent = NitroModules.applicationContext
|
|
22
|
+
val currentActivity = applicationContent?.currentActivity
|
|
23
|
+
return currentActivity?.packageManager?.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) == true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@RequiresApi(Build.VERSION_CODES.O)
|
|
27
|
+
fun createPictureInPictureParams(videoView: VideoView): PictureInPictureParams {
|
|
28
|
+
val builder = PictureInPictureParams.Builder()
|
|
29
|
+
|
|
30
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && videoView.autoEnterPictureInPicture) {
|
|
31
|
+
builder.setAutoEnterEnabled(videoView.autoEnterPictureInPicture)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return builder
|
|
35
|
+
.setAspectRatio(calculateAspectRatio(videoView))
|
|
36
|
+
.setSourceRectHint(calculateSourceRectHint(videoView.playerView))
|
|
37
|
+
.build()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@RequiresApi(Build.VERSION_CODES.O)
|
|
41
|
+
fun createDisabledPictureInPictureParams(videoView: VideoView): PictureInPictureParams {
|
|
42
|
+
val defaultParams = PictureInPictureParams.Builder()
|
|
43
|
+
.setAspectRatio(null) // Clear aspect ratio
|
|
44
|
+
.setSourceRectHint(null) // Clear source rect hint
|
|
45
|
+
|
|
46
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
47
|
+
defaultParams.setAutoEnterEnabled(false)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return defaultParams.build()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
fun calculateAspectRatio(videoView: VideoView): Rational {
|
|
54
|
+
// AspectRatio for PIP must be between 2.39:1 and 1:2.39
|
|
55
|
+
// see: https://developer.android.com/reference/android/app/PictureInPictureParams.Builder#setAspectRatio(android.util.Rational)
|
|
56
|
+
|
|
57
|
+
val maximumAspectRatio = Rational(239, 100)
|
|
58
|
+
val minimumAspectRatio = Rational(100, 239)
|
|
59
|
+
|
|
60
|
+
val player = videoView.hybridPlayer?.player
|
|
61
|
+
val videoFormat = player?.videoFormat
|
|
62
|
+
|
|
63
|
+
var width: Int
|
|
64
|
+
var height: Int
|
|
65
|
+
|
|
66
|
+
if (videoFormat != null && videoFormat.width > 0 && videoFormat.height > 0) {
|
|
67
|
+
width = videoFormat.width
|
|
68
|
+
height = videoFormat.height
|
|
69
|
+
|
|
70
|
+
val rotationDegrees = videoFormat.rotationDegrees
|
|
71
|
+
if (rotationDegrees == 90 || rotationDegrees == 270) {
|
|
72
|
+
val temp = width
|
|
73
|
+
width = height
|
|
74
|
+
height = temp
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Log.d(TAG, "Using video format dimensions for PiP: ${width}x${height} (rotation: ${rotationDegrees}°)")
|
|
78
|
+
} else {
|
|
79
|
+
width = videoView.playerView.width
|
|
80
|
+
height = videoView.playerView.height
|
|
81
|
+
Log.d(TAG, "Using view dimensions for PiP: ${width}x${height}")
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
val currentAspectRatio = Rational(width, height)
|
|
85
|
+
|
|
86
|
+
return when {
|
|
87
|
+
currentAspectRatio > maximumAspectRatio -> maximumAspectRatio
|
|
88
|
+
currentAspectRatio < minimumAspectRatio -> minimumAspectRatio
|
|
89
|
+
else -> currentAspectRatio
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fun calculateSourceRectHint(view: View): Rect {
|
|
94
|
+
// Get the visible rectangle of view in screen coordinates
|
|
95
|
+
val visibleRect = Rect()
|
|
96
|
+
view.getGlobalVisibleRect(visibleRect)
|
|
97
|
+
|
|
98
|
+
// Get the Y position of view on the screen
|
|
99
|
+
val locationOnScreen = IntArray(2)
|
|
100
|
+
view.getLocationOnScreen(locationOnScreen)
|
|
101
|
+
val yOnScreen = locationOnScreen[1]
|
|
102
|
+
|
|
103
|
+
// Preserve the original height
|
|
104
|
+
val height = visibleRect.height()
|
|
105
|
+
|
|
106
|
+
// Set the new top and bottom based on the view's screen position
|
|
107
|
+
visibleRect.top = yOnScreen
|
|
108
|
+
visibleRect.bottom = yOnScreen + height
|
|
109
|
+
|
|
110
|
+
return visibleRect
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
fun safeSetPictureInPictureParams(params: PictureInPictureParams) {
|
|
114
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
115
|
+
try {
|
|
116
|
+
val currentActivity = NitroModules.applicationContext?.currentActivity
|
|
117
|
+
currentActivity?.setPictureInPictureParams(params)
|
|
118
|
+
Log.d(TAG, "Successfully set PiP params")
|
|
119
|
+
} catch (e: Exception) {
|
|
120
|
+
Log.w(TAG, "Failed to set PiP params - PiP may not be enabled in manifest", e)
|
|
121
|
+
// Ignore: We cannot check if user has added support for PIP in manifest
|
|
122
|
+
// so we need to catch error if he did not add it.
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@RequiresApi(Build.VERSION_CODES.O)
|
|
128
|
+
fun safeEnterPictureInPictureMode(params: PictureInPictureParams): Boolean {
|
|
129
|
+
return try {
|
|
130
|
+
val currentActivity = NitroModules.applicationContext?.currentActivity
|
|
131
|
+
val result = currentActivity?.enterPictureInPictureMode(params) ?: false
|
|
132
|
+
Log.d(TAG, "PiP enter result: $result")
|
|
133
|
+
result
|
|
134
|
+
} catch (e: Exception) {
|
|
135
|
+
Log.e(TAG, "Failed to enter PiP mode", e)
|
|
136
|
+
false
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fun isCurrentlyInPictureInPictureMode(): Boolean {
|
|
141
|
+
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
142
|
+
try {
|
|
143
|
+
val currentActivity = NitroModules.applicationContext?.currentActivity
|
|
144
|
+
currentActivity?.isInPictureInPictureMode == true
|
|
145
|
+
} catch (e: Exception) {
|
|
146
|
+
Log.w(TAG, "Failed to check PiP mode status", e)
|
|
147
|
+
false
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|