@zezosoft/zezo-ott-react-native-video-player 1.0.1 → 1.0.3

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.
Files changed (337) hide show
  1. package/README.md +342 -85
  2. package/lib/module/AdsPlayer/AdsPlayer.js +244 -0
  3. package/lib/module/AdsPlayer/AdsPlayer.js.map +1 -0
  4. package/lib/module/AdsPlayer/MediaControls/AdBottomControls.js +176 -0
  5. package/lib/module/AdsPlayer/MediaControls/AdBottomControls.js.map +1 -0
  6. package/lib/module/AdsPlayer/MediaControls/AdMediaControls.js +96 -0
  7. package/lib/module/AdsPlayer/MediaControls/AdMediaControls.js.map +1 -0
  8. package/lib/module/AdsPlayer/MediaControls/AdMediaControlsProvider.js +34 -0
  9. package/lib/module/AdsPlayer/MediaControls/AdMediaControlsProvider.js.map +1 -0
  10. package/lib/module/AdsPlayer/MediaControls/AdMiddleControls.js +65 -0
  11. package/lib/module/AdsPlayer/MediaControls/AdMiddleControls.js.map +1 -0
  12. package/lib/module/AdsPlayer/MediaControls/AdTopControls.js +177 -0
  13. package/lib/module/AdsPlayer/MediaControls/AdTopControls.js.map +1 -0
  14. package/lib/module/AdsPlayer/MediaControls/index.js +8 -0
  15. package/lib/module/AdsPlayer/MediaControls/index.js.map +1 -0
  16. package/lib/module/AdsPlayer/components/RotatingLoader.js +55 -0
  17. package/lib/module/AdsPlayer/components/RotatingLoader.js.map +1 -0
  18. package/lib/module/AdsPlayer/index.js +6 -0
  19. package/lib/module/AdsPlayer/index.js.map +1 -0
  20. package/lib/module/AdsPlayer/store/adsPlayer.type.js +4 -0
  21. package/lib/module/AdsPlayer/store/adsPlayer.type.js.map +1 -0
  22. package/lib/module/AdsPlayer/store/adsPlayerStore.js +70 -0
  23. package/lib/module/AdsPlayer/store/adsPlayerStore.js.map +1 -0
  24. package/lib/module/AdsPlayer/store/index.js +5 -0
  25. package/lib/module/AdsPlayer/store/index.js.map +1 -0
  26. package/lib/module/AdsPlayer/utils/adStateReset.js +31 -0
  27. package/lib/module/AdsPlayer/utils/adStateReset.js.map +1 -0
  28. package/lib/module/AdsPlayer/utils/controls.js +63 -0
  29. package/lib/module/AdsPlayer/utils/controls.js.map +1 -0
  30. package/lib/module/AdsPlayer/utils/useAdControlsAutoHide.js +35 -0
  31. package/lib/module/AdsPlayer/utils/useAdControlsAutoHide.js.map +1 -0
  32. package/lib/module/AdsPlayer/utils/useAdInitialization.js +60 -0
  33. package/lib/module/AdsPlayer/utils/useAdInitialization.js.map +1 -0
  34. package/lib/module/AdsPlayer/utils/useAdTracking.js +50 -0
  35. package/lib/module/AdsPlayer/utils/useAdTracking.js.map +1 -0
  36. package/lib/module/AdsPlayer/utils/useAdsManager.js +165 -0
  37. package/lib/module/AdsPlayer/utils/useAdsManager.js.map +1 -0
  38. package/lib/module/VideoPlayer/MediaControls/BottomControls.js +32 -13
  39. package/lib/module/VideoPlayer/MediaControls/BottomControls.js.map +1 -1
  40. package/lib/module/VideoPlayer/MediaControls/MediaControls.js +4 -3
  41. package/lib/module/VideoPlayer/MediaControls/MediaControls.js.map +1 -1
  42. package/lib/module/VideoPlayer/MediaControls/MediaControlsProvider.js +31 -31
  43. package/lib/module/VideoPlayer/MediaControls/MediaControlsProvider.js.map +1 -1
  44. package/lib/module/VideoPlayer/MediaControls/MiddleControls.js +50 -40
  45. package/lib/module/VideoPlayer/MediaControls/MiddleControls.js.map +1 -1
  46. package/lib/module/VideoPlayer/MediaControls/TopControls.js +7 -12
  47. package/lib/module/VideoPlayer/MediaControls/TopControls.js.map +1 -1
  48. package/lib/module/VideoPlayer/{model → Settings}/AudioAndSubtitles.js +0 -14
  49. package/lib/module/VideoPlayer/Settings/AudioAndSubtitles.js.map +1 -0
  50. package/lib/module/VideoPlayer/{model → Settings}/Episodes.js +1 -1
  51. package/lib/module/VideoPlayer/Settings/Episodes.js.map +1 -0
  52. package/lib/module/VideoPlayer/{model → Settings}/SettingModal.js +0 -1
  53. package/lib/module/VideoPlayer/Settings/SettingModal.js.map +1 -0
  54. package/lib/module/VideoPlayer/{model → Settings}/SpeedControls.js +1 -9
  55. package/lib/module/VideoPlayer/Settings/SpeedControls.js.map +1 -0
  56. package/lib/module/VideoPlayer/{model → Settings}/VideoPlayerSettings.js +1 -1
  57. package/lib/module/VideoPlayer/Settings/VideoPlayerSettings.js.map +1 -0
  58. package/lib/module/VideoPlayer/VideoPlayerCore.js +244 -0
  59. package/lib/module/VideoPlayer/VideoPlayerCore.js.map +1 -0
  60. package/lib/module/VideoPlayer/components/ProgressBar.js +99 -24
  61. package/lib/module/VideoPlayer/components/ProgressBar.js.map +1 -1
  62. package/lib/module/VideoPlayer/components/SkipAndNextControls.js +1 -6
  63. package/lib/module/VideoPlayer/components/SkipAndNextControls.js.map +1 -1
  64. package/lib/module/VideoPlayer/components/SubtitleView.js +1 -1
  65. package/lib/module/VideoPlayer/components/SubtitleView.js.map +1 -1
  66. package/lib/module/VideoPlayer/components/Toast.js +57 -0
  67. package/lib/module/VideoPlayer/components/Toast.js.map +1 -0
  68. package/lib/module/VideoPlayer/index.js +1 -1
  69. package/lib/module/VideoPlayer/index.js.map +1 -1
  70. package/lib/module/VideoPlayer/store/videoPlayerStore.js +0 -4
  71. package/lib/module/VideoPlayer/store/videoPlayerStore.js.map +1 -1
  72. package/lib/module/VideoPlayer/{Styles → styles}/globalStyles.js +5 -6
  73. package/lib/module/VideoPlayer/styles/globalStyles.js.map +1 -0
  74. package/lib/module/VideoPlayer/utils/{Display.js → display/Display.js} +0 -4
  75. package/lib/module/VideoPlayer/utils/display/Display.js.map +1 -0
  76. package/lib/module/VideoPlayer/utils/display/index.js +4 -0
  77. package/lib/module/VideoPlayer/utils/display/index.js.map +1 -0
  78. package/lib/module/VideoPlayer/utils/format/index.js +4 -0
  79. package/lib/module/VideoPlayer/utils/format/index.js.map +1 -0
  80. package/lib/module/VideoPlayer/utils/{timeFormatter.js → format/timeFormatter.js} +0 -6
  81. package/lib/module/VideoPlayer/utils/format/timeFormatter.js.map +1 -0
  82. package/lib/module/VideoPlayer/utils/hooks/index.js +3 -0
  83. package/lib/module/VideoPlayer/utils/hooks/index.js.map +1 -1
  84. package/lib/module/VideoPlayer/utils/hooks/useAdEventHandler.js +56 -0
  85. package/lib/module/VideoPlayer/utils/hooks/useAdEventHandler.js.map +1 -0
  86. package/lib/module/VideoPlayer/utils/hooks/useOrientationLock.js +25 -0
  87. package/lib/module/VideoPlayer/utils/hooks/useOrientationLock.js.map +1 -0
  88. package/lib/module/VideoPlayer/utils/hooks/usePauseVideoOnAd.js +43 -0
  89. package/lib/module/VideoPlayer/utils/hooks/usePauseVideoOnAd.js.map +1 -0
  90. package/lib/module/VideoPlayer/utils/hooks/useVideoPlayerBack.js +3 -4
  91. package/lib/module/VideoPlayer/utils/hooks/useVideoPlayerBack.js.map +1 -1
  92. package/lib/module/VideoPlayer/utils/hooks/useVideoResolutions.js +12 -11
  93. package/lib/module/VideoPlayer/utils/hooks/useVideoResolutions.js.map +1 -1
  94. package/lib/module/VideoPlayer/utils/index.js +5 -6
  95. package/lib/module/VideoPlayer/utils/index.js.map +1 -1
  96. package/lib/module/VideoPlayer/utils/{PlatformSelector.js → platform/PlatformSelector.js} +0 -5
  97. package/lib/module/VideoPlayer/utils/platform/PlatformSelector.js.map +1 -0
  98. package/lib/module/VideoPlayer/utils/platform/index.js +5 -0
  99. package/lib/module/VideoPlayer/utils/platform/index.js.map +1 -0
  100. package/lib/module/VideoPlayer/utils/{lockOrientation.js → platform/lockOrientation.js} +13 -5
  101. package/lib/module/VideoPlayer/utils/platform/lockOrientation.js.map +1 -0
  102. package/lib/module/VideoPlayer/utils/player/index.js +5 -0
  103. package/lib/module/VideoPlayer/utils/player/index.js.map +1 -0
  104. package/lib/module/VideoPlayer/utils/{playerEvents.js → player/playerEvents.js} +3 -3
  105. package/lib/module/VideoPlayer/utils/player/playerEvents.js.map +1 -0
  106. package/lib/module/VideoPlayer/utils/{useWatchReporter.js → player/useWatchReporter.js} +3 -2
  107. package/lib/module/VideoPlayer/utils/player/useWatchReporter.js.map +1 -0
  108. package/lib/module/VideoPlayer/utils/video/index.js +8 -0
  109. package/lib/module/VideoPlayer/utils/video/index.js.map +1 -0
  110. package/lib/module/VideoPlayer/utils/{videoControl.js → video/videoControl.js} +1 -14
  111. package/lib/module/VideoPlayer/utils/video/videoControl.js.map +1 -0
  112. package/lib/module/VideoPlayer/utils/video/videoRef.js +20 -0
  113. package/lib/module/VideoPlayer/utils/video/videoRef.js.map +1 -0
  114. package/lib/module/VideoPlayer/utils/video/videoResume.js +29 -0
  115. package/lib/module/VideoPlayer/utils/video/videoResume.js.map +1 -0
  116. package/lib/module/VideoPlayer/utils/video/videoSource.js.map +1 -0
  117. package/lib/module/VideoPlayer.js +140 -0
  118. package/lib/module/VideoPlayer.js.map +1 -0
  119. package/lib/module/index.js +3 -1
  120. package/lib/module/index.js.map +1 -1
  121. package/lib/typescript/src/AdsPlayer/AdsPlayer.d.ts +22 -0
  122. package/lib/typescript/src/AdsPlayer/AdsPlayer.d.ts.map +1 -0
  123. package/lib/typescript/src/AdsPlayer/MediaControls/AdBottomControls.d.ts +4 -0
  124. package/lib/typescript/src/AdsPlayer/MediaControls/AdBottomControls.d.ts.map +1 -0
  125. package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControls.d.ts +8 -0
  126. package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControls.d.ts.map +1 -0
  127. package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControlsProvider.d.ts +26 -0
  128. package/lib/typescript/src/AdsPlayer/MediaControls/AdMediaControlsProvider.d.ts.map +1 -0
  129. package/lib/typescript/src/AdsPlayer/MediaControls/AdMiddleControls.d.ts +4 -0
  130. package/lib/typescript/src/AdsPlayer/MediaControls/AdMiddleControls.d.ts.map +1 -0
  131. package/lib/typescript/src/AdsPlayer/MediaControls/AdTopControls.d.ts +7 -0
  132. package/lib/typescript/src/AdsPlayer/MediaControls/AdTopControls.d.ts.map +1 -0
  133. package/lib/typescript/src/AdsPlayer/MediaControls/index.d.ts +6 -0
  134. package/lib/typescript/src/AdsPlayer/MediaControls/index.d.ts.map +1 -0
  135. package/lib/typescript/src/AdsPlayer/components/RotatingLoader.d.ts +12 -0
  136. package/lib/typescript/src/AdsPlayer/components/RotatingLoader.d.ts.map +1 -0
  137. package/lib/typescript/src/AdsPlayer/index.d.ts +5 -0
  138. package/lib/typescript/src/AdsPlayer/index.d.ts.map +1 -0
  139. package/lib/typescript/src/AdsPlayer/store/adsPlayer.type.d.ts +28 -0
  140. package/lib/typescript/src/AdsPlayer/store/adsPlayer.type.d.ts.map +1 -0
  141. package/lib/typescript/src/AdsPlayer/store/adsPlayerStore.d.ts +22 -0
  142. package/lib/typescript/src/AdsPlayer/store/adsPlayerStore.d.ts.map +1 -0
  143. package/lib/typescript/src/AdsPlayer/store/index.d.ts +3 -0
  144. package/lib/typescript/src/AdsPlayer/store/index.d.ts.map +1 -0
  145. package/lib/typescript/src/AdsPlayer/utils/adStateReset.d.ts +6 -0
  146. package/lib/typescript/src/AdsPlayer/utils/adStateReset.d.ts.map +1 -0
  147. package/lib/typescript/src/AdsPlayer/utils/controls.d.ts +13 -0
  148. package/lib/typescript/src/AdsPlayer/utils/controls.d.ts.map +1 -0
  149. package/lib/typescript/src/AdsPlayer/utils/useAdControlsAutoHide.d.ts +3 -0
  150. package/lib/typescript/src/AdsPlayer/utils/useAdControlsAutoHide.d.ts.map +1 -0
  151. package/lib/typescript/src/AdsPlayer/utils/useAdInitialization.d.ts +20 -0
  152. package/lib/typescript/src/AdsPlayer/utils/useAdInitialization.d.ts.map +1 -0
  153. package/lib/typescript/src/AdsPlayer/utils/useAdTracking.d.ts +23 -0
  154. package/lib/typescript/src/AdsPlayer/utils/useAdTracking.d.ts.map +1 -0
  155. package/lib/typescript/src/AdsPlayer/utils/useAdsManager.d.ts +9 -0
  156. package/lib/typescript/src/AdsPlayer/utils/useAdsManager.d.ts.map +1 -0
  157. package/lib/typescript/src/VideoPlayer/MediaControls/BottomControls.d.ts.map +1 -1
  158. package/lib/typescript/src/VideoPlayer/MediaControls/MediaControlsProvider.d.ts +3 -1
  159. package/lib/typescript/src/VideoPlayer/MediaControls/MediaControlsProvider.d.ts.map +1 -1
  160. package/lib/typescript/src/VideoPlayer/MediaControls/MiddleControls.d.ts +2 -1
  161. package/lib/typescript/src/VideoPlayer/MediaControls/MiddleControls.d.ts.map +1 -1
  162. package/lib/typescript/src/VideoPlayer/MediaControls/TopControls.d.ts.map +1 -1
  163. package/lib/typescript/src/VideoPlayer/Settings/AudioAndSubtitles.d.ts.map +1 -0
  164. package/lib/typescript/src/VideoPlayer/{model → Settings}/Episodes.d.ts +1 -1
  165. package/lib/typescript/src/VideoPlayer/Settings/Episodes.d.ts.map +1 -0
  166. package/lib/typescript/src/VideoPlayer/{model → Settings}/SettingModal.d.ts +1 -1
  167. package/lib/typescript/src/VideoPlayer/Settings/SettingModal.d.ts.map +1 -0
  168. package/lib/typescript/src/VideoPlayer/Settings/SpeedControls.d.ts.map +1 -0
  169. package/lib/typescript/src/VideoPlayer/Settings/VideoPlayerSettings.d.ts.map +1 -0
  170. package/lib/typescript/src/VideoPlayer/{VideoPlayer.d.ts → VideoPlayerCore.d.ts} +10 -7
  171. package/lib/typescript/src/VideoPlayer/VideoPlayerCore.d.ts.map +1 -0
  172. package/lib/typescript/src/VideoPlayer/components/ProgressBar.d.ts +3 -1
  173. package/lib/typescript/src/VideoPlayer/components/ProgressBar.d.ts.map +1 -1
  174. package/lib/typescript/src/VideoPlayer/components/SkipAndNextControls.d.ts +1 -1
  175. package/lib/typescript/src/VideoPlayer/components/SkipAndNextControls.d.ts.map +1 -1
  176. package/lib/typescript/src/VideoPlayer/components/Toast.d.ts +12 -0
  177. package/lib/typescript/src/VideoPlayer/components/Toast.d.ts.map +1 -0
  178. package/lib/typescript/src/VideoPlayer/index.d.ts +1 -1
  179. package/lib/typescript/src/VideoPlayer/index.d.ts.map +1 -1
  180. package/lib/typescript/src/VideoPlayer/store/videoPlayer.type.d.ts +25 -5
  181. package/lib/typescript/src/VideoPlayer/store/videoPlayer.type.d.ts.map +1 -1
  182. package/lib/typescript/src/VideoPlayer/store/videoPlayerStore.d.ts.map +1 -1
  183. package/lib/typescript/src/VideoPlayer/{Styles → styles}/globalStyles.d.ts +16 -9
  184. package/lib/typescript/src/VideoPlayer/styles/globalStyles.d.ts.map +1 -0
  185. package/lib/typescript/src/VideoPlayer/utils/display/Display.d.ts.map +1 -0
  186. package/lib/typescript/src/VideoPlayer/utils/display/index.d.ts +2 -0
  187. package/lib/typescript/src/VideoPlayer/utils/display/index.d.ts.map +1 -0
  188. package/lib/typescript/src/VideoPlayer/utils/format/index.d.ts +2 -0
  189. package/lib/typescript/src/VideoPlayer/utils/format/index.d.ts.map +1 -0
  190. package/lib/typescript/src/VideoPlayer/utils/{timeFormatter.d.ts → format/timeFormatter.d.ts} +0 -5
  191. package/lib/typescript/src/VideoPlayer/utils/format/timeFormatter.d.ts.map +1 -0
  192. package/lib/typescript/src/VideoPlayer/utils/hooks/index.d.ts +3 -0
  193. package/lib/typescript/src/VideoPlayer/utils/hooks/index.d.ts.map +1 -1
  194. package/lib/typescript/src/VideoPlayer/utils/hooks/useAdEventHandler.d.ts +34 -0
  195. package/lib/typescript/src/VideoPlayer/utils/hooks/useAdEventHandler.d.ts.map +1 -0
  196. package/lib/typescript/src/VideoPlayer/utils/hooks/useOrientationLock.d.ts +11 -0
  197. package/lib/typescript/src/VideoPlayer/utils/hooks/useOrientationLock.d.ts.map +1 -0
  198. package/lib/typescript/src/VideoPlayer/utils/hooks/usePauseVideoOnAd.d.ts +6 -0
  199. package/lib/typescript/src/VideoPlayer/utils/hooks/usePauseVideoOnAd.d.ts.map +1 -0
  200. package/lib/typescript/src/VideoPlayer/utils/hooks/useVideoResolutions.d.ts.map +1 -1
  201. package/lib/typescript/src/VideoPlayer/utils/index.d.ts +5 -6
  202. package/lib/typescript/src/VideoPlayer/utils/index.d.ts.map +1 -1
  203. package/lib/typescript/src/VideoPlayer/utils/{PlatformSelector.d.ts → platform/PlatformSelector.d.ts} +0 -4
  204. package/lib/typescript/src/VideoPlayer/utils/platform/PlatformSelector.d.ts.map +1 -0
  205. package/lib/typescript/src/VideoPlayer/utils/platform/index.d.ts +3 -0
  206. package/lib/typescript/src/VideoPlayer/utils/platform/index.d.ts.map +1 -0
  207. package/lib/typescript/src/VideoPlayer/utils/platform/lockOrientation.d.ts.map +1 -0
  208. package/lib/typescript/src/VideoPlayer/utils/player/index.d.ts +3 -0
  209. package/lib/typescript/src/VideoPlayer/utils/player/index.d.ts.map +1 -0
  210. package/lib/typescript/src/VideoPlayer/utils/{playerEvents.d.ts → player/playerEvents.d.ts} +1 -1
  211. package/lib/typescript/src/VideoPlayer/utils/player/playerEvents.d.ts.map +1 -0
  212. package/lib/typescript/src/VideoPlayer/utils/{useWatchReporter.d.ts → player/useWatchReporter.d.ts} +1 -6
  213. package/lib/typescript/src/VideoPlayer/utils/player/useWatchReporter.d.ts.map +1 -0
  214. package/lib/typescript/src/VideoPlayer/utils/video/index.d.ts +6 -0
  215. package/lib/typescript/src/VideoPlayer/utils/video/index.d.ts.map +1 -0
  216. package/lib/typescript/src/VideoPlayer/utils/{videoControl.d.ts → video/videoControl.d.ts} +1 -1
  217. package/lib/typescript/src/VideoPlayer/utils/video/videoControl.d.ts.map +1 -0
  218. package/lib/typescript/src/VideoPlayer/utils/video/videoRef.d.ts +19 -0
  219. package/lib/typescript/src/VideoPlayer/utils/video/videoRef.d.ts.map +1 -0
  220. package/lib/typescript/src/VideoPlayer/utils/video/videoResume.d.ts +6 -0
  221. package/lib/typescript/src/VideoPlayer/utils/video/videoResume.d.ts.map +1 -0
  222. package/lib/typescript/src/VideoPlayer/utils/{videoSource.d.ts → video/videoSource.d.ts} +1 -1
  223. package/lib/typescript/src/VideoPlayer/utils/video/videoSource.d.ts.map +1 -0
  224. package/lib/typescript/src/VideoPlayer.d.ts +31 -0
  225. package/lib/typescript/src/VideoPlayer.d.ts.map +1 -0
  226. package/lib/typescript/src/index.d.ts +3 -1
  227. package/lib/typescript/src/index.d.ts.map +1 -1
  228. package/package.json +128 -101
  229. package/src/AdsPlayer/AdsPlayer.tsx +311 -0
  230. package/src/AdsPlayer/MediaControls/AdBottomControls.tsx +191 -0
  231. package/src/AdsPlayer/MediaControls/AdMediaControls.tsx +104 -0
  232. package/src/AdsPlayer/MediaControls/AdMediaControlsProvider.tsx +62 -0
  233. package/src/AdsPlayer/MediaControls/AdMiddleControls.tsx +63 -0
  234. package/src/AdsPlayer/MediaControls/AdTopControls.tsx +191 -0
  235. package/src/AdsPlayer/MediaControls/index.ts +5 -0
  236. package/src/AdsPlayer/components/RotatingLoader.tsx +79 -0
  237. package/src/AdsPlayer/index.ts +4 -0
  238. package/src/AdsPlayer/store/adsPlayer.type.ts +29 -0
  239. package/src/AdsPlayer/store/adsPlayerStore.ts +59 -0
  240. package/src/AdsPlayer/store/index.ts +2 -0
  241. package/src/AdsPlayer/utils/adStateReset.ts +29 -0
  242. package/src/AdsPlayer/utils/controls.ts +69 -0
  243. package/src/AdsPlayer/utils/useAdControlsAutoHide.ts +32 -0
  244. package/src/AdsPlayer/utils/useAdInitialization.ts +86 -0
  245. package/src/AdsPlayer/utils/useAdTracking.ts +89 -0
  246. package/src/AdsPlayer/utils/useAdsManager.ts +215 -0
  247. package/src/VideoPlayer/MediaControls/BottomControls.tsx +34 -9
  248. package/src/VideoPlayer/MediaControls/MediaControls.tsx +4 -3
  249. package/src/VideoPlayer/MediaControls/MediaControlsProvider.tsx +40 -35
  250. package/src/VideoPlayer/MediaControls/MiddleControls.tsx +87 -60
  251. package/src/VideoPlayer/MediaControls/TopControls.tsx +16 -8
  252. package/src/VideoPlayer/{model → Settings}/AudioAndSubtitles.tsx +0 -7
  253. package/src/VideoPlayer/{model → Settings}/Episodes.tsx +6 -3
  254. package/src/VideoPlayer/{model → Settings}/SettingModal.tsx +1 -2
  255. package/src/VideoPlayer/{model → Settings}/SpeedControls.tsx +1 -5
  256. package/src/VideoPlayer/{model → Settings}/VideoPlayerSettings.tsx +1 -1
  257. package/src/VideoPlayer/VideoPlayerCore.tsx +356 -0
  258. package/src/VideoPlayer/components/ProgressBar.tsx +135 -22
  259. package/src/VideoPlayer/components/SkipAndNextControls.tsx +2 -5
  260. package/src/VideoPlayer/components/SubtitleView.tsx +1 -1
  261. package/src/VideoPlayer/components/Toast.tsx +61 -0
  262. package/src/VideoPlayer/index.ts +1 -1
  263. package/src/VideoPlayer/store/videoPlayer.type.ts +28 -6
  264. package/src/VideoPlayer/store/videoPlayerStore.ts +0 -4
  265. package/src/VideoPlayer/{Styles → styles}/globalStyles.ts +5 -6
  266. package/src/VideoPlayer/utils/{Display.ts → display/Display.ts} +0 -4
  267. package/src/VideoPlayer/utils/display/index.ts +1 -0
  268. package/src/VideoPlayer/utils/format/index.ts +1 -0
  269. package/src/VideoPlayer/utils/{timeFormatter.ts → format/timeFormatter.ts} +4 -7
  270. package/src/VideoPlayer/utils/hooks/index.ts +3 -0
  271. package/src/VideoPlayer/utils/hooks/useAdEventHandler.ts +95 -0
  272. package/src/VideoPlayer/utils/hooks/useOrientationLock.ts +29 -0
  273. package/src/VideoPlayer/utils/hooks/usePauseVideoOnAd.ts +46 -0
  274. package/src/VideoPlayer/utils/hooks/useVideoPlayerBack.ts +3 -3
  275. package/src/VideoPlayer/utils/hooks/useVideoResolutions.ts +18 -12
  276. package/src/VideoPlayer/utils/index.ts +5 -6
  277. package/src/VideoPlayer/utils/{PlatformSelector.ts → platform/PlatformSelector.ts} +0 -5
  278. package/src/VideoPlayer/utils/platform/index.ts +2 -0
  279. package/src/VideoPlayer/utils/{lockOrientation.ts → platform/lockOrientation.ts} +11 -5
  280. package/src/VideoPlayer/utils/player/index.ts +2 -0
  281. package/src/VideoPlayer/utils/{playerEvents.ts → player/playerEvents.ts} +4 -4
  282. package/src/VideoPlayer/utils/{useWatchReporter.ts → player/useWatchReporter.ts} +4 -3
  283. package/src/VideoPlayer/utils/video/index.ts +5 -0
  284. package/src/VideoPlayer/utils/{videoControl.ts → video/videoControl.ts} +2 -9
  285. package/src/VideoPlayer/utils/video/videoRef.ts +21 -0
  286. package/src/VideoPlayer/utils/video/videoResume.ts +23 -0
  287. package/src/VideoPlayer/utils/{videoSource.ts → video/videoSource.ts} +1 -1
  288. package/src/VideoPlayer.tsx +181 -0
  289. package/src/index.tsx +3 -1
  290. package/lib/module/VideoPlayer/Styles/fonts.js +0 -58
  291. package/lib/module/VideoPlayer/Styles/fonts.js.map +0 -1
  292. package/lib/module/VideoPlayer/Styles/globalStyles.js.map +0 -1
  293. package/lib/module/VideoPlayer/VideoPlayer.js +0 -180
  294. package/lib/module/VideoPlayer/VideoPlayer.js.map +0 -1
  295. package/lib/module/VideoPlayer/model/AudioAndSubtitles.js.map +0 -1
  296. package/lib/module/VideoPlayer/model/Episodes.js.map +0 -1
  297. package/lib/module/VideoPlayer/model/SettingModal.js.map +0 -1
  298. package/lib/module/VideoPlayer/model/SpeedControls.js.map +0 -1
  299. package/lib/module/VideoPlayer/model/VideoPlayerSettings.js.map +0 -1
  300. package/lib/module/VideoPlayer/utils/Display.js.map +0 -1
  301. package/lib/module/VideoPlayer/utils/PlatformSelector.js.map +0 -1
  302. package/lib/module/VideoPlayer/utils/lockOrientation.js.map +0 -1
  303. package/lib/module/VideoPlayer/utils/playerEvents.js.map +0 -1
  304. package/lib/module/VideoPlayer/utils/timeFormatter.js.map +0 -1
  305. package/lib/module/VideoPlayer/utils/useWatchReporter.js.map +0 -1
  306. package/lib/module/VideoPlayer/utils/videoControl.js.map +0 -1
  307. package/lib/module/VideoPlayer/utils/videoRef.js +0 -5
  308. package/lib/module/VideoPlayer/utils/videoRef.js.map +0 -1
  309. package/lib/module/VideoPlayer/utils/videoSource.js.map +0 -1
  310. package/lib/typescript/src/VideoPlayer/Styles/fonts.d.ts +0 -54
  311. package/lib/typescript/src/VideoPlayer/Styles/fonts.d.ts.map +0 -1
  312. package/lib/typescript/src/VideoPlayer/Styles/globalStyles.d.ts.map +0 -1
  313. package/lib/typescript/src/VideoPlayer/VideoPlayer.d.ts.map +0 -1
  314. package/lib/typescript/src/VideoPlayer/model/AudioAndSubtitles.d.ts.map +0 -1
  315. package/lib/typescript/src/VideoPlayer/model/Episodes.d.ts.map +0 -1
  316. package/lib/typescript/src/VideoPlayer/model/SettingModal.d.ts.map +0 -1
  317. package/lib/typescript/src/VideoPlayer/model/SpeedControls.d.ts.map +0 -1
  318. package/lib/typescript/src/VideoPlayer/model/VideoPlayerSettings.d.ts.map +0 -1
  319. package/lib/typescript/src/VideoPlayer/utils/Display.d.ts.map +0 -1
  320. package/lib/typescript/src/VideoPlayer/utils/PlatformSelector.d.ts.map +0 -1
  321. package/lib/typescript/src/VideoPlayer/utils/lockOrientation.d.ts.map +0 -1
  322. package/lib/typescript/src/VideoPlayer/utils/playerEvents.d.ts.map +0 -1
  323. package/lib/typescript/src/VideoPlayer/utils/timeFormatter.d.ts.map +0 -1
  324. package/lib/typescript/src/VideoPlayer/utils/useWatchReporter.d.ts.map +0 -1
  325. package/lib/typescript/src/VideoPlayer/utils/videoControl.d.ts.map +0 -1
  326. package/lib/typescript/src/VideoPlayer/utils/videoRef.d.ts +0 -3
  327. package/lib/typescript/src/VideoPlayer/utils/videoRef.d.ts.map +0 -1
  328. package/lib/typescript/src/VideoPlayer/utils/videoSource.d.ts.map +0 -1
  329. package/src/VideoPlayer/Styles/fonts.ts +0 -106
  330. package/src/VideoPlayer/VideoPlayer.tsx +0 -217
  331. package/src/VideoPlayer/utils/videoRef.ts +0 -4
  332. /package/lib/module/VideoPlayer/utils/{videoSource.js → video/videoSource.js} +0 -0
  333. /package/lib/typescript/src/VideoPlayer/{model → Settings}/AudioAndSubtitles.d.ts +0 -0
  334. /package/lib/typescript/src/VideoPlayer/{model → Settings}/SpeedControls.d.ts +0 -0
  335. /package/lib/typescript/src/VideoPlayer/{model → Settings}/VideoPlayerSettings.d.ts +0 -0
  336. /package/lib/typescript/src/VideoPlayer/utils/{Display.d.ts → display/Display.d.ts} +0 -0
  337. /package/lib/typescript/src/VideoPlayer/utils/{lockOrientation.d.ts → platform/lockOrientation.d.ts} +0 -0
@@ -0,0 +1,191 @@
1
+ import React, { memo, useCallback, useMemo } from 'react';
2
+ import {
3
+ Animated,
4
+ StyleSheet,
5
+ Text,
6
+ View,
7
+ TouchableOpacity,
8
+ } from 'react-native';
9
+ import { scale, moderateScale } from 'react-native-size-matters';
10
+ import { RFValue } from 'react-native-responsive-fontsize';
11
+ import { ExternalLink } from 'lucide-react-native';
12
+ import { useAdsPlayerStore } from '../store/adsPlayerStore';
13
+ import { useAdControls } from './AdMediaControlsProvider';
14
+ import { useAdControlsAutoHide } from '../utils/useAdControlsAutoHide';
15
+ import ProgressBar from '../../VideoPlayer/components/ProgressBar';
16
+ import { handleAdClickThrough } from '../utils/controls';
17
+ import { resetAdState } from '../utils/adStateReset';
18
+ import { useAdTracking } from '../utils/useAdTracking';
19
+
20
+ const AdBottomControls: React.FC = () => {
21
+ const currentAd = useAdsPlayerStore((state) => state.currentAd);
22
+ const adCurrentTime = useAdsPlayerStore((state) => state.adCurrentTime);
23
+ const adDuration = useAdsPlayerStore((state) => state.adDuration);
24
+ const { onAdSkip, onAdTracking } = useAdControls();
25
+ const fadeAnim = useAdControlsAutoHide();
26
+ const { trackAdSkip, trackAdClick } = useAdTracking({ onAdTracking });
27
+
28
+ const shouldShowSkipButton = useMemo(
29
+ () =>
30
+ currentAd?.skippable &&
31
+ currentAd.skipAfter > 0 &&
32
+ adCurrentTime >= currentAd.skipAfter,
33
+ [currentAd?.skippable, currentAd?.skipAfter, adCurrentTime]
34
+ );
35
+
36
+ // Memoize animated style
37
+ const animatedOpacityStyle = useMemo(
38
+ () => ({ opacity: fadeAnim }),
39
+ [fadeAnim]
40
+ );
41
+
42
+ const handleSkip = useCallback(() => {
43
+ if (!currentAd) return;
44
+
45
+ trackAdSkip(currentAd);
46
+ onAdSkip?.(currentAd);
47
+ resetAdState();
48
+ }, [currentAd, onAdSkip, trackAdSkip]);
49
+
50
+ const handleClickThrough = useCallback(() => {
51
+ if (currentAd) {
52
+ trackAdClick(currentAd);
53
+ handleAdClickThrough(currentAd, onAdTracking);
54
+ }
55
+ }, [currentAd, onAdTracking, trackAdClick]);
56
+
57
+ if (!currentAd) {
58
+ return null;
59
+ }
60
+
61
+ return (
62
+ <View style={bottomControlsStyles.container}>
63
+ {/* Ad Metadata */}
64
+ {currentAd.clickThroughUrl && (
65
+ <Animated.View style={animatedOpacityStyle} pointerEvents="box-none">
66
+ <View pointerEvents="auto">
67
+ <TouchableOpacity
68
+ style={bottomControlsStyles.metadataContainer}
69
+ onPress={handleClickThrough}
70
+ activeOpacity={0.7}
71
+ >
72
+ <View style={bottomControlsStyles.metadataContent}>
73
+ <View style={bottomControlsStyles.metadataTextContainer}>
74
+ {currentAd.title && (
75
+ <Text
76
+ style={bottomControlsStyles.metadataTitle}
77
+ numberOfLines={1}
78
+ ellipsizeMode="tail"
79
+ >
80
+ {currentAd.title}
81
+ </Text>
82
+ )}
83
+ {currentAd.description && (
84
+ <Text
85
+ style={bottomControlsStyles.metadataDesc}
86
+ numberOfLines={2}
87
+ ellipsizeMode="tail"
88
+ >
89
+ {currentAd.description}
90
+ </Text>
91
+ )}
92
+ </View>
93
+ <View style={bottomControlsStyles.clickIndicator}>
94
+ <ExternalLink size={scale(14)} color="#fff" />
95
+ </View>
96
+ </View>
97
+ </TouchableOpacity>
98
+ </View>
99
+ </Animated.View>
100
+ )}
101
+
102
+ <Animated.View style={animatedOpacityStyle}>
103
+ <ProgressBar
104
+ duration={adDuration}
105
+ currentTime={adCurrentTime}
106
+ bufferedTime={adDuration}
107
+ disabled={true}
108
+ height={moderateScale(3)}
109
+ />
110
+ </Animated.View>
111
+ {shouldShowSkipButton && (
112
+ <View pointerEvents="auto">
113
+ <TouchableOpacity
114
+ onPress={handleSkip}
115
+ style={bottomControlsStyles.skipButton}
116
+ activeOpacity={0.7}
117
+ >
118
+ <Text style={bottomControlsStyles.skipButtonText}>Skip Ad</Text>
119
+ </TouchableOpacity>
120
+ </View>
121
+ )}
122
+ </View>
123
+ );
124
+ };
125
+
126
+ const bottomControlsStyles = StyleSheet.create({
127
+ container: {
128
+ position: 'relative',
129
+ width: '100%',
130
+ bottom: 0,
131
+ zIndex: 1,
132
+ overflow: 'hidden',
133
+ },
134
+ metadataContainer: {
135
+ backgroundColor: 'rgba(21, 21, 21, 0.95)',
136
+ borderRadius: moderateScale(6),
137
+ overflow: 'hidden',
138
+ marginBottom: moderateScale(5),
139
+ maxWidth: moderateScale(200),
140
+ borderWidth: 1,
141
+ borderColor: 'rgba(174, 174, 174, 0.12)',
142
+ },
143
+ metadataContent: {
144
+ flexDirection: 'row',
145
+ alignItems: 'center',
146
+ padding: moderateScale(5),
147
+ },
148
+ metadataTextContainer: {
149
+ flex: 1,
150
+ marginRight: moderateScale(4),
151
+ minWidth: 0,
152
+ },
153
+ metadataTitle: {
154
+ color: '#FFFFFF',
155
+ fontSize: RFValue(10),
156
+ fontWeight: '400',
157
+ marginBottom: moderateScale(0.5),
158
+ letterSpacing: 0.1,
159
+ },
160
+ metadataDesc: {
161
+ color: 'rgba(255, 255, 255, 0.7)',
162
+ fontSize: RFValue(9),
163
+ lineHeight: RFValue(12),
164
+ },
165
+ clickIndicator: {
166
+ width: moderateScale(20),
167
+ height: moderateScale(20),
168
+ borderRadius: moderateScale(10),
169
+ backgroundColor: 'rgba(255, 255, 255, 0.20)',
170
+ justifyContent: 'center',
171
+ alignItems: 'center',
172
+ },
173
+ skipButton: {
174
+ position: 'absolute',
175
+ right: moderateScale(2),
176
+ bottom: moderateScale(32),
177
+ backgroundColor: 'rgba(21, 21, 21, 0.95)',
178
+ paddingHorizontal: moderateScale(15),
179
+ paddingVertical: moderateScale(7),
180
+ borderRadius: moderateScale(14),
181
+ borderWidth: 1,
182
+ borderColor: 'rgba(255, 255, 255, 0.20)',
183
+ },
184
+ skipButtonText: {
185
+ color: '#fff',
186
+ fontSize: RFValue(12),
187
+ fontWeight: '600',
188
+ },
189
+ });
190
+
191
+ export default memo(AdBottomControls);
@@ -0,0 +1,104 @@
1
+ import { memo, useMemo } from 'react';
2
+ import { Animated, StyleSheet, View, type ViewStyle } from 'react-native';
3
+ import LinearGradient from 'react-native-linear-gradient';
4
+ import { moderateScale } from 'react-native-size-matters';
5
+ import type { EdgeInsets } from 'react-native-safe-area-context';
6
+ import { useAdControlsAutoHide } from '../utils/useAdControlsAutoHide';
7
+ import AdTopControls from './AdTopControls';
8
+ import AdMiddleControls from './AdMiddleControls';
9
+ import AdBottomControls from './AdBottomControls';
10
+ import globalStyles from '../../VideoPlayer/styles/globalStyles';
11
+
12
+ interface AdMediaControlsProps {
13
+ onClose?: () => void;
14
+ insets: EdgeInsets;
15
+ }
16
+
17
+ const HORIZONTAL_PADDING = moderateScale(12);
18
+ const BOTTOM_PADDING_EXTRA = moderateScale(8);
19
+ const MIN_TOP_PADDING = moderateScale(10);
20
+
21
+ const AdMediaControls: React.FC<AdMediaControlsProps> = ({
22
+ onClose,
23
+ insets,
24
+ }) => {
25
+ const { top, bottom, left, right } = insets;
26
+ const fadeAnim = useAdControlsAutoHide();
27
+
28
+ // Safe-area aware padding: never negative, consistent touch targets
29
+ const containerStyle: ViewStyle = useMemo(
30
+ () => ({
31
+ ...styles.container,
32
+ paddingTop: top - MIN_TOP_PADDING,
33
+ paddingBottom: bottom + BOTTOM_PADDING_EXTRA,
34
+ paddingLeft: left + HORIZONTAL_PADDING,
35
+ paddingRight: right + HORIZONTAL_PADDING,
36
+ }),
37
+ [top, bottom, left, right]
38
+ );
39
+
40
+ // Memoize gradient overlay styles — consistent positioning, no negative glitches
41
+ const topGradientStyle = useMemo(
42
+ () => [styles.topGradientOverlay, { opacity: fadeAnim, top: -top }],
43
+ [fadeAnim, top]
44
+ );
45
+
46
+ const bottomGradientStyle = useMemo(
47
+ () => [
48
+ styles.bottomGradientOverlay,
49
+ { opacity: fadeAnim, bottom: -bottom },
50
+ ],
51
+ [fadeAnim, bottom]
52
+ );
53
+
54
+ return (
55
+ <>
56
+ <Animated.View style={topGradientStyle} pointerEvents="none">
57
+ <LinearGradient
58
+ colors={['rgba(0, 0, 0, 0.4)', 'transparent', 'transparent']}
59
+ locations={[0, 0.4, 1]}
60
+ style={globalStyles.absoluteFill}
61
+ pointerEvents="none"
62
+ />
63
+ </Animated.View>
64
+ <View style={containerStyle}>
65
+ <AdTopControls onClose={onClose} />
66
+ <AdMiddleControls />
67
+ <AdBottomControls />
68
+ </View>
69
+ <Animated.View style={bottomGradientStyle} pointerEvents="none">
70
+ <LinearGradient
71
+ colors={['transparent', 'transparent', 'rgba(0, 0, 0, 0.5)']}
72
+ locations={[0, 0.4, 1]}
73
+ style={globalStyles.absoluteFill}
74
+ pointerEvents="none"
75
+ />
76
+ </Animated.View>
77
+ </>
78
+ );
79
+ };
80
+
81
+ export default memo(AdMediaControls);
82
+
83
+ const styles = StyleSheet.create({
84
+ container: {
85
+ ...globalStyles.absoluteFill,
86
+ justifyContent: 'space-between',
87
+ },
88
+ topGradientOverlay: {
89
+ position: 'absolute',
90
+ left: 0,
91
+ right: 0,
92
+ width: '100%',
93
+ height: moderateScale(150),
94
+ zIndex: 0,
95
+ },
96
+ bottomGradientOverlay: {
97
+ position: 'absolute',
98
+ left: 0,
99
+ right: 0,
100
+ width: '100%',
101
+ height: moderateScale(150),
102
+ zIndex: 0,
103
+ },
104
+ });
@@ -0,0 +1,62 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ import type { EdgeInsets } from 'react-native-safe-area-context';
3
+
4
+ import { useAdsPlayerStore } from '../store/adsPlayerStore';
5
+ import type { VideoAd } from '../../VideoPlayer/store/videoPlayer.type';
6
+ import AdMediaControls from './AdMediaControls';
7
+
8
+ interface AdControlsContextType {
9
+ onAdSkip?: (ad: VideoAd) => void;
10
+ onAdTracking?: ({
11
+ ad,
12
+ trackingUrl,
13
+ event,
14
+ }: {
15
+ ad: VideoAd;
16
+ trackingUrl: string;
17
+ event: string;
18
+ }) => void;
19
+ }
20
+
21
+ const AdControlsContext = createContext<AdControlsContextType>({});
22
+
23
+ export const useAdControls = () => useContext(AdControlsContext);
24
+
25
+ interface AdMediaControlsProviderProps {
26
+ children: React.ReactNode;
27
+ onAdSkip?: (ad: VideoAd) => void;
28
+ onAdTracking?: ({
29
+ ad,
30
+ trackingUrl,
31
+ event,
32
+ }: {
33
+ ad: VideoAd;
34
+ trackingUrl: string;
35
+ event: string;
36
+ }) => void;
37
+ onClose?: () => void;
38
+ insets: EdgeInsets;
39
+ }
40
+
41
+ const AdMediaControlsProvider: React.FC<AdMediaControlsProviderProps> = ({
42
+ children,
43
+ onAdSkip,
44
+ onAdTracking,
45
+ onClose,
46
+ insets,
47
+ }) => {
48
+ const isAdPlaying = useAdsPlayerStore((state) => state.isAdPlaying);
49
+
50
+ if (!isAdPlaying) {
51
+ return <>{children}</>;
52
+ }
53
+
54
+ return (
55
+ <AdControlsContext.Provider value={{ onAdSkip, onAdTracking }}>
56
+ {children}
57
+ <AdMediaControls onClose={onClose} insets={insets} />
58
+ </AdControlsContext.Provider>
59
+ );
60
+ };
61
+
62
+ export default AdMediaControlsProvider;
@@ -0,0 +1,63 @@
1
+ import React, { memo, useCallback, useMemo } from 'react';
2
+ import { Animated, StyleSheet, TouchableOpacity, View } from 'react-native';
3
+ import { scale } from 'react-native-size-matters';
4
+ import { Play, Pause } from 'lucide-react-native';
5
+ import { useAdsPlayerStore } from '../store/adsPlayerStore';
6
+ import { useAdControlsAutoHide } from '../utils/useAdControlsAutoHide';
7
+ import RotatingLoader from '../components/RotatingLoader';
8
+ import globalStyles from '../../VideoPlayer/styles/globalStyles';
9
+
10
+ const AdMiddleControls: React.FC = () => {
11
+ const { isAdPaused, isAdBuffering, setIsAdPaused } = useAdsPlayerStore();
12
+ const fadeAnim = useAdControlsAutoHide();
13
+
14
+ const handlePlayPause = useCallback(() => {
15
+ setIsAdPaused(!isAdPaused);
16
+ }, [isAdPaused, setIsAdPaused]);
17
+
18
+ // Memoize container style
19
+ const containerStyle = useMemo(
20
+ () => [styles.container, { opacity: fadeAnim }],
21
+ [fadeAnim]
22
+ );
23
+
24
+ return (
25
+ <Animated.View style={containerStyle} pointerEvents="box-none">
26
+ {isAdBuffering ? (
27
+ <RotatingLoader
28
+ color="#fff"
29
+ autoRotate={isAdBuffering}
30
+ size={scale(50)}
31
+ />
32
+ ) : (
33
+ <View pointerEvents="auto">
34
+ <TouchableOpacity
35
+ onPress={handlePlayPause}
36
+ style={styles.button}
37
+ activeOpacity={0.7}
38
+ >
39
+ {isAdPaused ? (
40
+ <Play size={scale(40)} color="#fff" fill="#fff" />
41
+ ) : (
42
+ <Pause size={scale(40)} color="#fff" fill="#fff" />
43
+ )}
44
+ </TouchableOpacity>
45
+ </View>
46
+ )}
47
+ </Animated.View>
48
+ );
49
+ };
50
+
51
+ const styles = StyleSheet.create({
52
+ container: {
53
+ ...globalStyles.absoluteFill,
54
+ justifyContent: 'center',
55
+ alignItems: 'center',
56
+ },
57
+ button: {
58
+ justifyContent: 'center',
59
+ alignItems: 'center',
60
+ },
61
+ });
62
+
63
+ export default memo(AdMiddleControls);
@@ -0,0 +1,191 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import {
3
+ Animated,
4
+ StyleSheet,
5
+ Text,
6
+ TouchableOpacity,
7
+ View,
8
+ Platform,
9
+ } from 'react-native';
10
+ import { moderateScale } from 'react-native-size-matters';
11
+ import { RFValue } from 'react-native-responsive-fontsize';
12
+ import { X } from 'lucide-react-native';
13
+ import { useVideoPlayerStore } from '../../VideoPlayer/store/videoPlayerStore';
14
+ import { useAdsPlayerStore } from '../store/adsPlayerStore';
15
+ import { useAdControlsAutoHide } from '../utils/useAdControlsAutoHide';
16
+ import { formatTime } from '../../VideoPlayer/utils';
17
+
18
+ interface AdTopControlsProps {
19
+ onClose?: () => void;
20
+ }
21
+
22
+ const AdTopControls: React.FC<AdTopControlsProps> = ({ onClose }) => {
23
+ const controlsVisible = useVideoPlayerStore((state) => state.controlsVisible);
24
+ const currentAd = useAdsPlayerStore((state) => state.currentAd);
25
+ const adCurrentTime = useAdsPlayerStore((state) => state.adCurrentTime);
26
+ const adDuration = useAdsPlayerStore((state) => state.adDuration);
27
+ const fadeAnim = useAdControlsAutoHide();
28
+
29
+ const adTimeRemaining = useMemo(
30
+ () => Math.max(0, (currentAd?.duration ?? adDuration) - adCurrentTime),
31
+ [currentAd?.duration, adDuration, adCurrentTime]
32
+ );
33
+
34
+ // Memoize styles to avoid recalculation
35
+ const adLabelContainerStyle = useMemo(
36
+ () => [
37
+ styles.adLabelContainer,
38
+ controlsVisible
39
+ ? styles.adLabelContainerVisible
40
+ : styles.adLabelContainerHidden,
41
+ ],
42
+ [controlsVisible]
43
+ );
44
+
45
+ const adBadgeStyle = useMemo(
46
+ () => [
47
+ styles.adBadge,
48
+ controlsVisible ? styles.adBadgeVisible : styles.adBadgeHidden,
49
+ ],
50
+ [controlsVisible]
51
+ );
52
+
53
+ const closeButtonStyle = useMemo(
54
+ () => [styles.closeButtonContainer, { opacity: fadeAnim }],
55
+ [fadeAnim]
56
+ );
57
+
58
+ return (
59
+ <View style={styles.container}>
60
+ {currentAd && (
61
+ <Animated.View style={adLabelContainerStyle}>
62
+ <View style={adBadgeStyle}>
63
+ <View style={styles.adLabelWrapper}>
64
+ <Text style={styles.adLabelText}>Ad</Text>
65
+ </View>
66
+ <View style={styles.separator} />
67
+ <Text style={styles.adTimeText}>{formatTime(adTimeRemaining)}</Text>
68
+ </View>
69
+ </Animated.View>
70
+ )}
71
+ <Animated.View style={closeButtonStyle}>
72
+ <TouchableOpacity
73
+ onPress={onClose}
74
+ style={styles.closeButton}
75
+ activeOpacity={0.7}
76
+ >
77
+ <View style={styles.closeButtonBackground}>
78
+ <X size={moderateScale(22)} color="#fff" strokeWidth={2.5} />
79
+ </View>
80
+ </TouchableOpacity>
81
+ </Animated.View>
82
+ </View>
83
+ );
84
+ };
85
+
86
+ const styles = StyleSheet.create({
87
+ container: {
88
+ flexDirection: 'row',
89
+ justifyContent: 'space-between',
90
+ alignItems: 'center',
91
+ marginTop: moderateScale(8),
92
+ paddingHorizontal: moderateScale(10),
93
+ paddingBottom: 0,
94
+ },
95
+ adLabelContainer: {
96
+ flex: 1,
97
+ alignItems: 'flex-start',
98
+ },
99
+ adLabelContainerVisible: {
100
+ opacity: 1,
101
+ },
102
+ adLabelContainerHidden: {
103
+ opacity: 0.95,
104
+ },
105
+ adBadge: {
106
+ flexDirection: 'row',
107
+ alignItems: 'center',
108
+ borderRadius: moderateScale(8),
109
+ paddingHorizontal: moderateScale(5),
110
+ paddingVertical: moderateScale(3),
111
+ borderWidth: 1,
112
+ },
113
+ adBadgeVisible: {
114
+ backgroundColor: 'rgba(0, 0, 0, 0.85)',
115
+ borderColor: 'rgba(255, 255, 255, 0.2)',
116
+ ...Platform.select({
117
+ ios: {
118
+ shadowColor: '#000',
119
+ shadowOffset: { width: 0, height: 2 },
120
+ shadowOpacity: 0.4,
121
+ shadowRadius: 5,
122
+ },
123
+ android: {
124
+ elevation: 5,
125
+ },
126
+ }),
127
+ },
128
+ adBadgeHidden: {
129
+ backgroundColor: 'rgba(0, 0, 0, 0.9)',
130
+ borderColor: 'rgba(255, 255, 255, 0.15)',
131
+ ...Platform.select({
132
+ ios: {
133
+ shadowColor: '#000',
134
+ shadowOffset: { width: 0, height: 2 },
135
+ shadowOpacity: 0.3,
136
+ shadowRadius: 4,
137
+ },
138
+ android: {
139
+ elevation: 4,
140
+ },
141
+ }),
142
+ },
143
+ adLabelWrapper: {
144
+ backgroundColor: 'rgb(255, 255, 255)',
145
+ borderRadius: moderateScale(3),
146
+ paddingHorizontal: moderateScale(5),
147
+ paddingVertical: moderateScale(1),
148
+ },
149
+ adLabelText: {
150
+ color: 'red',
151
+ fontSize: RFValue(10),
152
+ fontWeight: '700',
153
+ letterSpacing: 0.1,
154
+ textTransform: 'uppercase',
155
+ },
156
+ separator: {
157
+ width: 1,
158
+ height: moderateScale(12),
159
+ backgroundColor: 'rgba(255, 255, 255, 0.3)',
160
+ marginHorizontal: moderateScale(5),
161
+ },
162
+ adTimeText: {
163
+ color: '#fff',
164
+ fontSize: RFValue(13),
165
+ fontWeight: '700',
166
+ fontVariant: ['tabular-nums'],
167
+ letterSpacing: 0.3,
168
+ minWidth: moderateScale(40),
169
+ },
170
+ closeButtonContainer: {
171
+ justifyContent: 'flex-end',
172
+ alignItems: 'flex-end',
173
+ },
174
+ closeButton: {
175
+ justifyContent: 'center',
176
+ alignItems: 'center',
177
+ padding: moderateScale(2),
178
+ },
179
+ closeButtonBackground: {
180
+ width: moderateScale(32),
181
+ height: moderateScale(32),
182
+ borderRadius: moderateScale(16),
183
+ backgroundColor: 'rgba(0, 0, 0, 0.6)',
184
+ justifyContent: 'center',
185
+ alignItems: 'center',
186
+ borderWidth: 1,
187
+ borderColor: 'rgba(255, 255, 255, 0.2)',
188
+ },
189
+ });
190
+
191
+ export default memo(AdTopControls);
@@ -0,0 +1,5 @@
1
+ export { default as AdMediaControls } from './AdMediaControls';
2
+ export { default as AdMediaControlsProvider } from './AdMediaControlsProvider';
3
+ export { default as AdTopControls } from './AdTopControls';
4
+ export { default as AdMiddleControls } from './AdMiddleControls';
5
+ export { default as AdBottomControls } from './AdBottomControls';
@@ -0,0 +1,79 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import {
3
+ StyleSheet,
4
+ Animated,
5
+ Easing,
6
+ type StyleProp,
7
+ type ViewStyle,
8
+ } from 'react-native';
9
+ import { Loader } from 'lucide-react-native';
10
+ import { moderateScale } from 'react-native-size-matters';
11
+
12
+ interface RotatingLoaderProps {
13
+ size?: number;
14
+ color?: string;
15
+ containerStyle?: StyleProp<ViewStyle>;
16
+ rotationDuration?: number;
17
+ autoRotate?: boolean; // Whether to auto-rotate (default: true)
18
+ }
19
+
20
+ const RotatingLoader: React.FC<RotatingLoaderProps> = ({
21
+ size = moderateScale(35),
22
+ color = '#fff',
23
+ containerStyle,
24
+ rotationDuration = 1300,
25
+ autoRotate = true,
26
+ }) => {
27
+ const rotateAnim = useRef(new Animated.Value(0)).current;
28
+
29
+ useEffect(() => {
30
+ if (autoRotate) {
31
+ rotateAnim.setValue(0);
32
+ const animation = Animated.loop(
33
+ Animated.timing(rotateAnim, {
34
+ toValue: 1,
35
+ duration: rotationDuration,
36
+ easing: Easing.linear,
37
+ useNativeDriver: true,
38
+ })
39
+ );
40
+ animation.start();
41
+
42
+ return () => {
43
+ animation.stop();
44
+ rotateAnim.stopAnimation();
45
+ };
46
+ }
47
+ return undefined;
48
+ }, [autoRotate, rotationDuration, rotateAnim]);
49
+
50
+ return (
51
+ <Animated.View
52
+ style={[
53
+ styles.container,
54
+ containerStyle,
55
+ {
56
+ transform: [
57
+ {
58
+ rotate: rotateAnim.interpolate({
59
+ inputRange: [0, 1],
60
+ outputRange: ['0deg', '360deg'],
61
+ }),
62
+ },
63
+ ],
64
+ },
65
+ ]}
66
+ >
67
+ <Loader size={size} color={color} />
68
+ </Animated.View>
69
+ );
70
+ };
71
+
72
+ export default RotatingLoader;
73
+
74
+ const styles = StyleSheet.create({
75
+ container: {
76
+ justifyContent: 'center',
77
+ alignItems: 'center',
78
+ },
79
+ });
@@ -0,0 +1,4 @@
1
+ export { default as AdsPlayer } from './AdsPlayer';
2
+ export type { AdsPlayerProps, AdsPlayerRef } from './AdsPlayer';
3
+ export { useAdsManager } from './utils/useAdsManager';
4
+ export * from './store';