@pigeonmal/react-native-video 7.0.0-beta.10

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 (705) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +38 -0
  3. package/ReactNativeVideo.podspec +59 -0
  4. package/android/CMakeLists.txt +29 -0
  5. package/android/build.gradle +255 -0
  6. package/android/fix-prefab.gradle +51 -0
  7. package/android/gradle.properties +13 -0
  8. package/android/media3-ffmpeg-decoder/build.gradle +2 -0
  9. package/android/media3-ffmpeg-decoder/ffmpeg.aar +0 -0
  10. package/android/src/main/AndroidManifest.xml +3 -0
  11. package/android/src/main/AndroidManifestNew.xml +3 -0
  12. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  13. package/android/src/main/java/com/twg/video/core/AudioFocusManager.kt +233 -0
  14. package/android/src/main/java/com/twg/video/core/VideoError.kt +105 -0
  15. package/android/src/main/java/com/twg/video/core/VideoManager.kt +292 -0
  16. package/android/src/main/java/com/twg/video/core/custom/MyRenderersFactory.java +78 -0
  17. package/android/src/main/java/com/twg/video/core/custom/MyTextRenderer.java +121 -0
  18. package/android/src/main/java/com/twg/video/core/custom/TextFilter.java +6 -0
  19. package/android/src/main/java/com/twg/video/core/custom/TextSynchronizer.java +7 -0
  20. package/android/src/main/java/com/twg/video/core/extensions/ResizeMode+AspectRatioFrameLayout.kt +20 -0
  21. package/android/src/main/java/com/twg/video/core/extensions/SubtitleType+toString.kt +14 -0
  22. package/android/src/main/java/com/twg/video/core/extensions/VideoPlaybackService+ServiceManagment.kt +59 -0
  23. package/android/src/main/java/com/twg/video/core/fragments/FullscreenVideoFragment.kt +265 -0
  24. package/android/src/main/java/com/twg/video/core/fragments/PictureInPictureHelperFragment.kt +85 -0
  25. package/android/src/main/java/com/twg/video/core/player/DRMManagerSpec.kt +23 -0
  26. package/android/src/main/java/com/twg/video/core/player/DataSourceFactoryUtils.kt +80 -0
  27. package/android/src/main/java/com/twg/video/core/player/MediaItemUtils.kt +152 -0
  28. package/android/src/main/java/com/twg/video/core/player/MediaSourceUtils.kt +85 -0
  29. package/android/src/main/java/com/twg/video/core/player/OnAudioFocusChangedListener.kt +25 -0
  30. package/android/src/main/java/com/twg/video/core/plugins/PluginsRegistry.kt +223 -0
  31. package/android/src/main/java/com/twg/video/core/plugins/ReactNativeVideoPlugin.kt +173 -0
  32. package/android/src/main/java/com/twg/video/core/recivers/AudioBecomingNoisyReceiver.kt +38 -0
  33. package/android/src/main/java/com/twg/video/core/services/playback/CustomMediaNotificationProvider.kt +151 -0
  34. package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackCallback.kt +96 -0
  35. package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackService.kt +219 -0
  36. package/android/src/main/java/com/twg/video/core/services/playback/VideoPlaybackServiceConnection.kt +59 -0
  37. package/android/src/main/java/com/twg/video/core/utils/PictureInPictureUtils.kt +153 -0
  38. package/android/src/main/java/com/twg/video/core/utils/SmallVideoPlayerOptimizer.kt +157 -0
  39. package/android/src/main/java/com/twg/video/core/utils/SourceLoader.kt +48 -0
  40. package/android/src/main/java/com/twg/video/core/utils/Threading.kt +75 -0
  41. package/android/src/main/java/com/twg/video/core/utils/TrackUtils.kt +305 -0
  42. package/android/src/main/java/com/twg/video/core/utils/VideoFileHelper.kt +51 -0
  43. package/android/src/main/java/com/twg/video/core/utils/VideoInformationUtils.kt +67 -0
  44. package/android/src/main/java/com/twg/video/core/utils/VideoOrientationUtils.kt +30 -0
  45. package/android/src/main/java/com/twg/video/hybrids/videoplayer/HybridVideoPlayer.kt +670 -0
  46. package/android/src/main/java/com/twg/video/hybrids/videoplayer/HybridVideoPlayerFactory.kt +16 -0
  47. package/android/src/main/java/com/twg/video/hybrids/videoplayereventemitter/HybridVideoPlayerEventEmitter.kt +168 -0
  48. package/android/src/main/java/com/twg/video/hybrids/videoplayersource/HybridVideoPlayerSource.kt +67 -0
  49. package/android/src/main/java/com/twg/video/hybrids/videoplayersource/HybridVideoPlayerSourceFactory.kt +62 -0
  50. package/android/src/main/java/com/twg/video/hybrids/videoviewviewmanager/HybridVideoViewViewManager.kt +187 -0
  51. package/android/src/main/java/com/twg/video/hybrids/videoviewviewmanager/HybridVideoViewViewManagerFactory.kt +13 -0
  52. package/android/src/main/java/com/twg/video/react/VideoPackage.kt +26 -0
  53. package/android/src/main/java/com/twg/video/react/VideoViewViewManager.kt +78 -0
  54. package/android/src/main/java/com/twg/video/view/VideoView.kt +565 -0
  55. package/android/src/main/res/layout/player_view_surface.xml +14 -0
  56. package/android/src/main/res/layout/player_view_texture.xml +15 -0
  57. package/android/src/paper/java/com/facebook/react/viewmanagers/RNCVideoViewManagerDelegate.java +32 -0
  58. package/android/src/paper/java/com/facebook/react/viewmanagers/RNCVideoViewManagerInterface.java +16 -0
  59. package/android/src/stubs/dash/androidx/media3/exoplayer/dash/DashMediaSource.kt +35 -0
  60. package/android/src/stubs/dash/androidx/media3/exoplayer/dash/DashUtil.kt +11 -0
  61. package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/AdaptationSet.kt +9 -0
  62. package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/DashManifest.kt +10 -0
  63. package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/Period.kt +7 -0
  64. package/android/src/stubs/dash/androidx/media3/exoplayer/dash/manifest/Representation.kt +8 -0
  65. package/android/src/stubs/hls/androidx/media3/exoplayer/hls/HlsMediaSource.kt +33 -0
  66. package/android/src/stubs/subs/androidx/media3/exoplayer/text/NonFinalTextRenderer.java +583 -0
  67. package/app.plugin.js +1 -0
  68. package/ios/Video-Bridging-Header.h +1 -0
  69. package/ios/core/Extensions/AVAsset+estimatedMemoryUsage.swift +51 -0
  70. package/ios/core/Extensions/AVAssetTrack+orientation.swift +41 -0
  71. package/ios/core/Extensions/AVPlayerItem+externalSubtitles.swift +35 -0
  72. package/ios/core/Extensions/AVPlayerItem+getBufferedDurration.swift +34 -0
  73. package/ios/core/Extensions/AVPlayerItem+setBufferConfig.swift +37 -0
  74. package/ios/core/Extensions/AVPlayerViewController+Fullscreen.swift +21 -0
  75. package/ios/core/Extensions/AVPlayerViewController+PictureInPicture.swift +24 -0
  76. package/ios/core/Extensions/AVURLAsset+getAssetInformation.swift +68 -0
  77. package/ios/core/Extensions/NSObject+PerformIfResponds.swift +30 -0
  78. package/ios/core/Extensions/ResizeMode+VideoGravity.swift +24 -0
  79. package/ios/core/HLSSubtitleInjector.swift +381 -0
  80. package/ios/core/NowPlayingInfoCenterManager.swift +323 -0
  81. package/ios/core/Plugins/PluginsRegistry.swift +102 -0
  82. package/ios/core/Plugins/ReactNativeVideoPlugin.swift +91 -0
  83. package/ios/core/Spec/DRMManagerSpec.swift +14 -0
  84. package/ios/core/Spec/NativeVideoPlayerSourceSpec.swift +36 -0
  85. package/ios/core/Spec/NativeVideoPlayerSpec.swift +42 -0
  86. package/ios/core/Utils/ExternalSubtitlesUtils.swift +119 -0
  87. package/ios/core/Utils/HLSManifestParser.swift +170 -0
  88. package/ios/core/Utils/Weak.swift +26 -0
  89. package/ios/core/VideoError.swift +169 -0
  90. package/ios/core/VideoFileHelper.swift +48 -0
  91. package/ios/core/VideoManager.swift +412 -0
  92. package/ios/core/VideoPlayerObserver.swift +294 -0
  93. package/ios/hybrids/VideoPlayer/HybridVideoPlayer+Events.swift +198 -0
  94. package/ios/hybrids/VideoPlayer/HybridVideoPlayer.swift +555 -0
  95. package/ios/hybrids/VideoPlayer/HybridVideoPlayerFactory.swift +15 -0
  96. package/ios/hybrids/VideoPlayerEmitter/HybridVideoPlayerEventEmitter.swift +203 -0
  97. package/ios/hybrids/VideoPlayerSource/HybridVideoPlayerSource.swift +166 -0
  98. package/ios/hybrids/VideoPlayerSource/HybridVideoPlayerSourceFactory.swift +30 -0
  99. package/ios/hybrids/VideoPlayerSource/SourceLoader.swift +83 -0
  100. package/ios/hybrids/VideoViewViewManager/HybridVideoViewViewManager.swift +266 -0
  101. package/ios/hybrids/VideoViewViewManager/HybridVideoViewViewManagerFactory.swift +14 -0
  102. package/ios/view/VideoComponentView.swift +274 -0
  103. package/ios/view/VideoComponentViewObserver.swift +144 -0
  104. package/ios/view/fabric/RCTVideoViewComponentView.h +10 -0
  105. package/ios/view/fabric/RCTVideoViewComponentView.mm +94 -0
  106. package/ios/view/fabric/RCTVideoViewViewManager.mm +14 -0
  107. package/ios/view/paper/RCTVideoViewComponentView.h +9 -0
  108. package/ios/view/paper/RCTVideoViewComponentView.mm +45 -0
  109. package/ios/view/paper/RCTVideoViewViewManager.m +18 -0
  110. package/lib/commonjs/core/VideoPlayer.js +313 -0
  111. package/lib/commonjs/core/VideoPlayer.js.map +1 -0
  112. package/lib/commonjs/core/VideoPlayerEvents.js +87 -0
  113. package/lib/commonjs/core/VideoPlayerEvents.js.map +1 -0
  114. package/lib/commonjs/core/hooks/useEvent.js +24 -0
  115. package/lib/commonjs/core/hooks/useEvent.js.map +1 -0
  116. package/lib/commonjs/core/hooks/useManagedInstance.js +79 -0
  117. package/lib/commonjs/core/hooks/useManagedInstance.js.map +1 -0
  118. package/lib/commonjs/core/hooks/useVideoPlayer.js +62 -0
  119. package/lib/commonjs/core/hooks/useVideoPlayer.js.map +1 -0
  120. package/lib/commonjs/core/types/BufferConfig.js +2 -0
  121. package/lib/commonjs/core/types/BufferConfig.js.map +1 -0
  122. package/lib/commonjs/core/types/DrmParams.js +2 -0
  123. package/lib/commonjs/core/types/DrmParams.js.map +1 -0
  124. package/lib/commonjs/core/types/Events.js +14 -0
  125. package/lib/commonjs/core/types/Events.js.map +1 -0
  126. package/lib/commonjs/core/types/IgnoreSilentSwitchMode.js +2 -0
  127. package/lib/commonjs/core/types/IgnoreSilentSwitchMode.js.map +1 -0
  128. package/lib/commonjs/core/types/MixAudioMode.js +2 -0
  129. package/lib/commonjs/core/types/MixAudioMode.js.map +1 -0
  130. package/lib/commonjs/core/types/PlayerTrack.js +13 -0
  131. package/lib/commonjs/core/types/PlayerTrack.js.map +1 -0
  132. package/lib/commonjs/core/types/ResizeMode.js +2 -0
  133. package/lib/commonjs/core/types/ResizeMode.js.map +1 -0
  134. package/lib/commonjs/core/types/Utils.js +2 -0
  135. package/lib/commonjs/core/types/Utils.js.map +1 -0
  136. package/lib/commonjs/core/types/VideoConfig.js +6 -0
  137. package/lib/commonjs/core/types/VideoConfig.js.map +1 -0
  138. package/lib/commonjs/core/types/VideoError.js +108 -0
  139. package/lib/commonjs/core/types/VideoError.js.map +1 -0
  140. package/lib/commonjs/core/types/VideoInformation.js +6 -0
  141. package/lib/commonjs/core/types/VideoInformation.js.map +1 -0
  142. package/lib/commonjs/core/types/VideoOrientation.js +2 -0
  143. package/lib/commonjs/core/types/VideoOrientation.js.map +1 -0
  144. package/lib/commonjs/core/types/VideoPlayerBase.js +6 -0
  145. package/lib/commonjs/core/types/VideoPlayerBase.js.map +1 -0
  146. package/lib/commonjs/core/types/VideoPlayerSourceBase.js +6 -0
  147. package/lib/commonjs/core/types/VideoPlayerSourceBase.js.map +1 -0
  148. package/lib/commonjs/core/types/VideoPlayerStatus.js +2 -0
  149. package/lib/commonjs/core/types/VideoPlayerStatus.js.map +1 -0
  150. package/lib/commonjs/core/utils/playerFactory.js +27 -0
  151. package/lib/commonjs/core/utils/playerFactory.js.map +1 -0
  152. package/lib/commonjs/core/utils/sourceFactory.js +146 -0
  153. package/lib/commonjs/core/utils/sourceFactory.js.map +1 -0
  154. package/lib/commonjs/core/video-view/NativeVideoView.js +18 -0
  155. package/lib/commonjs/core/video-view/NativeVideoView.js.map +1 -0
  156. package/lib/commonjs/core/video-view/VideoView.js +208 -0
  157. package/lib/commonjs/core/video-view/VideoView.js.map +1 -0
  158. package/lib/commonjs/expo-plugins/@types.js +2 -0
  159. package/lib/commonjs/expo-plugins/@types.js.map +1 -0
  160. package/lib/commonjs/expo-plugins/getPackageInfo.js +27 -0
  161. package/lib/commonjs/expo-plugins/getPackageInfo.js.map +1 -0
  162. package/lib/commonjs/expo-plugins/withAndroidExtensions.js +40 -0
  163. package/lib/commonjs/expo-plugins/withAndroidExtensions.js.map +1 -0
  164. package/lib/commonjs/expo-plugins/withAndroidNotificationControls.js +34 -0
  165. package/lib/commonjs/expo-plugins/withAndroidNotificationControls.js.map +1 -0
  166. package/lib/commonjs/expo-plugins/withAndroidPictureInPicture.js +23 -0
  167. package/lib/commonjs/expo-plugins/withAndroidPictureInPicture.js.map +1 -0
  168. package/lib/commonjs/expo-plugins/withBackgroundAudio.js +26 -0
  169. package/lib/commonjs/expo-plugins/withBackgroundAudio.js.map +1 -0
  170. package/lib/commonjs/expo-plugins/withReactNativeVideo.js +31 -0
  171. package/lib/commonjs/expo-plugins/withReactNativeVideo.js.map +1 -0
  172. package/lib/commonjs/expo-plugins/writeToPodfile.js +59 -0
  173. package/lib/commonjs/expo-plugins/writeToPodfile.js.map +1 -0
  174. package/lib/commonjs/index.js +61 -0
  175. package/lib/commonjs/index.js.map +1 -0
  176. package/lib/commonjs/package.json +1 -0
  177. package/lib/commonjs/spec/fabric/VideoViewNativeComponent.ts +17 -0
  178. package/lib/commonjs/spec/nitro/VideoPlayer.nitro.js +6 -0
  179. package/lib/commonjs/spec/nitro/VideoPlayer.nitro.js.map +1 -0
  180. package/lib/commonjs/spec/nitro/VideoPlayerEventEmitter.nitro.js +6 -0
  181. package/lib/commonjs/spec/nitro/VideoPlayerEventEmitter.nitro.js.map +1 -0
  182. package/lib/commonjs/spec/nitro/VideoPlayerSource.nitro.js +6 -0
  183. package/lib/commonjs/spec/nitro/VideoPlayerSource.nitro.js.map +1 -0
  184. package/lib/commonjs/spec/nitro/VideoViewViewManager.nitro.js +6 -0
  185. package/lib/commonjs/spec/nitro/VideoViewViewManager.nitro.js.map +1 -0
  186. package/lib/module/core/VideoPlayer.js +309 -0
  187. package/lib/module/core/VideoPlayer.js.map +1 -0
  188. package/lib/module/core/VideoPlayerEvents.js +82 -0
  189. package/lib/module/core/VideoPlayerEvents.js.map +1 -0
  190. package/lib/module/core/hooks/useEvent.js +19 -0
  191. package/lib/module/core/hooks/useEvent.js.map +1 -0
  192. package/lib/module/core/hooks/useManagedInstance.js +75 -0
  193. package/lib/module/core/hooks/useManagedInstance.js.map +1 -0
  194. package/lib/module/core/hooks/useVideoPlayer.js +57 -0
  195. package/lib/module/core/hooks/useVideoPlayer.js.map +1 -0
  196. package/lib/module/core/types/BufferConfig.js +2 -0
  197. package/lib/module/core/types/BufferConfig.js.map +1 -0
  198. package/lib/module/core/types/DrmParams.js +2 -0
  199. package/lib/module/core/types/DrmParams.js.map +1 -0
  200. package/lib/module/core/types/Events.js +10 -0
  201. package/lib/module/core/types/Events.js.map +1 -0
  202. package/lib/module/core/types/IgnoreSilentSwitchMode.js +2 -0
  203. package/lib/module/core/types/IgnoreSilentSwitchMode.js.map +1 -0
  204. package/lib/module/core/types/MixAudioMode.js +2 -0
  205. package/lib/module/core/types/MixAudioMode.js.map +1 -0
  206. package/lib/module/core/types/PlayerTrack.js +9 -0
  207. package/lib/module/core/types/PlayerTrack.js.map +1 -0
  208. package/lib/module/core/types/ResizeMode.js +2 -0
  209. package/lib/module/core/types/ResizeMode.js.map +1 -0
  210. package/lib/module/core/types/Utils.js +2 -0
  211. package/lib/module/core/types/Utils.js.map +1 -0
  212. package/lib/module/core/types/VideoConfig.js +4 -0
  213. package/lib/module/core/types/VideoConfig.js.map +1 -0
  214. package/lib/module/core/types/VideoError.js +100 -0
  215. package/lib/module/core/types/VideoError.js.map +1 -0
  216. package/lib/module/core/types/VideoInformation.js +4 -0
  217. package/lib/module/core/types/VideoInformation.js.map +1 -0
  218. package/lib/module/core/types/VideoOrientation.js +2 -0
  219. package/lib/module/core/types/VideoOrientation.js.map +1 -0
  220. package/lib/module/core/types/VideoPlayerBase.js +4 -0
  221. package/lib/module/core/types/VideoPlayerBase.js.map +1 -0
  222. package/lib/module/core/types/VideoPlayerSourceBase.js +4 -0
  223. package/lib/module/core/types/VideoPlayerSourceBase.js.map +1 -0
  224. package/lib/module/core/types/VideoPlayerStatus.js +2 -0
  225. package/lib/module/core/types/VideoPlayerStatus.js.map +1 -0
  226. package/lib/module/core/utils/playerFactory.js +22 -0
  227. package/lib/module/core/utils/playerFactory.js.map +1 -0
  228. package/lib/module/core/utils/sourceFactory.js +138 -0
  229. package/lib/module/core/utils/sourceFactory.js.map +1 -0
  230. package/lib/module/core/video-view/NativeVideoView.js +13 -0
  231. package/lib/module/core/video-view/NativeVideoView.js.map +1 -0
  232. package/lib/module/core/video-view/VideoView.js +203 -0
  233. package/lib/module/core/video-view/VideoView.js.map +1 -0
  234. package/lib/module/expo-plugins/@types.js +2 -0
  235. package/lib/module/expo-plugins/@types.js.map +1 -0
  236. package/lib/module/expo-plugins/getPackageInfo.js +23 -0
  237. package/lib/module/expo-plugins/getPackageInfo.js.map +1 -0
  238. package/lib/module/expo-plugins/withAndroidExtensions.js +35 -0
  239. package/lib/module/expo-plugins/withAndroidExtensions.js.map +1 -0
  240. package/lib/module/expo-plugins/withAndroidNotificationControls.js +29 -0
  241. package/lib/module/expo-plugins/withAndroidNotificationControls.js.map +1 -0
  242. package/lib/module/expo-plugins/withAndroidPictureInPicture.js +18 -0
  243. package/lib/module/expo-plugins/withAndroidPictureInPicture.js.map +1 -0
  244. package/lib/module/expo-plugins/withBackgroundAudio.js +22 -0
  245. package/lib/module/expo-plugins/withBackgroundAudio.js.map +1 -0
  246. package/lib/module/expo-plugins/withReactNativeVideo.js +27 -0
  247. package/lib/module/expo-plugins/withReactNativeVideo.js.map +1 -0
  248. package/lib/module/expo-plugins/writeToPodfile.js +53 -0
  249. package/lib/module/expo-plugins/writeToPodfile.js.map +1 -0
  250. package/lib/module/index.js +9 -0
  251. package/lib/module/index.js.map +1 -0
  252. package/lib/module/package.json +1 -0
  253. package/lib/module/spec/fabric/VideoViewNativeComponent.ts +17 -0
  254. package/lib/module/spec/nitro/VideoPlayer.nitro.js +4 -0
  255. package/lib/module/spec/nitro/VideoPlayer.nitro.js.map +1 -0
  256. package/lib/module/spec/nitro/VideoPlayerEventEmitter.nitro.js +4 -0
  257. package/lib/module/spec/nitro/VideoPlayerEventEmitter.nitro.js.map +1 -0
  258. package/lib/module/spec/nitro/VideoPlayerSource.nitro.js +4 -0
  259. package/lib/module/spec/nitro/VideoPlayerSource.nitro.js.map +1 -0
  260. package/lib/module/spec/nitro/VideoViewViewManager.nitro.js +4 -0
  261. package/lib/module/spec/nitro/VideoViewViewManager.nitro.js.map +1 -0
  262. package/lib/typescript/commonjs/package.json +1 -0
  263. package/lib/typescript/commonjs/src/core/VideoPlayer.d.ts +66 -0
  264. package/lib/typescript/commonjs/src/core/VideoPlayer.d.ts.map +1 -0
  265. package/lib/typescript/commonjs/src/core/VideoPlayerEvents.d.ts +22 -0
  266. package/lib/typescript/commonjs/src/core/VideoPlayerEvents.d.ts.map +1 -0
  267. package/lib/typescript/commonjs/src/core/hooks/useEvent.d.ts +11 -0
  268. package/lib/typescript/commonjs/src/core/hooks/useEvent.d.ts.map +1 -0
  269. package/lib/typescript/commonjs/src/core/hooks/useManagedInstance.d.ts +2 -0
  270. package/lib/typescript/commonjs/src/core/hooks/useManagedInstance.d.ts.map +1 -0
  271. package/lib/typescript/commonjs/src/core/hooks/useVideoPlayer.d.ts +16 -0
  272. package/lib/typescript/commonjs/src/core/hooks/useVideoPlayer.d.ts.map +1 -0
  273. package/lib/typescript/commonjs/src/core/types/BufferConfig.d.ts +97 -0
  274. package/lib/typescript/commonjs/src/core/types/BufferConfig.d.ts.map +1 -0
  275. package/lib/typescript/commonjs/src/core/types/DrmParams.d.ts +64 -0
  276. package/lib/typescript/commonjs/src/core/types/DrmParams.d.ts.map +1 -0
  277. package/lib/typescript/commonjs/src/core/types/Events.d.ts +222 -0
  278. package/lib/typescript/commonjs/src/core/types/Events.d.ts.map +1 -0
  279. package/lib/typescript/commonjs/src/core/types/IgnoreSilentSwitchMode.d.ts +2 -0
  280. package/lib/typescript/commonjs/src/core/types/IgnoreSilentSwitchMode.d.ts.map +1 -0
  281. package/lib/typescript/commonjs/src/core/types/MixAudioMode.d.ts +2 -0
  282. package/lib/typescript/commonjs/src/core/types/MixAudioMode.d.ts.map +1 -0
  283. package/lib/typescript/commonjs/src/core/types/PlayerTrack.d.ts +34 -0
  284. package/lib/typescript/commonjs/src/core/types/PlayerTrack.d.ts.map +1 -0
  285. package/lib/typescript/commonjs/src/core/types/ResizeMode.d.ts +10 -0
  286. package/lib/typescript/commonjs/src/core/types/ResizeMode.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/src/core/types/Utils.d.ts +2 -0
  288. package/lib/typescript/commonjs/src/core/types/Utils.d.ts.map +1 -0
  289. package/lib/typescript/commonjs/src/core/types/VideoConfig.d.ts +138 -0
  290. package/lib/typescript/commonjs/src/core/types/VideoConfig.d.ts.map +1 -0
  291. package/lib/typescript/commonjs/src/core/types/VideoError.d.ts +27 -0
  292. package/lib/typescript/commonjs/src/core/types/VideoError.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/src/core/types/VideoInformation.d.ts +37 -0
  294. package/lib/typescript/commonjs/src/core/types/VideoInformation.d.ts.map +1 -0
  295. package/lib/typescript/commonjs/src/core/types/VideoOrientation.d.ts +2 -0
  296. package/lib/typescript/commonjs/src/core/types/VideoOrientation.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/src/core/types/VideoPlayerBase.d.ts +194 -0
  298. package/lib/typescript/commonjs/src/core/types/VideoPlayerBase.d.ts.map +1 -0
  299. package/lib/typescript/commonjs/src/core/types/VideoPlayerSourceBase.d.ts +17 -0
  300. package/lib/typescript/commonjs/src/core/types/VideoPlayerSourceBase.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/src/core/types/VideoPlayerStatus.d.ts +9 -0
  302. package/lib/typescript/commonjs/src/core/types/VideoPlayerStatus.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/src/core/utils/playerFactory.d.ts +2 -0
  304. package/lib/typescript/commonjs/src/core/utils/playerFactory.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/src/core/utils/sourceFactory.d.ts +29 -0
  306. package/lib/typescript/commonjs/src/core/utils/sourceFactory.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/src/core/video-view/NativeVideoView.d.ts +2 -0
  308. package/lib/typescript/commonjs/src/core/video-view/NativeVideoView.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/src/core/video-view/VideoView.d.ts +85 -0
  310. package/lib/typescript/commonjs/src/core/video-view/VideoView.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/src/expo-plugins/@types.d.ts +34 -0
  312. package/lib/typescript/commonjs/src/expo-plugins/@types.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/src/expo-plugins/getPackageInfo.d.ts +5 -0
  314. package/lib/typescript/commonjs/src/expo-plugins/getPackageInfo.d.ts.map +1 -0
  315. package/lib/typescript/commonjs/src/expo-plugins/withAndroidExtensions.d.ts +8 -0
  316. package/lib/typescript/commonjs/src/expo-plugins/withAndroidExtensions.d.ts.map +1 -0
  317. package/lib/typescript/commonjs/src/expo-plugins/withAndroidNotificationControls.d.ts +3 -0
  318. package/lib/typescript/commonjs/src/expo-plugins/withAndroidNotificationControls.d.ts.map +1 -0
  319. package/lib/typescript/commonjs/src/expo-plugins/withAndroidPictureInPicture.d.ts +3 -0
  320. package/lib/typescript/commonjs/src/expo-plugins/withAndroidPictureInPicture.d.ts.map +1 -0
  321. package/lib/typescript/commonjs/src/expo-plugins/withBackgroundAudio.d.ts +7 -0
  322. package/lib/typescript/commonjs/src/expo-plugins/withBackgroundAudio.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/src/expo-plugins/withReactNativeVideo.d.ts +5 -0
  324. package/lib/typescript/commonjs/src/expo-plugins/withReactNativeVideo.d.ts.map +1 -0
  325. package/lib/typescript/commonjs/src/expo-plugins/writeToPodfile.d.ts +2 -0
  326. package/lib/typescript/commonjs/src/expo-plugins/writeToPodfile.d.ts.map +1 -0
  327. package/lib/typescript/commonjs/src/index.d.ts +15 -0
  328. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  329. package/lib/typescript/commonjs/src/spec/fabric/VideoViewNativeComponent.d.ts +12 -0
  330. package/lib/typescript/commonjs/src/spec/fabric/VideoViewNativeComponent.d.ts.map +1 -0
  331. package/lib/typescript/commonjs/src/spec/nitro/VideoPlayer.nitro.d.ts +34 -0
  332. package/lib/typescript/commonjs/src/spec/nitro/VideoPlayer.nitro.d.ts.map +1 -0
  333. package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts +142 -0
  334. package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts.map +1 -0
  335. package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerSource.nitro.d.ts +21 -0
  336. package/lib/typescript/commonjs/src/spec/nitro/VideoPlayerSource.nitro.d.ts.map +1 -0
  337. package/lib/typescript/commonjs/src/spec/nitro/VideoViewViewManager.nitro.d.ts +2 -0
  338. package/lib/typescript/commonjs/src/spec/nitro/VideoViewViewManager.nitro.d.ts.map +1 -0
  339. package/lib/typescript/module/package.json +1 -0
  340. package/lib/typescript/module/src/core/VideoPlayer.d.ts +66 -0
  341. package/lib/typescript/module/src/core/VideoPlayer.d.ts.map +1 -0
  342. package/lib/typescript/module/src/core/VideoPlayerEvents.d.ts +22 -0
  343. package/lib/typescript/module/src/core/VideoPlayerEvents.d.ts.map +1 -0
  344. package/lib/typescript/module/src/core/hooks/useEvent.d.ts +11 -0
  345. package/lib/typescript/module/src/core/hooks/useEvent.d.ts.map +1 -0
  346. package/lib/typescript/module/src/core/hooks/useManagedInstance.d.ts +2 -0
  347. package/lib/typescript/module/src/core/hooks/useManagedInstance.d.ts.map +1 -0
  348. package/lib/typescript/module/src/core/hooks/useVideoPlayer.d.ts +16 -0
  349. package/lib/typescript/module/src/core/hooks/useVideoPlayer.d.ts.map +1 -0
  350. package/lib/typescript/module/src/core/types/BufferConfig.d.ts +97 -0
  351. package/lib/typescript/module/src/core/types/BufferConfig.d.ts.map +1 -0
  352. package/lib/typescript/module/src/core/types/DrmParams.d.ts +64 -0
  353. package/lib/typescript/module/src/core/types/DrmParams.d.ts.map +1 -0
  354. package/lib/typescript/module/src/core/types/Events.d.ts +222 -0
  355. package/lib/typescript/module/src/core/types/Events.d.ts.map +1 -0
  356. package/lib/typescript/module/src/core/types/IgnoreSilentSwitchMode.d.ts +2 -0
  357. package/lib/typescript/module/src/core/types/IgnoreSilentSwitchMode.d.ts.map +1 -0
  358. package/lib/typescript/module/src/core/types/MixAudioMode.d.ts +2 -0
  359. package/lib/typescript/module/src/core/types/MixAudioMode.d.ts.map +1 -0
  360. package/lib/typescript/module/src/core/types/PlayerTrack.d.ts +34 -0
  361. package/lib/typescript/module/src/core/types/PlayerTrack.d.ts.map +1 -0
  362. package/lib/typescript/module/src/core/types/ResizeMode.d.ts +10 -0
  363. package/lib/typescript/module/src/core/types/ResizeMode.d.ts.map +1 -0
  364. package/lib/typescript/module/src/core/types/Utils.d.ts +2 -0
  365. package/lib/typescript/module/src/core/types/Utils.d.ts.map +1 -0
  366. package/lib/typescript/module/src/core/types/VideoConfig.d.ts +138 -0
  367. package/lib/typescript/module/src/core/types/VideoConfig.d.ts.map +1 -0
  368. package/lib/typescript/module/src/core/types/VideoError.d.ts +27 -0
  369. package/lib/typescript/module/src/core/types/VideoError.d.ts.map +1 -0
  370. package/lib/typescript/module/src/core/types/VideoInformation.d.ts +37 -0
  371. package/lib/typescript/module/src/core/types/VideoInformation.d.ts.map +1 -0
  372. package/lib/typescript/module/src/core/types/VideoOrientation.d.ts +2 -0
  373. package/lib/typescript/module/src/core/types/VideoOrientation.d.ts.map +1 -0
  374. package/lib/typescript/module/src/core/types/VideoPlayerBase.d.ts +194 -0
  375. package/lib/typescript/module/src/core/types/VideoPlayerBase.d.ts.map +1 -0
  376. package/lib/typescript/module/src/core/types/VideoPlayerSourceBase.d.ts +17 -0
  377. package/lib/typescript/module/src/core/types/VideoPlayerSourceBase.d.ts.map +1 -0
  378. package/lib/typescript/module/src/core/types/VideoPlayerStatus.d.ts +9 -0
  379. package/lib/typescript/module/src/core/types/VideoPlayerStatus.d.ts.map +1 -0
  380. package/lib/typescript/module/src/core/utils/playerFactory.d.ts +2 -0
  381. package/lib/typescript/module/src/core/utils/playerFactory.d.ts.map +1 -0
  382. package/lib/typescript/module/src/core/utils/sourceFactory.d.ts +29 -0
  383. package/lib/typescript/module/src/core/utils/sourceFactory.d.ts.map +1 -0
  384. package/lib/typescript/module/src/core/video-view/NativeVideoView.d.ts +2 -0
  385. package/lib/typescript/module/src/core/video-view/NativeVideoView.d.ts.map +1 -0
  386. package/lib/typescript/module/src/core/video-view/VideoView.d.ts +85 -0
  387. package/lib/typescript/module/src/core/video-view/VideoView.d.ts.map +1 -0
  388. package/lib/typescript/module/src/expo-plugins/@types.d.ts +34 -0
  389. package/lib/typescript/module/src/expo-plugins/@types.d.ts.map +1 -0
  390. package/lib/typescript/module/src/expo-plugins/getPackageInfo.d.ts +5 -0
  391. package/lib/typescript/module/src/expo-plugins/getPackageInfo.d.ts.map +1 -0
  392. package/lib/typescript/module/src/expo-plugins/withAndroidExtensions.d.ts +8 -0
  393. package/lib/typescript/module/src/expo-plugins/withAndroidExtensions.d.ts.map +1 -0
  394. package/lib/typescript/module/src/expo-plugins/withAndroidNotificationControls.d.ts +3 -0
  395. package/lib/typescript/module/src/expo-plugins/withAndroidNotificationControls.d.ts.map +1 -0
  396. package/lib/typescript/module/src/expo-plugins/withAndroidPictureInPicture.d.ts +3 -0
  397. package/lib/typescript/module/src/expo-plugins/withAndroidPictureInPicture.d.ts.map +1 -0
  398. package/lib/typescript/module/src/expo-plugins/withBackgroundAudio.d.ts +7 -0
  399. package/lib/typescript/module/src/expo-plugins/withBackgroundAudio.d.ts.map +1 -0
  400. package/lib/typescript/module/src/expo-plugins/withReactNativeVideo.d.ts +5 -0
  401. package/lib/typescript/module/src/expo-plugins/withReactNativeVideo.d.ts.map +1 -0
  402. package/lib/typescript/module/src/expo-plugins/writeToPodfile.d.ts +2 -0
  403. package/lib/typescript/module/src/expo-plugins/writeToPodfile.d.ts.map +1 -0
  404. package/lib/typescript/module/src/index.d.ts +15 -0
  405. package/lib/typescript/module/src/index.d.ts.map +1 -0
  406. package/lib/typescript/module/src/spec/fabric/VideoViewNativeComponent.d.ts +12 -0
  407. package/lib/typescript/module/src/spec/fabric/VideoViewNativeComponent.d.ts.map +1 -0
  408. package/lib/typescript/module/src/spec/nitro/VideoPlayer.nitro.d.ts +34 -0
  409. package/lib/typescript/module/src/spec/nitro/VideoPlayer.nitro.d.ts.map +1 -0
  410. package/lib/typescript/module/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts +142 -0
  411. package/lib/typescript/module/src/spec/nitro/VideoPlayerEventEmitter.nitro.d.ts.map +1 -0
  412. package/lib/typescript/module/src/spec/nitro/VideoPlayerSource.nitro.d.ts +21 -0
  413. package/lib/typescript/module/src/spec/nitro/VideoPlayerSource.nitro.d.ts.map +1 -0
  414. package/lib/typescript/module/src/spec/nitro/VideoViewViewManager.nitro.d.ts +2 -0
  415. package/lib/typescript/module/src/spec/nitro/VideoViewViewManager.nitro.d.ts.map +1 -0
  416. package/nitro.json +28 -0
  417. package/nitrogen/generated/android/ReactNativeVideo+autolinking.cmake +94 -0
  418. package/nitrogen/generated/android/ReactNativeVideo+autolinking.gradle +27 -0
  419. package/nitrogen/generated/android/ReactNativeVideoOnLoad.cpp +98 -0
  420. package/nitrogen/generated/android/ReactNativeVideoOnLoad.hpp +25 -0
  421. package/nitrogen/generated/android/c++/JAllPlayerTracks.hpp +125 -0
  422. package/nitrogen/generated/android/c++/JBandwidthData.hpp +65 -0
  423. package/nitrogen/generated/android/c++/JBufferConfig.hpp +101 -0
  424. package/nitrogen/generated/android/c++/JCustomVideoMetadata.hpp +74 -0
  425. package/nitrogen/generated/android/c++/JExternalAudio.hpp +80 -0
  426. package/nitrogen/generated/android/c++/JExternalForcedType.hpp +59 -0
  427. package/nitrogen/generated/android/c++/JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp +126 -0
  428. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  429. package/nitrogen/generated/android/c++/JFunc_void_BandwidthData.hpp +78 -0
  430. package/nitrogen/generated/android/c++/JFunc_void_TimedMetadata.hpp +81 -0
  431. package/nitrogen/generated/android/c++/JFunc_void_VideoPlayerStatus.hpp +77 -0
  432. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
  433. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  434. package/nitrogen/generated/android/c++/JFunc_void_onLoadData.hpp +88 -0
  435. package/nitrogen/generated/android/c++/JFunc_void_onLoadStartData.hpp +82 -0
  436. package/nitrogen/generated/android/c++/JFunc_void_onPlaybackStateChangeData.hpp +77 -0
  437. package/nitrogen/generated/android/c++/JFunc_void_onProgressData.hpp +77 -0
  438. package/nitrogen/generated/android/c++/JFunc_void_onVolumeChangeData.hpp +77 -0
  439. package/nitrogen/generated/android/c++/JFunc_void_std__vector_std__string_.hpp +95 -0
  440. package/nitrogen/generated/android/c++/JHybridVideoPlayerEventEmitterSpec.cpp +221 -0
  441. package/nitrogen/generated/android/c++/JHybridVideoPlayerEventEmitterSpec.hpp +83 -0
  442. package/nitrogen/generated/android/c++/JHybridVideoPlayerFactorySpec.cpp +60 -0
  443. package/nitrogen/generated/android/c++/JHybridVideoPlayerFactorySpec.hpp +65 -0
  444. package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceFactorySpec.cpp +113 -0
  445. package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceFactorySpec.hpp +66 -0
  446. package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceSpec.cpp +131 -0
  447. package/nitrogen/generated/android/c++/JHybridVideoPlayerSourceSpec.hpp +66 -0
  448. package/nitrogen/generated/android/c++/JHybridVideoPlayerSpec.cpp +324 -0
  449. package/nitrogen/generated/android/c++/JHybridVideoPlayerSpec.hpp +106 -0
  450. package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.cpp +55 -0
  451. package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerFactorySpec.hpp +65 -0
  452. package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerSpec.cpp +184 -0
  453. package/nitrogen/generated/android/c++/JHybridVideoViewViewManagerSpec.hpp +89 -0
  454. package/nitrogen/generated/android/c++/JIgnoreSilentSwitchMode.hpp +62 -0
  455. package/nitrogen/generated/android/c++/JListenerSubscription.hpp +67 -0
  456. package/nitrogen/generated/android/c++/JLivePlaybackParams.hpp +73 -0
  457. package/nitrogen/generated/android/c++/JMixAudioMode.hpp +65 -0
  458. package/nitrogen/generated/android/c++/JNativeDrmParams.hpp +111 -0
  459. package/nitrogen/generated/android/c++/JNativeExternalSubtitle.hpp +71 -0
  460. package/nitrogen/generated/android/c++/JNativeVideoConfig.hpp +178 -0
  461. package/nitrogen/generated/android/c++/JOnGetLicensePayload.hpp +69 -0
  462. package/nitrogen/generated/android/c++/JPlayerTrack.hpp +70 -0
  463. package/nitrogen/generated/android/c++/JResizeMode.hpp +65 -0
  464. package/nitrogen/generated/android/c++/JResolution.hpp +61 -0
  465. package/nitrogen/generated/android/c++/JSourceType.hpp +59 -0
  466. package/nitrogen/generated/android/c++/JSubtitleType.hpp +68 -0
  467. package/nitrogen/generated/android/c++/JSurfaceType.hpp +59 -0
  468. package/nitrogen/generated/android/c++/JTimedMetadata.hpp +78 -0
  469. package/nitrogen/generated/android/c++/JTimedMetadataObject.hpp +61 -0
  470. package/nitrogen/generated/android/c++/JTrackType.hpp +62 -0
  471. package/nitrogen/generated/android/c++/JVariant_NullType_HybridVideoPlayerSourceSpec.cpp +26 -0
  472. package/nitrogen/generated/android/c++/JVariant_NullType_HybridVideoPlayerSourceSpec.hpp +72 -0
  473. package/nitrogen/generated/android/c++/JVideoInformation.hpp +86 -0
  474. package/nitrogen/generated/android/c++/JVideoOrientation.hpp +74 -0
  475. package/nitrogen/generated/android/c++/JVideoPlayerStatus.hpp +65 -0
  476. package/nitrogen/generated/android/c++/JVideoPlayerTrack.hpp +78 -0
  477. package/nitrogen/generated/android/c++/JonLoadData.hpp +87 -0
  478. package/nitrogen/generated/android/c++/JonLoadStartData.hpp +65 -0
  479. package/nitrogen/generated/android/c++/JonPlaybackStateChangeData.hpp +61 -0
  480. package/nitrogen/generated/android/c++/JonProgressData.hpp +65 -0
  481. package/nitrogen/generated/android/c++/JonVolumeChangeData.hpp +61 -0
  482. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/AllPlayerTracks.kt +44 -0
  483. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/BandwidthData.kt +44 -0
  484. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/BufferConfig.kt +68 -0
  485. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/CustomVideoMetadata.kt +50 -0
  486. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ExternalAudio.kt +44 -0
  487. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ExternalForcedType.kt +21 -0
  488. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.kt +80 -0
  489. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void.kt +80 -0
  490. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_BandwidthData.kt +80 -0
  491. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_TimedMetadata.kt +80 -0
  492. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_VideoPlayerStatus.kt +80 -0
  493. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_bool.kt +80 -0
  494. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_double.kt +80 -0
  495. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onLoadData.kt +80 -0
  496. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onLoadStartData.kt +80 -0
  497. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onPlaybackStateChangeData.kt +80 -0
  498. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onProgressData.kt +80 -0
  499. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_onVolumeChangeData.kt +80 -0
  500. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Func_void_std__vector_std__string_.kt +80 -0
  501. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerEventEmitterSpec.kt +219 -0
  502. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerFactorySpec.kt +57 -0
  503. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerSourceFactorySpec.kt +61 -0
  504. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerSourceSpec.kt +64 -0
  505. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoPlayerSpec.kt +201 -0
  506. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoViewViewManagerFactorySpec.kt +57 -0
  507. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/HybridVideoViewViewManagerSpec.kt +171 -0
  508. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/IgnoreSilentSwitchMode.kt +22 -0
  509. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ListenerSubscription.kt +42 -0
  510. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/LivePlaybackParams.kt +50 -0
  511. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/MixAudioMode.kt +23 -0
  512. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/NativeDrmParams.kt +60 -0
  513. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/NativeExternalSubtitle.kt +47 -0
  514. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/NativeVideoConfig.kt +71 -0
  515. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/OnGetLicensePayload.kt +47 -0
  516. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/PlayerTrack.kt +47 -0
  517. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ReactNativeVideoOnLoad.kt +35 -0
  518. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/ResizeMode.kt +23 -0
  519. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Resolution.kt +41 -0
  520. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SourceType.kt +21 -0
  521. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SubtitleType.kt +24 -0
  522. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/SurfaceType.kt +21 -0
  523. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/TimedMetadata.kt +38 -0
  524. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/TimedMetadataObject.kt +41 -0
  525. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/TrackType.kt +22 -0
  526. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/Variant_NullType_HybridVideoPlayerSourceSpec.kt +59 -0
  527. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoInformation.kt +59 -0
  528. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoOrientation.kt +26 -0
  529. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoPlayerStatus.kt +23 -0
  530. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/VideoPlayerTrack.kt +53 -0
  531. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onLoadData.kt +53 -0
  532. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onLoadStartData.kt +41 -0
  533. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onPlaybackStateChangeData.kt +41 -0
  534. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onProgressData.kt +44 -0
  535. package/nitrogen/generated/android/kotlin/com/margelo/nitro/video/onVolumeChangeData.kt +41 -0
  536. package/nitrogen/generated/ios/ReactNativeVideo+autolinking.rb +60 -0
  537. package/nitrogen/generated/ios/ReactNativeVideo-Swift-Cxx-Bridge.cpp +272 -0
  538. package/nitrogen/generated/ios/ReactNativeVideo-Swift-Cxx-Bridge.hpp +1134 -0
  539. package/nitrogen/generated/ios/ReactNativeVideo-Swift-Cxx-Umbrella.hpp +177 -0
  540. package/nitrogen/generated/ios/ReactNativeVideoAutolinking.mm +49 -0
  541. package/nitrogen/generated/ios/ReactNativeVideoAutolinking.swift +55 -0
  542. package/nitrogen/generated/ios/c++/HybridVideoPlayerEventEmitterSpecSwift.cpp +11 -0
  543. package/nitrogen/generated/ios/c++/HybridVideoPlayerEventEmitterSpecSwift.hpp +269 -0
  544. package/nitrogen/generated/ios/c++/HybridVideoPlayerFactorySpecSwift.cpp +11 -0
  545. package/nitrogen/generated/ios/c++/HybridVideoPlayerFactorySpecSwift.hpp +82 -0
  546. package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceFactorySpecSwift.cpp +11 -0
  547. package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceFactorySpecSwift.hpp +125 -0
  548. package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceSpecSwift.cpp +11 -0
  549. package/nitrogen/generated/ios/c++/HybridVideoPlayerSourceSpecSwift.hpp +125 -0
  550. package/nitrogen/generated/ios/c++/HybridVideoPlayerSpecSwift.cpp +11 -0
  551. package/nitrogen/generated/ios/c++/HybridVideoPlayerSpecSwift.hpp +283 -0
  552. package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerFactorySpecSwift.cpp +11 -0
  553. package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerFactorySpecSwift.hpp +78 -0
  554. package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerSpecSwift.cpp +11 -0
  555. package/nitrogen/generated/ios/c++/HybridVideoViewViewManagerSpecSwift.hpp +211 -0
  556. package/nitrogen/generated/ios/swift/AllPlayerTracks.swift +94 -0
  557. package/nitrogen/generated/ios/swift/BandwidthData.swift +82 -0
  558. package/nitrogen/generated/ios/swift/BufferConfig.swift +278 -0
  559. package/nitrogen/generated/ios/swift/CustomVideoMetadata.swift +175 -0
  560. package/nitrogen/generated/ios/swift/ExternalAudio.swift +116 -0
  561. package/nitrogen/generated/ios/swift/ExternalForcedType.swift +40 -0
  562. package/nitrogen/generated/ios/swift/Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.swift +62 -0
  563. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  564. package/nitrogen/generated/ios/swift/Func_void_BandwidthData.swift +47 -0
  565. package/nitrogen/generated/ios/swift/Func_void_TimedMetadata.swift +47 -0
  566. package/nitrogen/generated/ios/swift/Func_void_VideoInformation.swift +47 -0
  567. package/nitrogen/generated/ios/swift/Func_void_VideoPlayerStatus.swift +47 -0
  568. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  569. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  570. package/nitrogen/generated/ios/swift/Func_void_onLoadData.swift +47 -0
  571. package/nitrogen/generated/ios/swift/Func_void_onLoadStartData.swift +47 -0
  572. package/nitrogen/generated/ios/swift/Func_void_onPlaybackStateChangeData.swift +47 -0
  573. package/nitrogen/generated/ios/swift/Func_void_onProgressData.swift +47 -0
  574. package/nitrogen/generated/ios/swift/Func_void_onVolumeChangeData.swift +47 -0
  575. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  576. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_Promise_std__string__.swift +67 -0
  577. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
  578. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
  579. package/nitrogen/generated/ios/swift/HybridVideoPlayerEventEmitterSpec.swift +74 -0
  580. package/nitrogen/generated/ios/swift/HybridVideoPlayerEventEmitterSpec_cxx.swift +442 -0
  581. package/nitrogen/generated/ios/swift/HybridVideoPlayerFactorySpec.swift +56 -0
  582. package/nitrogen/generated/ios/swift/HybridVideoPlayerFactorySpec_cxx.swift +145 -0
  583. package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceFactorySpec.swift +57 -0
  584. package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceFactorySpec_cxx.swift +149 -0
  585. package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceSpec.swift +57 -0
  586. package/nitrogen/generated/ios/swift/HybridVideoPlayerSourceSpec_cxx.swift +150 -0
  587. package/nitrogen/generated/ios/swift/HybridVideoPlayerSpec.swift +85 -0
  588. package/nitrogen/generated/ios/swift/HybridVideoPlayerSpec_cxx.swift +508 -0
  589. package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerFactorySpec.swift +56 -0
  590. package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerFactorySpec_cxx.swift +134 -0
  591. package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerSpec.swift +73 -0
  592. package/nitrogen/generated/ios/swift/HybridVideoViewViewManagerSpec_cxx.swift +383 -0
  593. package/nitrogen/generated/ios/swift/IgnoreSilentSwitchMode.swift +44 -0
  594. package/nitrogen/generated/ios/swift/ListenerSubscription.swift +47 -0
  595. package/nitrogen/generated/ios/swift/LivePlaybackParams.swift +140 -0
  596. package/nitrogen/generated/ios/swift/MixAudioMode.swift +48 -0
  597. package/nitrogen/generated/ios/swift/NativeDrmParams.swift +287 -0
  598. package/nitrogen/generated/ios/swift/NativeExternalSubtitle.swift +69 -0
  599. package/nitrogen/generated/ios/swift/NativeVideoConfig.swift +368 -0
  600. package/nitrogen/generated/ios/swift/OnGetLicensePayload.swift +69 -0
  601. package/nitrogen/generated/ios/swift/PlayerTrack.swift +88 -0
  602. package/nitrogen/generated/ios/swift/ResizeMode.swift +48 -0
  603. package/nitrogen/generated/ios/swift/Resolution.swift +47 -0
  604. package/nitrogen/generated/ios/swift/SourceType.swift +40 -0
  605. package/nitrogen/generated/ios/swift/SubtitleType.swift +52 -0
  606. package/nitrogen/generated/ios/swift/SurfaceType.swift +40 -0
  607. package/nitrogen/generated/ios/swift/TimedMetadata.swift +48 -0
  608. package/nitrogen/generated/ios/swift/TimedMetadataObject.swift +47 -0
  609. package/nitrogen/generated/ios/swift/TrackType.swift +44 -0
  610. package/nitrogen/generated/ios/swift/Variant_NullType__any_HybridVideoPlayerSourceSpec_.swift +18 -0
  611. package/nitrogen/generated/ios/swift/VideoInformation.swift +113 -0
  612. package/nitrogen/generated/ios/swift/VideoOrientation.swift +60 -0
  613. package/nitrogen/generated/ios/swift/VideoPlayerStatus.swift +48 -0
  614. package/nitrogen/generated/ios/swift/VideoPlayerTrack.swift +110 -0
  615. package/nitrogen/generated/ios/swift/onLoadData.swift +91 -0
  616. package/nitrogen/generated/ios/swift/onLoadStartData.swift +57 -0
  617. package/nitrogen/generated/ios/swift/onPlaybackStateChangeData.swift +47 -0
  618. package/nitrogen/generated/ios/swift/onProgressData.swift +58 -0
  619. package/nitrogen/generated/ios/swift/onVolumeChangeData.swift +47 -0
  620. package/nitrogen/generated/shared/c++/AllPlayerTracks.hpp +88 -0
  621. package/nitrogen/generated/shared/c++/BandwidthData.hpp +83 -0
  622. package/nitrogen/generated/shared/c++/BufferConfig.hpp +120 -0
  623. package/nitrogen/generated/shared/c++/CustomVideoMetadata.hpp +92 -0
  624. package/nitrogen/generated/shared/c++/ExternalAudio.hpp +85 -0
  625. package/nitrogen/generated/shared/c++/ExternalForcedType.hpp +76 -0
  626. package/nitrogen/generated/shared/c++/HybridVideoPlayerEventEmitterSpec.cpp +39 -0
  627. package/nitrogen/generated/shared/c++/HybridVideoPlayerEventEmitterSpec.hpp +108 -0
  628. package/nitrogen/generated/shared/c++/HybridVideoPlayerFactorySpec.cpp +21 -0
  629. package/nitrogen/generated/shared/c++/HybridVideoPlayerFactorySpec.hpp +68 -0
  630. package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceFactorySpec.cpp +22 -0
  631. package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceFactorySpec.hpp +69 -0
  632. package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceSpec.cpp +23 -0
  633. package/nitrogen/generated/shared/c++/HybridVideoPlayerSourceSpec.hpp +69 -0
  634. package/nitrogen/generated/shared/c++/HybridVideoPlayerSpec.cpp +63 -0
  635. package/nitrogen/generated/shared/c++/HybridVideoPlayerSpec.hpp +132 -0
  636. package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerFactorySpec.cpp +21 -0
  637. package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerFactorySpec.hpp +64 -0
  638. package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerSpec.cpp +46 -0
  639. package/nitrogen/generated/shared/c++/HybridVideoViewViewManagerSpec.hpp +99 -0
  640. package/nitrogen/generated/shared/c++/IgnoreSilentSwitchMode.hpp +80 -0
  641. package/nitrogen/generated/shared/c++/ListenerSubscription.hpp +75 -0
  642. package/nitrogen/generated/shared/c++/LivePlaybackParams.hpp +91 -0
  643. package/nitrogen/generated/shared/c++/MixAudioMode.hpp +84 -0
  644. package/nitrogen/generated/shared/c++/NativeDrmParams.hpp +105 -0
  645. package/nitrogen/generated/shared/c++/NativeExternalSubtitle.hpp +89 -0
  646. package/nitrogen/generated/shared/c++/NativeVideoConfig.hpp +139 -0
  647. package/nitrogen/generated/shared/c++/OnGetLicensePayload.hpp +87 -0
  648. package/nitrogen/generated/shared/c++/PlayerTrack.hpp +88 -0
  649. package/nitrogen/generated/shared/c++/ResizeMode.hpp +84 -0
  650. package/nitrogen/generated/shared/c++/Resolution.hpp +79 -0
  651. package/nitrogen/generated/shared/c++/SourceType.hpp +76 -0
  652. package/nitrogen/generated/shared/c++/SubtitleType.hpp +88 -0
  653. package/nitrogen/generated/shared/c++/SurfaceType.hpp +76 -0
  654. package/nitrogen/generated/shared/c++/TimedMetadata.hpp +77 -0
  655. package/nitrogen/generated/shared/c++/TimedMetadataObject.hpp +79 -0
  656. package/nitrogen/generated/shared/c++/TrackType.hpp +63 -0
  657. package/nitrogen/generated/shared/c++/VideoInformation.hpp +104 -0
  658. package/nitrogen/generated/shared/c++/VideoOrientation.hpp +96 -0
  659. package/nitrogen/generated/shared/c++/VideoPlayerStatus.hpp +84 -0
  660. package/nitrogen/generated/shared/c++/VideoPlayerTrack.hpp +96 -0
  661. package/nitrogen/generated/shared/c++/onLoadData.hpp +99 -0
  662. package/nitrogen/generated/shared/c++/onLoadStartData.hpp +84 -0
  663. package/nitrogen/generated/shared/c++/onPlaybackStateChangeData.hpp +79 -0
  664. package/nitrogen/generated/shared/c++/onProgressData.hpp +83 -0
  665. package/nitrogen/generated/shared/c++/onVolumeChangeData.hpp +79 -0
  666. package/package.json +155 -0
  667. package/react-native.config.js +19 -0
  668. package/src/core/VideoPlayer.ts +377 -0
  669. package/src/core/VideoPlayerEvents.ts +142 -0
  670. package/src/core/hooks/useEvent.ts +24 -0
  671. package/src/core/hooks/useManagedInstance.ts +96 -0
  672. package/src/core/hooks/useVideoPlayer.ts +73 -0
  673. package/src/core/types/BufferConfig.ts +103 -0
  674. package/src/core/types/DrmParams.ts +65 -0
  675. package/src/core/types/Events.ts +280 -0
  676. package/src/core/types/IgnoreSilentSwitchMode.ts +1 -0
  677. package/src/core/types/MixAudioMode.ts +1 -0
  678. package/src/core/types/PlayerTrack.ts +39 -0
  679. package/src/core/types/ResizeMode.ts +9 -0
  680. package/src/core/types/Utils.ts +1 -0
  681. package/src/core/types/VideoConfig.ts +166 -0
  682. package/src/core/types/VideoError.ts +174 -0
  683. package/src/core/types/VideoInformation.ts +44 -0
  684. package/src/core/types/VideoOrientation.ts +8 -0
  685. package/src/core/types/VideoPlayerBase.ts +224 -0
  686. package/src/core/types/VideoPlayerSourceBase.ts +19 -0
  687. package/src/core/types/VideoPlayerStatus.ts +8 -0
  688. package/src/core/utils/playerFactory.ts +35 -0
  689. package/src/core/utils/sourceFactory.ts +171 -0
  690. package/src/core/video-view/NativeVideoView.tsx +18 -0
  691. package/src/core/video-view/VideoView.tsx +406 -0
  692. package/src/expo-plugins/@types.ts +37 -0
  693. package/src/expo-plugins/getPackageInfo.ts +23 -0
  694. package/src/expo-plugins/withAndroidExtensions.ts +46 -0
  695. package/src/expo-plugins/withAndroidNotificationControls.ts +43 -0
  696. package/src/expo-plugins/withAndroidPictureInPicture.ts +31 -0
  697. package/src/expo-plugins/withBackgroundAudio.ts +26 -0
  698. package/src/expo-plugins/withReactNativeVideo.ts +32 -0
  699. package/src/expo-plugins/writeToPodfile.ts +74 -0
  700. package/src/index.tsx +34 -0
  701. package/src/spec/fabric/VideoViewNativeComponent.ts +17 -0
  702. package/src/spec/nitro/VideoPlayer.nitro.ts +38 -0
  703. package/src/spec/nitro/VideoPlayerEventEmitter.nitro.ts +196 -0
  704. package/src/spec/nitro/VideoPlayerSource.nitro.ts +18 -0
  705. package/src/spec/nitro/VideoViewViewManager.nitro.ts +92 -0
@@ -0,0 +1,151 @@
1
+ package com.twg.video.core.services.playback
2
+
3
+ import android.content.Context
4
+ import android.app.PendingIntent
5
+ import android.content.Intent
6
+ import android.util.Log
7
+ import androidx.annotation.OptIn
8
+ import androidx.media3.common.MediaMetadata
9
+ import androidx.media3.common.Player
10
+ import androidx.media3.common.util.UnstableApi
11
+ import androidx.media3.session.CommandButton
12
+ import androidx.media3.session.DefaultMediaNotificationProvider
13
+ import androidx.media3.session.MediaSession
14
+ import com.google.common.collect.ImmutableList
15
+ import androidx.core.os.bundleOf
16
+ import android.os.Bundle
17
+ import com.margelo.nitro.NitroModules
18
+ import com.twg.video.core.LibraryError
19
+
20
+ @OptIn(UnstableApi::class)
21
+ class CustomMediaNotificationProvider(context: Context) : DefaultMediaNotificationProvider(context) {
22
+
23
+ init {
24
+ setSmallIcon(androidx.media3.session.R.drawable.media3_notification_small_icon)
25
+ }
26
+
27
+ fun getContext(): Context {
28
+ return NitroModules.applicationContext ?: run {
29
+ throw LibraryError.ApplicationContextNotFound
30
+ }
31
+ }
32
+
33
+ override fun getNotificationContentTitle(metadata: MediaMetadata): CharSequence? {
34
+ return metadata.title
35
+ ?: metadata.displayTitle
36
+ ?: metadata.subtitle
37
+ ?: metadata.description
38
+ ?: "${getAppName()} is playing"
39
+ }
40
+
41
+ override fun getNotificationContentText(metadata: MediaMetadata): CharSequence? {
42
+ return metadata.artist
43
+ ?: metadata.subtitle
44
+ ?: metadata.description
45
+ }
46
+
47
+ companion object {
48
+ private const val SEEK_INTERVAL_MS = 10000L
49
+ private const val TAG = "CustomMediaNotificationProvider"
50
+
51
+ enum class COMMAND(val stringValue: String) {
52
+ NONE("NONE"),
53
+ SEEK_FORWARD("COMMAND_SEEK_FORWARD"),
54
+ SEEK_BACKWARD("COMMAND_SEEK_BACKWARD"),
55
+ TOGGLE_PLAY("COMMAND_TOGGLE_PLAY"),
56
+ PLAY("COMMAND_PLAY"),
57
+ PAUSE("COMMAND_PAUSE")
58
+ }
59
+
60
+ fun commandFromString(value: String): COMMAND =
61
+ when (value) {
62
+ COMMAND.SEEK_FORWARD.stringValue -> COMMAND.SEEK_FORWARD
63
+ COMMAND.SEEK_BACKWARD.stringValue -> COMMAND.SEEK_BACKWARD
64
+ COMMAND.TOGGLE_PLAY.stringValue -> COMMAND.TOGGLE_PLAY
65
+ COMMAND.PLAY.stringValue -> COMMAND.PLAY
66
+ COMMAND.PAUSE.stringValue -> COMMAND.PAUSE
67
+ else -> COMMAND.NONE
68
+ }
69
+
70
+ fun handleCommand(command: COMMAND, session: MediaSession) {
71
+ // TODO: get somehow ControlsConfig here - for now hardcoded 10000ms
72
+
73
+ when (command) {
74
+ COMMAND.SEEK_BACKWARD -> session.player.seekTo(session.player.contentPosition - SEEK_INTERVAL_MS)
75
+ COMMAND.SEEK_FORWARD -> session.player.seekTo(session.player.contentPosition + SEEK_INTERVAL_MS)
76
+ COMMAND.TOGGLE_PLAY -> handleCommand(if (session.player.isPlaying) COMMAND.PAUSE else COMMAND.PLAY, session)
77
+ COMMAND.PLAY -> session.player.play()
78
+ COMMAND.PAUSE -> session.player.pause()
79
+ else -> Log.w(TAG, "Received COMMAND.NONE - was there an error?")
80
+ }
81
+ }
82
+ }
83
+
84
+ private fun getAppName(): String {
85
+ return try {
86
+ val context = getContext()
87
+ val applicationInfo = context.applicationInfo
88
+ val labelRes = applicationInfo.labelRes
89
+ if (labelRes != 0) {
90
+ context.getString(labelRes)
91
+ } else {
92
+ applicationInfo.nonLocalizedLabel?.toString() ?: context.packageManager.getApplicationLabel(applicationInfo).toString()
93
+ }
94
+ } catch (e: Exception) {
95
+ return "Unknown"
96
+ }
97
+ }
98
+
99
+ override fun getMediaButtons(
100
+ session: MediaSession,
101
+ playerCommands: Player.Commands,
102
+ mediaButtonPreferences: ImmutableList<CommandButton>,
103
+ showPauseButton: Boolean
104
+ ): ImmutableList<CommandButton> {
105
+ val rewind = CommandButton.Builder()
106
+ .setDisplayName("Rewind")
107
+ .setSessionCommand(androidx.media3.session.SessionCommand(
108
+ COMMAND.SEEK_BACKWARD.stringValue,
109
+ Bundle.EMPTY
110
+ ))
111
+ .setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_back_10)
112
+ .setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 0))
113
+ .build()
114
+
115
+ val toggle = CommandButton.Builder()
116
+ .setDisplayName(if (showPauseButton) "Pause" else "Play")
117
+ .setSessionCommand(androidx.media3.session.SessionCommand(
118
+ COMMAND.TOGGLE_PLAY.stringValue,
119
+ Bundle.EMPTY
120
+ ))
121
+ .setIconResId(
122
+ if (showPauseButton) androidx.media3.session.R.drawable.media3_icon_pause
123
+ else androidx.media3.session.R.drawable.media3_icon_play
124
+ )
125
+ .setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 1))
126
+ .build()
127
+
128
+ val forward = CommandButton.Builder()
129
+ .setDisplayName("Forward")
130
+ .setSessionCommand(androidx.media3.session.SessionCommand(
131
+ COMMAND.SEEK_FORWARD.stringValue,
132
+ Bundle.EMPTY
133
+ ))
134
+ .setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_forward_10)
135
+ .setExtras(bundleOf(COMMAND_KEY_COMPACT_VIEW_INDEX to 2))
136
+ .build()
137
+
138
+ return ImmutableList.of(rewind, toggle, forward)
139
+ }
140
+
141
+ override fun addNotificationActions(
142
+ mediaSession: MediaSession,
143
+ mediaButtons: ImmutableList<CommandButton>,
144
+ builder: androidx.core.app.NotificationCompat.Builder,
145
+ actionFactory: androidx.media3.session.MediaNotification.ActionFactory
146
+ ): IntArray {
147
+ // Use default behavior to add actions from our custom buttons and return compact indices
148
+ val compact = super.addNotificationActions(mediaSession, mediaButtons, builder, actionFactory)
149
+ return if (compact.isEmpty()) intArrayOf(0, 1, 2) else compact
150
+ }
151
+ }
@@ -0,0 +1,96 @@
1
+ package com.twg.video.core.services.playback
2
+
3
+ import android.os.Bundle
4
+ import androidx.annotation.OptIn
5
+ import androidx.media3.common.Player
6
+ import androidx.media3.common.util.UnstableApi
7
+ import androidx.media3.session.CommandButton
8
+ import androidx.media3.session.MediaSession
9
+ import androidx.media3.session.SessionCommand
10
+ import androidx.media3.session.SessionResult
11
+ import com.google.common.util.concurrent.ListenableFuture
12
+ import com.google.common.collect.ImmutableList
13
+
14
+ @OptIn(UnstableApi::class)
15
+ class VideoPlaybackCallback : MediaSession.Callback {
16
+ // For Android 13+
17
+ private fun buildCustomButtons(): ImmutableList<CommandButton> {
18
+ val rewind = CommandButton.Builder()
19
+ .setDisplayName("Rewind")
20
+ .setSessionCommand(
21
+ SessionCommand(
22
+ CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
23
+ Bundle.EMPTY
24
+ )
25
+ )
26
+ .setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_back_10)
27
+ .build()
28
+
29
+ val forward = CommandButton.Builder()
30
+ .setDisplayName("Forward")
31
+ .setSessionCommand(
32
+ SessionCommand(
33
+ CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
34
+ Bundle.EMPTY
35
+ )
36
+ )
37
+ .setIconResId(androidx.media3.session.R.drawable.media3_icon_skip_forward_10)
38
+ .build()
39
+
40
+ return ImmutableList.of(rewind, forward)
41
+ }
42
+
43
+ override fun onConnect(session: MediaSession, controller: MediaSession.ControllerInfo): MediaSession.ConnectionResult {
44
+ try {
45
+ return MediaSession.ConnectionResult.AcceptedResultBuilder(session)
46
+ .setAvailablePlayerCommands(
47
+ MediaSession.ConnectionResult.DEFAULT_PLAYER_COMMANDS.buildUpon()
48
+ .add(Player.COMMAND_SEEK_FORWARD)
49
+ .add(Player.COMMAND_SEEK_BACK)
50
+ .build()
51
+ ).setAvailableSessionCommands(
52
+ MediaSession.ConnectionResult.DEFAULT_SESSION_COMMANDS.buildUpon()
53
+ .add(
54
+ SessionCommand(
55
+ CustomMediaNotificationProvider.Companion.COMMAND.SEEK_FORWARD.stringValue,
56
+ Bundle.EMPTY
57
+ )
58
+ )
59
+ .add(
60
+ SessionCommand(
61
+ CustomMediaNotificationProvider.Companion.COMMAND.SEEK_BACKWARD.stringValue,
62
+ Bundle.EMPTY
63
+ )
64
+ )
65
+ .add(
66
+ SessionCommand(
67
+ CustomMediaNotificationProvider.Companion.COMMAND.TOGGLE_PLAY.stringValue,
68
+ Bundle.EMPTY
69
+ )
70
+ ).build()
71
+ ).build()
72
+ } catch (e: Exception) {
73
+ return MediaSession.ConnectionResult.reject()
74
+ }
75
+ }
76
+
77
+ override fun onPostConnect(session: MediaSession, controller: MediaSession.ControllerInfo) {
78
+ session.setCustomLayout(buildCustomButtons())
79
+ super.onPostConnect(session, controller)
80
+ }
81
+
82
+ override fun onCustomCommand(
83
+ session: MediaSession,
84
+ controller: MediaSession.ControllerInfo,
85
+ customCommand: SessionCommand,
86
+ args: Bundle
87
+ ): ListenableFuture<SessionResult> {
88
+ CustomMediaNotificationProvider.Companion.handleCommand(
89
+ CustomMediaNotificationProvider.Companion.commandFromString(
90
+ customCommand.customAction
91
+ ), session
92
+ )
93
+
94
+ return super.onCustomCommand(session, controller, customCommand, args)
95
+ }
96
+ }
@@ -0,0 +1,219 @@
1
+ package com.twg.video.core.services.playback
2
+
3
+ import android.app.Activity
4
+ import android.app.PendingIntent
5
+ import android.content.Intent
6
+ import android.os.Binder
7
+ import android.os.IBinder
8
+ import android.util.Log
9
+ import androidx.annotation.OptIn
10
+ import androidx.media3.common.util.BitmapLoader
11
+ import androidx.media3.common.util.UnstableApi
12
+ import androidx.media3.session.DefaultMediaNotificationProvider
13
+ import androidx.media3.session.SimpleBitmapLoader
14
+ import androidx.media3.session.MediaSession
15
+ import androidx.media3.session.MediaSessionService
16
+ import android.app.Notification
17
+ import android.app.NotificationChannel
18
+ import android.app.NotificationManager
19
+ import android.os.Build
20
+ import androidx.core.app.NotificationCompat
21
+ import com.margelo.nitro.NitroModules
22
+ import com.margelo.nitro.video.HybridVideoPlayer
23
+ import java.util.concurrent.ExecutorService
24
+ import java.util.concurrent.Executors
25
+
26
+ class VideoPlaybackServiceBinder(val service: VideoPlaybackService): Binder()
27
+
28
+ @OptIn(UnstableApi::class)
29
+ class VideoPlaybackService : MediaSessionService() {
30
+ private var mediaSessionsList = mutableMapOf<HybridVideoPlayer, MediaSession>()
31
+ private var binder = VideoPlaybackServiceBinder(this)
32
+ private var sourceActivity: Class<Activity>? = null // retained for future deep-links; currently unused
33
+ private var isForeground = false
34
+ private var cachedLaunchIntent: Intent? = null
35
+
36
+ override fun onCreate() {
37
+ super.onCreate()
38
+ setMediaNotificationProvider(CustomMediaNotificationProvider(this))
39
+ }
40
+
41
+ override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
42
+ // Ensure we call startForeground quickly on newer Android versions to avoid
43
+ // ForegroundServiceDidNotStartInTimeException when startForegroundService(...) was used.
44
+ try {
45
+ if (!isForeground && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
46
+ startForeground(PLACEHOLDER_NOTIFICATION_ID, createPlaceholderNotification())
47
+ isForeground = true
48
+ }
49
+ } catch (_: Exception) {
50
+ Log.e(TAG, "Failed to start foreground service!")
51
+ }
52
+
53
+ return super.onStartCommand(intent, flags, startId)
54
+ }
55
+
56
+ // Player Registry
57
+ fun registerPlayer(player: HybridVideoPlayer, from: Class<Activity>) {
58
+ if (mediaSessionsList.containsKey(player)) {
59
+ return
60
+ }
61
+ sourceActivity = from
62
+
63
+ val builder = MediaSession.Builder(this, player.player)
64
+ .setId("RNVideoPlaybackService_" + player.hashCode())
65
+ .setCallback(VideoPlaybackCallback())
66
+
67
+ // Ensure tapping the notification opens the app via sessionActivity
68
+ try {
69
+ var launchIntent = cachedLaunchIntent
70
+ if (launchIntent == null) {
71
+ launchIntent = packageManager.getLaunchIntentForPackage(packageName)
72
+ cachedLaunchIntent = launchIntent
73
+ }
74
+
75
+ if (launchIntent != null) {
76
+ // Clone the intent before modifying it to avoid mutating the cached instance
77
+ val intentToUse = launchIntent.clone() as Intent
78
+ intentToUse.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP)
79
+ val contentIntent = PendingIntent.getActivity(
80
+ this,
81
+ 0,
82
+ intentToUse,
83
+ PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
84
+ )
85
+ builder.setSessionActivity(contentIntent)
86
+ }
87
+ } catch (_: Exception) {}
88
+
89
+
90
+ val mediaSession = builder.build()
91
+
92
+ mediaSessionsList[player] = mediaSession
93
+ addSession(mediaSession)
94
+ }
95
+
96
+ fun unregisterPlayer(player: HybridVideoPlayer) {
97
+ val session = mediaSessionsList.remove(player)
98
+ session?.release()
99
+ stopIfNoPlayers()
100
+ }
101
+
102
+ fun updatePlayerPreferences(player: HybridVideoPlayer) {
103
+ val session = mediaSessionsList[player]
104
+ if (session == null) {
105
+ // If not registered but now needs it, register
106
+ if (player.playInBackground || player.showNotificationControls) {
107
+ val activity = try { NitroModules.applicationContext?.currentActivity } catch (_: Exception) { null }
108
+ if (activity != null) registerPlayer(player, activity.javaClass)
109
+ }
110
+ return
111
+ }
112
+
113
+ // If no longer needs registration, unregister and possibly stop service
114
+ if (!player.playInBackground && !player.showNotificationControls) {
115
+ unregisterPlayer(player)
116
+ stopIfNoPlayers()
117
+ return
118
+ }
119
+ }
120
+
121
+ // Callbacks
122
+
123
+ override fun onGetSession(controllerInfo: MediaSession.ControllerInfo): MediaSession? = null
124
+
125
+ override fun onBind(intent: Intent?): IBinder {
126
+ super.onBind(intent)
127
+ return binder
128
+ }
129
+
130
+ override fun onTaskRemoved(rootIntent: Intent?) {
131
+ stopForegroundSafely()
132
+ cleanup()
133
+ stopSelf()
134
+ }
135
+
136
+ override fun onDestroy() {
137
+ stopForegroundSafely()
138
+ cleanup()
139
+ super.onDestroy()
140
+ }
141
+
142
+ private fun stopForegroundSafely() {
143
+ try {
144
+ stopForeground(STOP_FOREGROUND_REMOVE)
145
+ } catch (_: Exception) {
146
+ Log.e(TAG, "Failed to stop foreground service!")
147
+ }
148
+ }
149
+
150
+ private fun cleanup() {
151
+ stopForegroundSafely()
152
+ stopSelf()
153
+ mediaSessionsList.forEach { (_, session) ->
154
+ session.release()
155
+ }
156
+ mediaSessionsList.clear()
157
+ }
158
+
159
+ // Stop the service if there are no active media sessions (no players need it)
160
+ fun stopIfNoPlayers() {
161
+ if (mediaSessionsList.isEmpty()) {
162
+ // Remove placeholder notification and stop the service when no active players exist
163
+ try {
164
+ if (isForeground) {
165
+ stopForegroundSafely()
166
+ isForeground = false
167
+ }
168
+ } catch (_: Exception) {
169
+ Log.e(TAG, "Failed to stop foreground service!")
170
+ }
171
+ cleanup()
172
+ }
173
+ }
174
+
175
+ companion object {
176
+ const val TAG = "VideoPlaybackService"
177
+ const val VIDEO_PLAYBACK_SERVICE_INTERFACE = SERVICE_INTERFACE
178
+ private const val PLACEHOLDER_NOTIFICATION_ID = 1729
179
+ private const val NOTIFICATION_CHANNEL_ID = "twg_video_playback"
180
+ }
181
+
182
+ private fun createPlaceholderNotification(): Notification {
183
+ val nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
184
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
185
+ try {
186
+ if (nm.getNotificationChannel(NOTIFICATION_CHANNEL_ID) == null) {
187
+ val channel = NotificationChannel(
188
+ NOTIFICATION_CHANNEL_ID,
189
+ "Media playback",
190
+ NotificationManager.IMPORTANCE_LOW
191
+ )
192
+ channel.setShowBadge(false)
193
+ nm.createNotificationChannel(channel)
194
+ }
195
+ } catch (_: Exception) {
196
+ Log.e(TAG, "Failed to create notification channel!")
197
+ }
198
+ }
199
+
200
+ val appName = try {
201
+ val labelRes = applicationInfo.labelRes
202
+ if (labelRes != 0) {
203
+ getString(labelRes)
204
+ } else {
205
+ applicationInfo.nonLocalizedLabel?.toString() ?: applicationInfo.loadLabel(packageManager).toString()
206
+ }
207
+ } catch (_: Exception) {
208
+ "Media Playback"
209
+ }
210
+
211
+ return NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
212
+ .setSmallIcon(android.R.drawable.ic_media_play)
213
+ .setContentTitle(appName)
214
+ .setContentText("")
215
+ .setOngoing(true)
216
+ .setCategory(Notification.CATEGORY_SERVICE)
217
+ .build()
218
+ }
219
+ }
@@ -0,0 +1,59 @@
1
+ package com.twg.video.core.services.playback
2
+
3
+ import android.content.ComponentName
4
+ import android.content.ServiceConnection
5
+ import android.os.IBinder
6
+ import android.util.Log
7
+ import androidx.annotation.OptIn
8
+ import androidx.media3.common.util.UnstableApi
9
+ import com.margelo.nitro.NitroModules
10
+ import com.margelo.nitro.video.HybridVideoPlayer
11
+ import java.lang.ref.WeakReference
12
+
13
+ @OptIn(UnstableApi::class)
14
+ class VideoPlaybackServiceConnection (private val player: WeakReference<HybridVideoPlayer>) :
15
+ ServiceConnection {
16
+ var serviceBinder: VideoPlaybackServiceBinder? = null
17
+
18
+ override fun onServiceConnected(componentName: ComponentName?, binder: IBinder?) {
19
+ val player = player.get() ?: return
20
+
21
+ try {
22
+ val activity = NitroModules.Companion.applicationContext?.currentActivity ?: run {
23
+ Log.e("VideoPlaybackServiceConnection", "Activity is null")
24
+ return
25
+ }
26
+
27
+ serviceBinder = binder as? VideoPlaybackServiceBinder
28
+ // Only register when the player actually needs background service/notification
29
+ if (player.playInBackground || player.showNotificationControls) {
30
+ serviceBinder?.service?.registerPlayer(player, activity.javaClass)
31
+ }
32
+ } catch (err: Exception) {
33
+ Log.e("VideoPlaybackServiceConnection", "Could not bind to playback service", err)
34
+ }
35
+ }
36
+
37
+ override fun onServiceDisconnected(componentName: ComponentName?) {
38
+ player.get()?.let {
39
+ unregisterPlayer(it)
40
+ }
41
+ serviceBinder = null
42
+ }
43
+
44
+ override fun onNullBinding(componentName: ComponentName?) {
45
+ Log.e(
46
+ "VideoPlaybackServiceConnection",
47
+ "Could not bind to playback service - there can be issues with background playback" +
48
+ "and notification controls"
49
+ )
50
+ }
51
+
52
+ fun unregisterPlayer(player: HybridVideoPlayer) {
53
+ try {
54
+ if (serviceBinder?.service != null) {
55
+ serviceBinder?.service?.unregisterPlayer(player)
56
+ }
57
+ } catch (_: Exception) {}
58
+ }
59
+ }
@@ -0,0 +1,153 @@
1
+ package com.twg.video.core.utils
2
+
3
+ import android.app.PictureInPictureParams
4
+ import android.content.pm.PackageManager
5
+ import android.graphics.Rect
6
+ import android.os.Build
7
+ import android.util.Log
8
+ import android.util.Rational
9
+ import android.view.View
10
+ import androidx.annotation.OptIn
11
+ import androidx.annotation.RequiresApi
12
+ import androidx.media3.common.util.UnstableApi
13
+ import com.margelo.nitro.NitroModules
14
+ import com.twg.video.view.VideoView
15
+
16
+ @OptIn(UnstableApi::class)
17
+ object PictureInPictureUtils {
18
+ private const val TAG = "PictureInPictureUtils"
19
+
20
+ fun canEnterPictureInPicture(): Boolean {
21
+ val applicationContent = NitroModules.applicationContext
22
+ val currentActivity = applicationContent?.currentActivity
23
+ return currentActivity?.packageManager?.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) == true
24
+ }
25
+
26
+ @RequiresApi(Build.VERSION_CODES.O)
27
+ fun createPictureInPictureParams(videoView: VideoView): PictureInPictureParams {
28
+ val builder = PictureInPictureParams.Builder()
29
+
30
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && videoView.autoEnterPictureInPicture) {
31
+ builder.setAutoEnterEnabled(videoView.autoEnterPictureInPicture)
32
+ }
33
+
34
+ return builder
35
+ .setAspectRatio(calculateAspectRatio(videoView))
36
+ .setSourceRectHint(calculateSourceRectHint(videoView.playerView))
37
+ .build()
38
+ }
39
+
40
+ @RequiresApi(Build.VERSION_CODES.O)
41
+ fun createDisabledPictureInPictureParams(videoView: VideoView): PictureInPictureParams {
42
+ val defaultParams = PictureInPictureParams.Builder()
43
+ .setAspectRatio(null) // Clear aspect ratio
44
+ .setSourceRectHint(null) // Clear source rect hint
45
+
46
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
47
+ defaultParams.setAutoEnterEnabled(false)
48
+ }
49
+
50
+ return defaultParams.build()
51
+ }
52
+
53
+ fun calculateAspectRatio(videoView: VideoView): Rational {
54
+ // AspectRatio for PIP must be between 2.39:1 and 1:2.39
55
+ // see: https://developer.android.com/reference/android/app/PictureInPictureParams.Builder#setAspectRatio(android.util.Rational)
56
+
57
+ val maximumAspectRatio = Rational(239, 100)
58
+ val minimumAspectRatio = Rational(100, 239)
59
+
60
+ val player = videoView.hybridPlayer?.player
61
+ val videoFormat = player?.videoFormat
62
+
63
+ var width: Int
64
+ var height: Int
65
+
66
+ if (videoFormat != null && videoFormat.width > 0 && videoFormat.height > 0) {
67
+ width = videoFormat.width
68
+ height = videoFormat.height
69
+
70
+ val rotationDegrees = videoFormat.rotationDegrees
71
+ if (rotationDegrees == 90 || rotationDegrees == 270) {
72
+ val temp = width
73
+ width = height
74
+ height = temp
75
+ }
76
+
77
+ Log.d(TAG, "Using video format dimensions for PiP: ${width}x${height} (rotation: ${rotationDegrees}°)")
78
+ } else {
79
+ width = videoView.playerView.width
80
+ height = videoView.playerView.height
81
+ Log.d(TAG, "Using view dimensions for PiP: ${width}x${height}")
82
+ }
83
+
84
+ val currentAspectRatio = Rational(width, height)
85
+
86
+ return when {
87
+ currentAspectRatio > maximumAspectRatio -> maximumAspectRatio
88
+ currentAspectRatio < minimumAspectRatio -> minimumAspectRatio
89
+ else -> currentAspectRatio
90
+ }
91
+ }
92
+
93
+ fun calculateSourceRectHint(view: View): Rect {
94
+ // Get the visible rectangle of view in screen coordinates
95
+ val visibleRect = Rect()
96
+ view.getGlobalVisibleRect(visibleRect)
97
+
98
+ // Get the Y position of view on the screen
99
+ val locationOnScreen = IntArray(2)
100
+ view.getLocationOnScreen(locationOnScreen)
101
+ val yOnScreen = locationOnScreen[1]
102
+
103
+ // Preserve the original height
104
+ val height = visibleRect.height()
105
+
106
+ // Set the new top and bottom based on the view's screen position
107
+ visibleRect.top = yOnScreen
108
+ visibleRect.bottom = yOnScreen + height
109
+
110
+ return visibleRect
111
+ }
112
+
113
+ fun safeSetPictureInPictureParams(params: PictureInPictureParams) {
114
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
115
+ try {
116
+ val currentActivity = NitroModules.applicationContext?.currentActivity
117
+ currentActivity?.setPictureInPictureParams(params)
118
+ Log.d(TAG, "Successfully set PiP params")
119
+ } catch (e: Exception) {
120
+ Log.w(TAG, "Failed to set PiP params - PiP may not be enabled in manifest", e)
121
+ // Ignore: We cannot check if user has added support for PIP in manifest
122
+ // so we need to catch error if he did not add it.
123
+ }
124
+ }
125
+ }
126
+
127
+ @RequiresApi(Build.VERSION_CODES.O)
128
+ fun safeEnterPictureInPictureMode(params: PictureInPictureParams): Boolean {
129
+ return try {
130
+ val currentActivity = NitroModules.applicationContext?.currentActivity
131
+ val result = currentActivity?.enterPictureInPictureMode(params) ?: false
132
+ Log.d(TAG, "PiP enter result: $result")
133
+ result
134
+ } catch (e: Exception) {
135
+ Log.e(TAG, "Failed to enter PiP mode", e)
136
+ false
137
+ }
138
+ }
139
+
140
+ fun isCurrentlyInPictureInPictureMode(): Boolean {
141
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
142
+ try {
143
+ val currentActivity = NitroModules.applicationContext?.currentActivity
144
+ currentActivity?.isInPictureInPictureMode == true
145
+ } catch (e: Exception) {
146
+ Log.w(TAG, "Failed to check PiP mode status", e)
147
+ false
148
+ }
149
+ } else {
150
+ false
151
+ }
152
+ }
153
+ }