spactureai-mobile-player 1.0.30
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 +474 -0
- package/UnifiedPlayer.podspec +51 -0
- package/android/CMakeLists.txt +29 -0
- package/android/build.gradle +249 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +15 -0
- package/android/src/main/AndroidManifest.xml +10 -0
- package/android/src/main/AndroidManifestNew.xml +9 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/unifiedplayer/core/AudioFocusManager.kt +233 -0
- package/android/src/main/java/com/unifiedplayer/core/VideoError.kt +105 -0
- package/android/src/main/java/com/unifiedplayer/core/VideoManager.kt +292 -0
- package/android/src/main/java/com/unifiedplayer/core/extensions/ResizeMode+AspectRatioFrameLayout.kt +20 -0
- package/android/src/main/java/com/unifiedplayer/core/extensions/SubtitleType+toString.kt +14 -0
- package/android/src/main/java/com/unifiedplayer/core/extensions/VideoPlaybackService+ServiceManagment.kt +59 -0
- package/android/src/main/java/com/unifiedplayer/core/fragments/FullscreenVideoFragment.kt +346 -0
- package/android/src/main/java/com/unifiedplayer/core/fragments/PictureInPictureHelperFragment.kt +85 -0
- package/android/src/main/java/com/unifiedplayer/core/player/DRMManagerSpec.kt +23 -0
- package/android/src/main/java/com/unifiedplayer/core/player/DataSourceFactoryUtils.kt +93 -0
- package/android/src/main/java/com/unifiedplayer/core/player/MediaItemUtils.kt +141 -0
- package/android/src/main/java/com/unifiedplayer/core/player/MediaSourceUtils.kt +134 -0
- package/android/src/main/java/com/unifiedplayer/core/player/OnAudioFocusChangedListener.kt +25 -0
- package/android/src/main/java/com/unifiedplayer/core/plugins/PluginsRegistry.kt +223 -0
- package/android/src/main/java/com/unifiedplayer/core/plugins/ReactNativeVideoPlugin.kt +173 -0
- package/android/src/main/java/com/unifiedplayer/core/recivers/AudioBecomingNoisyReceiver.kt +38 -0
- package/android/src/main/java/com/unifiedplayer/core/services/playback/CustomMediaNotificationProvider.kt +151 -0
- package/android/src/main/java/com/unifiedplayer/core/services/playback/VideoPlaybackCallback.kt +96 -0
- package/android/src/main/java/com/unifiedplayer/core/services/playback/VideoPlaybackService.kt +219 -0
- package/android/src/main/java/com/unifiedplayer/core/services/playback/VideoPlaybackServiceConnection.kt +59 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/PictureInPictureUtils.kt +153 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/SmallVideoPlayerOptimizer.kt +157 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/SourceLoader.kt +48 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/TextTrackUtils.kt +175 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/Threading.kt +75 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/VideoFileHelper.kt +51 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/VideoInformationUtils.kt +67 -0
- package/android/src/main/java/com/unifiedplayer/core/utils/VideoOrientationUtils.kt +30 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoplayer/HybridVideoPlayer.kt +732 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoplayer/HybridVideoPlayerFactory.kt +16 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoplayereventemitter/HybridVideoPlayerEventEmitter.kt +180 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoplayersource/HybridVideoPlayerSource.kt +67 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoplayersource/HybridVideoPlayerSourceFactory.kt +58 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoviewviewmanager/HybridVideoViewViewManager.kt +187 -0
- package/android/src/main/java/com/unifiedplayer/hybrids/videoviewviewmanager/HybridVideoViewViewManagerFactory.kt +13 -0
- package/android/src/main/java/com/unifiedplayer/react/VideoPackage.kt +25 -0
- package/android/src/main/java/com/unifiedplayer/react/VideoViewViewManager.kt +78 -0
- package/android/src/main/java/com/unifiedplayer/view/VideoView.kt +565 -0
- package/android/src/main/res/layout/custom_player_control_view.xml +82 -0
- package/android/src/main/res/layout/player_view_surface.xml +13 -0
- package/android/src/main/res/layout/player_view_texture.xml +13 -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/ios/RNCVideoViewManager.mm +39 -0
- package/ios/Video-Bridging-Header.h +2 -0
- package/ios/core/HLSAuthProxy.swift +428 -0
- package/ios/core/VideoError.swift +164 -0
- package/ios/core/VideoManager.swift +219 -0
- package/ios/hybrids/VideoPlayer/HybridVideoPlayer.swift +697 -0
- package/ios/hybrids/VideoPlayer/HybridVideoPlayerFactory.swift +15 -0
- package/ios/hybrids/VideoPlayer/VLCPlaybackDelegates.swift +58 -0
- package/ios/hybrids/VideoPlayerEmitter/HybridVideoPlayerEventEmitter.swift +203 -0
- package/ios/hybrids/VideoPlayerSource/HybridVideoPlayerSource.swift +55 -0
- package/ios/hybrids/VideoPlayerSource/HybridVideoPlayerSourceFactory.swift +29 -0
- package/ios/hybrids/VideoViewViewManager/HybridVideoViewViewManager.swift +266 -0
- package/ios/hybrids/VideoViewViewManager/HybridVideoViewViewManagerFactory.swift +14 -0
- package/ios/view/VideoComponentView.swift +196 -0
- package/ios/view/VideoComponentViewObserver.swift +48 -0
- package/lib/module/core/VideoPlayer.js +287 -0
- package/lib/module/core/VideoPlayer.js.map +1 -0
- package/lib/module/core/VideoPlayerEvents.js +84 -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/ResizeMode.js +2 -0
- package/lib/module/core/types/ResizeMode.js.map +1 -0
- package/lib/module/core/types/TextTrack.js +2 -0
- package/lib/module/core/types/TextTrack.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.tsx +18 -0
- package/lib/module/core/video-view/VideoView.js +261 -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 +8 -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/drm-plugin/src/PluginManager.nitro.d.ts +10 -0
- package/lib/typescript/drm-plugin/src/PluginManager.nitro.d.ts.map +1 -0
- package/lib/typescript/drm-plugin/src/index.d.ts +4 -0
- package/lib/typescript/drm-plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/core/VideoPlayer.d.ts +88 -0
- package/lib/typescript/src/core/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/core/VideoPlayerEvents.d.ts +22 -0
- package/lib/typescript/src/core/VideoPlayerEvents.d.ts.map +1 -0
- package/lib/typescript/src/core/hooks/useEvent.d.ts +11 -0
- package/lib/typescript/src/core/hooks/useEvent.d.ts.map +1 -0
- package/lib/typescript/src/core/hooks/useManagedInstance.d.ts +19 -0
- package/lib/typescript/src/core/hooks/useManagedInstance.d.ts.map +1 -0
- package/lib/typescript/src/core/hooks/useVideoPlayer.d.ts +16 -0
- package/lib/typescript/src/core/hooks/useVideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/core/types/BufferConfig.d.ts +97 -0
- package/lib/typescript/src/core/types/BufferConfig.d.ts.map +1 -0
- package/lib/typescript/src/core/types/DrmParams.d.ts +64 -0
- package/lib/typescript/src/core/types/DrmParams.d.ts.map +1 -0
- package/lib/typescript/src/core/types/Events.d.ts +224 -0
- package/lib/typescript/src/core/types/Events.d.ts.map +1 -0
- package/lib/typescript/src/core/types/IgnoreSilentSwitchMode.d.ts +2 -0
- package/lib/typescript/src/core/types/IgnoreSilentSwitchMode.d.ts.map +1 -0
- package/lib/typescript/src/core/types/MixAudioMode.d.ts +2 -0
- package/lib/typescript/src/core/types/MixAudioMode.d.ts.map +1 -0
- package/lib/typescript/src/core/types/ResizeMode.d.ts +10 -0
- package/lib/typescript/src/core/types/ResizeMode.d.ts.map +1 -0
- package/lib/typescript/src/core/types/TextTrack.d.ts +20 -0
- package/lib/typescript/src/core/types/TextTrack.d.ts.map +1 -0
- package/lib/typescript/src/core/types/Utils.d.ts +2 -0
- package/lib/typescript/src/core/types/Utils.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoConfig.d.ts +138 -0
- package/lib/typescript/src/core/types/VideoConfig.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoError.d.ts +31 -0
- package/lib/typescript/src/core/types/VideoError.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoInformation.d.ts +38 -0
- package/lib/typescript/src/core/types/VideoInformation.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoOrientation.d.ts +2 -0
- package/lib/typescript/src/core/types/VideoOrientation.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoPlayerBase.d.ts +155 -0
- package/lib/typescript/src/core/types/VideoPlayerBase.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoPlayerSourceBase.d.ts +17 -0
- package/lib/typescript/src/core/types/VideoPlayerSourceBase.d.ts.map +1 -0
- package/lib/typescript/src/core/types/VideoPlayerStatus.d.ts +9 -0
- package/lib/typescript/src/core/types/VideoPlayerStatus.d.ts.map +1 -0
- package/lib/typescript/src/core/utils/playerFactory.d.ts +12 -0
- package/lib/typescript/src/core/utils/playerFactory.d.ts.map +1 -0
- package/lib/typescript/src/core/utils/sourceFactory.d.ts +29 -0
- package/lib/typescript/src/core/utils/sourceFactory.d.ts.map +1 -0
- package/lib/typescript/src/core/video-view/NativeVideoView.d.ts +2 -0
- package/lib/typescript/src/core/video-view/NativeVideoView.d.ts.map +1 -0
- package/lib/typescript/src/core/video-view/VideoView.d.ts +104 -0
- package/lib/typescript/src/core/video-view/VideoView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +13 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/spec/fabric/VideoViewNativeComponent.d.ts +13 -0
- package/lib/typescript/src/spec/fabric/VideoViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/spec/nitro/VideoPlayer.nitro.d.ts +55 -0
- package/lib/typescript/src/spec/nitro/VideoPlayer.nitro.d.ts.map +1 -0
- package/lib/typescript/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts +150 -0
- package/lib/typescript/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts.map +1 -0
- package/lib/typescript/src/spec/nitro/VideoPlayerSource.nitro.d.ts +21 -0
- package/lib/typescript/src/spec/nitro/VideoPlayerSource.nitro.d.ts.map +1 -0
- package/lib/typescript/src/spec/nitro/VideoViewViewManager.nitro.d.ts +75 -0
- package/lib/typescript/src/spec/nitro/VideoViewViewManager.nitro.d.ts.map +1 -0
- package/nitro.json +47 -0
- package/nitrogen/generated/android/UnifiedPlayer+autolinking.cmake +95 -0
- package/nitrogen/generated/android/UnifiedPlayer+autolinking.gradle +27 -0
- package/nitrogen/generated/android/UnifiedPlayerOnLoad.cpp +122 -0
- package/nitrogen/generated/android/UnifiedPlayerOnLoad.hpp +34 -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++/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 +79 -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__optional_std__variant_nitro__NullType__TextTrack__.hpp +83 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +95 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerEventEmitterSpec.cpp +224 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerEventEmitterSpec.hpp +82 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerFactorySpec.cpp +60 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerFactorySpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceFactorySpec.cpp +106 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceFactorySpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceSpec.cpp +124 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSpec.cpp +300 -0
- package/nitrogen/generated/android/c++/JHybridVideoPlayerSpec.hpp +98 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.cpp +56 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerSpec.cpp +185 -0
- package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerSpec.hpp +87 -0
- package/nitrogen/generated/android/c++/JIgnoreSilentSwitchMode.hpp +61 -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 +64 -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 +136 -0
- package/nitrogen/generated/android/c++/JOnGetLicensePayload.hpp +69 -0
- package/nitrogen/generated/android/c++/JResizeMode.hpp +64 -0
- package/nitrogen/generated/android/c++/JResolution.hpp +61 -0
- package/nitrogen/generated/android/c++/JSourceType.hpp +58 -0
- package/nitrogen/generated/android/c++/JSubtitleType.hpp +67 -0
- package/nitrogen/generated/android/c++/JSurfaceType.hpp +58 -0
- package/nitrogen/generated/android/c++/JTextTrack.hpp +70 -0
- package/nitrogen/generated/android/c++/JTimedMetadata.hpp +78 -0
- package/nitrogen/generated/android/c++/JTimedMetadataObject.hpp +61 -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++/JVariant_NullType_TextTrack.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_TextTrack.hpp +73 -0
- package/nitrogen/generated/android/c++/JVideoInformation.hpp +86 -0
- package/nitrogen/generated/android/c++/JVideoOrientation.hpp +73 -0
- package/nitrogen/generated/android/c++/JVideoPlayerStatus.hpp +64 -0
- package/nitrogen/generated/android/c++/JonLoadData.hpp +74 -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 +65 -0
- package/nitrogen/generated/android/c++/JonVolumeChangeData.hpp +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/BandwidthData.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/BufferConfig.kt +101 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/CustomVideoMetadata.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_BandwidthData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_TimedMetadata.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_VideoPlayerStatus.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_bool.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_onLoadData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_onLoadStartData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_onPlaybackStateChangeData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_onProgressData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_onVolumeChangeData.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_std__optional_std__variant_nitro__NullType__TextTrack__.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Func_void_std__vector_std__string_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoPlayerEventEmitterSpec.kt +226 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoPlayerFactorySpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoPlayerSourceFactorySpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoPlayerSourceSpec.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoPlayerSpec.kt +178 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoViewViewManagerFactorySpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/HybridVideoViewViewManagerSpec.kt +168 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/IgnoreSilentSwitchMode.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/ListenerSubscription.kt +55 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/LivePlaybackParams.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/MixAudioMode.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/NativeDrmParams.kt +85 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/NativeExternalSubtitle.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/NativeVideoConfig.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/OnGetLicensePayload.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/ResizeMode.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Resolution.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/SourceType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/SubtitleType.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/SurfaceType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/TextTrack.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/TimedMetadata.kt +51 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/TimedMetadataObject.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/UnifiedPlayerOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Variant_NullType_HybridVideoPlayerSourceSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/Variant_NullType_TextTrack.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/VideoInformation.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/VideoOrientation.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/VideoPlayerStatus.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/onLoadData.kt +71 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/onLoadStartData.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/onPlaybackStateChangeData.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/onProgressData.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unifiedplayer/onVolumeChangeData.kt +56 -0
- package/nitrogen/generated/ios/UnifiedPlayer+autolinking.rb +62 -0
- package/nitrogen/generated/ios/UnifiedPlayer-Swift-Cxx-Bridge.cpp +280 -0
- package/nitrogen/generated/ios/UnifiedPlayer-Swift-Cxx-Bridge.hpp +1106 -0
- package/nitrogen/generated/ios/UnifiedPlayer-Swift-Cxx-Umbrella.hpp +162 -0
- package/nitrogen/generated/ios/UnifiedPlayerAutolinking.mm +49 -0
- package/nitrogen/generated/ios/UnifiedPlayerAutolinking.swift +50 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerEventEmitterSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerEventEmitterSpecSwift.hpp +279 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoPlayerFactorySpecSwift.hpp +87 -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 +256 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerFactorySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerFactorySpecSwift.hpp +84 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerSpecSwift.hpp +217 -0
- package/nitrogen/generated/ios/swift/BandwidthData.swift +65 -0
- package/nitrogen/generated/ios/swift/BufferConfig.swift +201 -0
- package/nitrogen/generated/ios/swift/CustomVideoMetadata.swift +114 -0
- package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.swift +61 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BandwidthData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_TimedMetadata.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_VideoInformation.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_VideoPlayerStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_onLoadData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_onLoadStartData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_onPlaybackStateChangeData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_onProgressData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_onVolumeChangeData.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__variant_nitro__NullType__TextTrack__.swift +65 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_std__string__.swift +66 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerEventEmitterSpec.swift +74 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerEventEmitterSpec_cxx.swift +479 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerFactorySpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerFactorySpec_cxx.swift +145 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceFactorySpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceFactorySpec_cxx.swift +156 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceSpec_cxx.swift +157 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSpec.swift +80 -0
- package/nitrogen/generated/ios/swift/HybridVideoPlayerSpec_cxx.swift +490 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerFactorySpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerFactorySpec_cxx.swift +141 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerSpec.swift +72 -0
- package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerSpec_cxx.swift +390 -0
- package/nitrogen/generated/ios/swift/IgnoreSilentSwitchMode.swift +44 -0
- package/nitrogen/generated/ios/swift/ListenerSubscription.swift +37 -0
- package/nitrogen/generated/ios/swift/LivePlaybackParams.swift +114 -0
- package/nitrogen/generated/ios/swift/MixAudioMode.swift +48 -0
- package/nitrogen/generated/ios/swift/NativeDrmParams.swift +193 -0
- package/nitrogen/generated/ios/swift/NativeExternalSubtitle.swift +44 -0
- package/nitrogen/generated/ios/swift/NativeVideoConfig.swift +136 -0
- package/nitrogen/generated/ios/swift/OnGetLicensePayload.swift +44 -0
- package/nitrogen/generated/ios/swift/ResizeMode.swift +48 -0
- package/nitrogen/generated/ios/swift/Resolution.swift +34 -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/TextTrack.swift +57 -0
- package/nitrogen/generated/ios/swift/TimedMetadata.swift +35 -0
- package/nitrogen/generated/ios/swift/TimedMetadataObject.swift +34 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_TextTrack.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType__any_HybridVideoPlayerSourceSpec_.swift +30 -0
- package/nitrogen/generated/ios/swift/VideoInformation.swift +64 -0
- package/nitrogen/generated/ios/swift/VideoOrientation.swift +60 -0
- package/nitrogen/generated/ios/swift/VideoPlayerStatus.swift +48 -0
- package/nitrogen/generated/ios/swift/onLoadData.swift +49 -0
- package/nitrogen/generated/ios/swift/onLoadStartData.swift +41 -0
- package/nitrogen/generated/ios/swift/onPlaybackStateChangeData.swift +34 -0
- package/nitrogen/generated/ios/swift/onProgressData.swift +39 -0
- package/nitrogen/generated/ios/swift/onVolumeChangeData.swift +34 -0
- package/nitrogen/generated/shared/c++/BandwidthData.hpp +91 -0
- package/nitrogen/generated/shared/c++/BufferConfig.hpp +128 -0
- package/nitrogen/generated/shared/c++/CustomVideoMetadata.hpp +100 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerEventEmitterSpec.cpp +40 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerEventEmitterSpec.hpp +115 -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 +57 -0
- package/nitrogen/generated/shared/c++/HybridVideoPlayerSpec.hpp +120 -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 +83 -0
- package/nitrogen/generated/shared/c++/LivePlaybackParams.hpp +99 -0
- package/nitrogen/generated/shared/c++/MixAudioMode.hpp +84 -0
- package/nitrogen/generated/shared/c++/NativeDrmParams.hpp +113 -0
- package/nitrogen/generated/shared/c++/NativeExternalSubtitle.hpp +97 -0
- package/nitrogen/generated/shared/c++/NativeVideoConfig.hpp +121 -0
- package/nitrogen/generated/shared/c++/OnGetLicensePayload.hpp +95 -0
- package/nitrogen/generated/shared/c++/ResizeMode.hpp +84 -0
- package/nitrogen/generated/shared/c++/Resolution.hpp +87 -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++/TextTrack.hpp +96 -0
- package/nitrogen/generated/shared/c++/TimedMetadata.hpp +85 -0
- package/nitrogen/generated/shared/c++/TimedMetadataObject.hpp +87 -0
- package/nitrogen/generated/shared/c++/VideoInformation.hpp +112 -0
- package/nitrogen/generated/shared/c++/VideoOrientation.hpp +96 -0
- package/nitrogen/generated/shared/c++/VideoPlayerStatus.hpp +84 -0
- package/nitrogen/generated/shared/c++/onLoadData.hpp +100 -0
- package/nitrogen/generated/shared/c++/onLoadStartData.hpp +92 -0
- package/nitrogen/generated/shared/c++/onPlaybackStateChangeData.hpp +87 -0
- package/nitrogen/generated/shared/c++/onProgressData.hpp +91 -0
- package/nitrogen/generated/shared/c++/onVolumeChangeData.hpp +87 -0
- package/package.json +180 -0
- package/react-native.config.js +10 -0
- package/src/core/VideoPlayer.ts +357 -0
- package/src/core/VideoPlayerEvents.ts +146 -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 +283 -0
- package/src/core/types/IgnoreSilentSwitchMode.ts +1 -0
- package/src/core/types/MixAudioMode.ts +1 -0
- package/src/core/types/ResizeMode.ts +9 -0
- package/src/core/types/TextTrack.ts +22 -0
- package/src/core/types/Utils.ts +1 -0
- package/src/core/types/VideoConfig.ts +150 -0
- package/src/core/types/VideoError.ts +174 -0
- package/src/core/types/VideoInformation.ts +45 -0
- package/src/core/types/VideoOrientation.ts +8 -0
- package/src/core/types/VideoPlayerBase.ts +181 -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 +492 -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 +29 -0
- package/src/spec/fabric/VideoViewNativeComponent.ts +17 -0
- package/src/spec/nitro/VideoPlayer.nitro.ts +62 -0
- package/src/spec/nitro/VideoPlayerEventEmitter.nitro.ts +207 -0
- package/src/spec/nitro/VideoPlayerSource.nitro.ts +18 -0
- package/src/spec/nitro/VideoViewViewManager.nitro.ts +92 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import type { VideoPlayerSource } from '../../spec/nitro/VideoPlayerSource.nitro';
|
|
2
|
+
import type { TextTrack } from './TextTrack';
|
|
3
|
+
import type { VideoRuntimeError } from './VideoError';
|
|
4
|
+
import type { VideoOrientation } from './VideoOrientation';
|
|
5
|
+
import type { VideoPlayerStatus } from './VideoPlayerStatus';
|
|
6
|
+
|
|
7
|
+
export interface VideoPlayerEvents {
|
|
8
|
+
/**
|
|
9
|
+
* Called when the audio becomes noisy.
|
|
10
|
+
* @platform Android
|
|
11
|
+
*/
|
|
12
|
+
onAudioBecomingNoisy: () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Called when the audio focus changes.
|
|
15
|
+
* @param hasAudioFocus Whether the audio has focus.
|
|
16
|
+
* @platform Android
|
|
17
|
+
*/
|
|
18
|
+
onAudioFocusChange: (hasAudioFocus: boolean) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the bandwidth of the video changes.
|
|
21
|
+
*/
|
|
22
|
+
onBandwidthUpdate: (data: BandwidthData) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Called when the video is buffering.
|
|
25
|
+
* @param buffering Whether the video is buffering.
|
|
26
|
+
*/
|
|
27
|
+
onBuffer: (buffering: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Called when the video view's controls visibility changes.
|
|
30
|
+
* @param visible Whether the video view's controls are visible.
|
|
31
|
+
*/
|
|
32
|
+
onControlsVisibleChange: (visible: boolean) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Called when the video ends.
|
|
35
|
+
*/
|
|
36
|
+
onEnd: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Called when the external playback state changes.
|
|
39
|
+
* @param externalPlaybackActive Whether the external playback is active.
|
|
40
|
+
* @platform iOS
|
|
41
|
+
*/
|
|
42
|
+
onExternalPlaybackChange: (externalPlaybackActive: boolean) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Called when the video is loaded.
|
|
45
|
+
* @note onLoadStart -> initialize the player -> onLoad
|
|
46
|
+
*/
|
|
47
|
+
onLoad: (data: onLoadData) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when the video starts loading.
|
|
50
|
+
* @note onLoadStart -> initialize the player -> onLoad
|
|
51
|
+
*/
|
|
52
|
+
onLoadStart: (data: onLoadStartData) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Called when the player playback state changes.
|
|
55
|
+
*/
|
|
56
|
+
onPlaybackStateChange: (data: onPlaybackStateChangeData) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Called when the player playback rate changes.
|
|
59
|
+
*/
|
|
60
|
+
onPlaybackRateChange: (rate: number) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Called when the player progress changes.
|
|
63
|
+
*/
|
|
64
|
+
onProgress: (data: onProgressData) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Called when the video is ready to display.
|
|
67
|
+
*/
|
|
68
|
+
onReadyToDisplay: () => void;
|
|
69
|
+
/**
|
|
70
|
+
* Called when the player seeks.
|
|
71
|
+
*/
|
|
72
|
+
onSeek: (seekTime: number) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Called when player receives timed metadata.
|
|
75
|
+
*/
|
|
76
|
+
onTimedMetadata: (metadata: TimedMetadata) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Called when the text track (currently displayed subtitle) data changes.
|
|
79
|
+
*/
|
|
80
|
+
onTextTrackDataChanged: (texts: string[]) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Called when the selected text track changes.
|
|
83
|
+
* @param track - The newly selected text track, or null if no track is selected
|
|
84
|
+
*/
|
|
85
|
+
onTrackChange: (track: TextTrack | null) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Called when the volume of the player changes.
|
|
88
|
+
*/
|
|
89
|
+
onVolumeChange: (data: onVolumeChangeData) => void;
|
|
90
|
+
/**
|
|
91
|
+
* Called when the player status changes.
|
|
92
|
+
*/
|
|
93
|
+
onStatusChange: (status: VideoPlayerStatus) => void;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface JSVideoPlayerEvents {
|
|
97
|
+
onError: (error: VideoRuntimeError) => void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type AllPlayerEvents = VideoPlayerEvents & JSVideoPlayerEvents;
|
|
101
|
+
|
|
102
|
+
export interface VideoViewEvents {
|
|
103
|
+
/**
|
|
104
|
+
* Called when the video view's picture in picture state changes.
|
|
105
|
+
* @param isInPictureInPicture Whether the video view is in picture in picture mode.
|
|
106
|
+
*/
|
|
107
|
+
onPictureInPictureChange: (isInPictureInPicture: boolean) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Called when the video view's fullscreen state changes.
|
|
110
|
+
* @param fullscreen Whether the video view is in fullscreen mode.
|
|
111
|
+
*/
|
|
112
|
+
onFullscreenChange: (fullscreen: boolean) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Called when the video view will enter fullscreen mode.
|
|
115
|
+
*/
|
|
116
|
+
willEnterFullscreen: () => void;
|
|
117
|
+
/**
|
|
118
|
+
* Called when the video view will exit fullscreen mode.
|
|
119
|
+
*/
|
|
120
|
+
willExitFullscreen: () => void;
|
|
121
|
+
/**
|
|
122
|
+
* Called when the video view will enter picture in picture mode.
|
|
123
|
+
*/
|
|
124
|
+
willEnterPictureInPicture: () => void;
|
|
125
|
+
/**
|
|
126
|
+
* Called when the video view will exit picture in picture mode.
|
|
127
|
+
*/
|
|
128
|
+
willExitPictureInPicture: () => void;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface BandwidthData {
|
|
132
|
+
/**
|
|
133
|
+
* The bitrate of the video in bits per second.
|
|
134
|
+
*/
|
|
135
|
+
bitrate: number;
|
|
136
|
+
/**
|
|
137
|
+
* The width of the video in pixels.
|
|
138
|
+
* @platform android
|
|
139
|
+
*/
|
|
140
|
+
width?: number;
|
|
141
|
+
/**
|
|
142
|
+
* The height of the video in pixels.
|
|
143
|
+
* @platform Android
|
|
144
|
+
*/
|
|
145
|
+
height?: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface onLoadData {
|
|
149
|
+
/**
|
|
150
|
+
* The current time of the video in seconds.
|
|
151
|
+
*/
|
|
152
|
+
currentTime: number;
|
|
153
|
+
/**
|
|
154
|
+
* The duration of the video in seconds.
|
|
155
|
+
* @note NaN if the duration is unknown.
|
|
156
|
+
*/
|
|
157
|
+
duration: number;
|
|
158
|
+
/**
|
|
159
|
+
* The height of the video in pixels.
|
|
160
|
+
*/
|
|
161
|
+
height: number;
|
|
162
|
+
/**
|
|
163
|
+
* The width of the video in pixels.
|
|
164
|
+
*/
|
|
165
|
+
width: number;
|
|
166
|
+
/**
|
|
167
|
+
* The orientation of the video.
|
|
168
|
+
*/
|
|
169
|
+
orientation: VideoOrientation;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type SourceType = 'local' | 'network';
|
|
173
|
+
|
|
174
|
+
export interface onLoadStartData {
|
|
175
|
+
/**
|
|
176
|
+
* The type of the source.
|
|
177
|
+
* @note `local` for local files, `network` for network sources.
|
|
178
|
+
*/
|
|
179
|
+
sourceType: SourceType;
|
|
180
|
+
/**
|
|
181
|
+
* The source of the video.
|
|
182
|
+
*/
|
|
183
|
+
source: VideoPlayerSource;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface onPlaybackStateChangeData {
|
|
187
|
+
/**
|
|
188
|
+
* Whether the video is playing.
|
|
189
|
+
*/
|
|
190
|
+
isPlaying: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Whether the video is buffering.
|
|
193
|
+
*/
|
|
194
|
+
isBuffering: boolean;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface onProgressData {
|
|
198
|
+
/**
|
|
199
|
+
* The current time of the video in seconds.
|
|
200
|
+
*/
|
|
201
|
+
currentTime: number;
|
|
202
|
+
/**
|
|
203
|
+
* The duration of the video in seconds.
|
|
204
|
+
* @note NaN if the duration is unknown (e.g., live streams).
|
|
205
|
+
*/
|
|
206
|
+
duration: number;
|
|
207
|
+
/**
|
|
208
|
+
* The time that player is able to play with only buffer.
|
|
209
|
+
*/
|
|
210
|
+
bufferDuration: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type TimedMetadataObject = {
|
|
214
|
+
value: string;
|
|
215
|
+
identifier: string;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export interface TimedMetadata {
|
|
219
|
+
/**
|
|
220
|
+
* The timed metadata of the video.
|
|
221
|
+
*/
|
|
222
|
+
metadata: Array<TimedMetadataObject>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface onVolumeChangeData {
|
|
226
|
+
/**
|
|
227
|
+
* The volume of the player (0.0 = 0%, 1.0 = 100%).
|
|
228
|
+
*/
|
|
229
|
+
volume: number;
|
|
230
|
+
/**
|
|
231
|
+
* Whether the player is muted.
|
|
232
|
+
*/
|
|
233
|
+
muted: boolean;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
type CheckAllAndOnly<T, A extends readonly (keyof T)[]> =
|
|
237
|
+
// Missing keys?
|
|
238
|
+
Exclude<keyof T, A[number]> extends never
|
|
239
|
+
? // Extra keys?
|
|
240
|
+
Exclude<A[number], keyof T> extends never
|
|
241
|
+
? A
|
|
242
|
+
: ['Extra keys', Exclude<A[number], keyof T>]
|
|
243
|
+
: ['Missing keys', Exclude<keyof T, A[number]>];
|
|
244
|
+
|
|
245
|
+
function allKeysOf<T>() {
|
|
246
|
+
return <A extends readonly (keyof T)[]>(...arr: A): CheckAllAndOnly<T, A> => {
|
|
247
|
+
return arr as CheckAllAndOnly<T, A>;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export const ALL_PLAYER_EVENTS: (keyof AllPlayerEvents)[] =
|
|
252
|
+
allKeysOf<AllPlayerEvents>()(
|
|
253
|
+
'onAudioBecomingNoisy',
|
|
254
|
+
'onAudioFocusChange',
|
|
255
|
+
'onBandwidthUpdate',
|
|
256
|
+
'onBuffer',
|
|
257
|
+
'onControlsVisibleChange',
|
|
258
|
+
'onEnd',
|
|
259
|
+
'onError',
|
|
260
|
+
'onExternalPlaybackChange',
|
|
261
|
+
'onLoad',
|
|
262
|
+
'onLoadStart',
|
|
263
|
+
'onPlaybackStateChange',
|
|
264
|
+
'onPlaybackRateChange',
|
|
265
|
+
'onProgress',
|
|
266
|
+
'onReadyToDisplay',
|
|
267
|
+
'onSeek',
|
|
268
|
+
'onTimedMetadata',
|
|
269
|
+
'onTextTrackDataChanged',
|
|
270
|
+
'onTrackChange',
|
|
271
|
+
'onVolumeChange',
|
|
272
|
+
'onStatusChange'
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
export const ALL_VIEW_EVENTS: (keyof VideoViewEvents)[] =
|
|
276
|
+
allKeysOf<VideoViewEvents>()(
|
|
277
|
+
'onPictureInPictureChange',
|
|
278
|
+
'onFullscreenChange',
|
|
279
|
+
'willEnterFullscreen',
|
|
280
|
+
'willExitFullscreen',
|
|
281
|
+
'willEnterPictureInPicture',
|
|
282
|
+
'willExitPictureInPicture'
|
|
283
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type IgnoreSilentSwitchMode = 'auto' | 'ignore' | 'obey';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MixAudioMode = 'mixWithOthers' | 'doNotMix' | 'duckOthers' | 'auto';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video resize modes that determine how video content is resized to fit the view
|
|
3
|
+
*
|
|
4
|
+
* - 'contain': Scale the video uniformly (maintain aspect ratio) so that it fits entirely within the view
|
|
5
|
+
* - 'cover': Scale the video uniformly (maintain aspect ratio) so that it fills the entire view (may crop)
|
|
6
|
+
* - 'stretch': Scale the video to fill the entire view without maintaining aspect ratio
|
|
7
|
+
* - 'none': Do not resize the video - it will fallback to default behavior (contain)
|
|
8
|
+
*/
|
|
9
|
+
export type ResizeMode = 'contain' | 'cover' | 'stretch' | 'none';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface TextTrack {
|
|
2
|
+
/**
|
|
3
|
+
* Unique identifier for the text track
|
|
4
|
+
*/
|
|
5
|
+
id: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Display label for the text track
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Language code (ISO 639-1 or ISO 639-2)
|
|
14
|
+
* @example "en", "es", "fr"
|
|
15
|
+
*/
|
|
16
|
+
language?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Whether this track is currently selected
|
|
20
|
+
*/
|
|
21
|
+
selected: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type NoAutocomplete<T> = T & never;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { BufferConfig } from './BufferConfig';
|
|
2
|
+
import type { DrmParams } from './DrmParams';
|
|
3
|
+
|
|
4
|
+
export type VideoSource = number | string;
|
|
5
|
+
|
|
6
|
+
export type VideoConfig = {
|
|
7
|
+
/**
|
|
8
|
+
* The uri of the video.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* uri: 'https://example.com/video.mp4'
|
|
12
|
+
* // or
|
|
13
|
+
* uri: require('./assets/video.mp4')
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
uri: VideoSource;
|
|
17
|
+
/**
|
|
18
|
+
* The headers to be sent with the request.
|
|
19
|
+
*/
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* The DRM parameters to be used.
|
|
23
|
+
*/
|
|
24
|
+
drm?: DrmParams;
|
|
25
|
+
/**
|
|
26
|
+
* The player buffer configuration.
|
|
27
|
+
*/
|
|
28
|
+
bufferConfig?: BufferConfig;
|
|
29
|
+
/**
|
|
30
|
+
* The custom metadata to be associated with the video.
|
|
31
|
+
* This metadata can be used by the native player to show information about the video.
|
|
32
|
+
*/
|
|
33
|
+
metadata?: CustomVideoMetadata;
|
|
34
|
+
/**
|
|
35
|
+
* The external subtitles to be used.
|
|
36
|
+
* @note on iOS, only WebVTT (.vtt) subtitles are supported (for HLS streams and MP4 files).
|
|
37
|
+
* @note on iOS, `label` can be overridden by player and there is no way to get around it.
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* externalSubtitles: [
|
|
41
|
+
* {
|
|
42
|
+
* uri: 'https://example.com/subtitles_en.vtt',
|
|
43
|
+
* label: 'English',
|
|
44
|
+
* type: 'vtt',
|
|
45
|
+
* language: 'en'
|
|
46
|
+
* },
|
|
47
|
+
* {
|
|
48
|
+
* uri: 'https://example.com/subtitles_es.vtt',
|
|
49
|
+
* label: 'Español',
|
|
50
|
+
* type: 'vtt',
|
|
51
|
+
* language: 'es'
|
|
52
|
+
* }
|
|
53
|
+
* ]
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
externalSubtitles?: ExternalSubtitle[];
|
|
57
|
+
/**
|
|
58
|
+
* when the player is created, this flag will determine if native player should be initialized immediately.
|
|
59
|
+
* If set to true, the player will be initialized as soon as player is created
|
|
60
|
+
* If set to false, the player will need be initialized manually later
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
initializeOnCreation?: boolean;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// @internal
|
|
67
|
+
export interface NativeVideoConfig extends VideoConfig {
|
|
68
|
+
// The uri should be resolved to string before creating the source
|
|
69
|
+
uri: string;
|
|
70
|
+
externalSubtitles?: NativeExternalSubtitle[];
|
|
71
|
+
drm?: NativeDrmParams;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The type of the subtitle.
|
|
76
|
+
* - `vtt` - WebVTT
|
|
77
|
+
* - `srt` - SubRip
|
|
78
|
+
* - `ssa` - SubStation Alpha
|
|
79
|
+
* - `ass` - Advanced SubStation Alpha
|
|
80
|
+
* - `auto` - Auto detect the subtitle type from the file extension
|
|
81
|
+
*
|
|
82
|
+
* @note `auto` is not available when uri have no extension.
|
|
83
|
+
*/
|
|
84
|
+
export type SubtitleType = 'vtt' | 'srt' | 'ssa' | 'ass' | 'auto';
|
|
85
|
+
|
|
86
|
+
interface ExternalSubtitleWithInferredType {
|
|
87
|
+
/**
|
|
88
|
+
* The uri of the subtitle.
|
|
89
|
+
* @note the uri must end with the subtitle type.
|
|
90
|
+
*/
|
|
91
|
+
uri: `${string}.${SubtitleType}`;
|
|
92
|
+
/**
|
|
93
|
+
* The label for the subtitle.
|
|
94
|
+
*/
|
|
95
|
+
label: string;
|
|
96
|
+
/**
|
|
97
|
+
* The type of the subtitle.
|
|
98
|
+
*/
|
|
99
|
+
type?: SubtitleType;
|
|
100
|
+
/**
|
|
101
|
+
* The language code for the subtitle (ISO 639-1 or ISO 639-2).
|
|
102
|
+
* @example 'en', 'es', 'fr', 'de', 'zh-CN'
|
|
103
|
+
* @default 'und' (undefined)
|
|
104
|
+
*/
|
|
105
|
+
language?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface ExternalSubtitleWithCustomType {
|
|
109
|
+
/**
|
|
110
|
+
* The uri of the subtitle.
|
|
111
|
+
*/
|
|
112
|
+
uri: string;
|
|
113
|
+
/**
|
|
114
|
+
* The label for the subtitle.
|
|
115
|
+
*/
|
|
116
|
+
label: string;
|
|
117
|
+
/**
|
|
118
|
+
* The type of the subtitle.
|
|
119
|
+
*/
|
|
120
|
+
type: Omit<SubtitleType, 'auto'>;
|
|
121
|
+
/**
|
|
122
|
+
* The language code for the subtitle (ISO 639-1 or ISO 639-2).
|
|
123
|
+
* @example 'en', 'es', 'fr', 'de', 'zh-CN'
|
|
124
|
+
* @default 'und' (undefined)
|
|
125
|
+
*/
|
|
126
|
+
language?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type ExternalSubtitle =
|
|
130
|
+
| ExternalSubtitleWithInferredType
|
|
131
|
+
| ExternalSubtitleWithCustomType;
|
|
132
|
+
|
|
133
|
+
interface NativeExternalSubtitle {
|
|
134
|
+
uri: string;
|
|
135
|
+
label: string;
|
|
136
|
+
type: SubtitleType;
|
|
137
|
+
language: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface NativeDrmParams extends DrmParams {
|
|
141
|
+
type?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface CustomVideoMetadata {
|
|
145
|
+
title?: string;
|
|
146
|
+
subtitle?: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
artist?: string;
|
|
149
|
+
imageUri?: string;
|
|
150
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export type LibraryError =
|
|
2
|
+
| 'library/deallocated'
|
|
3
|
+
| 'library/application-context-not-found';
|
|
4
|
+
|
|
5
|
+
export type PlayerError =
|
|
6
|
+
| 'player/released'
|
|
7
|
+
| 'player/not-initialized'
|
|
8
|
+
| 'player/asset-not-initialized'
|
|
9
|
+
| 'player/invalid-source';
|
|
10
|
+
|
|
11
|
+
export type SourceError =
|
|
12
|
+
| 'source/invalid-uri'
|
|
13
|
+
| 'source/missing-read-file-permission'
|
|
14
|
+
| 'source/file-does-not-exist'
|
|
15
|
+
| 'source/failed-to-initialize-asset'
|
|
16
|
+
| 'source/unsupported-content-type';
|
|
17
|
+
|
|
18
|
+
export type VideoViewError =
|
|
19
|
+
| 'view/not-found'
|
|
20
|
+
| 'view/deallocated'
|
|
21
|
+
| 'view/picture-in-picture-not-supported';
|
|
22
|
+
|
|
23
|
+
export type UnknownError = 'unknown/unknown';
|
|
24
|
+
|
|
25
|
+
export type VideoErrorCode =
|
|
26
|
+
| LibraryError
|
|
27
|
+
| PlayerError
|
|
28
|
+
| SourceError
|
|
29
|
+
| VideoViewError
|
|
30
|
+
| UnknownError;
|
|
31
|
+
|
|
32
|
+
export class VideoError<TCode extends VideoErrorCode> extends Error {
|
|
33
|
+
private readonly _code: TCode;
|
|
34
|
+
private readonly _message: string;
|
|
35
|
+
private readonly _stack?: string;
|
|
36
|
+
|
|
37
|
+
public get code(): TCode {
|
|
38
|
+
return this._code;
|
|
39
|
+
}
|
|
40
|
+
public get message(): string {
|
|
41
|
+
return this._message;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public get stack(): string | undefined {
|
|
45
|
+
return this._stack;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
constructor(code: TCode, message: string, stack?: string) {
|
|
52
|
+
super(`[${code}]: ${message}`);
|
|
53
|
+
super.name = `[Unified Player] ${code}`;
|
|
54
|
+
super.message = message;
|
|
55
|
+
super.stack = stack;
|
|
56
|
+
this._code = code;
|
|
57
|
+
this._message = message;
|
|
58
|
+
this._stack = stack;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public toString(): string {
|
|
62
|
+
let string = `[${this.code}]: ${this.message}`;
|
|
63
|
+
return string;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class VideoComponentError extends VideoError<VideoViewError> {}
|
|
68
|
+
|
|
69
|
+
export class VideoRuntimeError extends VideoError<
|
|
70
|
+
LibraryError | PlayerError | SourceError | UnknownError
|
|
71
|
+
> {}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Check if the message contains code and message
|
|
75
|
+
*/
|
|
76
|
+
const getCodeAndMessage = (
|
|
77
|
+
message: string
|
|
78
|
+
): { code: string; message: string } | null => {
|
|
79
|
+
// (...){%@(match[1])::(match[2]);@%}(...)
|
|
80
|
+
const regex = /\{%@([^:]+)::([^@]+)@%\}/;
|
|
81
|
+
const match = message.match(regex);
|
|
82
|
+
|
|
83
|
+
if (
|
|
84
|
+
match &&
|
|
85
|
+
match.length === 3 &&
|
|
86
|
+
typeof match[1] === 'string' &&
|
|
87
|
+
typeof match[2] === 'string'
|
|
88
|
+
) {
|
|
89
|
+
return {
|
|
90
|
+
code: match[1],
|
|
91
|
+
message: match[2],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Check if the error has a stack property
|
|
99
|
+
* If it does, it will try to parse the error message in the stack trace
|
|
100
|
+
* and replace it with the proper code and message
|
|
101
|
+
*/
|
|
102
|
+
const maybeFixErrorStack = (error: object) => {
|
|
103
|
+
if ('stack' in error && typeof error.stack === 'string') {
|
|
104
|
+
const stack = error.stack;
|
|
105
|
+
|
|
106
|
+
// (...){%@(match[1])::(match[2]);@%}(...)
|
|
107
|
+
const regex = /\{%@([^:]+)::([^@]+)@%\}/;
|
|
108
|
+
const match = stack.match(regex);
|
|
109
|
+
|
|
110
|
+
if (
|
|
111
|
+
match &&
|
|
112
|
+
match.length === 3 &&
|
|
113
|
+
typeof match[1] === 'string' &&
|
|
114
|
+
typeof match[2] === 'string'
|
|
115
|
+
) {
|
|
116
|
+
error.stack = error.stack.replace(regex, `[${match[1]}]: ${match[2]}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const isVideoError = (
|
|
122
|
+
error: unknown
|
|
123
|
+
): error is { code: string; message: string } =>
|
|
124
|
+
typeof error === 'object' &&
|
|
125
|
+
error != null &&
|
|
126
|
+
// @ts-expect-error error is still unknown
|
|
127
|
+
typeof error.message === 'string' &&
|
|
128
|
+
// @ts-expect-error error is still unknown
|
|
129
|
+
getCodeAndMessage(error.message) != null;
|
|
130
|
+
|
|
131
|
+
const hasStack = (error: unknown): error is { stack: string } =>
|
|
132
|
+
typeof error === 'object' &&
|
|
133
|
+
error != null &&
|
|
134
|
+
'stack' in error &&
|
|
135
|
+
typeof error.stack === 'string';
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Tries to parse an error coming from native to a typed JS video error.
|
|
139
|
+
* @param {VideoError} nativeError The native error instance. This is a JSON in the legacy native module architecture.
|
|
140
|
+
* @returns A {@linkcode VideoRuntimeError} or {@linkcode VideoComponentError}, or the `nativeError` itself if it's not parsable
|
|
141
|
+
* @method
|
|
142
|
+
*/
|
|
143
|
+
export const tryParseNativeVideoError = <T>(
|
|
144
|
+
nativeError: T
|
|
145
|
+
): (VideoRuntimeError | VideoComponentError) | T => {
|
|
146
|
+
if (isVideoError(nativeError)) {
|
|
147
|
+
const result = getCodeAndMessage(nativeError.message);
|
|
148
|
+
|
|
149
|
+
if (result == null) {
|
|
150
|
+
return nativeError;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const { code, message } = result;
|
|
154
|
+
|
|
155
|
+
maybeFixErrorStack(nativeError);
|
|
156
|
+
|
|
157
|
+
if (code.startsWith('view')) {
|
|
158
|
+
return new VideoComponentError(
|
|
159
|
+
code as VideoViewError,
|
|
160
|
+
message,
|
|
161
|
+
hasStack(nativeError) ? nativeError.stack : undefined
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return new VideoRuntimeError(
|
|
166
|
+
// @ts-expect-error the code is string, we narrow it down to TS union.
|
|
167
|
+
code,
|
|
168
|
+
message,
|
|
169
|
+
hasStack(nativeError) ? nativeError.stack : undefined
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return nativeError;
|
|
174
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Int64 } from 'react-native-nitro-modules';
|
|
2
|
+
import type { VideoOrientation } from './VideoOrientation';
|
|
3
|
+
|
|
4
|
+
export interface VideoInformation {
|
|
5
|
+
/**
|
|
6
|
+
* The bitrate of the video in kbps.
|
|
7
|
+
*/
|
|
8
|
+
bitrate: number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The width of the video in pixels.
|
|
12
|
+
*/
|
|
13
|
+
width: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The height of the video in pixels.
|
|
17
|
+
*/
|
|
18
|
+
height: number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The duration of the video in seconds.
|
|
22
|
+
*/
|
|
23
|
+
duration: Int64;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The file size of the video in bytes.
|
|
27
|
+
*/
|
|
28
|
+
fileSize: Int64;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Whether the video is HDR.
|
|
32
|
+
*/
|
|
33
|
+
isHDR: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Whether the video is live
|
|
37
|
+
*/
|
|
38
|
+
isLive: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The orientation of the video.
|
|
42
|
+
* see {@link VideoOrientation}
|
|
43
|
+
*/
|
|
44
|
+
orientation: VideoOrientation;
|
|
45
|
+
}
|