bitmovin-player-react-native 0.44.1-alpha.0 → 1.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (497) hide show
  1. package/.eslintignore +11 -0
  2. package/.eslintrc.js +7 -0
  3. package/.gitattributes +3 -0
  4. package/.prettierignore +11 -0
  5. package/.ruby-version +1 -0
  6. package/.swiftlint.yml +171 -0
  7. package/Brewfile +2 -0
  8. package/CHANGELOG.md +627 -0
  9. package/CONTRIBUTING.md +255 -0
  10. package/TODO.md +0 -0
  11. package/android/.editorconfig +8 -0
  12. package/android/build.gradle +78 -75
  13. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  14. package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  15. package/android/gradle.properties +1 -0
  16. package/android/gradlew +248 -0
  17. package/android/gradlew.bat +92 -0
  18. package/android/ktlint.gradle +31 -0
  19. package/android/src/main/java/com/bitmovin/player/reactnative/ActivityLifecycleListener.kt +51 -0
  20. package/android/src/main/java/com/bitmovin/player/reactnative/BitmovinCastManagerModule.kt +32 -55
  21. package/android/src/main/java/com/bitmovin/player/reactnative/BufferModule.kt +33 -45
  22. package/android/src/main/java/com/bitmovin/player/reactnative/CustomMessageHandlerModule.kt +84 -0
  23. package/android/src/main/java/com/bitmovin/player/reactnative/DebugModule.kt +6 -14
  24. package/android/src/main/java/com/bitmovin/player/reactnative/DecoderConfigModule.kt +89 -44
  25. package/android/src/main/java/com/bitmovin/player/reactnative/DrmModule.kt +80 -99
  26. package/android/src/main/java/com/bitmovin/player/reactnative/EventSubscription.kt +22 -0
  27. package/android/src/main/java/com/bitmovin/player/reactnative/FullscreenHandlerModule.kt +100 -0
  28. package/android/src/main/java/com/bitmovin/player/reactnative/MediaSessionPlaybackManager.kt +5 -5
  29. package/android/src/main/java/com/bitmovin/player/reactnative/NetworkModule.kt +98 -56
  30. package/android/src/main/java/com/bitmovin/player/reactnative/OfflineModule.kt +132 -186
  31. package/android/src/main/java/com/bitmovin/player/reactnative/PlayerAnalyticsModule.kt +37 -36
  32. package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +252 -528
  33. package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerPackage.kt +11 -0
  34. package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt +558 -213
  35. package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewManager.kt +99 -286
  36. package/android/src/main/java/com/bitmovin/player/reactnative/ResultWaiter.kt +58 -0
  37. package/android/src/main/java/com/bitmovin/player/reactnative/SourceModule.kt +77 -151
  38. package/android/src/main/java/com/bitmovin/player/reactnative/Types.kt +44 -0
  39. package/android/src/main/java/com/bitmovin/player/reactnative/UuidModule.kt +12 -15
  40. package/android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt +296 -456
  41. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ListExtension.kt +89 -0
  42. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/MapExtension.kt +95 -0
  43. package/android/src/main/java/com/bitmovin/player/reactnative/offline/OfflineContentManagerBridge.kt +20 -52
  44. package/android/src/main/java/com/bitmovin/player/reactnative/ui/CustomMessageHandlerBridge.kt +10 -20
  45. package/android/src/main/java/com/bitmovin/player/reactnative/ui/FullscreenHandlerBridge.kt +4 -9
  46. package/app.plugin.js +21 -0
  47. package/build/BitmovinPlayerReactNative.types.d.ts +18 -0
  48. package/build/BitmovinPlayerReactNative.types.d.ts.map +1 -0
  49. package/build/BitmovinPlayerReactNative.types.js +2 -0
  50. package/build/BitmovinPlayerReactNative.types.js.map +1 -0
  51. package/build/adaptationConfig.d.ts +18 -0
  52. package/build/adaptationConfig.d.ts.map +1 -0
  53. package/build/adaptationConfig.js +2 -0
  54. package/build/adaptationConfig.js.map +1 -0
  55. package/build/advertising.d.ts +175 -0
  56. package/build/advertising.d.ts.map +1 -0
  57. package/build/advertising.js +37 -0
  58. package/build/advertising.js.map +1 -0
  59. package/build/analytics/config.d.ts +194 -0
  60. package/build/analytics/config.d.ts.map +1 -0
  61. package/build/analytics/config.js +2 -0
  62. package/build/analytics/config.js.map +1 -0
  63. package/build/analytics/index.d.ts +3 -0
  64. package/build/analytics/index.d.ts.map +1 -0
  65. package/build/analytics/index.js +3 -0
  66. package/build/analytics/index.js.map +1 -0
  67. package/build/analytics/player.d.ts +24 -0
  68. package/build/analytics/player.d.ts.map +1 -0
  69. package/build/analytics/player.js +30 -0
  70. package/build/analytics/player.js.map +1 -0
  71. package/build/analytics/playerAnalyticsModule.d.ts +13 -0
  72. package/build/analytics/playerAnalyticsModule.d.ts.map +1 -0
  73. package/build/analytics/playerAnalyticsModule.js +3 -0
  74. package/build/analytics/playerAnalyticsModule.js.map +1 -0
  75. package/build/audioSession.d.ts +33 -0
  76. package/build/audioSession.d.ts.map +1 -0
  77. package/build/audioSession.js +21 -0
  78. package/build/audioSession.js.map +1 -0
  79. package/build/audioTrack.d.ts +39 -0
  80. package/build/audioTrack.d.ts.map +1 -0
  81. package/build/audioTrack.js +2 -0
  82. package/build/audioTrack.js.map +1 -0
  83. package/build/bitmovinCastManager.d.ts +58 -0
  84. package/build/bitmovinCastManager.d.ts.map +1 -0
  85. package/build/bitmovinCastManager.js +64 -0
  86. package/build/bitmovinCastManager.js.map +1 -0
  87. package/build/bufferApi.d.ts +85 -0
  88. package/build/bufferApi.d.ts.map +1 -0
  89. package/build/bufferApi.js +60 -0
  90. package/build/bufferApi.js.map +1 -0
  91. package/build/bufferConfig.d.ts +42 -0
  92. package/build/bufferConfig.d.ts.map +1 -0
  93. package/build/bufferConfig.js +2 -0
  94. package/build/bufferConfig.js.map +1 -0
  95. package/build/components/PlayerView/events.d.ts +310 -0
  96. package/build/components/PlayerView/events.d.ts.map +1 -0
  97. package/build/components/PlayerView/events.js +2 -0
  98. package/build/components/PlayerView/events.js.map +1 -0
  99. package/build/components/PlayerView/index.d.ts +10 -0
  100. package/build/components/PlayerView/index.d.ts.map +1 -0
  101. package/build/components/PlayerView/index.js +72 -0
  102. package/build/components/PlayerView/index.js.map +1 -0
  103. package/build/components/PlayerView/native.d.ts +30 -0
  104. package/build/components/PlayerView/native.d.ts.map +1 -0
  105. package/build/components/PlayerView/native.js +6 -0
  106. package/build/components/PlayerView/native.js.map +1 -0
  107. package/build/components/PlayerView/nativeEvents.d.ts +437 -0
  108. package/build/components/PlayerView/nativeEvents.d.ts.map +1 -0
  109. package/build/components/PlayerView/nativeEvents.js +2 -0
  110. package/build/components/PlayerView/nativeEvents.js.map +1 -0
  111. package/build/components/PlayerView/pictureInPictureConfig.d.ts +22 -0
  112. package/build/components/PlayerView/pictureInPictureConfig.d.ts.map +1 -0
  113. package/build/components/PlayerView/pictureInPictureConfig.js +2 -0
  114. package/build/components/PlayerView/pictureInPictureConfig.js.map +1 -0
  115. package/build/components/PlayerView/playerViewConfig.d.ts +111 -0
  116. package/build/components/PlayerView/playerViewConfig.d.ts.map +1 -0
  117. package/build/components/PlayerView/playerViewConfig.js +51 -0
  118. package/build/components/PlayerView/playerViewConfig.js.map +1 -0
  119. package/build/components/PlayerView/properties.d.ts +61 -0
  120. package/build/components/PlayerView/properties.d.ts.map +1 -0
  121. package/build/components/PlayerView/properties.js +2 -0
  122. package/build/components/PlayerView/properties.js.map +1 -0
  123. package/build/components/index.d.ts +5 -0
  124. package/build/components/index.d.ts.map +1 -0
  125. package/build/components/index.js +5 -0
  126. package/build/components/index.js.map +1 -0
  127. package/build/debug.d.ts +46 -0
  128. package/build/debug.d.ts.map +1 -0
  129. package/build/debug.js +52 -0
  130. package/build/debug.js.map +1 -0
  131. package/build/decoder/decoderConfig.d.ts +96 -0
  132. package/build/decoder/decoderConfig.d.ts.map +1 -0
  133. package/build/decoder/decoderConfig.js +6 -0
  134. package/build/decoder/decoderConfig.js.map +1 -0
  135. package/build/decoder/decoderConfigModule.d.ts +14 -0
  136. package/build/decoder/decoderConfigModule.d.ts.map +1 -0
  137. package/build/decoder/decoderConfigModule.js +31 -0
  138. package/build/decoder/decoderConfigModule.js.map +1 -0
  139. package/build/decoder/index.d.ts +26 -0
  140. package/build/decoder/index.d.ts.map +1 -0
  141. package/build/decoder/index.js +50 -0
  142. package/build/decoder/index.js.map +1 -0
  143. package/build/drm/drmModule.d.ts +55 -0
  144. package/build/drm/drmModule.d.ts.map +1 -0
  145. package/build/drm/drmModule.js +3 -0
  146. package/build/drm/drmModule.js.map +1 -0
  147. package/build/drm/fairplayConfig.d.ts +91 -0
  148. package/build/drm/fairplayConfig.d.ts.map +1 -0
  149. package/build/drm/fairplayConfig.js +2 -0
  150. package/build/drm/fairplayConfig.js.map +1 -0
  151. package/build/drm/index.d.ts +112 -0
  152. package/build/drm/index.d.ts.map +1 -0
  153. package/build/drm/index.js +191 -0
  154. package/build/drm/index.js.map +1 -0
  155. package/build/drm/widevineConfig.d.ts +58 -0
  156. package/build/drm/widevineConfig.d.ts.map +1 -0
  157. package/build/drm/widevineConfig.js +2 -0
  158. package/build/drm/widevineConfig.js.map +1 -0
  159. package/build/events.d.ts +692 -0
  160. package/build/events.d.ts.map +1 -0
  161. package/build/events.js +2 -0
  162. package/build/events.js.map +1 -0
  163. package/build/hooks/index.d.ts +2 -0
  164. package/build/hooks/index.d.ts.map +1 -0
  165. package/build/hooks/index.js +2 -0
  166. package/build/hooks/index.js.map +1 -0
  167. package/build/hooks/usePlayer.d.ts +8 -0
  168. package/build/hooks/usePlayer.d.ts.map +1 -0
  169. package/build/hooks/usePlayer.js +10 -0
  170. package/build/hooks/usePlayer.js.map +1 -0
  171. package/build/hooks/useProxy.d.ts +18 -0
  172. package/build/hooks/useProxy.d.ts.map +1 -0
  173. package/build/hooks/useProxy.js +16 -0
  174. package/build/hooks/useProxy.js.map +1 -0
  175. package/build/index.d.ts +32 -0
  176. package/build/index.d.ts.map +1 -0
  177. package/build/index.js +32 -0
  178. package/build/index.js.map +1 -0
  179. package/build/liveConfig.d.ts +13 -0
  180. package/build/liveConfig.d.ts.map +1 -0
  181. package/build/liveConfig.js +2 -0
  182. package/build/liveConfig.js.map +1 -0
  183. package/build/media.d.ts +85 -0
  184. package/build/media.d.ts.map +1 -0
  185. package/build/media.js +2 -0
  186. package/build/media.js.map +1 -0
  187. package/build/mediaControlConfig.d.ts +62 -0
  188. package/build/mediaControlConfig.d.ts.map +1 -0
  189. package/build/mediaControlConfig.js +2 -0
  190. package/build/mediaControlConfig.js.map +1 -0
  191. package/build/mediaTrackRole.d.ts +28 -0
  192. package/build/mediaTrackRole.d.ts.map +1 -0
  193. package/build/mediaTrackRole.js +2 -0
  194. package/build/mediaTrackRole.js.map +1 -0
  195. package/build/modules/AudioSessionModule.d.ts +8 -0
  196. package/build/modules/AudioSessionModule.d.ts.map +1 -0
  197. package/build/modules/AudioSessionModule.js +7 -0
  198. package/build/modules/AudioSessionModule.js.map +1 -0
  199. package/build/modules/BitmovinCastManagerModule.d.ts +11 -0
  200. package/build/modules/BitmovinCastManagerModule.d.ts.map +1 -0
  201. package/build/modules/BitmovinCastManagerModule.js +3 -0
  202. package/build/modules/BitmovinCastManagerModule.js.map +1 -0
  203. package/build/modules/BufferModule.d.ts +16 -0
  204. package/build/modules/BufferModule.d.ts.map +1 -0
  205. package/build/modules/BufferModule.js +3 -0
  206. package/build/modules/BufferModule.js.map +1 -0
  207. package/build/modules/DebugModule.d.ts +8 -0
  208. package/build/modules/DebugModule.d.ts.map +1 -0
  209. package/build/modules/DebugModule.js +3 -0
  210. package/build/modules/DebugModule.js.map +1 -0
  211. package/build/modules/PlayerModule.d.ts +188 -0
  212. package/build/modules/PlayerModule.d.ts.map +1 -0
  213. package/build/modules/PlayerModule.js +3 -0
  214. package/build/modules/PlayerModule.js.map +1 -0
  215. package/build/modules/SourceModule.d.ts +51 -0
  216. package/build/modules/SourceModule.d.ts.map +1 -0
  217. package/build/modules/SourceModule.js +3 -0
  218. package/build/modules/SourceModule.js.map +1 -0
  219. package/build/modules/UuidModule.d.ts +8 -0
  220. package/build/modules/UuidModule.d.ts.map +1 -0
  221. package/build/modules/UuidModule.js +3 -0
  222. package/build/modules/UuidModule.js.map +1 -0
  223. package/build/nativeInstance.d.ts +49 -0
  224. package/build/nativeInstance.d.ts.map +1 -0
  225. package/build/nativeInstance.js +20 -0
  226. package/build/nativeInstance.js.map +1 -0
  227. package/build/network/index.d.ts +50 -0
  228. package/build/network/index.d.ts.map +1 -0
  229. package/build/network/index.js +102 -0
  230. package/build/network/index.js.map +1 -0
  231. package/build/network/networkConfig.d.ts +151 -0
  232. package/build/network/networkConfig.d.ts.map +1 -0
  233. package/build/network/networkConfig.js +21 -0
  234. package/build/network/networkConfig.js.map +1 -0
  235. package/build/network/networkModule.d.ts +29 -0
  236. package/build/network/networkModule.d.ts.map +1 -0
  237. package/build/network/networkModule.js +3 -0
  238. package/build/network/networkModule.js.map +1 -0
  239. package/build/offline/index.d.ts +8 -0
  240. package/build/offline/index.d.ts.map +1 -0
  241. package/build/offline/index.js +8 -0
  242. package/build/offline/index.js.map +1 -0
  243. package/build/offline/offlineContentConfig.d.ts +18 -0
  244. package/build/offline/offlineContentConfig.d.ts.map +1 -0
  245. package/build/offline/offlineContentConfig.js +2 -0
  246. package/build/offline/offlineContentConfig.js.map +1 -0
  247. package/build/offline/offlineContentManager.d.ts +90 -0
  248. package/build/offline/offlineContentManager.d.ts.map +1 -0
  249. package/build/offline/offlineContentManager.js +177 -0
  250. package/build/offline/offlineContentManager.js.map +1 -0
  251. package/build/offline/offlineContentManagerListener.d.ts +174 -0
  252. package/build/offline/offlineContentManagerListener.d.ts.map +1 -0
  253. package/build/offline/offlineContentManagerListener.js +17 -0
  254. package/build/offline/offlineContentManagerListener.js.map +1 -0
  255. package/build/offline/offlineContentOptions.d.ts +29 -0
  256. package/build/offline/offlineContentOptions.d.ts.map +1 -0
  257. package/build/offline/offlineContentOptions.js +2 -0
  258. package/build/offline/offlineContentOptions.js.map +1 -0
  259. package/build/offline/offlineDownloadRequest.d.ts +19 -0
  260. package/build/offline/offlineDownloadRequest.d.ts.map +1 -0
  261. package/build/offline/offlineDownloadRequest.js +2 -0
  262. package/build/offline/offlineDownloadRequest.js.map +1 -0
  263. package/build/offline/offlineModule.d.ts +32 -0
  264. package/build/offline/offlineModule.d.ts.map +1 -0
  265. package/build/offline/offlineModule.js +3 -0
  266. package/build/offline/offlineModule.js.map +1 -0
  267. package/build/offline/offlineSourceOptions.d.ts +12 -0
  268. package/build/offline/offlineSourceOptions.d.ts.map +1 -0
  269. package/build/offline/offlineSourceOptions.js +2 -0
  270. package/build/offline/offlineSourceOptions.js.map +1 -0
  271. package/build/offline/offlineState.d.ts +23 -0
  272. package/build/offline/offlineState.d.ts.map +1 -0
  273. package/build/offline/offlineState.js +24 -0
  274. package/build/offline/offlineState.js.map +1 -0
  275. package/build/playbackConfig.d.ts +88 -0
  276. package/build/playbackConfig.d.ts.map +1 -0
  277. package/build/playbackConfig.js +2 -0
  278. package/build/playbackConfig.js.map +1 -0
  279. package/build/player.d.ts +308 -0
  280. package/build/player.d.ts.map +1 -0
  281. package/build/player.js +445 -0
  282. package/build/player.js.map +1 -0
  283. package/build/playerConfig.d.ts +83 -0
  284. package/build/playerConfig.d.ts.map +1 -0
  285. package/build/playerConfig.js +2 -0
  286. package/build/playerConfig.js.map +1 -0
  287. package/build/remoteControlConfig.d.ts +38 -0
  288. package/build/remoteControlConfig.d.ts.map +1 -0
  289. package/build/remoteControlConfig.js +2 -0
  290. package/build/remoteControlConfig.js.map +1 -0
  291. package/build/source.d.ts +216 -0
  292. package/build/source.d.ts.map +1 -0
  293. package/build/source.js +167 -0
  294. package/build/source.js.map +1 -0
  295. package/build/styleConfig.d.ts +120 -0
  296. package/build/styleConfig.d.ts.map +1 -0
  297. package/build/styleConfig.js +38 -0
  298. package/build/styleConfig.js.map +1 -0
  299. package/build/subtitleFormat.d.ts +27 -0
  300. package/build/subtitleFormat.d.ts.map +1 -0
  301. package/build/subtitleFormat.js +28 -0
  302. package/build/subtitleFormat.js.map +1 -0
  303. package/build/subtitleTrack.d.ts +55 -0
  304. package/build/subtitleTrack.d.ts.map +1 -0
  305. package/build/subtitleTrack.js +2 -0
  306. package/build/subtitleTrack.js.map +1 -0
  307. package/build/thumbnail.d.ts +38 -0
  308. package/build/thumbnail.d.ts.map +1 -0
  309. package/build/thumbnail.js +2 -0
  310. package/build/thumbnail.js.map +1 -0
  311. package/build/tweaksConfig.d.ts +197 -0
  312. package/build/tweaksConfig.d.ts.map +1 -0
  313. package/build/tweaksConfig.js +25 -0
  314. package/build/tweaksConfig.js.map +1 -0
  315. package/build/ui/customMessageHandlerModule.d.ts +27 -0
  316. package/build/ui/customMessageHandlerModule.d.ts.map +1 -0
  317. package/build/ui/customMessageHandlerModule.js +3 -0
  318. package/build/ui/customMessageHandlerModule.js.map +1 -0
  319. package/build/ui/custommessagehandler.d.ts +56 -0
  320. package/build/ui/custommessagehandler.d.ts.map +1 -0
  321. package/build/ui/custommessagehandler.js +54 -0
  322. package/build/ui/custommessagehandler.js.map +1 -0
  323. package/build/ui/custommessagehandlerbridge.d.ts +33 -0
  324. package/build/ui/custommessagehandlerbridge.d.ts.map +1 -0
  325. package/build/ui/custommessagehandlerbridge.js +72 -0
  326. package/build/ui/custommessagehandlerbridge.js.map +1 -0
  327. package/build/ui/custommessagesender.d.ts +5 -0
  328. package/build/ui/custommessagesender.d.ts.map +1 -0
  329. package/build/ui/custommessagesender.js +2 -0
  330. package/build/ui/custommessagesender.js.map +1 -0
  331. package/build/ui/fullscreenHandlerModule.d.ts +20 -0
  332. package/build/ui/fullscreenHandlerModule.d.ts.map +1 -0
  333. package/build/ui/fullscreenHandlerModule.js +3 -0
  334. package/build/ui/fullscreenHandlerModule.js.map +1 -0
  335. package/build/ui/fullscreenhandler.d.ts +18 -0
  336. package/build/ui/fullscreenhandler.d.ts.map +1 -0
  337. package/build/ui/fullscreenhandler.js +2 -0
  338. package/build/ui/fullscreenhandler.js.map +1 -0
  339. package/build/ui/fullscreenhandlerbridge.d.ts +26 -0
  340. package/build/ui/fullscreenhandlerbridge.d.ts.map +1 -0
  341. package/build/ui/fullscreenhandlerbridge.js +67 -0
  342. package/build/ui/fullscreenhandlerbridge.js.map +1 -0
  343. package/build/ui/index.d.ts +3 -0
  344. package/build/ui/index.d.ts.map +1 -0
  345. package/build/ui/index.js +3 -0
  346. package/build/ui/index.js.map +1 -0
  347. package/expo-module.config.json +40 -0
  348. package/ios/AppLifecycleDelegate.swift +25 -0
  349. package/ios/AudioSessionModule.swift +14 -40
  350. package/ios/BitmovinCastManagerModule.swift +30 -69
  351. package/ios/BufferModule.swift +26 -62
  352. package/ios/CustomMessageHandlerBridge.swift +11 -18
  353. package/ios/CustomMessageHandlerModule.swift +61 -63
  354. package/ios/DebugModule.swift +6 -27
  355. package/ios/DrmModule.swift +105 -379
  356. package/ios/Event+JSON.swift +1 -0
  357. package/ios/FullscreenHandlerBridge.swift +12 -5
  358. package/ios/FullscreenHandlerModule.swift +73 -57
  359. package/ios/LockedBox.swift +21 -0
  360. package/ios/ModuleRegistry+Generics.swift +11 -0
  361. package/ios/NetworkModule.swift +78 -82
  362. package/ios/OfflineContentManagerBridge.swift +11 -38
  363. package/ios/OfflineModule.swift +136 -454
  364. package/ios/PlayerAnalyticsModule.swift +24 -52
  365. package/ios/PlayerModule.swift +192 -770
  366. package/ios/RCTConvert+BitmovinPlayer.swift +38 -312
  367. package/ios/RNBitmovinPlayer.h +1 -8
  368. package/ios/RNBitmovinPlayer.podspec +47 -0
  369. package/ios/RNPlayerView.swift +600 -77
  370. package/ios/RNPlayerViewManager.swift +96 -210
  371. package/ios/Registry.swift +2 -2
  372. package/ios/ResultWaiter.swift +66 -0
  373. package/ios/SourceModule.swift +104 -223
  374. package/ios/UuidModule.swift +9 -18
  375. package/package.json +67 -71
  376. package/plugin/build/FeatureFlags.d.ts +24 -0
  377. package/plugin/build/FeatureFlags.js +2 -0
  378. package/plugin/build/index.d.ts +7 -0
  379. package/plugin/build/index.js +10 -0
  380. package/plugin/build/withAppGradleDependencies.d.ts +7 -0
  381. package/plugin/build/withAppGradleDependencies.js +49 -0
  382. package/plugin/build/withBitmovinAndroidConfig.d.ts +7 -0
  383. package/plugin/build/withBitmovinAndroidConfig.js +159 -0
  384. package/plugin/build/withBitmovinConfig.d.ts +7 -0
  385. package/plugin/build/withBitmovinConfig.js +21 -0
  386. package/plugin/build/withBitmovinIosConfig.d.ts +7 -0
  387. package/plugin/build/withBitmovinIosConfig.js +53 -0
  388. package/plugin/src/FeatureFlags.ts +21 -0
  389. package/plugin/src/index.ts +9 -0
  390. package/plugin/src/withAppGradleDependencies.ts +80 -0
  391. package/plugin/src/withBitmovinAndroidConfig.ts +224 -0
  392. package/plugin/src/withBitmovinConfig.ts +24 -0
  393. package/plugin/src/withBitmovinIosConfig.ts +71 -0
  394. package/plugin/tsconfig.json +9 -0
  395. package/plugin/tsconfig.tsbuildinfo +1 -0
  396. package/prettier.config.js +7 -0
  397. package/scripts/format-android.sh +2 -0
  398. package/scripts/format-swift.sh +3 -0
  399. package/scripts/lint-android.sh +2 -0
  400. package/scripts/lint-swift.sh +3 -0
  401. package/scripts/pre-commit.sh +14 -0
  402. package/scripts/setup-hooks.sh +58 -0
  403. package/src/BitmovinPlayerReactNative.types.ts +19 -0
  404. package/src/adaptationConfig.ts +1 -1
  405. package/src/advertising.ts +1 -1
  406. package/src/analytics/config.ts +4 -4
  407. package/src/analytics/player.ts +4 -6
  408. package/src/analytics/playerAnalyticsModule.ts +19 -0
  409. package/src/audioSession.ts +4 -6
  410. package/src/audioTrack.ts +1 -1
  411. package/src/bitmovinCastManager.ts +14 -10
  412. package/src/bufferApi.ts +1 -3
  413. package/src/bufferConfig.ts +2 -2
  414. package/src/components/PlayerView/events.ts +92 -94
  415. package/src/components/PlayerView/index.tsx +109 -159
  416. package/src/components/PlayerView/native.ts +24 -11
  417. package/src/components/PlayerView/nativeEvents.ts +113 -94
  418. package/src/components/PlayerView/pictureInPictureConfig.ts +1 -1
  419. package/src/components/PlayerView/playerViewConfig.ts +4 -8
  420. package/src/components/PlayerView/properties.ts +23 -22
  421. package/src/debug.ts +1 -3
  422. package/src/decoder/decoderConfig.ts +3 -3
  423. package/src/decoder/decoderConfigModule.ts +62 -0
  424. package/src/decoder/index.ts +32 -16
  425. package/src/drm/drmModule.ts +84 -0
  426. package/src/drm/fairplayConfig.ts +1 -1
  427. package/src/drm/index.ts +130 -40
  428. package/src/drm/widevineConfig.ts +5 -5
  429. package/src/events.ts +47 -41
  430. package/src/hooks/useProxy.ts +13 -20
  431. package/src/mediaControlConfig.ts +1 -1
  432. package/src/modules/AudioSessionModule.ts +13 -0
  433. package/src/modules/BitmovinCastManagerModule.ts +14 -0
  434. package/src/modules/BufferModule.ts +18 -0
  435. package/src/modules/DebugModule.ts +9 -0
  436. package/src/modules/PlayerModule.ts +251 -0
  437. package/src/modules/SourceModule.ts +74 -0
  438. package/src/modules/UuidModule.ts +9 -0
  439. package/src/nativeInstance.ts +3 -3
  440. package/src/network/index.ts +42 -15
  441. package/src/network/networkConfig.ts +3 -3
  442. package/src/network/networkModule.ts +51 -0
  443. package/src/offline/offlineContentConfig.ts +1 -1
  444. package/src/offline/offlineContentManager.ts +15 -50
  445. package/src/offline/offlineContentManagerListener.ts +20 -23
  446. package/src/offline/offlineContentOptions.ts +2 -2
  447. package/src/offline/offlineDownloadRequest.ts +1 -1
  448. package/src/offline/offlineModule.ts +46 -0
  449. package/src/offline/offlineSourceOptions.ts +2 -2
  450. package/src/offline/offlineState.ts +1 -1
  451. package/src/playbackConfig.ts +5 -6
  452. package/src/player.ts +53 -48
  453. package/src/source.ts +15 -14
  454. package/src/styleConfig.ts +5 -5
  455. package/src/subtitleFormat.ts +5 -5
  456. package/src/subtitleTrack.ts +1 -1
  457. package/src/tweaksConfig.ts +16 -16
  458. package/src/ui/customMessageHandlerModule.ts +46 -0
  459. package/src/ui/custommessagehandlerbridge.ts +45 -18
  460. package/src/ui/fullscreenHandlerModule.ts +35 -0
  461. package/src/ui/fullscreenhandlerbridge.ts +35 -15
  462. package/tsconfig.json +9 -0
  463. package/typedoc.json +23 -0
  464. package/RNBitmovinPlayer.podspec +0 -26
  465. package/android/src/main/java/com/bitmovin/player/reactnative/BitmovinBaseModule.kt +0 -114
  466. package/android/src/main/java/com/bitmovin/player/reactnative/EventRelay.kt +0 -47
  467. package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerViewPackage.kt +0 -48
  468. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReactContextExtension.kt +0 -24
  469. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableArray.kt +0 -20
  470. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableMap.kt +0 -15
  471. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/ReadableMapExtension.kt +0 -57
  472. package/android/src/main/java/com/bitmovin/player/reactnative/extensions/WritableMap.kt +0 -27
  473. package/android/src/main/java/com/bitmovin/player/reactnative/ui/CustomMessageHandlerModule.kt +0 -86
  474. package/android/src/main/java/com/bitmovin/player/reactnative/ui/FullscreenHandlerModule.kt +0 -78
  475. package/ios/AudioSessionModule.m +0 -10
  476. package/ios/BitmovinCastManagerModule.m +0 -14
  477. package/ios/BufferModule.m +0 -8
  478. package/ios/CustomMessageHandlerModule.m +0 -10
  479. package/ios/DebugModule.m +0 -7
  480. package/ios/DrmModule.m +0 -16
  481. package/ios/FullscreenHandlerModule.m +0 -10
  482. package/ios/NetworkModule.m +0 -10
  483. package/ios/OfflineModule.m +0 -19
  484. package/ios/PlayerAnalyticsModule.m +0 -8
  485. package/ios/PlayerModule.m +0 -130
  486. package/ios/PreprocessHttpRequestDelegateBridge.swift +0 -30
  487. package/ios/RCTBridge+Generics.swift +0 -6
  488. package/ios/RNBitmovinPlayer.xcodeproj/project.pbxproj +0 -303
  489. package/ios/RNPlayerView+PlayerListener.swift +0 -229
  490. package/ios/RNPlayerView+UserInterfaceListener.swift +0 -35
  491. package/ios/RNPlayerViewManager.m +0 -79
  492. package/ios/SourceModule.m +0 -42
  493. package/ios/UuidModule.m +0 -9
  494. package/lib/index.d.mts +0 -4303
  495. package/lib/index.d.ts +0 -4303
  496. package/lib/index.js +0 -1895
  497. package/lib/index.mjs +0 -1836
@@ -1,302 +1,115 @@
1
1
  package com.bitmovin.player.reactnative
2
2
 
3
- import android.os.Handler
4
- import android.os.Looper
5
- import android.util.Log
6
- import android.view.ViewGroup.LayoutParams
7
- import com.bitmovin.player.PlayerView
8
- import com.bitmovin.player.SubtitleView
9
- import com.bitmovin.player.api.ui.PlayerViewConfig
10
- import com.bitmovin.player.api.ui.ScalingMode
11
- import com.bitmovin.player.api.ui.UiConfig
12
3
  import com.bitmovin.player.reactnative.converter.toRNPlayerViewConfigWrapper
13
- import com.bitmovin.player.reactnative.converter.toRNStyleConfigWrapperFromPlayerConfig
14
- import com.bitmovin.player.reactnative.extensions.customMessageHandlerModule
15
4
  import com.bitmovin.player.reactnative.extensions.getBooleanOrNull
16
- import com.bitmovin.player.reactnative.extensions.getModule
17
- import com.bitmovin.player.reactnative.extensions.playerModule
18
- import com.bitmovin.player.reactnative.ui.FullscreenHandlerModule
19
- import com.bitmovin.player.reactnative.ui.RNPictureInPictureHandler
20
- import com.facebook.react.bridge.*
21
- import com.facebook.react.module.annotations.ReactModule
22
- import com.facebook.react.uimanager.SimpleViewManager
23
- import com.facebook.react.uimanager.ThemedReactContext
24
- import com.facebook.react.uimanager.annotations.ReactProp
25
- import java.security.InvalidParameterException
26
-
27
- private const val MODULE_NAME = "NativePlayerView"
28
-
29
- @ReactModule(name = MODULE_NAME)
30
- class RNPlayerViewManager(private val context: ReactApplicationContext) : SimpleViewManager<RNPlayerView>() {
31
- /**
32
- * Native component functions.
33
- */
34
- enum class Commands(val command: String) {
35
- ATTACH_PLAYER("attachPlayer"),
36
- ATTACH_FULLSCREEN_BRIDGE("attachFullscreenBridge"),
37
- SET_CUSTOM_MESSAGE_HANDLER_BRIDGE_ID("setCustomMessageHandlerBridgeId"),
38
- SET_FULLSCREEN("setFullscreen"),
39
- SET_SCALING_MODE("setScalingMode"),
40
- SET_PICTURE_IN_PICTURE("setPictureInPicture"),
41
- }
42
-
43
- /**
44
- * Exported module name to JS.
45
- */
46
- override fun getName() = MODULE_NAME
47
-
48
- private var customMessageHandlerBridgeId: NativeId? = null
49
- private val handler = Handler(Looper.getMainLooper())
50
-
51
- /**
52
- * The component's native view factory. RN may call this method multiple times
53
- * for each component instance.
54
- */
55
- override fun createViewInstance(reactContext: ThemedReactContext) = RNPlayerView(context)
56
-
57
- /**
58
- * Called when the component's view gets detached from the view hierarchy. Useful to perform
59
- * cleanups.
60
- */
61
- override fun onDropViewInstance(view: RNPlayerView) {
62
- super.onDropViewInstance(view)
63
- view.dispose()
64
- }
65
-
66
- /**
67
- * A mapping between a event native identifier and its bubbled version that will
68
- * be accessed from React.
69
- */
70
- private val bubblingEventsMapping: Map<String, String> = mapOf(
71
- "event" to "onBmpEvent",
72
- "playerError" to "onBmpPlayerError",
73
- "playerWarning" to "onBmpPlayerWarning",
74
- "destroy" to "onBmpDestroy",
75
- "muted" to "onBmpMuted",
76
- "unmuted" to "onBmpUnmuted",
77
- "ready" to "onBmpReady",
78
- "paused" to "onBmpPaused",
79
- "play" to "onBmpPlay",
80
- "playing" to "onBmpPlaying",
81
- "playbackFinished" to "onBmpPlaybackFinished",
82
- "seek" to "onBmpSeek",
83
- "seeked" to "onBmpSeeked",
84
- "timeShift" to "onBmpTimeShift",
85
- "timeShifted" to "onBmpTimeShifted",
86
- "stallStarted" to "onBmpStallStarted",
87
- "stallEnded" to "onBmpStallEnded",
88
- "timeChanged" to "onBmpTimeChanged",
89
- "sourceLoad" to "onBmpSourceLoad",
90
- "sourceLoaded" to "onBmpSourceLoaded",
91
- "sourceUnloaded" to "onBmpSourceUnloaded",
92
- "sourceError" to "onBmpSourceError",
93
- "sourceWarning" to "onBmpSourceWarning",
94
- "audioAdded" to "onBmpAudioAdded",
95
- "audioChanged" to "onBmpAudioChanged",
96
- "audioRemoved" to "onBmpAudioRemoved",
97
- "subtitleAdded" to "onBmpSubtitleAdded",
98
- "subtitleChanged" to "onBmpSubtitleChanged",
99
- "subtitleRemoved" to "onBmpSubtitleRemoved",
100
- "downloadFinished" to "onBmpDownloadFinished",
101
- "videoDownloadQualityChanged" to "onBmpVideoDownloadQualityChanged",
102
- "pictureInPictureAvailabilityChanged" to "onBmpPictureInPictureAvailabilityChanged",
103
- "pictureInPictureEnter" to "onBmpPictureInPictureEnter",
104
- "pictureInPictureExit" to "onBmpPictureInPictureExit",
105
- "adBreakFinished" to "onBmpAdBreakFinished",
106
- "adBreakStarted" to "onBmpAdBreakStarted",
107
- "adClicked" to "onBmpAdClicked",
108
- "adError" to "onBmpAdError",
109
- "adFinished" to "onBmpAdFinished",
110
- "adManifestLoad" to "onBmpAdManifestLoad",
111
- "adManifestLoaded" to "onBmpAdManifestLoaded",
112
- "adQuartile" to "onBmpAdQuartile",
113
- "adScheduled" to "onBmpAdScheduled",
114
- "adSkipped" to "onBmpAdSkipped",
115
- "adStarted" to "onBmpAdStarted",
116
- "videoPlaybackQualityChanged" to "onBmpVideoPlaybackQualityChanged",
117
- "fullscreenEnabled" to "onBmpFullscreenEnabled",
118
- "fullscreenDisabled" to "onBmpFullscreenDisabled",
119
- "fullscreenEnter" to "onBmpFullscreenEnter",
120
- "fullscreenExit" to "onBmpFullscreenExit",
121
- "castStart" to "onBmpCastStart",
122
- "castPlaybackFinished" to "onBmpCastPlaybackFinished",
123
- "castPaused" to "onBmpCastPaused",
124
- "castPlaying" to "onBmpCastPlaying",
125
- "castStarted" to "onBmpCastStarted",
126
- "castAvailable" to "onBmpCastAvailable",
127
- "castStopped" to "onBmpCastStopped",
128
- "castWaitingForDevice" to "onBmpCastWaitingForDevice",
129
- "castTimeUpdated" to "onBmpCastTimeUpdated",
130
- "cueEnter" to "onBmpCueEnter",
131
- "cueExit" to "onBmpCueExit",
132
- )
133
-
134
- /**
135
- * Component's event registry. Bubbling events are directly mapped to react props. No
136
- * need to use proxy functions or `NativeEventEmitter`.
137
- * @return map between event names (sent from native code) to js props.
138
- */
139
- override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any> =
140
- bubblingEventsMapping.entries.associate {
141
- it.key to mapOf(
142
- "phasedRegistrationNames" to mapOf("bubbled" to it.value),
143
- )
144
- }.toMutableMap()
145
-
146
- /**
147
- * Component's command registry. They enable granular control over
148
- * instances of a certain native component from js and give the ability
149
- * to call 'functions' on them.
150
- * @return map between names (used in js) and command ids (used in native code).
151
- */
152
- override fun getCommandsMap(): Map<String, Int> = Commands.values().associate {
153
- it.command to it.ordinal
154
- }
155
-
156
- /**
157
- * Callback triggered in response to command dispatches from the js side.
158
- * @param view Root native view of the targeted component.
159
- * @param commandId Command number identifier. It's a number even though RN sends it as a string.
160
- * @param args Arguments list sent from the js side.
161
- */
162
- override fun receiveCommand(view: RNPlayerView, commandId: String?, args: ReadableArray?) {
163
- fun Int.toCommand(): Commands? = Commands.values().getOrNull(this)
164
- val command = commandId?.toInt()?.toCommand() ?: throw IllegalArgumentException(
165
- "The received command is not supported by the Bitmovin Player View",
166
- )
167
-
168
- fun <T> T?.require(): T = this ?: throw InvalidParameterException("Missing parameter")
169
- when (command) {
170
- Commands.ATTACH_PLAYER -> attachPlayer(view, args?.getString(1).require(), args?.getMap(2))
171
- Commands.ATTACH_FULLSCREEN_BRIDGE -> attachFullscreenBridge(view, args?.getString(1).require())
172
- Commands.SET_CUSTOM_MESSAGE_HANDLER_BRIDGE_ID -> setCustomMessageHandlerBridgeId(
173
- view,
174
- args?.getString(1).require(),
175
- )
176
-
177
- Commands.SET_FULLSCREEN -> setFullscreen(view, args?.getBoolean(1).require())
178
- Commands.SET_SCALING_MODE -> setScalingMode(view, args?.getString(1).require())
179
- Commands.SET_PICTURE_IN_PICTURE -> setPictureInPicture(view, args?.getBoolean(1).require())
180
- }
181
- }
182
-
183
- @ReactProp(name = "config")
184
- fun setConfig(view: RNPlayerView, config: ReadableMap?) {
185
- view.config = config?.toRNPlayerViewConfigWrapper()
186
- }
187
-
188
- private fun attachFullscreenBridge(view: RNPlayerView, fullscreenBridgeId: NativeId) {
189
- handler.postAndLogException {
190
- view.playerView?.setFullscreenHandler(
191
- context.getModule<FullscreenHandlerModule>()?.getInstance(fullscreenBridgeId),
192
- )
193
- }
194
- }
195
-
196
- private fun setFullscreen(view: RNPlayerView, isFullscreenRequested: Boolean) {
197
- handler.postAndLogException {
198
- val playerView = view.playerView ?: return@postAndLogException
199
- if (playerView.isFullscreen == isFullscreenRequested) return@postAndLogException
200
- if (isFullscreenRequested) {
201
- playerView.enterFullscreen()
202
- } else {
203
- playerView.exitFullscreen()
5
+ import com.bitmovin.player.reactnative.extensions.getMap
6
+ import com.bitmovin.player.reactnative.extensions.getString
7
+ import expo.modules.kotlin.modules.Module
8
+ import expo.modules.kotlin.modules.ModuleDefinition
9
+
10
+ class RNPlayerViewManager : Module() {
11
+ override fun definition() = ModuleDefinition {
12
+ Name("RNPlayerViewManager")
13
+
14
+ View(RNPlayerView::class) {
15
+ Prop("config") { view: RNPlayerView, playerInfo: Map<String, Any>? ->
16
+ val playerId = playerInfo?.get("playerId") as? String
17
+ ?: throw IllegalArgumentException("Player info must contain 'playerId' field")
18
+ val customMessageHandlerBridgeId = playerInfo.getString("customMessageHandlerBridgeId")
19
+ val enableBackgroundPlayback = playerInfo.getBooleanOrNull("enableBackgroundPlayback") ?: false
20
+ val isPictureInPictureEnabledOnPlayer =
21
+ playerInfo.getBooleanOrNull("isPictureInPictureEnabledOnPlayer") ?: false
22
+ val userInterfaceTypeName = playerInfo.getString("userInterfaceTypeName")
23
+ val playerViewConfigWrapper = playerInfo.getMap("playerViewConfig")?.toRNPlayerViewConfigWrapper()
24
+ view.attachPlayer(
25
+ playerId,
26
+ playerViewConfigWrapper,
27
+ customMessageHandlerBridgeId,
28
+ enableBackgroundPlayback,
29
+ isPictureInPictureEnabledOnPlayer,
30
+ userInterfaceTypeName,
31
+ )
204
32
  }
205
- }
206
- }
207
33
 
208
- private fun setPictureInPicture(view: RNPlayerView, isPictureInPictureRequested: Boolean) {
209
- handler.postAndLogException {
210
- val playerView = view.playerView ?: throw IllegalStateException("The player view is not yet created")
211
- if (playerView.isPictureInPicture == isPictureInPictureRequested) return@postAndLogException
212
- if (isPictureInPictureRequested) {
213
- playerView.enterPictureInPicture()
214
- } else {
215
- playerView.exitPictureInPicture()
34
+ Prop("scalingMode") { view: RNPlayerView, scalingMode: String? ->
35
+ view.setScalingMode(scalingMode)
216
36
  }
217
- }
218
- }
219
-
220
- private fun setScalingMode(view: RNPlayerView, scalingMode: String) {
221
- handler.postAndLogException {
222
- view.playerView?.scalingMode = ScalingMode.valueOf(scalingMode)
223
- }
224
- }
225
37
 
226
- private fun setCustomMessageHandlerBridgeId(view: RNPlayerView, customMessageHandlerBridgeId: NativeId) {
227
- this.customMessageHandlerBridgeId = customMessageHandlerBridgeId
228
- attachCustomMessageHandlerBridge(view)
229
- }
230
-
231
- private fun attachCustomMessageHandlerBridge(view: RNPlayerView) {
232
- view.playerView?.setCustomMessageHandler(
233
- context.customMessageHandlerModule
234
- ?.getInstance(customMessageHandlerBridgeId)
235
- ?.customMessageHandler,
236
- )
237
- }
238
-
239
- /**
240
- * Set the `Player` instance for the target view using `playerId`.
241
- * @param view Target `RNPlayerView`.
242
- * @param playerId `Player` instance id inside `PlayerModule`'s registry.
243
- */
244
- private fun attachPlayer(view: RNPlayerView, playerId: NativeId, playerConfig: ReadableMap?) {
245
- handler.postAndLogException {
246
- val player = playerId.let { context.playerModule?.getPlayerOrNull(it) }
247
- ?: throw InvalidParameterException("Cannot create a PlayerView, invalid playerId was passed: $playerId")
248
- val playbackConfig = playerConfig?.getMap("playbackConfig")
249
- val isPictureInPictureEnabled = view.config?.pictureInPictureConfig?.isEnabled == true ||
250
- playbackConfig?.getBooleanOrNull("isPictureInPictureEnabled") == true
251
- view.enableBackgroundPlayback = playbackConfig?.getBooleanOrNull("isBackgroundPlaybackEnabled") == true
252
-
253
- val rnStyleConfigWrapper = playerConfig?.toRNStyleConfigWrapperFromPlayerConfig()
254
- val configuredPlayerViewConfig = view.config?.playerViewConfig ?: PlayerViewConfig()
255
-
256
- if (view.playerView != null) {
257
- view.player = player
258
- } else {
259
- // PlayerView has to be initialized with Activity context
260
- val currentActivity = context.currentActivity
261
- ?: throw IllegalStateException("Cannot create a PlayerView, because no activity is attached.")
262
- val userInterfaceType = rnStyleConfigWrapper?.userInterfaceType ?: UserInterfaceType.Bitmovin
263
- val playerViewConfig: PlayerViewConfig = if (userInterfaceType != UserInterfaceType.Bitmovin) {
264
- configuredPlayerViewConfig.copy(uiConfig = UiConfig.Disabled)
265
- } else {
266
- configuredPlayerViewConfig
267
- }
268
-
269
- val playerView = PlayerView(currentActivity, player, playerViewConfig)
38
+ Prop("isFullscreenRequested") { view: RNPlayerView, isFullscreen: Boolean ->
39
+ view.setFullscreen(isFullscreen)
40
+ }
270
41
 
271
- playerView.layoutParams = LayoutParams(
272
- LayoutParams.MATCH_PARENT,
273
- LayoutParams.MATCH_PARENT,
274
- )
275
- if (isPictureInPictureEnabled) {
276
- playerView.setPictureInPictureHandler(RNPictureInPictureHandler(currentActivity, player))
277
- }
278
- view.setPlayerView(playerView)
279
- attachCustomMessageHandlerBridge(view)
42
+ Prop("isPictureInPictureRequested") { view: RNPlayerView, isPictureInPicture: Boolean ->
43
+ view.setPictureInPicture(isPictureInPicture)
280
44
  }
281
45
 
282
- if (rnStyleConfigWrapper?.styleConfig?.isUiEnabled != false &&
283
- rnStyleConfigWrapper?.userInterfaceType == UserInterfaceType.Subtitle
284
- ) {
285
- context.currentActivity?.let { activity ->
286
- val subtitleView = SubtitleView(activity)
287
- subtitleView.setPlayer(player)
288
- view.setSubtitleView(subtitleView)
289
- }
46
+ Prop("fullscreenBridgeId") { view: RNPlayerView, fullscreenBridgeId: String ->
47
+ view.attachFullscreenBridge(fullscreenBridgeId)
290
48
  }
291
- }
292
- }
293
49
 
294
- /** Post and log any exceptions instead of crashing the app. */
295
- private inline fun Handler.postAndLogException(crossinline block: () -> Unit) = post {
296
- try {
297
- block()
298
- } catch (e: Exception) {
299
- Log.e(MODULE_NAME, "Error while executing command", e)
50
+ Events(
51
+ "onBmpEvent",
52
+ "onBmpPlayerError",
53
+ "onBmpPlayerWarning",
54
+ "onBmpDestroy",
55
+ "onBmpMuted",
56
+ "onBmpUnmuted",
57
+ "onBmpReady",
58
+ "onBmpPaused",
59
+ "onBmpPlay",
60
+ "onBmpPlaying",
61
+ "onBmpPlaybackFinished",
62
+ "onBmpSeek",
63
+ "onBmpSeeked",
64
+ "onBmpTimeShift",
65
+ "onBmpTimeShifted",
66
+ "onBmpStallStarted",
67
+ "onBmpStallEnded",
68
+ "onBmpTimeChanged",
69
+ "onBmpSourceLoad",
70
+ "onBmpSourceLoaded",
71
+ "onBmpSourceUnloaded",
72
+ "onBmpSourceError",
73
+ "onBmpSourceWarning",
74
+ "onBmpAudioAdded",
75
+ "onBmpAudioChanged",
76
+ "onBmpAudioRemoved",
77
+ "onBmpSubtitleAdded",
78
+ "onBmpSubtitleChanged",
79
+ "onBmpSubtitleRemoved",
80
+ "onBmpDownloadFinished",
81
+ "onBmpVideoDownloadQualityChanged",
82
+ "onBmpPictureInPictureAvailabilityChanged",
83
+ "onBmpPictureInPictureEnter",
84
+ "onBmpPictureInPictureExit",
85
+ "onBmpAdBreakFinished",
86
+ "onBmpAdBreakStarted",
87
+ "onBmpAdClicked",
88
+ "onBmpAdError",
89
+ "onBmpAdFinished",
90
+ "onBmpAdManifestLoad",
91
+ "onBmpAdManifestLoaded",
92
+ "onBmpAdQuartile",
93
+ "onBmpAdScheduled",
94
+ "onBmpAdSkipped",
95
+ "onBmpAdStarted",
96
+ "onBmpVideoPlaybackQualityChanged",
97
+ "onBmpFullscreenEnabled",
98
+ "onBmpFullscreenDisabled",
99
+ "onBmpFullscreenEnter",
100
+ "onBmpFullscreenExit",
101
+ "onBmpCastStart",
102
+ "onBmpCastPlaybackFinished",
103
+ "onBmpCastPaused",
104
+ "onBmpCastPlaying",
105
+ "onBmpCastStarted",
106
+ "onBmpCastAvailable",
107
+ "onBmpCastStopped",
108
+ "onBmpCastWaitingForDevice",
109
+ "onBmpCastTimeUpdated",
110
+ "onBmpCueEnter",
111
+ "onBmpCueExit",
112
+ )
300
113
  }
301
114
  }
302
115
  }
@@ -0,0 +1,58 @@
1
+ package com.bitmovin.player.reactnative
2
+
3
+ import java.util.concurrent.ConcurrentHashMap
4
+ import java.util.concurrent.CountDownLatch
5
+ import java.util.concurrent.TimeUnit
6
+ import java.util.concurrent.atomic.AtomicInteger
7
+
8
+ /**
9
+ * Lets native code synchronously wait for a value that will be supplied
10
+ * later (typically from JavaScript). Thread-safe, generic, timeout-aware.
11
+ *
12
+ * val (id, wait) = boolWaiter.make(250) // 250 ms
13
+ * sendEvent("...", mapOf("id" to id))
14
+ * val answer = wait() ?: false // fallback on timeout
15
+ */
16
+ class ResultWaiter<T> {
17
+
18
+ private data class Entry<V>(
19
+ val latch: CountDownLatch = CountDownLatch(1),
20
+ @Volatile var value: V? = null,
21
+ )
22
+
23
+ private val nextId = AtomicInteger()
24
+ private val table = ConcurrentHashMap<Int, Entry<T>>()
25
+
26
+ /**
27
+ * Registers a new waiter and returns:
28
+ * • id – unique request handle
29
+ * • wait – blocking lambda that returns null on timeout
30
+ *
31
+ * @param timeoutMs max time the caller is willing to block
32
+ */
33
+ fun make(timeoutMs: Long): Pair<Int, () -> T?> {
34
+ val id = nextId.incrementAndGet()
35
+ val entry = Entry<T>()
36
+ table[id] = entry
37
+
38
+ val waitFn = {
39
+ entry.latch.await(timeoutMs, TimeUnit.MILLISECONDS)
40
+ table.remove(id) // GC once done
41
+ entry.value
42
+ }
43
+
44
+ return id to waitFn
45
+ }
46
+
47
+ /** Completes the waiter if it exists; does nothing otherwise. */
48
+ fun complete(id: Int, value: T) {
49
+ table[id]?.let {
50
+ it.value = value
51
+ it.latch.countDown()
52
+ }
53
+ }
54
+
55
+ fun clear() {
56
+ table.clear()
57
+ }
58
+ }