@zezosoft/zezo-ott-react-native-video-player 1.0.1 → 1.0.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/README.md +330 -71
- package/lib/module/AdsPlayer/AdsPlayer.js +248 -0
- package/lib/module/AdsPlayer/AdsPlayer.js.map +1 -0
- package/lib/module/AdsPlayer/MediaControls/AdBottomControls.js +174 -0
- package/lib/module/AdsPlayer/MediaControls/AdBottomControls.js.map +1 -0
- package/lib/module/AdsPlayer/MediaControls/AdMediaControls.js +91 -0
- package/lib/module/AdsPlayer/MediaControls/AdMediaControls.js.map +1 -0
- package/lib/module/AdsPlayer/MediaControls/AdMediaControlsProvider.js +34 -0
- package/lib/module/AdsPlayer/MediaControls/AdMediaControlsProvider.js.map +1 -0
- package/lib/module/AdsPlayer/MediaControls/AdMiddleControls.js +65 -0
- package/lib/module/AdsPlayer/MediaControls/AdMiddleControls.js.map +1 -0
- package/lib/module/AdsPlayer/MediaControls/AdTopControls.js +189 -0
- package/lib/module/AdsPlayer/MediaControls/AdTopControls.js.map +1 -0
- package/lib/module/AdsPlayer/MediaControls/index.js +8 -0
- package/lib/module/AdsPlayer/MediaControls/index.js.map +1 -0
- package/lib/module/AdsPlayer/components/RotatingLoader.js +55 -0
- package/lib/module/AdsPlayer/components/RotatingLoader.js.map +1 -0
- package/lib/module/AdsPlayer/index.js +6 -0
- package/lib/module/AdsPlayer/index.js.map +1 -0
- package/lib/module/AdsPlayer/store/adsPlayer.type.js +4 -0
- package/lib/module/AdsPlayer/store/adsPlayer.type.js.map +1 -0
- package/lib/module/AdsPlayer/store/adsPlayerStore.js +70 -0
- package/lib/module/AdsPlayer/store/adsPlayerStore.js.map +1 -0
- package/lib/module/AdsPlayer/store/index.js +5 -0
- package/lib/module/AdsPlayer/store/index.js.map +1 -0
- package/lib/module/AdsPlayer/utils/adStateReset.js +31 -0
- package/lib/module/AdsPlayer/utils/adStateReset.js.map +1 -0
- package/lib/module/AdsPlayer/utils/controls.js +63 -0
- package/lib/module/AdsPlayer/utils/controls.js.map +1 -0
- package/lib/module/AdsPlayer/utils/useAdControlsAutoHide.js +35 -0
- package/lib/module/AdsPlayer/utils/useAdControlsAutoHide.js.map +1 -0
- package/lib/module/AdsPlayer/utils/useAdInitialization.js +60 -0
- package/lib/module/AdsPlayer/utils/useAdInitialization.js.map +1 -0
- package/lib/module/AdsPlayer/utils/useAdTracking.js +50 -0
- package/lib/module/AdsPlayer/utils/useAdTracking.js.map +1 -0
- package/lib/module/AdsPlayer/utils/useAdsManager.js +165 -0
- package/lib/module/AdsPlayer/utils/useAdsManager.js.map +1 -0
- package/lib/module/VideoPlayer/MediaControls/BottomControls.js +17 -6
- package/lib/module/VideoPlayer/MediaControls/BottomControls.js.map +1 -1
- package/lib/module/VideoPlayer/MediaControls/MediaControls.js +3 -1
- package/lib/module/VideoPlayer/MediaControls/MediaControls.js.map +1 -1
- package/lib/module/VideoPlayer/MediaControls/MediaControlsProvider.js +28 -31
- package/lib/module/VideoPlayer/MediaControls/MediaControlsProvider.js.map +1 -1
- package/lib/module/VideoPlayer/MediaControls/MiddleControls.js +50 -40
- package/lib/module/VideoPlayer/MediaControls/MiddleControls.js.map +1 -1
- package/lib/module/VideoPlayer/MediaControls/TopControls.js +11 -9
- package/lib/module/VideoPlayer/MediaControls/TopControls.js.map +1 -1
- package/lib/module/VideoPlayer/{model → Settings}/AudioAndSubtitles.js +0 -14
- package/lib/module/VideoPlayer/Settings/AudioAndSubtitles.js.map +1 -0
- package/lib/module/VideoPlayer/{model → Settings}/Episodes.js +1 -1
- package/lib/module/VideoPlayer/Settings/Episodes.js.map +1 -0
- package/lib/module/VideoPlayer/{model → Settings}/SettingModal.js +0 -1
- package/lib/module/VideoPlayer/Settings/SettingModal.js.map +1 -0
- package/lib/module/VideoPlayer/{model → Settings}/SpeedControls.js +1 -9
- package/lib/module/VideoPlayer/Settings/SpeedControls.js.map +1 -0
- package/lib/module/VideoPlayer/{model → Settings}/VideoPlayerSettings.js +1 -1
- package/lib/module/VideoPlayer/Settings/VideoPlayerSettings.js.map +1 -0
- package/lib/module/VideoPlayer/VideoPlayerCore.js +244 -0
- package/lib/module/VideoPlayer/VideoPlayerCore.js.map +1 -0
- package/lib/module/VideoPlayer/components/ProgressBar.js +63 -23
- package/lib/module/VideoPlayer/components/ProgressBar.js.map +1 -1
- package/lib/module/VideoPlayer/components/SkipAndNextControls.js +1 -6
- package/lib/module/VideoPlayer/components/SkipAndNextControls.js.map +1 -1
- package/lib/module/VideoPlayer/components/SubtitleView.js +1 -1
- package/lib/module/VideoPlayer/components/SubtitleView.js.map +1 -1
- package/lib/module/VideoPlayer/components/Toast.js +57 -0
- package/lib/module/VideoPlayer/components/Toast.js.map +1 -0
- package/lib/module/VideoPlayer/index.js +1 -1
- package/lib/module/VideoPlayer/index.js.map +1 -1
- package/lib/module/VideoPlayer/store/videoPlayerStore.js +0 -4
- package/lib/module/VideoPlayer/store/videoPlayerStore.js.map +1 -1
- package/lib/module/VideoPlayer/{Styles → styles}/globalStyles.js +5 -6
- package/lib/module/VideoPlayer/styles/globalStyles.js.map +1 -0
- package/lib/module/VideoPlayer/utils/{Display.js → display/Display.js} +0 -4
- package/lib/module/VideoPlayer/utils/display/Display.js.map +1 -0
- package/lib/module/VideoPlayer/utils/display/index.js +4 -0
- package/lib/module/VideoPlayer/utils/display/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/format/index.js +4 -0
- package/lib/module/VideoPlayer/utils/format/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/{timeFormatter.js → format/timeFormatter.js} +0 -6
- package/lib/module/VideoPlayer/utils/format/timeFormatter.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/index.js +3 -0
- package/lib/module/VideoPlayer/utils/hooks/index.js.map +1 -1
- package/lib/module/VideoPlayer/utils/hooks/useAdEventHandler.js +56 -0
- package/lib/module/VideoPlayer/utils/hooks/useAdEventHandler.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/useOrientationLock.js +25 -0
- package/lib/module/VideoPlayer/utils/hooks/useOrientationLock.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/usePauseVideoOnAd.js +43 -0
- package/lib/module/VideoPlayer/utils/hooks/usePauseVideoOnAd.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/useVideoPlayerBack.js +3 -4
- package/lib/module/VideoPlayer/utils/hooks/useVideoPlayerBack.js.map +1 -1
- package/lib/module/VideoPlayer/utils/hooks/useVideoResolutions.js +1 -4
- package/lib/module/VideoPlayer/utils/hooks/useVideoResolutions.js.map +1 -1
- package/lib/module/VideoPlayer/utils/index.js +5 -6
- package/lib/module/VideoPlayer/utils/index.js.map +1 -1
- package/lib/module/VideoPlayer/utils/{PlatformSelector.js → platform/PlatformSelector.js} +0 -5
- package/lib/module/VideoPlayer/utils/platform/PlatformSelector.js.map +1 -0
- package/lib/module/VideoPlayer/utils/platform/index.js +5 -0
- package/lib/module/VideoPlayer/utils/platform/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/{lockOrientation.js → platform/lockOrientation.js} +13 -5
- package/lib/module/VideoPlayer/utils/platform/lockOrientation.js.map +1 -0
- package/lib/module/VideoPlayer/utils/player/index.js +5 -0
- package/lib/module/VideoPlayer/utils/player/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/{playerEvents.js → player/playerEvents.js} +3 -3
- package/lib/module/VideoPlayer/utils/player/playerEvents.js.map +1 -0
- package/lib/module/VideoPlayer/utils/{useWatchReporter.js → player/useWatchReporter.js} +3 -2
- package/lib/module/VideoPlayer/utils/player/useWatchReporter.js.map +1 -0
- package/lib/module/VideoPlayer/utils/video/index.js +8 -0
- package/lib/module/VideoPlayer/utils/video/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/{videoControl.js → video/videoControl.js} +1 -14
- package/lib/module/VideoPlayer/utils/video/videoControl.js.map +1 -0
- package/lib/module/VideoPlayer/utils/video/videoRef.js +20 -0
- package/lib/module/VideoPlayer/utils/video/videoRef.js.map +1 -0
- package/lib/module/VideoPlayer/utils/video/videoResume.js +29 -0
- package/lib/module/VideoPlayer/utils/video/videoResume.js.map +1 -0
- package/lib/module/VideoPlayer/utils/video/videoSource.js.map +1 -0
- package/lib/module/VideoPlayer.js +128 -0
- package/lib/module/VideoPlayer.js.map +1 -0
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/AdsPlayer/AdsPlayer.d.ts +22 -0
- package/lib/typescript/src/AdsPlayer/AdsPlayer.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdBottomControls.d.ts +4 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdBottomControls.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControls.d.ts +8 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControls.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControlsProvider.d.ts +26 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControlsProvider.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdMiddleControls.d.ts +4 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdMiddleControls.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdTopControls.d.ts +7 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/AdTopControls.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/index.d.ts +6 -0
- package/lib/typescript/src/AdsPlayer/MediaControls/index.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/components/RotatingLoader.d.ts +12 -0
- package/lib/typescript/src/AdsPlayer/components/RotatingLoader.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/index.d.ts +5 -0
- package/lib/typescript/src/AdsPlayer/index.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/store/adsPlayer.type.d.ts +28 -0
- package/lib/typescript/src/AdsPlayer/store/adsPlayer.type.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/store/adsPlayerStore.d.ts +22 -0
- package/lib/typescript/src/AdsPlayer/store/adsPlayerStore.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/store/index.d.ts +3 -0
- package/lib/typescript/src/AdsPlayer/store/index.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/utils/adStateReset.d.ts +6 -0
- package/lib/typescript/src/AdsPlayer/utils/adStateReset.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/utils/controls.d.ts +13 -0
- package/lib/typescript/src/AdsPlayer/utils/controls.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdControlsAutoHide.d.ts +3 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdControlsAutoHide.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdInitialization.d.ts +20 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdInitialization.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdTracking.d.ts +23 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdTracking.d.ts.map +1 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdsManager.d.ts +9 -0
- package/lib/typescript/src/AdsPlayer/utils/useAdsManager.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/BottomControls.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControls.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControlsProvider.d.ts +3 -1
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControlsProvider.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/MediaControls/MiddleControls.d.ts +2 -1
- package/lib/typescript/src/VideoPlayer/MediaControls/MiddleControls.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/MediaControls/TopControls.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/Settings/AudioAndSubtitles.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/{model → Settings}/Episodes.d.ts +1 -1
- package/lib/typescript/src/VideoPlayer/Settings/Episodes.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/{model → Settings}/SettingModal.d.ts +1 -1
- package/lib/typescript/src/VideoPlayer/Settings/SettingModal.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/Settings/SpeedControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/Settings/VideoPlayerSettings.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/{VideoPlayer.d.ts → VideoPlayerCore.d.ts} +10 -7
- package/lib/typescript/src/VideoPlayer/VideoPlayerCore.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/components/ProgressBar.d.ts +3 -1
- package/lib/typescript/src/VideoPlayer/components/ProgressBar.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/components/SkipAndNextControls.d.ts +1 -1
- package/lib/typescript/src/VideoPlayer/components/SkipAndNextControls.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/components/Toast.d.ts +12 -0
- package/lib/typescript/src/VideoPlayer/components/Toast.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/index.d.ts +1 -1
- package/lib/typescript/src/VideoPlayer/index.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/store/videoPlayer.type.d.ts +25 -5
- package/lib/typescript/src/VideoPlayer/store/videoPlayer.type.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/store/videoPlayerStore.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/{Styles → styles}/globalStyles.d.ts +16 -9
- package/lib/typescript/src/VideoPlayer/styles/globalStyles.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/display/Display.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/display/index.d.ts +2 -0
- package/lib/typescript/src/VideoPlayer/utils/display/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/format/index.d.ts +2 -0
- package/lib/typescript/src/VideoPlayer/utils/format/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/{timeFormatter.d.ts → format/timeFormatter.d.ts} +0 -5
- package/lib/typescript/src/VideoPlayer/utils/format/timeFormatter.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/index.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/utils/hooks/useAdEventHandler.d.ts +34 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useAdEventHandler.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useOrientationLock.d.ts +11 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useOrientationLock.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/usePauseVideoOnAd.d.ts +6 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/usePauseVideoOnAd.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useVideoResolutions.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/utils/index.d.ts +5 -6
- package/lib/typescript/src/VideoPlayer/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/VideoPlayer/utils/{PlatformSelector.d.ts → platform/PlatformSelector.d.ts} +0 -4
- package/lib/typescript/src/VideoPlayer/utils/platform/PlatformSelector.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/platform/index.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/utils/platform/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/platform/lockOrientation.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/player/index.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/utils/player/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/{playerEvents.d.ts → player/playerEvents.d.ts} +1 -1
- package/lib/typescript/src/VideoPlayer/utils/player/playerEvents.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/{useWatchReporter.d.ts → player/useWatchReporter.d.ts} +1 -6
- package/lib/typescript/src/VideoPlayer/utils/player/useWatchReporter.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/video/index.d.ts +6 -0
- package/lib/typescript/src/VideoPlayer/utils/video/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/{videoControl.d.ts → video/videoControl.d.ts} +1 -1
- package/lib/typescript/src/VideoPlayer/utils/video/videoControl.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/video/videoRef.d.ts +19 -0
- package/lib/typescript/src/VideoPlayer/utils/video/videoRef.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/video/videoResume.d.ts +6 -0
- package/lib/typescript/src/VideoPlayer/utils/video/videoResume.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/{videoSource.d.ts → video/videoSource.d.ts} +1 -1
- package/lib/typescript/src/VideoPlayer/utils/video/videoSource.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer.d.ts +31 -0
- package/lib/typescript/src/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +125 -101
- package/src/AdsPlayer/AdsPlayer.tsx +312 -0
- package/src/AdsPlayer/MediaControls/AdBottomControls.tsx +189 -0
- package/src/AdsPlayer/MediaControls/AdMediaControls.tsx +98 -0
- package/src/AdsPlayer/MediaControls/AdMediaControlsProvider.tsx +62 -0
- package/src/AdsPlayer/MediaControls/AdMiddleControls.tsx +63 -0
- package/src/AdsPlayer/MediaControls/AdTopControls.tsx +196 -0
- package/src/AdsPlayer/MediaControls/index.ts +5 -0
- package/src/AdsPlayer/components/RotatingLoader.tsx +79 -0
- package/src/AdsPlayer/index.ts +4 -0
- package/src/AdsPlayer/store/adsPlayer.type.ts +29 -0
- package/src/AdsPlayer/store/adsPlayerStore.ts +59 -0
- package/src/AdsPlayer/store/index.ts +2 -0
- package/src/AdsPlayer/utils/adStateReset.ts +29 -0
- package/src/AdsPlayer/utils/controls.ts +69 -0
- package/src/AdsPlayer/utils/useAdControlsAutoHide.ts +32 -0
- package/src/AdsPlayer/utils/useAdInitialization.ts +86 -0
- package/src/AdsPlayer/utils/useAdTracking.ts +89 -0
- package/src/AdsPlayer/utils/useAdsManager.ts +215 -0
- package/src/VideoPlayer/MediaControls/BottomControls.tsx +22 -3
- package/src/VideoPlayer/MediaControls/MediaControls.tsx +3 -2
- package/src/VideoPlayer/MediaControls/MediaControlsProvider.tsx +36 -35
- package/src/VideoPlayer/MediaControls/MiddleControls.tsx +87 -60
- package/src/VideoPlayer/MediaControls/TopControls.tsx +21 -7
- package/src/VideoPlayer/{model → Settings}/AudioAndSubtitles.tsx +0 -7
- package/src/VideoPlayer/{model → Settings}/Episodes.tsx +6 -3
- package/src/VideoPlayer/{model → Settings}/SettingModal.tsx +1 -2
- package/src/VideoPlayer/{model → Settings}/SpeedControls.tsx +1 -5
- package/src/VideoPlayer/{model → Settings}/VideoPlayerSettings.tsx +1 -1
- package/src/VideoPlayer/VideoPlayerCore.tsx +356 -0
- package/src/VideoPlayer/components/ProgressBar.tsx +85 -21
- package/src/VideoPlayer/components/SkipAndNextControls.tsx +2 -5
- package/src/VideoPlayer/components/SubtitleView.tsx +1 -1
- package/src/VideoPlayer/components/Toast.tsx +61 -0
- package/src/VideoPlayer/index.ts +1 -1
- package/src/VideoPlayer/store/videoPlayer.type.ts +28 -6
- package/src/VideoPlayer/store/videoPlayerStore.ts +0 -4
- package/src/VideoPlayer/{Styles → styles}/globalStyles.ts +5 -6
- package/src/VideoPlayer/utils/{Display.ts → display/Display.ts} +0 -4
- package/src/VideoPlayer/utils/display/index.ts +1 -0
- package/src/VideoPlayer/utils/format/index.ts +1 -0
- package/src/VideoPlayer/utils/{timeFormatter.ts → format/timeFormatter.ts} +4 -7
- package/src/VideoPlayer/utils/hooks/index.ts +3 -0
- package/src/VideoPlayer/utils/hooks/useAdEventHandler.ts +95 -0
- package/src/VideoPlayer/utils/hooks/useOrientationLock.ts +29 -0
- package/src/VideoPlayer/utils/hooks/usePauseVideoOnAd.ts +46 -0
- package/src/VideoPlayer/utils/hooks/useVideoPlayerBack.ts +3 -3
- package/src/VideoPlayer/utils/hooks/useVideoResolutions.ts +1 -3
- package/src/VideoPlayer/utils/index.ts +5 -6
- package/src/VideoPlayer/utils/{PlatformSelector.ts → platform/PlatformSelector.ts} +0 -5
- package/src/VideoPlayer/utils/platform/index.ts +2 -0
- package/src/VideoPlayer/utils/{lockOrientation.ts → platform/lockOrientation.ts} +11 -5
- package/src/VideoPlayer/utils/player/index.ts +2 -0
- package/src/VideoPlayer/utils/{playerEvents.ts → player/playerEvents.ts} +4 -4
- package/src/VideoPlayer/utils/{useWatchReporter.ts → player/useWatchReporter.ts} +4 -3
- package/src/VideoPlayer/utils/video/index.ts +5 -0
- package/src/VideoPlayer/utils/{videoControl.ts → video/videoControl.ts} +2 -9
- package/src/VideoPlayer/utils/video/videoRef.ts +21 -0
- package/src/VideoPlayer/utils/video/videoResume.ts +23 -0
- package/src/VideoPlayer/utils/{videoSource.ts → video/videoSource.ts} +1 -1
- package/src/VideoPlayer.tsx +166 -0
- package/src/index.tsx +3 -1
- package/lib/module/VideoPlayer/Styles/fonts.js +0 -58
- package/lib/module/VideoPlayer/Styles/fonts.js.map +0 -1
- package/lib/module/VideoPlayer/Styles/globalStyles.js.map +0 -1
- package/lib/module/VideoPlayer/VideoPlayer.js +0 -180
- package/lib/module/VideoPlayer/VideoPlayer.js.map +0 -1
- package/lib/module/VideoPlayer/model/AudioAndSubtitles.js.map +0 -1
- package/lib/module/VideoPlayer/model/Episodes.js.map +0 -1
- package/lib/module/VideoPlayer/model/SettingModal.js.map +0 -1
- package/lib/module/VideoPlayer/model/SpeedControls.js.map +0 -1
- package/lib/module/VideoPlayer/model/VideoPlayerSettings.js.map +0 -1
- package/lib/module/VideoPlayer/utils/Display.js.map +0 -1
- package/lib/module/VideoPlayer/utils/PlatformSelector.js.map +0 -1
- package/lib/module/VideoPlayer/utils/lockOrientation.js.map +0 -1
- package/lib/module/VideoPlayer/utils/playerEvents.js.map +0 -1
- package/lib/module/VideoPlayer/utils/timeFormatter.js.map +0 -1
- package/lib/module/VideoPlayer/utils/useWatchReporter.js.map +0 -1
- package/lib/module/VideoPlayer/utils/videoControl.js.map +0 -1
- package/lib/module/VideoPlayer/utils/videoRef.js +0 -5
- package/lib/module/VideoPlayer/utils/videoRef.js.map +0 -1
- package/lib/module/VideoPlayer/utils/videoSource.js.map +0 -1
- package/lib/typescript/src/VideoPlayer/Styles/fonts.d.ts +0 -54
- package/lib/typescript/src/VideoPlayer/Styles/fonts.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/Styles/globalStyles.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/VideoPlayer.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/model/AudioAndSubtitles.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/model/Episodes.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/model/SettingModal.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/model/SpeedControls.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/model/VideoPlayerSettings.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/Display.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/PlatformSelector.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/lockOrientation.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/playerEvents.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/timeFormatter.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/useWatchReporter.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/videoControl.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/videoRef.d.ts +0 -3
- package/lib/typescript/src/VideoPlayer/utils/videoRef.d.ts.map +0 -1
- package/lib/typescript/src/VideoPlayer/utils/videoSource.d.ts.map +0 -1
- package/src/VideoPlayer/Styles/fonts.ts +0 -106
- package/src/VideoPlayer/VideoPlayer.tsx +0 -217
- package/src/VideoPlayer/utils/videoRef.ts +0 -4
- /package/lib/module/VideoPlayer/utils/{videoSource.js → video/videoSource.js} +0 -0
- /package/lib/typescript/src/VideoPlayer/{model → Settings}/AudioAndSubtitles.d.ts +0 -0
- /package/lib/typescript/src/VideoPlayer/{model → Settings}/SpeedControls.d.ts +0 -0
- /package/lib/typescript/src/VideoPlayer/{model → Settings}/VideoPlayerSettings.d.ts +0 -0
- /package/lib/typescript/src/VideoPlayer/utils/{Display.d.ts → display/Display.d.ts} +0 -0
- /package/lib/typescript/src/VideoPlayer/utils/{lockOrientation.d.ts → platform/lockOrientation.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,20 +1,76 @@
|
|
|
1
1
|
# 🎬 ZezoOTT Video Player
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
3
|
+
A powerful, production-ready React Native video player component designed specifically for OTT (Over-The-Top) platforms. Built with TypeScript and featuring a centralized state management system, it delivers a seamless full-screen video playback experience with comprehensive support for playlists, seasons, ads, analytics, and custom controls.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📋 Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Features](#-features)
|
|
10
|
+
- [Requirements](#-requirements)
|
|
11
|
+
- [Installation](#-installation)
|
|
12
|
+
- [Quick Start](#-quick-start)
|
|
13
|
+
- [API Reference](#-api-reference)
|
|
14
|
+
- [VideoPlayer Props](#-videoplayer-props)
|
|
15
|
+
- [VideoAd Interface](#-videoad-interface)
|
|
16
|
+
- [Usage Examples](#-usage-examples)
|
|
17
|
+
- [Basic Example](#-basic-example)
|
|
18
|
+
- [Auto-Next Episodes](#-auto-next-episodes)
|
|
19
|
+
- [Custom Theming](#-custom-theming)
|
|
20
|
+
- [Playlist & Seasons](#-playlist--seasons)
|
|
21
|
+
- [Ads Player](#-ads-player)
|
|
22
|
+
- [Video Player Store](#-video-player-store)
|
|
23
|
+
- [Best Practices](#-best-practices)
|
|
24
|
+
- [Troubleshooting](#-troubleshooting)
|
|
25
|
+
- [Demo App](#-demo-app)
|
|
26
|
+
- [License](#-license)
|
|
5
27
|
|
|
6
28
|
---
|
|
7
29
|
|
|
8
30
|
## ✨ Features
|
|
9
31
|
|
|
10
|
-
- 📺 **Episode
|
|
11
|
-
- 📊 **Watch
|
|
12
|
-
- 🎨 **Custom
|
|
13
|
-
- 🔄 **Auto-next
|
|
14
|
-
- 🎬 **Playlist
|
|
15
|
-
- 🗄️ **Centralized
|
|
16
|
-
- 📱 **Optimized for React Native OTT apps
|
|
17
|
-
-
|
|
32
|
+
- 📺 **Episode Navigation & Seasons** - Seamless navigation between episodes and seasons
|
|
33
|
+
- 📊 **Watch Progress Tracking** - Built-in analytics for watch time and progress
|
|
34
|
+
- 🎨 **Custom Theming** - Fully customizable UI colors and metrics
|
|
35
|
+
- 🔄 **Auto-Next Playback** - Automatically plays next episode/video
|
|
36
|
+
- 🎬 **Playlist Integration** - Support for playlists and multi-season content
|
|
37
|
+
- 🗄️ **Centralized Store** - Zustand-powered state management for playback, tracks & UI
|
|
38
|
+
- 📱 **React Native Optimized** - Built specifically for React Native OTT apps
|
|
39
|
+
- 📢 **Ads Player** - Pre-roll, mid-roll, and post-roll ads with comprehensive tracking
|
|
40
|
+
- 🎯 **Production Ready** - Minimal configuration, battle-tested in production
|
|
41
|
+
- 🔒 **TypeScript** - Full TypeScript support with comprehensive type definitions
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 📦 Requirements
|
|
46
|
+
|
|
47
|
+
### Peer Dependencies
|
|
48
|
+
|
|
49
|
+
This package requires the following peer dependencies to be installed in your project:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
yarn add react react-native react-native-video react-native-safe-area-context \
|
|
53
|
+
react-native-gesture-handler react-native-reanimated react-native-fast-image \
|
|
54
|
+
react-native-linear-gradient react-native-svg
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
or
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm install react react-native react-native-video react-native-safe-area-context \
|
|
61
|
+
react-native-gesture-handler react-native-reanimated react-native-fast-image \
|
|
62
|
+
react-native-linear-gradient react-native-svg
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Additional Setup
|
|
66
|
+
|
|
67
|
+
For fullscreen functionality, you'll also need:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
yarn add react-native-orientation-locker
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
See [Troubleshooting](#-troubleshooting) section for setup instructions.
|
|
18
74
|
|
|
19
75
|
---
|
|
20
76
|
|
|
@@ -32,19 +88,91 @@ npm install @zezosoft/zezo-ott-react-native-video-player
|
|
|
32
88
|
|
|
33
89
|
---
|
|
34
90
|
|
|
35
|
-
##
|
|
91
|
+
## 🚀 Quick Start
|
|
36
92
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
93
|
+
```tsx
|
|
94
|
+
import React from 'react';
|
|
95
|
+
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
96
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
97
|
+
|
|
98
|
+
export default function VideoPlayerScreen() {
|
|
99
|
+
const insets = useSafeAreaInsets();
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<VideoPlayer
|
|
103
|
+
insets={insets}
|
|
104
|
+
isFocused={true}
|
|
105
|
+
mode="fullscreen"
|
|
106
|
+
autoNext={true}
|
|
107
|
+
onClose={() => console.log('Player closed')}
|
|
108
|
+
onWatchProgress={(progress) => {
|
|
109
|
+
console.log('Watch Progress:', progress);
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> **Note:** Make sure you've set up the video player store with your content before rendering the player. See [Playlist & Seasons](#-playlist--seasons) section for details.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 📚 API Reference
|
|
121
|
+
|
|
122
|
+
### ⚙️ VideoPlayer Props
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Required | Default | Description |
|
|
125
|
+
| ------------------- | ------------------------------------------------------------------------------------------- | -------- | -------------- | -------------------------------------------------------------------------------------- |
|
|
126
|
+
| **insets** | `EdgeInsets` | ✅ Yes | - | Safe area insets from `react-native-safe-area-context` (use `useSafeAreaInsets()`). |
|
|
127
|
+
| **onClose** | `() => void` | ❌ No | - | Callback triggered when the player is closed. |
|
|
128
|
+
| **isFocused** | `boolean` | ❌ No | `true` | Controls playback focus. Automatically pauses when the screen is not active. |
|
|
129
|
+
| **seekTime** | `number \| null` | ❌ No | `null` | Starts playback from a given time (in seconds). |
|
|
130
|
+
| **mode** | `'fullscreen' \| 'normal'` | ❌ No | `'fullscreen'` | Sets the display mode of the player. |
|
|
131
|
+
| **autoNext** | `boolean` | ❌ No | `true` | Automatically plays the next episode/video after completion. |
|
|
132
|
+
| **event** | `{ onPressEpisode?: ({ episode }: { episode: MediaEpisode }) => Promise<boolean> }` | ❌ No | - | Event hooks for custom handling (e.g. episode selection, subscription checks). |
|
|
133
|
+
| **theme** | `Partial<VideoPlayerTheme>` | ❌ No | - | Customize the look & feel of the player (colors, metrics, etc.). |
|
|
134
|
+
| **onWatchProgress** | `(progress: ExtendedWatchProgress) => void` | ❌ No | - | Reports playback analytics such as watch time, current time, and completion. |
|
|
135
|
+
| **ads** | `VideoAd[]` | ❌ No | `[]` | Array of video ads to display (pre-roll, mid-roll, post-roll). |
|
|
136
|
+
| **onAdEnd** | `(ad: VideoAd) => void` | ❌ No | - | Callback fired when an ad finishes playing. |
|
|
137
|
+
| **onAdError** | `(error: Error, ad: VideoAd) => void` | ❌ No | - | Callback fired when an ad encounters an error. |
|
|
138
|
+
| **onAdTracking** | `({ ad, trackingUrl, event }: { ad: VideoAd; trackingUrl: string; event: string }) => void` | ❌ No | - | Callback for ad tracking events (impression, start, quartiles, complete, skip, click). |
|
|
139
|
+
|
|
140
|
+
### 📢 VideoAd Interface
|
|
141
|
+
|
|
142
|
+
The `VideoAd` interface defines the structure for video advertisements:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
interface VideoAd {
|
|
146
|
+
id: string; // Unique identifier for the ad
|
|
147
|
+
title: string; // Ad title
|
|
148
|
+
description: string; // Ad description
|
|
149
|
+
position: 'pre' | 'mid' | 'post'; // Ad position: pre-roll, mid-roll, or post-roll
|
|
150
|
+
source: string; // Video source URL (MP4 or HLS)
|
|
151
|
+
duration: number; // Ad duration in seconds
|
|
152
|
+
time?: number; // For mid-roll ads: time in seconds when ad should play
|
|
153
|
+
skippable: boolean; // Whether the ad can be skipped
|
|
154
|
+
skipAfter: number; // Seconds after which skip button appears (if skippable)
|
|
155
|
+
clickThroughUrl?: string; // Optional URL to open when ad is clicked
|
|
156
|
+
tracking?: AdTracking; // Optional tracking URLs for ad events
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface AdTracking {
|
|
160
|
+
impression?: string; // Fired when ad is displayed
|
|
161
|
+
start?: string; // Fired when ad playback starts
|
|
162
|
+
firstQuartile?: string; // Fired at 25% of ad duration
|
|
163
|
+
midpoint?: string; // Fired at 50% of ad duration
|
|
164
|
+
thirdQuartile?: string; // Fired at 75% of ad duration
|
|
165
|
+
complete?: string; // Fired when ad completes
|
|
166
|
+
skip?: string; // Fired when ad is skipped
|
|
167
|
+
click?: string; // Fired when ad is clicked
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Ad Position Types:**
|
|
172
|
+
|
|
173
|
+
- `'pre'` - Pre-roll ad: Plays before the main video content
|
|
174
|
+
- `'mid'` - Mid-roll ad: Plays during the video at the specified `time`
|
|
175
|
+
- `'post'` - Post-roll ad: Plays after the main video content completes
|
|
48
176
|
|
|
49
177
|
---
|
|
50
178
|
|
|
@@ -55,10 +183,14 @@ npm install @zezosoft/zezo-ott-react-native-video-player
|
|
|
55
183
|
```tsx
|
|
56
184
|
import React from 'react';
|
|
57
185
|
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
186
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
58
187
|
|
|
59
188
|
export default function App() {
|
|
189
|
+
const insets = useSafeAreaInsets();
|
|
190
|
+
|
|
60
191
|
return (
|
|
61
192
|
<VideoPlayer
|
|
193
|
+
insets={insets}
|
|
62
194
|
isFocused={true}
|
|
63
195
|
onClose={() => console.log('Player closed')}
|
|
64
196
|
autoNext={true}
|
|
@@ -73,32 +205,56 @@ export default function App() {
|
|
|
73
205
|
### 🔄 Auto-Next Episodes
|
|
74
206
|
|
|
75
207
|
```tsx
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
208
|
+
import React from 'react';
|
|
209
|
+
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
210
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
211
|
+
|
|
212
|
+
export default function VideoPlayerScreen() {
|
|
213
|
+
const insets = useSafeAreaInsets();
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<VideoPlayer
|
|
217
|
+
insets={insets}
|
|
218
|
+
autoNext={true}
|
|
219
|
+
event={{
|
|
220
|
+
onPressEpisode: async ({ episode }) => {
|
|
221
|
+
console.log('Next episode:', episode.title);
|
|
222
|
+
// Add your custom logic here (e.g., subscription check)
|
|
223
|
+
// return false to block playback
|
|
224
|
+
return true;
|
|
225
|
+
},
|
|
226
|
+
}}
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
85
230
|
```
|
|
86
231
|
|
|
87
|
-
### 🎨 Theming
|
|
232
|
+
### 🎨 Custom Theming
|
|
88
233
|
|
|
89
234
|
```tsx
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
235
|
+
import React from 'react';
|
|
236
|
+
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
237
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
238
|
+
|
|
239
|
+
export default function ThemedPlayer() {
|
|
240
|
+
const insets = useSafeAreaInsets();
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<VideoPlayer
|
|
244
|
+
insets={insets}
|
|
245
|
+
theme={{
|
|
246
|
+
colors: {
|
|
247
|
+
primary: '#E50914',
|
|
248
|
+
background: '#000000',
|
|
249
|
+
onBackground: '#FFFFFF',
|
|
250
|
+
},
|
|
251
|
+
metrics: {
|
|
252
|
+
controlButtonSize: 42,
|
|
253
|
+
},
|
|
254
|
+
}}
|
|
255
|
+
/>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
102
258
|
```
|
|
103
259
|
|
|
104
260
|
### 📺 Playlist & Seasons Setup
|
|
@@ -120,10 +276,14 @@ export default function ContentDetailsScreen({ contentData }) {
|
|
|
120
276
|
const navigation = useNavigation();
|
|
121
277
|
|
|
122
278
|
const handlePlay = () => {
|
|
279
|
+
// Always reset store before loading new content
|
|
123
280
|
resetStore();
|
|
281
|
+
|
|
282
|
+
// Set seasons data
|
|
124
283
|
setContentSeasons(contentData.seasons);
|
|
125
284
|
setActiveSeason(contentData.seasons[0]);
|
|
126
285
|
|
|
286
|
+
// Create playlist from episodes
|
|
127
287
|
const playlist = contentData.seasons[0].episodes.map((ep) => ({
|
|
128
288
|
id: ep.id,
|
|
129
289
|
title: ep.name,
|
|
@@ -132,10 +292,12 @@ export default function ContentDetailsScreen({ contentData }) {
|
|
|
132
292
|
type: contentData.type,
|
|
133
293
|
}));
|
|
134
294
|
|
|
295
|
+
// Set playlist and active track
|
|
135
296
|
setPlayList(playlist);
|
|
136
297
|
setCurrentTrackIndex(0);
|
|
137
298
|
setActiveTrack(playlist[0]);
|
|
138
299
|
|
|
300
|
+
// Navigate to player screen
|
|
139
301
|
navigation.navigate('VideoPlayerScreen');
|
|
140
302
|
};
|
|
141
303
|
|
|
@@ -146,32 +308,118 @@ export default function ContentDetailsScreen({ contentData }) {
|
|
|
146
308
|
```tsx
|
|
147
309
|
// VideoPlayerScreen.tsx
|
|
148
310
|
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
311
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
149
312
|
|
|
150
313
|
export default function VideoPlayerScreen() {
|
|
151
|
-
|
|
314
|
+
const insets = useSafeAreaInsets();
|
|
315
|
+
|
|
316
|
+
return <VideoPlayer insets={insets} isFocused={true} autoNext={true} />;
|
|
152
317
|
}
|
|
153
318
|
```
|
|
154
319
|
|
|
155
|
-
|
|
320
|
+
### 📢 Ads Player
|
|
156
321
|
|
|
157
|
-
|
|
322
|
+
```tsx
|
|
323
|
+
import React from 'react';
|
|
324
|
+
import {
|
|
325
|
+
VideoPlayer,
|
|
326
|
+
type VideoAd,
|
|
327
|
+
} from '@zezosoft/zezo-ott-react-native-video-player';
|
|
328
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
329
|
+
|
|
330
|
+
export default function VideoPlayerWithAds() {
|
|
331
|
+
const insets = useSafeAreaInsets();
|
|
332
|
+
|
|
333
|
+
const ads: VideoAd[] = [
|
|
334
|
+
{
|
|
335
|
+
id: 'ad1',
|
|
336
|
+
title: 'Pre-roll Ad',
|
|
337
|
+
description: 'Advertisement',
|
|
338
|
+
position: 'pre',
|
|
339
|
+
source: 'https://example.com/ad.mp4',
|
|
340
|
+
duration: 30,
|
|
341
|
+
skippable: true,
|
|
342
|
+
skipAfter: 5,
|
|
343
|
+
clickThroughUrl: 'https://example.com',
|
|
344
|
+
tracking: {
|
|
345
|
+
impression: 'https://example.com/track/impression',
|
|
346
|
+
start: 'https://example.com/track/start',
|
|
347
|
+
firstQuartile: 'https://example.com/track/firstQuartile',
|
|
348
|
+
midpoint: 'https://example.com/track/midpoint',
|
|
349
|
+
thirdQuartile: 'https://example.com/track/thirdQuartile',
|
|
350
|
+
complete: 'https://example.com/track/complete',
|
|
351
|
+
skip: 'https://example.com/track/skip',
|
|
352
|
+
click: 'https://example.com/track/click',
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
id: 'ad2',
|
|
357
|
+
title: 'Mid-roll Ad',
|
|
358
|
+
description: 'Advertisement',
|
|
359
|
+
position: 'mid',
|
|
360
|
+
source: 'https://example.com/mid-ad.mp4',
|
|
361
|
+
duration: 15,
|
|
362
|
+
time: 300, // Show at 5 minutes (300 seconds)
|
|
363
|
+
skippable: false,
|
|
364
|
+
skipAfter: 0,
|
|
365
|
+
tracking: {
|
|
366
|
+
impression: 'https://example.com/track/mid/impression',
|
|
367
|
+
complete: 'https://example.com/track/mid/complete',
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
id: 'ad3',
|
|
372
|
+
title: 'Post-roll Ad',
|
|
373
|
+
description: 'Advertisement',
|
|
374
|
+
position: 'post',
|
|
375
|
+
source: 'https://example.com/post-ad.mp4',
|
|
376
|
+
duration: 20,
|
|
377
|
+
skippable: true,
|
|
378
|
+
skipAfter: 10,
|
|
379
|
+
tracking: {
|
|
380
|
+
impression: 'https://example.com/track/post/impression',
|
|
381
|
+
complete: 'https://example.com/track/post/complete',
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
];
|
|
158
385
|
|
|
159
|
-
|
|
160
|
-
|
|
386
|
+
return (
|
|
387
|
+
<VideoPlayer
|
|
388
|
+
insets={insets}
|
|
389
|
+
isFocused={true}
|
|
390
|
+
ads={ads}
|
|
391
|
+
onAdEnd={(ad) => {
|
|
392
|
+
console.log('Ad finished:', ad.title);
|
|
393
|
+
}}
|
|
394
|
+
onAdError={(error, ad) => {
|
|
395
|
+
console.error('Ad error:', error, ad.title);
|
|
396
|
+
}}
|
|
397
|
+
onAdTracking={({ ad, trackingUrl, event }) => {
|
|
398
|
+
console.log('Ad tracking:', event, trackingUrl);
|
|
399
|
+
// Make tracking request to your ad server
|
|
400
|
+
fetch(trackingUrl).catch(console.error);
|
|
401
|
+
}}
|
|
402
|
+
onClose={() => console.log('Player closed')}
|
|
403
|
+
/>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
```
|
|
161
407
|
|
|
162
408
|
---
|
|
163
409
|
|
|
164
|
-
##
|
|
410
|
+
## 🗄️ Video Player Store
|
|
165
411
|
|
|
166
|
-
|
|
167
|
-
- Handle **tracks**: audio, subtitles, video quality
|
|
168
|
-
- Control **UI state**: controls visibility, settings modal, skip/next episode
|
|
169
|
-
- Track **content structure**: playlists, seasons, active season/episode
|
|
170
|
-
- Support **analytics**: watch time, view count, error handling
|
|
412
|
+
The **VideoPlayerStore** is a centralized Zustand store that powers the ZezoOTT Video Player. It manages playback state, tracks, UI controls, analytics, and content navigation.
|
|
171
413
|
|
|
172
|
-
|
|
414
|
+
### 🚀 Store Features
|
|
173
415
|
|
|
174
|
-
|
|
416
|
+
- **Playback State**: current time, duration, buffering, playback rate
|
|
417
|
+
- **Tracks Management**: audio tracks, subtitles, video quality
|
|
418
|
+
- **UI State**: controls visibility, settings modal, skip/next episode indicators
|
|
419
|
+
- **Content Structure**: playlists, seasons, active season/episode
|
|
420
|
+
- **Analytics**: watch time tracking, view count, error handling
|
|
421
|
+
|
|
422
|
+
### ⚡ Store Usage Example
|
|
175
423
|
|
|
176
424
|
```tsx
|
|
177
425
|
import { useVideoPlayerStore } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
@@ -251,21 +499,25 @@ export default function VideoPlayerExample() {
|
|
|
251
499
|
|
|
252
500
|
---
|
|
253
501
|
|
|
254
|
-
## 📝
|
|
502
|
+
## 📝 Best Practices
|
|
255
503
|
|
|
256
|
-
- 🔄 **Always call `resetStore()`** before loading new content
|
|
257
|
-
- 🎚️ **Playback rate** requires both `rate` and `label` in sync
|
|
258
|
-
- 🕹️ **Controls auto-hide** is managed by `controlsTimer
|
|
259
|
-
- 🌐 **Track selections** depend on available `OnLoadData` — always null-check
|
|
260
|
-
- 📊 **Analytics props** integrate with your analytics pipeline
|
|
261
|
-
- ⚠️ **Error handling**: Use `setError` for surfacing playback issues
|
|
262
|
-
- 🎬 **Seasons & episodes**: Update both `contentSeasons` and `activeSeason` before setting playlist
|
|
504
|
+
- 🔄 **Always call `resetStore()`** before loading new content to prevent state conflicts
|
|
505
|
+
- 🎚️ **Playback rate** requires both `rate` and `label` to be in sync
|
|
506
|
+
- 🕹️ **Controls auto-hide** is managed by `controlsTimer` in the store
|
|
507
|
+
- 🌐 **Track selections** depend on available `OnLoadData` — always null-check before using
|
|
508
|
+
- 📊 **Analytics props** integrate seamlessly with your analytics pipeline
|
|
509
|
+
- ⚠️ **Error handling**: Use `setError` from the store for surfacing playback issues
|
|
510
|
+
- 🎬 **Seasons & episodes**: Update both `contentSeasons` and `activeSeason` before setting playlist
|
|
511
|
+
- 📢 **Ads**: Ensure ad sources are valid and tracking URLs are properly configured
|
|
512
|
+
- 🔒 **Type safety**: Leverage TypeScript types for better development experience
|
|
263
513
|
|
|
264
514
|
---
|
|
265
515
|
|
|
266
|
-
##
|
|
516
|
+
## 🔧 Troubleshooting
|
|
517
|
+
|
|
518
|
+
### Fullscreen Not Working
|
|
267
519
|
|
|
268
|
-
If fullscreen doesn
|
|
520
|
+
If fullscreen doesn't work, ensure you have installed **react-native-orientation-locker**:
|
|
269
521
|
|
|
270
522
|
```bash
|
|
271
523
|
yarn add react-native-orientation-locker
|
|
@@ -273,22 +525,29 @@ yarn add react-native-orientation-locker
|
|
|
273
525
|
npm install react-native-orientation-locker
|
|
274
526
|
```
|
|
275
527
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
### 🔹 Known Issues
|
|
528
|
+
#### Known Issues
|
|
279
529
|
|
|
280
530
|
If you encounter any problems with react-native-orientation-locker, check the official issues page:
|
|
281
531
|
[View Known Issues](https://github.com/wonday/react-native-orientation-locker/issues)
|
|
282
532
|
|
|
283
|
-
|
|
533
|
+
#### Setup & Installation
|
|
284
534
|
|
|
285
535
|
Follow the official guide to properly set up react-native-orientation-locker:
|
|
286
536
|
[View Setup Guide](https://github.com/wonday/react-native-orientation-locker)
|
|
287
537
|
|
|
538
|
+
### Common Issues
|
|
539
|
+
|
|
540
|
+
1. **Player not showing**: Ensure you've set up the store with `activeTrack` before rendering
|
|
541
|
+
2. **Ads not playing**: Verify ad sources are accessible and `position` is correctly set
|
|
542
|
+
3. **Controls not visible**: Check `isFocused` prop and ensure screen is active
|
|
543
|
+
4. **TypeScript errors**: Make sure all peer dependencies are installed
|
|
544
|
+
|
|
288
545
|
---
|
|
289
546
|
|
|
290
547
|
## 🔗 Demo App
|
|
291
548
|
|
|
549
|
+
Check out our demo app to see the player in action:
|
|
550
|
+
|
|
292
551
|
👉 [Zezo OTT Demo App](https://github.com/Zezo-Soft/zezo-ott-demo-app)
|
|
293
552
|
|
|
294
553
|
---
|