@zezosoft/zezo-ott-react-native-video-player 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +308 -0
- package/lib/module/VideoPlayer/MediaControls/BottomControls.js +156 -0
- package/lib/module/VideoPlayer/MediaControls/BottomControls.js.map +1 -0
- package/lib/module/VideoPlayer/MediaControls/MediaControls.js +27 -0
- package/lib/module/VideoPlayer/MediaControls/MediaControls.js.map +1 -0
- package/lib/module/VideoPlayer/MediaControls/MediaControlsProvider.js +85 -0
- package/lib/module/VideoPlayer/MediaControls/MediaControlsProvider.js.map +1 -0
- package/lib/module/VideoPlayer/MediaControls/MiddleControls.js +208 -0
- package/lib/module/VideoPlayer/MediaControls/MiddleControls.js.map +1 -0
- package/lib/module/VideoPlayer/MediaControls/TopControls.js +94 -0
- package/lib/module/VideoPlayer/MediaControls/TopControls.js.map +1 -0
- package/lib/module/VideoPlayer/Styles/fonts.js +58 -0
- package/lib/module/VideoPlayer/Styles/fonts.js.map +1 -0
- package/lib/module/VideoPlayer/Styles/globalStyles.js +75 -0
- package/lib/module/VideoPlayer/Styles/globalStyles.js.map +1 -0
- package/lib/module/VideoPlayer/VideoPlayer.js +180 -0
- package/lib/module/VideoPlayer/VideoPlayer.js.map +1 -0
- package/lib/module/VideoPlayer/components/ProgressBar.js +84 -0
- package/lib/module/VideoPlayer/components/ProgressBar.js.map +1 -0
- package/lib/module/VideoPlayer/components/SkipAndNextControls.js +154 -0
- package/lib/module/VideoPlayer/components/SkipAndNextControls.js.map +1 -0
- package/lib/module/VideoPlayer/components/SubtitleView.js +57 -0
- package/lib/module/VideoPlayer/components/SubtitleView.js.map +1 -0
- package/lib/module/VideoPlayer/context/VideoPlayerConfig.js +47 -0
- package/lib/module/VideoPlayer/context/VideoPlayerConfig.js.map +1 -0
- package/lib/module/VideoPlayer/context/index.js +4 -0
- package/lib/module/VideoPlayer/context/index.js.map +1 -0
- package/lib/module/VideoPlayer/index.js +7 -0
- package/lib/module/VideoPlayer/index.js.map +1 -0
- package/lib/module/VideoPlayer/model/AudioAndSubtitles.js +257 -0
- package/lib/module/VideoPlayer/model/AudioAndSubtitles.js.map +1 -0
- package/lib/module/VideoPlayer/model/Episodes.js +272 -0
- package/lib/module/VideoPlayer/model/Episodes.js.map +1 -0
- package/lib/module/VideoPlayer/model/SettingModal.js +115 -0
- package/lib/module/VideoPlayer/model/SettingModal.js.map +1 -0
- package/lib/module/VideoPlayer/model/SpeedControls.js +140 -0
- package/lib/module/VideoPlayer/model/SpeedControls.js.map +1 -0
- package/lib/module/VideoPlayer/model/VideoPlayerSettings.js +113 -0
- package/lib/module/VideoPlayer/model/VideoPlayerSettings.js.map +1 -0
- package/lib/module/VideoPlayer/store/index.js +5 -0
- package/lib/module/VideoPlayer/store/index.js.map +1 -0
- package/lib/module/VideoPlayer/store/videoPlayer.type.js +4 -0
- package/lib/module/VideoPlayer/store/videoPlayer.type.js.map +1 -0
- package/lib/module/VideoPlayer/store/videoPlayerStore.js +147 -0
- package/lib/module/VideoPlayer/store/videoPlayerStore.js.map +1 -0
- package/lib/module/VideoPlayer/utils/Display.js +22 -0
- package/lib/module/VideoPlayer/utils/Display.js.map +1 -0
- package/lib/module/VideoPlayer/utils/PlatformSelector.js +18 -0
- package/lib/module/VideoPlayer/utils/PlatformSelector.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/index.js +5 -0
- package/lib/module/VideoPlayer/utils/hooks/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/useVideoPlayerBack.js +48 -0
- package/lib/module/VideoPlayer/utils/hooks/useVideoPlayerBack.js.map +1 -0
- package/lib/module/VideoPlayer/utils/hooks/useVideoResolutions.js +88 -0
- package/lib/module/VideoPlayer/utils/hooks/useVideoResolutions.js.map +1 -0
- package/lib/module/VideoPlayer/utils/index.js +10 -0
- package/lib/module/VideoPlayer/utils/index.js.map +1 -0
- package/lib/module/VideoPlayer/utils/lockOrientation.js +31 -0
- package/lib/module/VideoPlayer/utils/lockOrientation.js.map +1 -0
- package/lib/module/VideoPlayer/utils/playerEvents.js +79 -0
- package/lib/module/VideoPlayer/utils/playerEvents.js.map +1 -0
- package/lib/module/VideoPlayer/utils/timeFormatter.js +35 -0
- package/lib/module/VideoPlayer/utils/timeFormatter.js.map +1 -0
- package/lib/module/VideoPlayer/utils/useWatchReporter.js +68 -0
- package/lib/module/VideoPlayer/utils/useWatchReporter.js.map +1 -0
- package/lib/module/VideoPlayer/utils/videoControl.js +166 -0
- package/lib/module/VideoPlayer/utils/videoControl.js.map +1 -0
- package/lib/module/VideoPlayer/utils/videoRef.js +5 -0
- package/lib/module/VideoPlayer/utils/videoRef.js.map +1 -0
- package/lib/module/VideoPlayer/utils/videoSource.js +17 -0
- package/lib/module/VideoPlayer/utils/videoSource.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/BottomControls.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/BottomControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControls.d.ts +6 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControlsProvider.d.ts +14 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/MediaControlsProvider.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/MiddleControls.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/MiddleControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/TopControls.d.ts +7 -0
- package/lib/typescript/src/VideoPlayer/MediaControls/TopControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/Styles/fonts.d.ts +54 -0
- package/lib/typescript/src/VideoPlayer/Styles/fonts.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/Styles/globalStyles.d.ts +70 -0
- package/lib/typescript/src/VideoPlayer/Styles/globalStyles.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/VideoPlayer.d.ts +22 -0
- package/lib/typescript/src/VideoPlayer/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/components/ProgressBar.d.ts +12 -0
- package/lib/typescript/src/VideoPlayer/components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/components/SkipAndNextControls.d.ts +12 -0
- package/lib/typescript/src/VideoPlayer/components/SkipAndNextControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/components/SubtitleView.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/components/SubtitleView.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/context/VideoPlayerConfig.d.ts +25 -0
- package/lib/typescript/src/VideoPlayer/context/VideoPlayerConfig.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/context/index.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/context/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/index.d.ts +5 -0
- package/lib/typescript/src/VideoPlayer/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/model/AudioAndSubtitles.d.ts +4 -0
- package/lib/typescript/src/VideoPlayer/model/AudioAndSubtitles.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/model/Episodes.d.ts +12 -0
- package/lib/typescript/src/VideoPlayer/model/Episodes.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/model/SettingModal.d.ts +12 -0
- package/lib/typescript/src/VideoPlayer/model/SettingModal.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/model/SpeedControls.d.ts +4 -0
- package/lib/typescript/src/VideoPlayer/model/SpeedControls.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/model/VideoPlayerSettings.d.ts +7 -0
- package/lib/typescript/src/VideoPlayer/model/VideoPlayerSettings.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/store/index.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/store/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/store/videoPlayer.type.d.ts +144 -0
- package/lib/typescript/src/VideoPlayer/store/videoPlayer.type.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/store/videoPlayerStore.d.ts +20 -0
- package/lib/typescript/src/VideoPlayer/store/videoPlayerStore.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/Display.d.ts +8 -0
- package/lib/typescript/src/VideoPlayer/utils/Display.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/PlatformSelector.d.ts +11 -0
- package/lib/typescript/src/VideoPlayer/utils/PlatformSelector.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 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useVideoPlayerBack.d.ts +6 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useVideoPlayerBack.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useVideoResolutions.d.ts +12 -0
- package/lib/typescript/src/VideoPlayer/utils/hooks/useVideoResolutions.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/index.d.ts +8 -0
- package/lib/typescript/src/VideoPlayer/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/lockOrientation.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/utils/lockOrientation.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/playerEvents.d.ts +18 -0
- package/lib/typescript/src/VideoPlayer/utils/playerEvents.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/timeFormatter.d.ts +9 -0
- package/lib/typescript/src/VideoPlayer/utils/timeFormatter.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/useWatchReporter.d.ts +26 -0
- package/lib/typescript/src/VideoPlayer/utils/useWatchReporter.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/videoControl.d.ts +17 -0
- package/lib/typescript/src/VideoPlayer/utils/videoControl.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/videoRef.d.ts +3 -0
- package/lib/typescript/src/VideoPlayer/utils/videoRef.d.ts.map +1 -0
- package/lib/typescript/src/VideoPlayer/utils/videoSource.d.ts +10 -0
- package/lib/typescript/src/VideoPlayer/utils/videoSource.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +191 -0
- package/src/VideoPlayer/MediaControls/BottomControls.tsx +185 -0
- package/src/VideoPlayer/MediaControls/MediaControls.tsx +29 -0
- package/src/VideoPlayer/MediaControls/MediaControlsProvider.tsx +99 -0
- package/src/VideoPlayer/MediaControls/MiddleControls.tsx +232 -0
- package/src/VideoPlayer/MediaControls/TopControls.tsx +92 -0
- package/src/VideoPlayer/Styles/fonts.ts +106 -0
- package/src/VideoPlayer/Styles/globalStyles.ts +74 -0
- package/src/VideoPlayer/VideoPlayer.tsx +217 -0
- package/src/VideoPlayer/components/ProgressBar.tsx +98 -0
- package/src/VideoPlayer/components/SkipAndNextControls.tsx +195 -0
- package/src/VideoPlayer/components/SubtitleView.tsx +53 -0
- package/src/VideoPlayer/context/VideoPlayerConfig.tsx +65 -0
- package/src/VideoPlayer/context/index.ts +5 -0
- package/src/VideoPlayer/index.ts +4 -0
- package/src/VideoPlayer/model/AudioAndSubtitles.tsx +302 -0
- package/src/VideoPlayer/model/Episodes.tsx +294 -0
- package/src/VideoPlayer/model/SettingModal.tsx +128 -0
- package/src/VideoPlayer/model/SpeedControls.tsx +134 -0
- package/src/VideoPlayer/model/VideoPlayerSettings.tsx +141 -0
- package/src/VideoPlayer/store/index.ts +2 -0
- package/src/VideoPlayer/store/videoPlayer.type.ts +192 -0
- package/src/VideoPlayer/store/videoPlayerStore.ts +101 -0
- package/src/VideoPlayer/utils/Display.ts +14 -0
- package/src/VideoPlayer/utils/PlatformSelector.ts +18 -0
- package/src/VideoPlayer/utils/hooks/index.ts +2 -0
- package/src/VideoPlayer/utils/hooks/useVideoPlayerBack.ts +66 -0
- package/src/VideoPlayer/utils/hooks/useVideoResolutions.ts +119 -0
- package/src/VideoPlayer/utils/index.ts +7 -0
- package/src/VideoPlayer/utils/lockOrientation.ts +34 -0
- package/src/VideoPlayer/utils/playerEvents.ts +97 -0
- package/src/VideoPlayer/utils/timeFormatter.ts +47 -0
- package/src/VideoPlayer/utils/useWatchReporter.ts +104 -0
- package/src/VideoPlayer/utils/videoControl.ts +192 -0
- package/src/VideoPlayer/utils/videoRef.ts +4 -0
- package/src/VideoPlayer/utils/videoSource.ts +23 -0
- package/src/index.tsx +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Naresh Dhamu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# 🎬 ZezoOTT Video Player
|
|
2
|
+
|
|
3
|
+
The **ZezoOTT Video Player** is a powerful React Native component crafted for OTT platforms.
|
|
4
|
+
It delivers a **seamless full-screen video playback experience**, powered by a centralized **VideoPlayer Store** for state management.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- 📺 **Episode navigation & Seasons support**
|
|
11
|
+
- 📊 **Watch progress tracking & analytics**
|
|
12
|
+
- 🎨 **Custom theming**
|
|
13
|
+
- 🔄 **Auto-next playback**
|
|
14
|
+
- 🎬 **Playlist & seasons integration**
|
|
15
|
+
- 🗄️ **Centralized store for playback state, tracks & UI**
|
|
16
|
+
- 📱 **Optimized for React Native OTT apps**
|
|
17
|
+
- 🛠 **Minimal configuration, production-ready**
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📦 Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add @zezosoft/zezo-ott-react-native-video-player
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
or
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @zezosoft/zezo-ott-react-native-video-player
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## ⚙️ VideoPlayer Props
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Description |
|
|
38
|
+
| ------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
39
|
+
| **onClose** | `() => void` | Triggered when the player is closed. |
|
|
40
|
+
| **isFocused** | `boolean` | Controls playback focus. Automatically pauses when the screen is not active. |
|
|
41
|
+
| **seekTime** | `number \| null` | Starts playback from a given time (in seconds). |
|
|
42
|
+
| **mode** | `'fullscreen' \| 'normal'` | Sets the display mode of the player. |
|
|
43
|
+
| **onSeek** | `(time: number) => void` | Fired when the user manually seeks to a new playback position. |
|
|
44
|
+
| **autoNext** | `boolean` | Automatically plays the next episode/video after completion. |
|
|
45
|
+
| **event** | `{ onPressEpisode?: ({ episode }: { episode: MediaEpisode }) => Promise<boolean> }` | Event hooks (e.g. custom handling for episode selection). |
|
|
46
|
+
| **theme** | `Partial<VideoPlayerTheme>` | Customize the look & feel of the player (colors, metrics, etc.). |
|
|
47
|
+
| **onWatchProgress** | `(progress: ExtendedWatchProgress) => void` | Reports playback analytics such as watch time, current time, and completion. |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🚀 Usage Examples
|
|
52
|
+
|
|
53
|
+
### ▶️ Basic Example
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import React from 'react';
|
|
57
|
+
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
58
|
+
|
|
59
|
+
export default function App() {
|
|
60
|
+
return (
|
|
61
|
+
<VideoPlayer
|
|
62
|
+
isFocused={true}
|
|
63
|
+
onClose={() => console.log('Player closed')}
|
|
64
|
+
autoNext={true}
|
|
65
|
+
onWatchProgress={(progress) => {
|
|
66
|
+
console.log('Watch Progress:', progress);
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 🔄 Auto-Next Episodes
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<VideoPlayer
|
|
77
|
+
autoNext={true}
|
|
78
|
+
event={{
|
|
79
|
+
onPressEpisode: async ({ episode }) => {
|
|
80
|
+
console.log('Next episode:', episode.title);
|
|
81
|
+
return true; // return false to block playback
|
|
82
|
+
},
|
|
83
|
+
}}
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 🎨 Theming Example
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
<VideoPlayer
|
|
91
|
+
theme={{
|
|
92
|
+
colors: {
|
|
93
|
+
primary: '#E50914',
|
|
94
|
+
background: '#000000',
|
|
95
|
+
onBackground: '#FFFFFF',
|
|
96
|
+
},
|
|
97
|
+
metrics: {
|
|
98
|
+
controlButtonSize: 42,
|
|
99
|
+
},
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 📺 Playlist & Seasons Setup
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
// ContentDetailsScreen.tsx
|
|
108
|
+
import { useVideoPlayerStore } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
109
|
+
import { useNavigation } from '@react-navigation/native';
|
|
110
|
+
|
|
111
|
+
export default function ContentDetailsScreen({ contentData }) {
|
|
112
|
+
const {
|
|
113
|
+
resetStore,
|
|
114
|
+
setPlayList,
|
|
115
|
+
setContentSeasons,
|
|
116
|
+
setActiveSeason,
|
|
117
|
+
setCurrentTrackIndex,
|
|
118
|
+
setActiveTrack,
|
|
119
|
+
} = useVideoPlayerStore();
|
|
120
|
+
const navigation = useNavigation();
|
|
121
|
+
|
|
122
|
+
const handlePlay = () => {
|
|
123
|
+
resetStore();
|
|
124
|
+
setContentSeasons(contentData.seasons);
|
|
125
|
+
setActiveSeason(contentData.seasons[0]);
|
|
126
|
+
|
|
127
|
+
const playlist = contentData.seasons[0].episodes.map((ep) => ({
|
|
128
|
+
id: ep.id,
|
|
129
|
+
title: ep.name,
|
|
130
|
+
contentId: contentData.id,
|
|
131
|
+
sourceLink: ep.sourceLink,
|
|
132
|
+
type: contentData.type,
|
|
133
|
+
}));
|
|
134
|
+
|
|
135
|
+
setPlayList(playlist);
|
|
136
|
+
setCurrentTrackIndex(0);
|
|
137
|
+
setActiveTrack(playlist[0]);
|
|
138
|
+
|
|
139
|
+
navigation.navigate('VideoPlayerScreen');
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return <Button title="Play" onPress={handlePlay} />;
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
// VideoPlayerScreen.tsx
|
|
148
|
+
import { VideoPlayer } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
149
|
+
|
|
150
|
+
export default function VideoPlayerScreen() {
|
|
151
|
+
return <VideoPlayer isFocused={true} autoNext={true} />;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
# 🗄️ Video Player Store
|
|
158
|
+
|
|
159
|
+
The **VideoPlayerStore** is a centralized state store that powers the ZezoOTT Video Player.
|
|
160
|
+
It manages **playback state, tracks, UI controls, analytics, and content navigation**.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 🚀 Store Features
|
|
165
|
+
|
|
166
|
+
- Manage **playback state**: current time, duration, buffering, playback rate
|
|
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
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## ⚡ Store Usage Example
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { useVideoPlayerStore } from '@zezosoft/zezo-ott-react-native-video-player';
|
|
178
|
+
import React from 'react';
|
|
179
|
+
|
|
180
|
+
export default function VideoPlayerExample() {
|
|
181
|
+
const {
|
|
182
|
+
setPlayList,
|
|
183
|
+
setActiveSeason,
|
|
184
|
+
setActiveTrack,
|
|
185
|
+
setContentSeasons,
|
|
186
|
+
setCurrentTrackIndex,
|
|
187
|
+
resetStore,
|
|
188
|
+
playList,
|
|
189
|
+
activeTrack,
|
|
190
|
+
activeSeason,
|
|
191
|
+
} = useVideoPlayerStore();
|
|
192
|
+
|
|
193
|
+
const contentData = {
|
|
194
|
+
id: 'movie123',
|
|
195
|
+
type: 'series',
|
|
196
|
+
name: 'My Series',
|
|
197
|
+
seasons: [
|
|
198
|
+
{
|
|
199
|
+
id: 'season1',
|
|
200
|
+
name: 'Season 1',
|
|
201
|
+
seasonNumber: 1,
|
|
202
|
+
episodes: [
|
|
203
|
+
{
|
|
204
|
+
id: 'ep1',
|
|
205
|
+
name: 'Episode 1',
|
|
206
|
+
sourceLink: 'https://example.com/ep1.mp4',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: 'ep2',
|
|
210
|
+
name: 'Episode 2',
|
|
211
|
+
sourceLink: 'https://example.com/ep2.mp4',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const setupPlayer = () => {
|
|
219
|
+
resetStore();
|
|
220
|
+
setContentSeasons(contentData.seasons);
|
|
221
|
+
setActiveSeason(contentData.seasons[0]);
|
|
222
|
+
|
|
223
|
+
const playlist = contentData.seasons[0].episodes.map((ep) => ({
|
|
224
|
+
id: ep.id,
|
|
225
|
+
title: ep.name,
|
|
226
|
+
contentId: contentData.id,
|
|
227
|
+
sourceLink: ep.sourceLink,
|
|
228
|
+
type: contentData.type,
|
|
229
|
+
}));
|
|
230
|
+
|
|
231
|
+
setPlayList(playlist);
|
|
232
|
+
setCurrentTrackIndex(0);
|
|
233
|
+
setActiveTrack(playlist[0]);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<div>
|
|
238
|
+
<button onClick={setupPlayer}>Load Series</button>
|
|
239
|
+
<h3>Active Season: {activeSeason?.name}</h3>
|
|
240
|
+
<ul>
|
|
241
|
+
{playList.map((track) => (
|
|
242
|
+
<li key={track.id}>
|
|
243
|
+
{track.title} {activeTrack?.id === track.id ? '(Playing)' : ''}
|
|
244
|
+
</li>
|
|
245
|
+
))}
|
|
246
|
+
</ul>
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 📝 Notes & Best Practices
|
|
255
|
+
|
|
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.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 📌 Fullscreen Notes
|
|
267
|
+
|
|
268
|
+
If fullscreen doesn’t work, ensure you install **react-native-orientation-locker**:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
yarn add react-native-orientation-locker
|
|
272
|
+
# or
|
|
273
|
+
npm install react-native-orientation-locker
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
🔗 Known issues: [react-native-orientation-locker issues](https://github.com/wonday/react-native-orientation-locker/issues)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 🔗 Demo App
|
|
281
|
+
|
|
282
|
+
👉 [Zezo OTT Demo App](https://github.com/Zezo-Soft/zezo-ott-demo-app)
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 👨💻 Developer
|
|
287
|
+
|
|
288
|
+
Made with passion by:
|
|
289
|
+
|
|
290
|
+
<p>
|
|
291
|
+
<a href="https://github.com/Naresh-Dhamu" target="_blank">
|
|
292
|
+
<img src="https://avatars.githubusercontent.com/u/89912059?v=4" width="80" height="80" alt="Naresh Dhamu" style="border-radius: 50%; margin-left:10px">
|
|
293
|
+
<br />
|
|
294
|
+
<strong>Naresh Dhamu</strong>
|
|
295
|
+
</a>
|
|
296
|
+
</p>
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## 📄 License
|
|
301
|
+
|
|
302
|
+
Licensed under the [MIT License](LICENSE).
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
<p align="center">
|
|
307
|
+
⚡ Powered by <a href="https://zezosoft.com" target="_blank"><strong>ZezoSoft</strong></a>
|
|
308
|
+
</p>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import { scale, verticalScale, moderateScale } from 'react-native-size-matters';
|
|
6
|
+
import { RFValue } from 'react-native-responsive-fontsize';
|
|
7
|
+
import { Settings as SettingsIcon, SlidersHorizontal as SpeedIcon, Subtitles as SubtitlesIcon, ListChecks as EpisodesIcon } from 'lucide-react-native';
|
|
8
|
+
import { useVideoPlayerStore } from "../store/videoPlayerStore.js";
|
|
9
|
+
import { videoRef } from "../utils/videoRef.js";
|
|
10
|
+
import { formatTime } from "../utils/index.js";
|
|
11
|
+
import ProgressBar from "../components/ProgressBar.js";
|
|
12
|
+
import { useVideoPlayerConfig } from "../context/index.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const ControlButton = ({
|
|
15
|
+
onPress,
|
|
16
|
+
icon,
|
|
17
|
+
label,
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
buttonStyle,
|
|
20
|
+
labelStyle,
|
|
21
|
+
colors
|
|
22
|
+
}) => /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
23
|
+
onPress: onPress,
|
|
24
|
+
style: [styles.button, buttonStyle],
|
|
25
|
+
activeOpacity: 0.8,
|
|
26
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
27
|
+
children: [icon, /*#__PURE__*/_jsx(Text, {
|
|
28
|
+
style: [styles.buttonText, labelStyle, {
|
|
29
|
+
color: colors.text
|
|
30
|
+
}],
|
|
31
|
+
children: label
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
const BottomControls = () => {
|
|
35
|
+
const {
|
|
36
|
+
duration,
|
|
37
|
+
currentTime,
|
|
38
|
+
activeTrack,
|
|
39
|
+
playableDuration,
|
|
40
|
+
setSettingsModal,
|
|
41
|
+
setIsPaused,
|
|
42
|
+
setControlsVisible,
|
|
43
|
+
playBackRateLabel
|
|
44
|
+
} = useVideoPlayerStore();
|
|
45
|
+
const {
|
|
46
|
+
colors
|
|
47
|
+
} = useVideoPlayerConfig();
|
|
48
|
+
const getRemainingTime = useCallback((totalDuration, currentPos) => {
|
|
49
|
+
const remainingTime = totalDuration - currentPos;
|
|
50
|
+
return formatTime(Math.max(remainingTime, 0));
|
|
51
|
+
}, []);
|
|
52
|
+
const onSeek = value => {
|
|
53
|
+
videoRef.current?.seek(value);
|
|
54
|
+
};
|
|
55
|
+
const onOpenSettings = type => {
|
|
56
|
+
setSettingsModal({
|
|
57
|
+
action: type,
|
|
58
|
+
isVisible: true
|
|
59
|
+
});
|
|
60
|
+
setIsPaused(true);
|
|
61
|
+
setControlsVisible(false);
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
64
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
65
|
+
style: styles.sliderContainer,
|
|
66
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
67
|
+
style: styles.sliderWrapper,
|
|
68
|
+
children: /*#__PURE__*/_jsx(ProgressBar, {
|
|
69
|
+
duration: duration,
|
|
70
|
+
currentTime: currentTime,
|
|
71
|
+
bufferedTime: playableDuration,
|
|
72
|
+
onSeek: onSeek
|
|
73
|
+
})
|
|
74
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
75
|
+
style: [styles.timeText, {
|
|
76
|
+
color: colors.text
|
|
77
|
+
}],
|
|
78
|
+
children: getRemainingTime(duration, currentTime)
|
|
79
|
+
})]
|
|
80
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
81
|
+
style: styles.buttonsContainer,
|
|
82
|
+
children: [/*#__PURE__*/_jsx(ControlButton, {
|
|
83
|
+
onPress: () => onOpenSettings('speed'),
|
|
84
|
+
icon: /*#__PURE__*/_jsx(SpeedIcon, {
|
|
85
|
+
size: moderateScale(18),
|
|
86
|
+
color: colors.text
|
|
87
|
+
}),
|
|
88
|
+
label: playBackRateLabel && playBackRateLabel !== 'Normal' ? `Speed (${playBackRateLabel})` : 'Speed',
|
|
89
|
+
colors: colors
|
|
90
|
+
}), /*#__PURE__*/_jsx(ControlButton, {
|
|
91
|
+
onPress: () => onOpenSettings('audioOrSubtitle'),
|
|
92
|
+
icon: /*#__PURE__*/_jsx(SubtitlesIcon, {
|
|
93
|
+
size: moderateScale(19),
|
|
94
|
+
color: colors.text
|
|
95
|
+
}),
|
|
96
|
+
label: "Audio & Subtitles",
|
|
97
|
+
colors: colors
|
|
98
|
+
}), /*#__PURE__*/_jsx(ControlButton, {
|
|
99
|
+
onPress: () => onOpenSettings('settings'),
|
|
100
|
+
icon: /*#__PURE__*/_jsx(SettingsIcon, {
|
|
101
|
+
size: moderateScale(18),
|
|
102
|
+
color: colors.text
|
|
103
|
+
}),
|
|
104
|
+
label: "Settings",
|
|
105
|
+
colors: colors
|
|
106
|
+
}), !activeTrack?.isTrailer && activeTrack?.type === 'series' && /*#__PURE__*/_jsx(ControlButton, {
|
|
107
|
+
onPress: () => onOpenSettings('episodes'),
|
|
108
|
+
icon: /*#__PURE__*/_jsx(EpisodesIcon, {
|
|
109
|
+
size: moderateScale(17),
|
|
110
|
+
color: colors.text
|
|
111
|
+
}),
|
|
112
|
+
label: "Episodes",
|
|
113
|
+
colors: colors
|
|
114
|
+
})]
|
|
115
|
+
})]
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
export default BottomControls;
|
|
119
|
+
const styles = StyleSheet.create({
|
|
120
|
+
sliderContainer: {
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
paddingHorizontal: scale(12)
|
|
124
|
+
},
|
|
125
|
+
sliderWrapper: {
|
|
126
|
+
flex: 1,
|
|
127
|
+
minWidth: 0
|
|
128
|
+
},
|
|
129
|
+
timeText: {
|
|
130
|
+
width: scale(50),
|
|
131
|
+
textAlign: 'right',
|
|
132
|
+
marginLeft: scale(4),
|
|
133
|
+
fontSize: RFValue(12),
|
|
134
|
+
fontWeight: '500'
|
|
135
|
+
},
|
|
136
|
+
buttonsContainer: {
|
|
137
|
+
flexDirection: 'row',
|
|
138
|
+
justifyContent: 'center',
|
|
139
|
+
flexWrap: 'wrap',
|
|
140
|
+
paddingHorizontal: scale(10)
|
|
141
|
+
},
|
|
142
|
+
button: {
|
|
143
|
+
flexDirection: 'row',
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
paddingHorizontal: scale(12),
|
|
146
|
+
paddingVertical: verticalScale(6),
|
|
147
|
+
marginHorizontal: scale(6),
|
|
148
|
+
marginVertical: verticalScale(4),
|
|
149
|
+
borderRadius: moderateScale(8)
|
|
150
|
+
},
|
|
151
|
+
buttonText: {
|
|
152
|
+
fontSize: RFValue(13),
|
|
153
|
+
marginLeft: scale(6)
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=BottomControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","StyleSheet","Text","TouchableOpacity","View","scale","verticalScale","moderateScale","RFValue","Settings","SettingsIcon","SlidersHorizontal","SpeedIcon","Subtitles","SubtitlesIcon","ListChecks","EpisodesIcon","useVideoPlayerStore","videoRef","formatTime","ProgressBar","useVideoPlayerConfig","jsx","_jsx","jsxs","_jsxs","ControlButton","onPress","icon","label","accessibilityLabel","buttonStyle","labelStyle","colors","style","styles","button","activeOpacity","children","buttonText","color","text","BottomControls","duration","currentTime","activeTrack","playableDuration","setSettingsModal","setIsPaused","setControlsVisible","playBackRateLabel","getRemainingTime","totalDuration","currentPos","remainingTime","Math","max","onSeek","value","current","seek","onOpenSettings","type","action","isVisible","sliderContainer","sliderWrapper","bufferedTime","timeText","buttonsContainer","size","isTrailer","create","flexDirection","alignItems","paddingHorizontal","flex","minWidth","width","textAlign","marginLeft","fontSize","fontWeight","justifyContent","flexWrap","paddingVertical","marginHorizontal","marginVertical","borderRadius"],"sourceRoot":"../../../../src","sources":["VideoPlayer/MediaControls/BottomControls.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SACEC,UAAU,EACVC,IAAI,EACJC,gBAAgB,EAChBC,IAAI,QAIC,cAAc;AACrB,SAASC,KAAK,EAAEC,aAAa,EAAEC,aAAa,QAAQ,2BAA2B;AAC/E,SAASC,OAAO,QAAQ,kCAAkC;AAE1D,SACEC,QAAQ,IAAIC,YAAY,EACxBC,iBAAiB,IAAIC,SAAS,EAC9BC,SAAS,IAAIC,aAAa,EAC1BC,UAAU,IAAIC,YAAY,QACrB,qBAAqB;AAE5B,SAASC,mBAAmB,QAAQ,8BAA2B;AAC/D,SAASC,QAAQ,QAAQ,sBAAmB;AAE5C,SAASC,UAAU,QAAQ,mBAAU;AACrC,OAAOC,WAAW,MAAM,8BAA2B;AACnD,SAASC,oBAAoB,QAAQ,qBAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAclD,MAAMC,aAA2C,GAAGA,CAAC;EACnDC,OAAO;EACPC,IAAI;EACJC,KAAK;EACLC,kBAAkB;EAClBC,WAAW;EACXC,UAAU;EACVC;AACF,CAAC,kBACCR,KAAA,CAACtB,gBAAgB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,CAAC;EACDb,gBAAgB,EAAE;IAChBI,aAAa,EAAE,KAAK;IACpBU,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE,MAAM;IAChBT,iBAAiB,EAAEtE,KAAK,CAAC,EAAE;EAC7B,CAAC;EACD+B,MAAM,EAAE;IACNqC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,iBAAiB,EAAEtE,KAAK,CAAC,EAAE,CAAC;IAC5BgF,eAAe,EAAE/E,aAAa,CAAC,CAAC,CAAC;IACjCgF,gBAAgB,EAAEjF,KAAK,CAAC,CAAC,CAAC;IAC1BkF,cAAc,EAAEjF,aAAa,CAAC,CAAC,CAAC;IAChCkF,YAAY,EAAEjF,aAAa,CAAC,CAAC;EAC/B,CAAC;EACDgC,UAAU,EAAE;IACV0C,QAAQ,EAAEzE,OAAO,CAAC,EAAE,CAAC;IACrBwE,UAAU,EAAE3E,KAAK,CAAC,CAAC;EACrB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { StyleSheet, SafeAreaView } from 'react-native';
|
|
5
|
+
import TopControls from "./TopControls.js";
|
|
6
|
+
import MiddleControls from "./MiddleControls.js";
|
|
7
|
+
import BottomControls from "./BottomControls.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const MediaControls = ({
|
|
10
|
+
onClose
|
|
11
|
+
}) => {
|
|
12
|
+
return /*#__PURE__*/_jsxs(SafeAreaView, {
|
|
13
|
+
style: styles.container,
|
|
14
|
+
children: [/*#__PURE__*/_jsx(TopControls, {
|
|
15
|
+
onClose: onClose
|
|
16
|
+
}), /*#__PURE__*/_jsx(MiddleControls, {}), /*#__PURE__*/_jsx(BottomControls, {})]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export default /*#__PURE__*/memo(MediaControls);
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
justifyContent: 'space-between'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=MediaControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","StyleSheet","SafeAreaView","TopControls","MiddleControls","BottomControls","jsx","_jsx","jsxs","_jsxs","MediaControls","onClose","style","styles","container","children","create","flex","flexDirection","justifyContent"],"sourceRoot":"../../../../src","sources":["VideoPlayer/MediaControls/MediaControls.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,EAAEC,YAAY,QAAQ,cAAc;AACvD,OAAOC,WAAW,MAAM,kBAAe;AACvC,OAAOC,cAAc,MAAM,qBAAkB;AAC7C,OAAOC,cAAc,MAAM,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAM9C,MAAMC,aAA2C,GAAGA,CAAC;EAAEC;AAAQ,CAAC,KAAK;EACnE,oBACEF,KAAA,CAACP,YAAY;IAACU,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,gBACpCR,IAAA,CAACJ,WAAW;MAACQ,OAAO,EAAEA;IAAQ,CAAE,CAAC,eACjCJ,IAAA,CAACH,cAAc,IAAE,CAAC,eAClBG,IAAA,CAACF,cAAc,IAAE,CAAC;EAAA,CACN,CAAC;AAEnB,CAAC;AAED,4BAAeL,IAAI,CAACU,aAAa,CAAC;AAElC,MAAMG,MAAM,GAAGZ,UAAU,CAACe,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,IAAI,EAAE,CAAC;IACPC,aAAa,EAAE,QAAQ;IACvBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
import { StyleSheet, TouchableOpacity, View, Animated } from 'react-native';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
+
import { moderateScale } from 'react-native-size-matters';
|
|
7
|
+
import MediaControls from "./MediaControls.js";
|
|
8
|
+
import SettingModal from "../model/SettingModal.js";
|
|
9
|
+
import { useVideoPlayerStore } from "../store/videoPlayerStore.js";
|
|
10
|
+
import SkipAndNextControls from "../components/SkipAndNextControls.js";
|
|
11
|
+
import globalStyles from "../Styles/globalStyles.js";
|
|
12
|
+
import SubtitleView from "../components/SubtitleView.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const MediaControlsProvider = ({
|
|
15
|
+
children,
|
|
16
|
+
onClose,
|
|
17
|
+
onPressEpisode,
|
|
18
|
+
reportProgress
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
controlsVisible,
|
|
22
|
+
setControlsVisible,
|
|
23
|
+
controlsTimer
|
|
24
|
+
} = useVideoPlayerStore();
|
|
25
|
+
const {
|
|
26
|
+
top,
|
|
27
|
+
bottom,
|
|
28
|
+
left,
|
|
29
|
+
right
|
|
30
|
+
} = useSafeAreaInsets();
|
|
31
|
+
const timeid = React.useRef(null);
|
|
32
|
+
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
Animated.timing(fadeAnim, {
|
|
35
|
+
toValue: controlsVisible ? 1 : 0,
|
|
36
|
+
duration: 200,
|
|
37
|
+
useNativeDriver: true
|
|
38
|
+
}).start();
|
|
39
|
+
if (controlsVisible) {
|
|
40
|
+
timeid.current = setTimeout(() => {
|
|
41
|
+
setControlsVisible(false);
|
|
42
|
+
}, controlsTimer * 1000);
|
|
43
|
+
}
|
|
44
|
+
return () => {
|
|
45
|
+
if (timeid.current) clearTimeout(timeid.current);
|
|
46
|
+
};
|
|
47
|
+
}, [controlsVisible, controlsTimer, setControlsVisible, fadeAnim]);
|
|
48
|
+
const containerPadding = {
|
|
49
|
+
paddingTop: top,
|
|
50
|
+
paddingBottom: bottom + moderateScale(5),
|
|
51
|
+
paddingLeft: left + moderateScale(10),
|
|
52
|
+
paddingRight: right + moderateScale(10)
|
|
53
|
+
};
|
|
54
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
55
|
+
style: globalStyles.flexOne,
|
|
56
|
+
children: [children, /*#__PURE__*/_jsx(Animated.View, {
|
|
57
|
+
pointerEvents: controlsVisible ? 'auto' : 'none',
|
|
58
|
+
style: [StyleSheet.absoluteFillObject, {
|
|
59
|
+
opacity: fadeAnim
|
|
60
|
+
}],
|
|
61
|
+
children: /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
62
|
+
onPress: () => setControlsVisible(false),
|
|
63
|
+
style: [styles.container, containerPadding],
|
|
64
|
+
activeOpacity: 1,
|
|
65
|
+
children: /*#__PURE__*/_jsx(MediaControls, {
|
|
66
|
+
onClose: onClose
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
}), /*#__PURE__*/_jsx(SettingModal, {
|
|
70
|
+
onPressEpisode: onPressEpisode,
|
|
71
|
+
reportProgress: reportProgress
|
|
72
|
+
}), /*#__PURE__*/_jsx(SubtitleView, {}), /*#__PURE__*/_jsx(SkipAndNextControls, {
|
|
73
|
+
onPressEpisode: onPressEpisode,
|
|
74
|
+
reportProgress: reportProgress
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
export default MediaControlsProvider;
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
container: {
|
|
81
|
+
flex: 1,
|
|
82
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=MediaControlsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","StyleSheet","TouchableOpacity","View","Animated","useSafeAreaInsets","moderateScale","MediaControls","SettingModal","useVideoPlayerStore","SkipAndNextControls","globalStyles","SubtitleView","jsx","_jsx","jsxs","_jsxs","MediaControlsProvider","children","onClose","onPressEpisode","reportProgress","controlsVisible","setControlsVisible","controlsTimer","top","bottom","left","right","timeid","fadeAnim","Value","current","timing","toValue","duration","useNativeDriver","start","setTimeout","clearTimeout","containerPadding","paddingTop","paddingBottom","paddingLeft","paddingRight","style","flexOne","pointerEvents","absoluteFillObject","opacity","onPress","styles","container","activeOpacity","create","flex","backgroundColor"],"sourceRoot":"../../../../src","sources":["VideoPlayer/MediaControls/MediaControlsProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SACEC,UAAU,EACVC,gBAAgB,EAChBC,IAAI,EAEJC,QAAQ,QACH,cAAc;AACrB,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,aAAa,QAAQ,2BAA2B;AACzD,OAAOC,aAAa,MAAmC,oBAAiB;AACxE,OAAOC,YAAY,MAAM,0BAAuB;AAChD,SAASC,mBAAmB,QAAQ,8BAA2B;AAC/D,OAAOC,mBAAmB,MAAM,sCAAmC;AAEnE,OAAOC,YAAY,MAAM,2BAAwB;AAEjD,OAAOC,YAAY,MAAM,+BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQtD,MAAMC,qBAA2D,GAAGA,CAAC;EACnEC,QAAQ;EACRC,OAAO;EACPC,cAAc;EACdC;AACF,CAAC,KAAK;EACJ,MAAM;IAAEC,eAAe;IAAEC,kBAAkB;IAAEC;EAAc,CAAC,GAC1Df,mBAAmB,CAAC,CAAC;EACvB,MAAM;IAAEgB,GAAG;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGvB,iBAAiB,CAAC,CAAC;EACxD,MAAMwB,MAAM,GAAG/B,KAAK,CAACE,MAAM,CAAwB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