react-native-theoplayer 1.6.1 → 1.7.1

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 (465) hide show
  1. package/README.md +4 -0
  2. package/android/build.gradle +76 -33
  3. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.3.0/ads-wrapper-4.3.0.aar +0 -0
  4. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.3.0/ads-wrapper-4.3.0.pom +9 -0
  5. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +13 -0
  6. package/android/src/main/java/com/theoplayer/PlayerConfigHelper.java +40 -0
  7. package/android/src/main/java/com/theoplayer/ReactTHEOplayerPackage.java +8 -3
  8. package/android/src/main/java/com/theoplayer/ReactTHEOplayerView.java +131 -28
  9. package/android/src/main/java/com/theoplayer/ReactTHEOplayerViewManager.java +14 -1
  10. package/android/src/main/java/com/theoplayer/SourceHelper.java +137 -86
  11. package/android/src/main/java/com/theoplayer/VideoEventEmitter.java +44 -12
  12. package/android/src/main/java/com/theoplayer/abr/ABRConfigurationAdapter.kt +72 -0
  13. package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.java +92 -0
  14. package/android/src/main/java/com/theoplayer/ads/AdInfo.java +168 -0
  15. package/android/src/main/java/com/theoplayer/ads/AdsModule.java +152 -0
  16. package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +143 -0
  17. package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +273 -0
  18. package/android/src/main/java/com/theoplayer/drm/KeySystemAdapter.kt +22 -0
  19. package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +33 -0
  20. package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +19 -0
  21. package/android/src/main/java/com/theoplayer/drm/RequestMethodAdapter.kt +28 -0
  22. package/android/src/main/java/com/theoplayer/track/QualityListAdapter.java +54 -0
  23. package/android/src/main/java/com/theoplayer/track/QualityListFilter.java +40 -0
  24. package/android/src/main/java/com/theoplayer/track/TrackListInfo.java +10 -2
  25. package/android/src/main/java/com/theoplayer/util/TypeUtils.kt +17 -0
  26. package/android/src/main/java/com/theoplayer/util/ViewResolver.java +42 -0
  27. package/ios/THEOplayerRCTAdAggregator.swift +158 -0
  28. package/ios/THEOplayerRCTAdsAPI.swift +296 -0
  29. package/ios/THEOplayerRCTBridge.m +65 -0
  30. package/ios/THEOplayerRCTContentProtectionAPI.swift +359 -0
  31. package/ios/THEOplayerRCTContentProtectionAggregator.swift +119 -0
  32. package/ios/THEOplayerRCTDebug.swift +11 -5
  33. package/ios/THEOplayerRCTMetadataAggregator.swift +1 -1
  34. package/ios/THEOplayerRCTNetworkUtils.swift +54 -0
  35. package/ios/THEOplayerRCTProxyContentProtectionIntegration.swift +155 -0
  36. package/ios/THEOplayerRCTProxyContentProtectionIntegrationFactory.swift +32 -0
  37. package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +223 -30
  38. package/ios/THEOplayerRCTTypeUtils.swift +18 -0
  39. package/ios/THEOplayerRCTView.swift +109 -49
  40. package/ios/THEOplayerRCTViewAdEventHandler.swift +238 -0
  41. package/ios/{THEOplayerRCTViewEventHandler.swift → THEOplayerRCTViewMainEventHandler.swift} +7 -119
  42. package/ios/THEOplayerRCTViewTextTrackEventHandler.swift +134 -0
  43. package/ios/Theoplayer-Bridging-Header.h +3 -1
  44. package/ios/custom/Frameworks/ios/put_custom_ios_xcframework_here.txt +2 -0
  45. package/ios/custom/react-native-theoplayer_custom_ios.podspec +36 -0
  46. package/ios/custom/theofeatures.sh +14 -0
  47. package/lib/commonjs/api/THEOplayerView.js.map +1 -1
  48. package/lib/commonjs/api/abr/ABRConfiguration.js +2 -0
  49. package/lib/commonjs/api/abr/ABRConfiguration.js.map +1 -0
  50. package/lib/commonjs/api/abr/barrel.js +19 -0
  51. package/lib/commonjs/api/abr/barrel.js.map +1 -0
  52. package/lib/commonjs/api/ads/Ad.js +6 -0
  53. package/lib/commonjs/api/ads/Ad.js.map +1 -0
  54. package/lib/commonjs/api/ads/AdBreak.js +6 -0
  55. package/lib/commonjs/api/ads/AdBreak.js.map +1 -0
  56. package/lib/commonjs/api/ads/AdsAPI.js +6 -0
  57. package/lib/commonjs/api/ads/AdsAPI.js.map +1 -0
  58. package/lib/commonjs/api/ads/AdsConfiguration.js +6 -0
  59. package/lib/commonjs/api/ads/AdsConfiguration.js.map +1 -0
  60. package/lib/commonjs/api/ads/CompanionAd.js +2 -0
  61. package/lib/commonjs/api/ads/CompanionAd.js.map +1 -0
  62. package/lib/commonjs/api/ads/GoogleDai.js +2 -0
  63. package/lib/commonjs/api/ads/GoogleDai.js.map +1 -0
  64. package/lib/commonjs/api/ads/GoogleImaAd.js +6 -0
  65. package/lib/commonjs/api/ads/GoogleImaAd.js.map +1 -0
  66. package/lib/commonjs/api/ads/GoogleImaConfiguration.js +2 -0
  67. package/lib/commonjs/api/ads/GoogleImaConfiguration.js.map +1 -0
  68. package/lib/commonjs/api/ads/barrel.js +110 -0
  69. package/lib/commonjs/api/ads/barrel.js.map +1 -0
  70. package/lib/commonjs/api/barrel.js +58 -6
  71. package/lib/commonjs/api/barrel.js.map +1 -1
  72. package/lib/commonjs/api/config/PlayerConfiguration.js +4 -0
  73. package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
  74. package/lib/commonjs/api/drm/ContentProtectionAPI.js +6 -0
  75. package/lib/commonjs/api/drm/ContentProtectionAPI.js.map +1 -0
  76. package/lib/commonjs/api/drm/ContentProtectionIntegration.js +6 -0
  77. package/lib/commonjs/api/drm/ContentProtectionIntegration.js.map +1 -0
  78. package/lib/commonjs/api/drm/ContentProtectionIntegrationFactory.js +6 -0
  79. package/lib/commonjs/api/drm/ContentProtectionIntegrationFactory.js.map +1 -0
  80. package/lib/commonjs/api/drm/ContentProtectionRequest.js +2 -0
  81. package/lib/commonjs/api/drm/ContentProtectionRequest.js.map +1 -0
  82. package/lib/commonjs/api/drm/ContentProtectionResponse.js +6 -0
  83. package/lib/commonjs/api/drm/ContentProtectionResponse.js.map +1 -0
  84. package/lib/commonjs/api/drm/barrel.js +71 -0
  85. package/lib/commonjs/api/drm/barrel.js.map +1 -0
  86. package/lib/commonjs/api/event/AdEvent.js +89 -0
  87. package/lib/commonjs/api/event/AdEvent.js.map +1 -0
  88. package/lib/commonjs/api/event/barrel.js +13 -0
  89. package/lib/commonjs/api/event/barrel.js.map +1 -1
  90. package/lib/commonjs/api/source/SourceDescription.js.map +1 -1
  91. package/lib/commonjs/api/source/ads/FreeWheelAdDescription.js +6 -0
  92. package/lib/commonjs/api/source/ads/FreeWheelAdDescription.js.map +1 -0
  93. package/lib/commonjs/api/source/ads/IMAAdDescription.js +6 -0
  94. package/lib/commonjs/api/source/ads/IMAAdDescription.js.map +1 -0
  95. package/lib/commonjs/api/source/ads/SpotXAdDescription.js +6 -0
  96. package/lib/commonjs/api/source/ads/SpotXAdDescription.js.map +1 -0
  97. package/lib/commonjs/api/source/ads/THEOplayerAdDescription.js +6 -0
  98. package/lib/commonjs/api/source/ads/THEOplayerAdDescription.js.map +1 -0
  99. package/lib/commonjs/api/source/ads/barrel.js +84 -0
  100. package/lib/commonjs/api/source/ads/barrel.js.map +1 -0
  101. package/lib/commonjs/api/source/ads/ssai/GoogleDAIConfiguration.js +6 -0
  102. package/lib/commonjs/api/source/ads/ssai/GoogleDAIConfiguration.js.map +1 -0
  103. package/lib/commonjs/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js +6 -0
  104. package/lib/commonjs/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js.map +1 -0
  105. package/lib/commonjs/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js +6 -0
  106. package/lib/commonjs/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js.map +1 -0
  107. package/lib/commonjs/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js +6 -0
  108. package/lib/commonjs/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js.map +1 -0
  109. package/lib/commonjs/api/source/ads/ssai/barrel.js +58 -0
  110. package/lib/commonjs/api/source/ads/ssai/barrel.js.map +1 -0
  111. package/lib/commonjs/api/source/barrel.js +16 -3
  112. package/lib/commonjs/api/source/barrel.js.map +1 -1
  113. package/lib/commonjs/api/source/drm/DRMConfiguration.js.map +1 -1
  114. package/lib/commonjs/api/track/MediaTrack.js +29 -0
  115. package/lib/commonjs/api/track/MediaTrack.js.map +1 -1
  116. package/lib/commonjs/api/utils/TypeUtils.js +62 -0
  117. package/lib/commonjs/api/utils/TypeUtils.js.map +1 -0
  118. package/lib/commonjs/api/utils/barrel.js +19 -0
  119. package/lib/commonjs/api/utils/barrel.js.map +1 -0
  120. package/lib/commonjs/index.js +10 -1
  121. package/lib/commonjs/index.js.map +1 -1
  122. package/lib/commonjs/internal/THEOplayerView.js +42 -3
  123. package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
  124. package/lib/commonjs/internal/THEOplayerView.web.js +41 -2
  125. package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
  126. package/lib/commonjs/internal/ads/THEOplayerNativeAdsAPI.js +54 -0
  127. package/lib/commonjs/internal/ads/THEOplayerNativeAdsAPI.js.map +1 -0
  128. package/lib/commonjs/internal/ads/THEOplayerNativeGoogleDAI.js +34 -0
  129. package/lib/commonjs/internal/ads/THEOplayerNativeGoogleDAI.js.map +1 -0
  130. package/lib/commonjs/internal/ads/THEOplayerWebAdsAPI.js +78 -0
  131. package/lib/commonjs/internal/ads/THEOplayerWebAdsAPI.js.map +1 -0
  132. package/lib/commonjs/internal/ads/THEOplayerWebGoogleDAI.js +32 -0
  133. package/lib/commonjs/internal/ads/THEOplayerWebGoogleDAI.js.map +1 -0
  134. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +214 -0
  135. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -0
  136. package/lib/commonjs/internal/drm/ContentProtectionRegistry.web.js +20 -0
  137. package/lib/commonjs/internal/drm/ContentProtectionRegistry.web.js.map +1 -0
  138. package/lib/commonjs/internal/drm/NativeCertificateRequest.js +41 -0
  139. package/lib/commonjs/internal/drm/NativeCertificateRequest.js.map +1 -0
  140. package/lib/commonjs/internal/drm/NativeCertificateResponse.js +41 -0
  141. package/lib/commonjs/internal/drm/NativeCertificateResponse.js.map +1 -0
  142. package/lib/commonjs/internal/drm/NativeContentProtectionEvent.js +2 -0
  143. package/lib/commonjs/internal/drm/NativeContentProtectionEvent.js.map +1 -0
  144. package/lib/commonjs/internal/drm/NativeLicenseRequest.js +44 -0
  145. package/lib/commonjs/internal/drm/NativeLicenseRequest.js.map +1 -0
  146. package/lib/commonjs/internal/drm/NativeLicenseResponse.js +41 -0
  147. package/lib/commonjs/internal/drm/NativeLicenseResponse.js.map +1 -0
  148. package/lib/commonjs/internal/utils/TypeUtils.js +41 -0
  149. package/lib/commonjs/internal/utils/TypeUtils.js.map +1 -0
  150. package/lib/commonjs/internal/web/TrackUtils.js +19 -0
  151. package/lib/commonjs/internal/web/TrackUtils.js.map +1 -1
  152. package/lib/module/api/THEOplayerView.js.map +1 -1
  153. package/lib/module/api/abr/ABRConfiguration.js +2 -0
  154. package/lib/module/api/abr/ABRConfiguration.js.map +1 -0
  155. package/lib/module/api/abr/barrel.js +2 -0
  156. package/lib/module/api/abr/barrel.js.map +1 -0
  157. package/lib/module/api/ads/Ad.js +2 -0
  158. package/lib/module/api/ads/Ad.js.map +1 -0
  159. package/lib/module/api/ads/AdBreak.js +2 -0
  160. package/lib/module/api/ads/AdBreak.js.map +1 -0
  161. package/lib/module/api/ads/AdsAPI.js +2 -0
  162. package/lib/module/api/ads/AdsAPI.js.map +1 -0
  163. package/lib/module/api/ads/AdsConfiguration.js +2 -0
  164. package/lib/module/api/ads/AdsConfiguration.js.map +1 -0
  165. package/lib/module/api/ads/CompanionAd.js +2 -0
  166. package/lib/module/api/ads/CompanionAd.js.map +1 -0
  167. package/lib/module/api/ads/GoogleDai.js +2 -0
  168. package/lib/module/api/ads/GoogleDai.js.map +1 -0
  169. package/lib/module/api/ads/GoogleImaAd.js +2 -0
  170. package/lib/module/api/ads/GoogleImaAd.js.map +1 -0
  171. package/lib/module/api/ads/GoogleImaConfiguration.js +2 -0
  172. package/lib/module/api/ads/GoogleImaConfiguration.js.map +1 -0
  173. package/lib/module/api/ads/barrel.js +9 -0
  174. package/lib/module/api/ads/barrel.js.map +1 -0
  175. package/lib/module/api/barrel.js +5 -1
  176. package/lib/module/api/barrel.js.map +1 -1
  177. package/lib/module/api/config/PlayerConfiguration.js +1 -1
  178. package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
  179. package/lib/module/api/drm/ContentProtectionAPI.js +2 -0
  180. package/lib/module/api/drm/ContentProtectionAPI.js.map +1 -0
  181. package/lib/module/api/drm/ContentProtectionIntegration.js +2 -0
  182. package/lib/module/api/drm/ContentProtectionIntegration.js.map +1 -0
  183. package/lib/module/api/drm/ContentProtectionIntegrationFactory.js +2 -0
  184. package/lib/module/api/drm/ContentProtectionIntegrationFactory.js.map +1 -0
  185. package/lib/module/api/drm/ContentProtectionRequest.js +2 -0
  186. package/lib/module/api/drm/ContentProtectionRequest.js.map +1 -0
  187. package/lib/module/api/drm/ContentProtectionResponse.js +2 -0
  188. package/lib/module/api/drm/ContentProtectionResponse.js.map +1 -0
  189. package/lib/module/api/drm/barrel.js +6 -0
  190. package/lib/module/api/drm/barrel.js.map +1 -0
  191. package/lib/module/api/event/AdEvent.js +82 -0
  192. package/lib/module/api/event/AdEvent.js.map +1 -0
  193. package/lib/module/api/event/barrel.js +1 -0
  194. package/lib/module/api/event/barrel.js.map +1 -1
  195. package/lib/module/api/source/SourceDescription.js.map +1 -1
  196. package/lib/module/api/source/ads/FreeWheelAdDescription.js +2 -0
  197. package/lib/module/api/source/ads/FreeWheelAdDescription.js.map +1 -0
  198. package/lib/module/api/source/ads/IMAAdDescription.js +2 -0
  199. package/lib/module/api/source/ads/IMAAdDescription.js.map +1 -0
  200. package/lib/module/api/source/ads/SpotXAdDescription.js +2 -0
  201. package/lib/module/api/source/ads/SpotXAdDescription.js.map +1 -0
  202. package/lib/module/api/source/ads/THEOplayerAdDescription.js +2 -0
  203. package/lib/module/api/source/ads/THEOplayerAdDescription.js.map +1 -0
  204. package/lib/module/api/source/ads/barrel.js +7 -0
  205. package/lib/module/api/source/ads/barrel.js.map +1 -0
  206. package/lib/module/api/source/ads/ssai/GoogleDAIConfiguration.js +2 -0
  207. package/lib/module/api/source/ads/ssai/GoogleDAIConfiguration.js.map +1 -0
  208. package/lib/module/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js +2 -0
  209. package/lib/module/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js.map +1 -0
  210. package/lib/module/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js +2 -0
  211. package/lib/module/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js.map +1 -0
  212. package/lib/module/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js +2 -0
  213. package/lib/module/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js.map +1 -0
  214. package/lib/module/api/source/ads/ssai/barrel.js +5 -0
  215. package/lib/module/api/source/ads/ssai/barrel.js.map +1 -0
  216. package/lib/module/api/source/barrel.js +1 -0
  217. package/lib/module/api/source/barrel.js.map +1 -1
  218. package/lib/module/api/source/drm/DRMConfiguration.js.map +1 -1
  219. package/lib/module/api/track/MediaTrack.js +23 -1
  220. package/lib/module/api/track/MediaTrack.js.map +1 -1
  221. package/lib/module/api/utils/TypeUtils.js +36 -0
  222. package/lib/module/api/utils/TypeUtils.js.map +1 -0
  223. package/lib/module/api/utils/barrel.js +2 -0
  224. package/lib/module/api/utils/barrel.js.map +1 -0
  225. package/lib/module/index.js +1 -0
  226. package/lib/module/index.js.map +1 -1
  227. package/lib/module/internal/THEOplayerView.js +40 -3
  228. package/lib/module/internal/THEOplayerView.js.map +1 -1
  229. package/lib/module/internal/THEOplayerView.web.js +42 -4
  230. package/lib/module/internal/THEOplayerView.web.js.map +1 -1
  231. package/lib/module/internal/ads/THEOplayerNativeAdsAPI.js +43 -0
  232. package/lib/module/internal/ads/THEOplayerNativeAdsAPI.js.map +1 -0
  233. package/lib/module/internal/ads/THEOplayerNativeGoogleDAI.js +24 -0
  234. package/lib/module/internal/ads/THEOplayerNativeGoogleDAI.js.map +1 -0
  235. package/lib/module/internal/ads/THEOplayerWebAdsAPI.js +68 -0
  236. package/lib/module/internal/ads/THEOplayerWebAdsAPI.js.map +1 -0
  237. package/lib/module/internal/ads/THEOplayerWebGoogleDAI.js +23 -0
  238. package/lib/module/internal/ads/THEOplayerWebGoogleDAI.js.map +1 -0
  239. package/lib/module/internal/drm/ContentProtectionRegistry.js +188 -0
  240. package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -0
  241. package/lib/module/internal/drm/ContentProtectionRegistry.web.js +9 -0
  242. package/lib/module/internal/drm/ContentProtectionRegistry.web.js.map +1 -0
  243. package/lib/module/internal/drm/NativeCertificateRequest.js +31 -0
  244. package/lib/module/internal/drm/NativeCertificateRequest.js.map +1 -0
  245. package/lib/module/internal/drm/NativeCertificateResponse.js +30 -0
  246. package/lib/module/internal/drm/NativeCertificateResponse.js.map +1 -0
  247. package/lib/module/internal/drm/NativeContentProtectionEvent.js +2 -0
  248. package/lib/module/internal/drm/NativeContentProtectionEvent.js.map +1 -0
  249. package/lib/module/internal/drm/NativeLicenseRequest.js +34 -0
  250. package/lib/module/internal/drm/NativeLicenseRequest.js.map +1 -0
  251. package/lib/module/internal/drm/NativeLicenseResponse.js +30 -0
  252. package/lib/module/internal/drm/NativeLicenseResponse.js.map +1 -0
  253. package/lib/module/internal/utils/TypeUtils.js +24 -0
  254. package/lib/module/internal/utils/TypeUtils.js.map +1 -0
  255. package/lib/module/internal/web/TrackUtils.js +15 -0
  256. package/lib/module/internal/web/TrackUtils.js.map +1 -1
  257. package/lib/typescript/lib/commonjs/api/abr/ABRConfiguration.d.ts +0 -0
  258. package/lib/typescript/lib/commonjs/api/abr/barrel.d.ts +1 -0
  259. package/lib/typescript/lib/commonjs/api/ads/Ad.d.ts +1 -0
  260. package/lib/typescript/lib/commonjs/api/ads/AdBreak.d.ts +1 -0
  261. package/lib/typescript/lib/commonjs/api/ads/AdsAPI.d.ts +1 -0
  262. package/lib/typescript/lib/commonjs/api/ads/AdsConfiguration.d.ts +1 -0
  263. package/lib/typescript/lib/commonjs/api/ads/CompanionAd.d.ts +0 -0
  264. package/lib/typescript/lib/commonjs/api/ads/GoogleDai.d.ts +0 -0
  265. package/lib/typescript/lib/commonjs/api/ads/GoogleImaAd.d.ts +1 -0
  266. package/lib/typescript/lib/commonjs/api/ads/GoogleImaConfiguration.d.ts +0 -0
  267. package/lib/typescript/lib/commonjs/api/ads/barrel.d.ts +1 -0
  268. package/lib/typescript/lib/commonjs/api/config/PlayerConfiguration.d.ts +1 -0
  269. package/lib/typescript/lib/commonjs/api/drm/ContentProtectionAPI.d.ts +1 -0
  270. package/lib/typescript/lib/commonjs/api/drm/ContentProtectionIntegration.d.ts +1 -0
  271. package/lib/typescript/lib/commonjs/api/drm/ContentProtectionIntegrationFactory.d.ts +1 -0
  272. package/lib/typescript/lib/commonjs/api/drm/ContentProtectionRequest.d.ts +0 -0
  273. package/lib/typescript/lib/commonjs/api/drm/ContentProtectionResponse.d.ts +1 -0
  274. package/lib/typescript/lib/commonjs/api/drm/barrel.d.ts +1 -0
  275. package/lib/typescript/lib/commonjs/api/event/AdEvent.d.ts +2 -0
  276. package/lib/typescript/lib/commonjs/api/source/ads/FreeWheelAdDescription.d.ts +1 -0
  277. package/lib/typescript/lib/commonjs/api/source/ads/IMAAdDescription.d.ts +1 -0
  278. package/lib/typescript/lib/commonjs/api/source/ads/SpotXAdDescription.d.ts +1 -0
  279. package/lib/typescript/lib/commonjs/api/source/ads/THEOplayerAdDescription.d.ts +1 -0
  280. package/lib/typescript/lib/commonjs/api/source/ads/barrel.d.ts +1 -0
  281. package/lib/typescript/lib/commonjs/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +1 -0
  282. package/lib/typescript/lib/commonjs/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +1 -0
  283. package/lib/typescript/lib/commonjs/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +1 -0
  284. package/lib/typescript/lib/commonjs/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +1 -0
  285. package/lib/typescript/lib/commonjs/api/source/ads/ssai/barrel.d.ts +1 -0
  286. package/lib/typescript/lib/commonjs/api/track/MediaTrack.d.ts +8 -0
  287. package/lib/typescript/lib/commonjs/api/utils/TypeUtils.d.ts +13 -0
  288. package/lib/typescript/lib/commonjs/api/utils/barrel.d.ts +1 -0
  289. package/lib/typescript/lib/commonjs/index.d.ts +2 -0
  290. package/lib/typescript/lib/commonjs/internal/THEOplayerView.d.ts +5 -0
  291. package/lib/typescript/lib/commonjs/internal/THEOplayerView.web.d.ts +4 -0
  292. package/lib/typescript/lib/commonjs/internal/ads/THEOplayerNativeAdsAPI.d.ts +14 -0
  293. package/lib/typescript/lib/commonjs/internal/ads/THEOplayerNativeGoogleDAI.d.ts +9 -0
  294. package/lib/typescript/lib/commonjs/internal/ads/THEOplayerWebAdsAPI.d.ts +14 -0
  295. package/lib/typescript/lib/commonjs/internal/ads/THEOplayerWebGoogleDAI.d.ts +9 -0
  296. package/lib/typescript/lib/commonjs/internal/drm/ContentProtectionRegistry.d.ts +14 -0
  297. package/lib/typescript/lib/commonjs/internal/drm/ContentProtectionRegistry.web.d.ts +5 -0
  298. package/lib/typescript/lib/commonjs/internal/drm/NativeCertificateRequest.d.ts +18 -0
  299. package/lib/typescript/lib/commonjs/internal/drm/NativeCertificateResponse.d.ts +21 -0
  300. package/lib/typescript/lib/commonjs/internal/drm/NativeContentProtectionEvent.d.ts +0 -0
  301. package/lib/typescript/lib/commonjs/internal/drm/NativeLicenseRequest.d.ts +20 -0
  302. package/lib/typescript/lib/commonjs/internal/drm/NativeLicenseResponse.d.ts +22 -0
  303. package/lib/typescript/lib/commonjs/internal/utils/TypeUtils.d.ts +6 -0
  304. package/lib/typescript/lib/commonjs/internal/web/TrackUtils.d.ts +2 -0
  305. package/lib/typescript/lib/module/api/abr/ABRConfiguration.d.ts +0 -0
  306. package/lib/typescript/lib/module/api/abr/barrel.d.ts +1 -0
  307. package/lib/typescript/lib/module/api/ads/Ad.d.ts +1 -0
  308. package/lib/typescript/lib/module/api/ads/AdBreak.d.ts +1 -0
  309. package/lib/typescript/lib/module/api/ads/AdsAPI.d.ts +1 -0
  310. package/lib/typescript/lib/module/api/ads/AdsConfiguration.d.ts +1 -0
  311. package/lib/typescript/lib/module/api/ads/CompanionAd.d.ts +0 -0
  312. package/lib/typescript/lib/module/api/ads/GoogleDai.d.ts +0 -0
  313. package/lib/typescript/lib/module/api/ads/GoogleImaAd.d.ts +1 -0
  314. package/lib/typescript/lib/module/api/ads/GoogleImaConfiguration.d.ts +0 -0
  315. package/lib/typescript/lib/module/api/ads/barrel.d.ts +5 -0
  316. package/lib/typescript/lib/module/api/barrel.d.ts +5 -1
  317. package/lib/typescript/lib/module/api/config/PlayerConfiguration.d.ts +1 -0
  318. package/lib/typescript/lib/module/api/config/barrel.d.ts +1 -1
  319. package/lib/typescript/lib/module/api/drm/ContentProtectionAPI.d.ts +1 -0
  320. package/lib/typescript/lib/module/api/drm/ContentProtectionIntegration.d.ts +1 -0
  321. package/lib/typescript/lib/module/api/drm/ContentProtectionIntegrationFactory.d.ts +1 -0
  322. package/lib/typescript/lib/module/api/drm/ContentProtectionRequest.d.ts +0 -0
  323. package/lib/typescript/lib/module/api/drm/ContentProtectionResponse.d.ts +1 -0
  324. package/lib/typescript/lib/module/api/drm/barrel.d.ts +4 -0
  325. package/lib/typescript/lib/module/api/event/AdEvent.d.ts +1 -0
  326. package/lib/typescript/lib/module/api/event/barrel.d.ts +1 -0
  327. package/lib/typescript/lib/module/api/source/ads/FreeWheelAdDescription.d.ts +1 -0
  328. package/lib/typescript/lib/module/api/source/ads/IMAAdDescription.d.ts +1 -0
  329. package/lib/typescript/lib/module/api/source/ads/SpotXAdDescription.d.ts +1 -0
  330. package/lib/typescript/lib/module/api/source/ads/THEOplayerAdDescription.d.ts +1 -0
  331. package/lib/typescript/lib/module/api/source/ads/barrel.d.ts +5 -0
  332. package/lib/typescript/lib/module/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +1 -0
  333. package/lib/typescript/lib/module/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +1 -0
  334. package/lib/typescript/lib/module/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +1 -0
  335. package/lib/typescript/lib/module/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +1 -0
  336. package/lib/typescript/lib/module/api/source/ads/ssai/barrel.d.ts +4 -0
  337. package/lib/typescript/lib/module/api/source/barrel.d.ts +1 -0
  338. package/lib/typescript/lib/module/api/track/MediaTrack.d.ts +8 -1
  339. package/lib/typescript/lib/module/api/utils/TypeUtils.d.ts +12 -0
  340. package/lib/typescript/lib/module/api/utils/barrel.d.ts +1 -0
  341. package/lib/typescript/lib/module/index.d.ts +1 -0
  342. package/lib/typescript/lib/module/internal/THEOplayerView.d.ts +8 -0
  343. package/lib/typescript/lib/module/internal/THEOplayerView.web.d.ts +4 -0
  344. package/lib/typescript/lib/module/internal/ads/THEOplayerNativeAdsAPI.d.ts +13 -0
  345. package/lib/typescript/lib/module/internal/ads/THEOplayerNativeGoogleDAI.d.ts +8 -0
  346. package/lib/typescript/lib/module/internal/ads/THEOplayerWebAdsAPI.d.ts +13 -0
  347. package/lib/typescript/lib/module/internal/ads/THEOplayerWebGoogleDAI.d.ts +8 -0
  348. package/lib/typescript/lib/module/internal/drm/ContentProtectionRegistry.d.ts +13 -0
  349. package/lib/typescript/lib/module/internal/drm/ContentProtectionRegistry.web.d.ts +4 -0
  350. package/lib/typescript/lib/module/internal/drm/NativeCertificateRequest.d.ts +17 -0
  351. package/lib/typescript/lib/module/internal/drm/NativeCertificateResponse.d.ts +20 -0
  352. package/lib/typescript/lib/module/internal/drm/NativeContentProtectionEvent.d.ts +0 -0
  353. package/lib/typescript/lib/module/internal/drm/NativeLicenseRequest.d.ts +19 -0
  354. package/lib/typescript/lib/module/internal/drm/NativeLicenseResponse.d.ts +21 -0
  355. package/lib/typescript/lib/module/internal/utils/TypeUtils.d.ts +5 -0
  356. package/lib/typescript/lib/module/internal/web/TrackUtils.d.ts +2 -0
  357. package/lib/typescript/src/api/THEOplayerView.d.ts +25 -4
  358. package/lib/typescript/src/api/abr/ABRConfiguration.d.ts +95 -0
  359. package/lib/typescript/src/api/abr/barrel.d.ts +1 -0
  360. package/lib/typescript/src/api/ads/Ad.d.ts +238 -0
  361. package/lib/typescript/src/api/ads/AdBreak.d.ts +39 -0
  362. package/lib/typescript/src/api/ads/AdsAPI.d.ts +46 -0
  363. package/lib/typescript/src/api/ads/AdsConfiguration.d.ts +69 -0
  364. package/lib/typescript/src/api/ads/CompanionAd.d.ts +59 -0
  365. package/lib/typescript/src/api/ads/GoogleDai.d.ts +29 -0
  366. package/lib/typescript/src/api/ads/GoogleImaAd.d.ts +78 -0
  367. package/lib/typescript/src/api/ads/GoogleImaConfiguration.d.ts +13 -0
  368. package/lib/typescript/src/api/ads/barrel.d.ts +8 -0
  369. package/lib/typescript/src/api/barrel.d.ts +5 -1
  370. package/lib/typescript/src/api/config/PlayerConfiguration.d.ts +5 -0
  371. package/lib/typescript/src/api/drm/ContentProtectionAPI.d.ts +5 -0
  372. package/lib/typescript/src/api/drm/ContentProtectionIntegration.d.ts +86 -0
  373. package/lib/typescript/src/api/drm/ContentProtectionIntegrationFactory.d.ts +15 -0
  374. package/lib/typescript/src/api/drm/ContentProtectionRequest.d.ts +56 -0
  375. package/lib/typescript/src/api/drm/ContentProtectionResponse.d.ts +56 -0
  376. package/lib/typescript/src/api/drm/barrel.d.ts +5 -0
  377. package/lib/typescript/src/api/event/AdEvent.d.ts +13 -0
  378. package/lib/typescript/src/api/event/barrel.d.ts +1 -0
  379. package/lib/typescript/src/api/source/SourceDescription.d.ts +8 -0
  380. package/lib/typescript/src/api/source/ads/FreeWheelAdDescription.d.ts +85 -0
  381. package/lib/typescript/src/api/source/ads/IMAAdDescription.d.ts +25 -0
  382. package/lib/typescript/src/api/source/ads/SpotXAdDescription.d.ts +115 -0
  383. package/lib/typescript/src/api/source/ads/THEOplayerAdDescription.d.ts +32 -0
  384. package/lib/typescript/src/api/source/ads/barrel.d.ts +6 -0
  385. package/lib/typescript/src/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +130 -0
  386. package/lib/typescript/src/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +27 -0
  387. package/lib/typescript/src/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +26 -0
  388. package/lib/typescript/src/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +46 -0
  389. package/lib/typescript/src/api/source/ads/ssai/barrel.d.ts +4 -0
  390. package/lib/typescript/src/api/source/barrel.d.ts +1 -0
  391. package/lib/typescript/src/api/source/drm/DRMConfiguration.d.ts +0 -30
  392. package/lib/typescript/src/api/track/MediaTrack.d.ts +5 -2
  393. package/lib/typescript/src/api/utils/TypeUtils.d.ts +20 -0
  394. package/lib/typescript/src/api/utils/barrel.d.ts +1 -0
  395. package/lib/typescript/src/index.d.ts +1 -0
  396. package/lib/typescript/src/internal/THEOplayerView.d.ts +10 -4
  397. package/lib/typescript/src/internal/THEOplayerView.web.d.ts +7 -2
  398. package/lib/typescript/src/internal/ads/THEOplayerNativeAdsAPI.d.ts +17 -0
  399. package/lib/typescript/src/internal/ads/THEOplayerNativeGoogleDAI.d.ts +10 -0
  400. package/lib/typescript/src/internal/ads/THEOplayerWebAdsAPI.d.ts +15 -0
  401. package/lib/typescript/src/internal/ads/THEOplayerWebGoogleDAI.d.ts +10 -0
  402. package/lib/typescript/src/internal/drm/ContentProtectionRegistry.d.ts +19 -0
  403. package/lib/typescript/src/internal/drm/ContentProtectionRegistry.web.d.ts +5 -0
  404. package/lib/typescript/src/internal/drm/NativeCertificateRequest.d.ts +13 -0
  405. package/lib/typescript/src/internal/drm/NativeCertificateResponse.d.ts +18 -0
  406. package/lib/typescript/src/internal/drm/NativeContentProtectionEvent.d.ts +5 -0
  407. package/lib/typescript/src/internal/drm/NativeLicenseRequest.d.ts +14 -0
  408. package/lib/typescript/src/internal/drm/NativeLicenseResponse.d.ts +18 -0
  409. package/lib/typescript/src/internal/utils/TypeUtils.d.ts +5 -0
  410. package/lib/typescript/src/internal/web/TrackUtils.d.ts +3 -1
  411. package/package.json +4 -3
  412. package/src/api/THEOplayerView.ts +29 -4
  413. package/src/api/abr/ABRConfiguration.ts +103 -0
  414. package/src/api/abr/barrel.ts +1 -0
  415. package/src/api/ads/Ad.ts +267 -0
  416. package/src/api/ads/AdBreak.ts +44 -0
  417. package/src/api/ads/AdsAPI.ts +53 -0
  418. package/src/api/ads/AdsConfiguration.ts +76 -0
  419. package/src/api/ads/CompanionAd.ts +65 -0
  420. package/src/api/ads/GoogleDai.ts +32 -0
  421. package/src/api/ads/GoogleImaAd.ts +86 -0
  422. package/src/api/ads/GoogleImaConfiguration.ts +13 -0
  423. package/src/api/ads/barrel.ts +8 -0
  424. package/src/api/barrel.ts +5 -1
  425. package/src/api/config/PlayerConfiguration.ts +7 -0
  426. package/src/api/drm/ContentProtectionAPI.ts +6 -0
  427. package/src/api/drm/ContentProtectionIntegration.ts +93 -0
  428. package/src/api/drm/ContentProtectionIntegrationFactory.ts +16 -0
  429. package/src/api/drm/ContentProtectionRequest.ts +60 -0
  430. package/src/api/drm/ContentProtectionResponse.ts +62 -0
  431. package/src/api/drm/barrel.ts +5 -0
  432. package/src/api/event/AdEvent.ts +117 -0
  433. package/src/api/event/barrel.ts +1 -0
  434. package/src/api/source/SourceDescription.ts +9 -0
  435. package/src/api/source/ads/FreeWheelAdDescription.ts +97 -0
  436. package/src/api/source/ads/IMAAdDescription.ts +26 -0
  437. package/src/api/source/ads/SpotXAdDescription.ts +126 -0
  438. package/src/api/source/ads/THEOplayerAdDescription.ts +34 -0
  439. package/src/api/source/ads/barrel.ts +6 -0
  440. package/src/api/source/ads/ssai/GoogleDAIConfiguration.ts +145 -0
  441. package/src/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.ts +30 -0
  442. package/src/api/source/ads/ssai/ServerSideAdInsertionConfiguration.ts +28 -0
  443. package/src/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.ts +51 -0
  444. package/src/api/source/ads/ssai/barrel.ts +4 -0
  445. package/src/api/source/barrel.ts +1 -0
  446. package/src/api/source/drm/DRMConfiguration.ts +0 -35
  447. package/src/api/track/MediaTrack.ts +22 -2
  448. package/src/api/utils/TypeUtils.ts +39 -0
  449. package/src/api/utils/barrel.ts +1 -0
  450. package/src/index.tsx +1 -0
  451. package/src/internal/THEOplayerView.tsx +49 -8
  452. package/src/internal/THEOplayerView.web.tsx +37 -7
  453. package/src/internal/ads/THEOplayerNativeAdsAPI.ts +44 -0
  454. package/src/internal/ads/THEOplayerNativeGoogleDAI.ts +23 -0
  455. package/src/internal/ads/THEOplayerWebAdsAPI.ts +51 -0
  456. package/src/internal/ads/THEOplayerWebGoogleDAI.ts +22 -0
  457. package/src/internal/drm/ContentProtectionRegistry.ts +173 -0
  458. package/src/internal/drm/ContentProtectionRegistry.web.ts +10 -0
  459. package/src/internal/drm/NativeCertificateRequest.ts +41 -0
  460. package/src/internal/drm/NativeCertificateResponse.ts +45 -0
  461. package/src/internal/drm/NativeContentProtectionEvent.ts +5 -0
  462. package/src/internal/drm/NativeLicenseRequest.ts +39 -0
  463. package/src/internal/drm/NativeLicenseResponse.ts +45 -0
  464. package/src/internal/utils/TypeUtils.ts +39 -0
  465. package/src/internal/web/TrackUtils.ts +22 -1
@@ -0,0 +1,155 @@
1
+ //
2
+ // THEOplayerRCTContentProtectionIntegration.swift
3
+ // Theoplayer
4
+ //
5
+ // Created by William van Haevre on 28/10/2022.
6
+ //
7
+
8
+ import Foundation
9
+ import THEOplayerSDK
10
+
11
+ enum ProxyIntegrationError: Error {
12
+ case certificateRequestHandlingFailed
13
+ case certificateResponseHandlingFailed
14
+ case licenseRequestHandlingFailed
15
+ case licenseResponseHandlingFailed
16
+ case extractFairplayContentIdFailed
17
+ }
18
+
19
+ let CERTIFICATE_MARKER: String = "https://certificatemarker/"
20
+ let PROXY_INTEGRATION_TAG: String = "[ProxyContentProtectionIntegration]"
21
+ let BRIDGE_TIMEOUT = 10.0
22
+
23
+ class THEOplayerRCTProxyContentProtectionIntegration: THEOplayerSDK.ContentProtectionIntegration {
24
+ private weak var contentProtectionAPI: THEOplayerRCTContentProtectionAPI?
25
+ private var integrationId: String!
26
+ private var keySystemId: String!
27
+ private var buildIntegrationSemaphore = DispatchSemaphore(value: 0)
28
+ private var contentIdExtractionSemaphore = DispatchSemaphore(value: 0)
29
+ private var drmConfig: THEOplayerSDK.DRMConfiguration
30
+
31
+ init(contentProtectionAPI: THEOplayerRCTContentProtectionAPI?, integrationId: String, keySystemId: String, drmConfig: THEOplayerSDK.DRMConfiguration) {
32
+ self.contentProtectionAPI = contentProtectionAPI
33
+ self.integrationId = integrationId
34
+ self.keySystemId = keySystemId
35
+ self.drmConfig = drmConfig
36
+ self.contentProtectionAPI?.handleBuildIntegration(integrationId: integrationId, keySystemId: keySystemId, drmConfig: drmConfig, completion: { success in
37
+ if success {
38
+ print(PROXY_INTEGRATION_TAG, "Successfully created a THEOplayer ContentProtectionIntegration for \(integrationId) - \(keySystemId)")
39
+ } else {
40
+ print(PROXY_INTEGRATION_TAG, "WARNING: Failed to create a THEOplayer ContentProtectionIntegration for \(integrationId) - \(keySystemId)")
41
+ }
42
+ self.buildIntegrationSemaphore.signal()
43
+ })
44
+ _ = self.buildIntegrationSemaphore.wait(timeout: .now() + BRIDGE_TIMEOUT)
45
+ }
46
+
47
+ func onCertificateRequest(request: CertificateRequest, callback: CertificateRequestCallback) {
48
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "THEOplayer triggered an onCertificateRequest") }
49
+ let processedLocally = self.handleCertificateRequestLocally(drmConfig: drmConfig, callback: callback)
50
+ if !processedLocally {
51
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "Handling certificate request through content protection integration.") }
52
+ self.contentProtectionAPI?.handleCertificateRequest(integrationId: self.integrationId, keySystemId: self.keySystemId, certificateRequest: request) { certificateData, error in
53
+ if let error = error {
54
+ callback.error(error: error)
55
+ return
56
+ }
57
+ if let data = certificateData {
58
+ callback.respond(certificate: data)
59
+ } else {
60
+ callback.error(error: ProxyIntegrationError.certificateRequestHandlingFailed)
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ func onCertificateResponse(response: CertificateResponse, callback: CertificateResponseCallback) {
67
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "THEOplayer triggered an onCertificateResponse") }
68
+ self.contentProtectionAPI?.handleCertificateResponse(integrationId: self.integrationId, keySystemId: self.keySystemId, certificateResponse: response) { certificateData, error in
69
+ if let error = error {
70
+ callback.error(error: error)
71
+ return
72
+ }
73
+ if let data = certificateData {
74
+ callback.respond(certificate: data)
75
+ } else {
76
+ callback.error(error: ProxyIntegrationError.certificateResponseHandlingFailed)
77
+ }
78
+ }
79
+ }
80
+
81
+ func onLicenseRequest(request: LicenseRequest, callback: LicenseRequestCallback) {
82
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "THEOplayer triggered an onLicenseRequest") }
83
+ self.contentProtectionAPI?.handleLicenseRequest(integrationId: self.integrationId, keySystemId: self.keySystemId, licenseRequest: request) { licenseData, error in
84
+ if let error = error {
85
+ callback.error(error: error)
86
+ return
87
+ }
88
+ if let data = licenseData {
89
+ callback.respond(license: data)
90
+ } else {
91
+ callback.error(error: ProxyIntegrationError.licenseRequestHandlingFailed)
92
+ }
93
+ }
94
+ }
95
+
96
+ func onLicenseResponse(response: LicenseResponse, callback: LicenseResponseCallback) {
97
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "THEOplayer triggered an onLicenseResponse") }
98
+ self.contentProtectionAPI?.handleLicenseResponse(integrationId: self.integrationId, keySystemId: self.keySystemId, licenseResponse: response) { licenseData, error in
99
+ if let error = error {
100
+ callback.error(error: error)
101
+ return
102
+ }
103
+ if let data = licenseData {
104
+ callback.respond(license: data)
105
+ } else {
106
+ callback.error(error: ProxyIntegrationError.licenseResponseHandlingFailed)
107
+ }
108
+ }
109
+ }
110
+
111
+ func extractFairplayContentId(skdUrl: String) -> String {
112
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "THEOplayer triggered an extractFairplayContentId") }
113
+ var extractedContentId = skdUrl
114
+ self.contentProtectionAPI?.handleExtractFairplayContentId(integrationId: self.integrationId, keySystemId: self.keySystemId, skdUrl: skdUrl) { contentId, error in
115
+ if let error = error {
116
+ extractedContentId = skdUrl
117
+ print(PROXY_INTEGRATION_TAG, "We encountered an issue while extracting the fairplay contentId: \(error.localizedDescription)")
118
+ self.contentIdExtractionSemaphore.signal()
119
+ return
120
+ }
121
+ extractedContentId = contentId
122
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "Received extracted fairplay contentId \(extractedContentId) on RN bridge") }
123
+ self.contentIdExtractionSemaphore.signal()
124
+ }
125
+ // TODO: make extractFairplayContentId async on THEOplayer SDK
126
+ // FOR NOW: We temporarily block (topped to max 5 sec) the flow to retrieve the extracted contentId asynchronously.
127
+ _ = self.contentIdExtractionSemaphore.wait(timeout: .now() + BRIDGE_TIMEOUT)
128
+ return extractedContentId
129
+ }
130
+
131
+ // MARK: local certificate handling
132
+ private func handleCertificateRequestLocally(drmConfig: THEOplayerSDK.DRMConfiguration, callback: CertificateRequestCallback) -> Bool {
133
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "Checking for certificate in drmConfiguration...") }
134
+ var fairplayConfig: THEOplayerSDK.KeySystemConfiguration?
135
+ if let multiDrmConfigCollection = drmConfig as? THEOplayerSDK.MultiplatformDRMConfiguration {
136
+ let keySystemConfigurations: THEOplayerSDK.KeySystemConfigurationCollection = multiDrmConfigCollection.keySystemConfigurations
137
+ fairplayConfig = keySystemConfigurations.fairplay
138
+ } else if let fairplayDrmConfig = drmConfig as? THEOplayerSDK.FairPlayDRMConfiguration {
139
+ fairplayConfig = fairplayDrmConfig.fairplay
140
+ }
141
+
142
+ if let fairplay = fairplayConfig,
143
+ let certificateUrl = fairplay.certificateURL?.absoluteString,
144
+ certificateUrl.hasPrefix(CERTIFICATE_MARKER) {
145
+ let certificateBase64 = String(certificateUrl.suffix(from: CERTIFICATE_MARKER.endIndex))
146
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_INTEGRATION_TAG, "Using provided base64 certificate: \(certificateBase64)") }
147
+ if let certificateData = Data(base64Encoded: certificateBase64, options: .ignoreUnknownCharacters) {
148
+ callback.respond(certificate: certificateData)
149
+ return true
150
+ }
151
+ }
152
+
153
+ return false
154
+ }
155
+ }
@@ -0,0 +1,32 @@
1
+ //
2
+ // THEOplayerRCTContentProtectionIntegrationFactory.swift
3
+ // Theoplayer
4
+ //
5
+ // Created by William van Haevre on 28/10/2022.
6
+ //
7
+
8
+ import Foundation
9
+ import THEOplayerSDK
10
+
11
+ let PROXY_FACTORY_TAG: String = "[ProxyContentProtectionIntegrationFactory]"
12
+
13
+ class THEOplayerRCTProxyContentProtectionIntegrationFactory: THEOplayerSDK.ContentProtectionIntegrationFactory {
14
+ private weak var contentProtectionAPI: THEOplayerRCTContentProtectionAPI?
15
+ private var integrationId: String!
16
+ private var keySystemId: String!
17
+
18
+ init(contentProtectionAPI: THEOplayerRCTContentProtectionAPI, integrationId: String, keySystemId: String) {
19
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_FACTORY_TAG, "Proxy ContentProtectionIntegrationFactory initialised for \(integrationId)-\(keySystemId).") }
20
+ self.contentProtectionAPI = contentProtectionAPI
21
+ self.integrationId = integrationId
22
+ self.keySystemId = keySystemId
23
+ }
24
+
25
+ func build(configuration: THEOplayerSDK.DRMConfiguration) -> ContentProtectionIntegration {
26
+ if DEBUG_CONTENT_PROTECTION_API { print(PROXY_FACTORY_TAG, "Building proxy ContentProtectionIntegration for \(self.integrationId ?? "") - \(self.keySystemId ?? "").") }
27
+ return THEOplayerRCTProxyContentProtectionIntegration(contentProtectionAPI: self.contentProtectionAPI,
28
+ integrationId: self.integrationId,
29
+ keySystemId: self.keySystemId,
30
+ drmConfig: configuration)
31
+ }
32
+ }
@@ -7,15 +7,34 @@ import UIKit
7
7
  let SD_PROP_SOURCES: String = "sources"
8
8
  let SD_PROP_POSTER: String = "poster"
9
9
  let SD_PROP_TEXTTRACKS: String = "textTracks"
10
+ let SD_PROP_ADS: String = "ads"
10
11
  let SD_PROP_SRC: String = "src"
11
12
  let SD_PROP_TYPE: String = "type"
13
+ let SD_PROP_SSAI: String = "ssai"
12
14
  let SD_PROP_INTEGRATION: String = "integration"
15
+ let SD_PROP_INTEGRATION_PARAMETERS: String = "integrationParameters"
16
+ let SD_PROP_AVAILABILITY_TYPE: String = "availabilityType"
17
+ let SD_PROP_AUTH_TOKEN: String = "authToken"
18
+ let SD_PROP_STREAM_ACTIVITY_MONITOR_ID: String = "streamActivityMonitorID"
19
+ let SD_PROP_AD_TAG_PARAMETERS: String = "adTagParameters"
20
+ let SD_PROP_APIKEY: String = "apiKey"
21
+ let SD_PROP_VIDEOID: String = "videoID"
22
+ let SD_PROP_CONTENT_SOURCE_ID: String = "contentSourceID"
23
+ let SD_PROP_ASSET_KEY: String = "assetKey"
24
+ let SD_PROP_TIME_OFFSET: String = "timeOffset"
13
25
  let SD_PROP_SRC_LANG: String = "srclang"
14
26
  let SD_PROP_DEFAULT: String = "default"
15
27
  let SD_PROP_LABEL: String = "label"
16
28
  let SD_PROP_KIND: String = "kind"
17
29
  let SD_PROP_FORMAT: String = "format"
18
30
  let SD_PROP_CONTENT_PROTECTION: String = "contentProtection"
31
+ let SD_PROP_FAIRPLAY: String = "fairplay"
32
+ let SD_PROP_WIDEVINE: String = "widevine"
33
+ let SD_PROP_CERTIFICATE: String = "certificate"
34
+ let SD_PROP_CERTIFICATE_URL: String = "certificateURL"
35
+ let SD_PROP_LICENSE_URL: String = "licenseAcquisitionURL"
36
+ let SD_PROP_HEADERS: String = "headers"
37
+ let SD_PROP_LICENSE_TYPE: String = "licenseType"
19
38
 
20
39
  let EXTENSION_HLS: String = ".m3u8"
21
40
  let EXTENSION_MP4: String = ".mp4"
@@ -30,9 +49,9 @@ let DRM_INTEGRATION_ID_KEYOS = "keyos"
30
49
  let DRM_INTEGRATION_ID_VERIMATRIX = "verimatrix"
31
50
 
32
51
  class THEOplayerRCTSourceDescriptionBuilder {
33
-
52
+
34
53
  /**
35
- Builds a THEOplayer SourceDescription that can be passed as a source for the THEOplayer.
54
+ Builds a THEOplayer SourceDescription that can be passed as a source for the THEOplayer.
36
55
  - returns: a THEOplayer TypedSource. In case of SSAI we support GoogleDAITypedSource with GoogleDAIVodConfiguration or GoogleDAILiveConfiguration
37
56
  */
38
57
  static func buildSourceDescription(_ sourceData: NSDictionary) -> SourceDescription? {
@@ -40,7 +59,7 @@ class THEOplayerRCTSourceDescriptionBuilder {
40
59
  guard let sourcesData = sourceData[SD_PROP_SOURCES] else {
41
60
  return nil
42
61
  }
43
-
62
+
44
63
  var typedSources: [TypedSource] = []
45
64
  // case: array of source objects
46
65
  if let sourcesDataArray = sourcesData as? [[String:Any]] {
@@ -66,10 +85,10 @@ class THEOplayerRCTSourceDescriptionBuilder {
66
85
  return nil
67
86
  }
68
87
  }
69
-
88
+
70
89
  // 2. extract 'poster'
71
90
  let poster = sourceData[SD_PROP_POSTER] as? String
72
-
91
+
73
92
  // 3. extract 'textTracks'
74
93
  var textTrackDescriptions: [TextTrackDescription]?
75
94
  if let textTracksDataArray = sourceData[SD_PROP_TEXTTRACKS] as? [[String:Any]] {
@@ -84,20 +103,54 @@ class THEOplayerRCTSourceDescriptionBuilder {
84
103
  return nil
85
104
  }
86
105
  }
87
-
106
+
88
107
  }
89
-
90
- // 4. construct and return SourceDescription
108
+
109
+ // 4. extract Google IMA "ads"
110
+ var adsDescriptions: [AdDescription]?
111
+
112
+ #if ADS && GOOGLE_IMA
113
+ if let ads = sourceData[SD_PROP_ADS] {
114
+ adsDescriptions = []
115
+ // case: array of ads objects
116
+ if let adsDataArray = ads as? [[String:Any]] {
117
+ for adsData in adsDataArray {
118
+ if let adDescription = THEOplayerRCTSourceDescriptionBuilder.buildAdDescription(adsData) {
119
+ adsDescriptions?.append(adDescription)
120
+ } else {
121
+ if DEBUG_SOURCE_DESCRIPTION_BUIDER {
122
+ print("[NATIVE] Could not create THEOplayer GoogleImaAdDescription from adsData array")
123
+ }
124
+ return nil
125
+ }
126
+ }
127
+ }
128
+ // case: single ads object
129
+ else if let adsData = ads as? [String:Any] {
130
+ if let adDescription = THEOplayerRCTSourceDescriptionBuilder.buildAdDescription(adsData) {
131
+ adsDescriptions?.append(adDescription)
132
+ } else {
133
+ if DEBUG_SOURCE_DESCRIPTION_BUIDER {
134
+ print("[NATIVE] Could not create THEOplayer GoogleImaAdDescription from adsData")
135
+ }
136
+ return nil
137
+ }
138
+ }
139
+ }
140
+ #endif
141
+
142
+ // 5. construct and return SourceDescription
91
143
  return SourceDescription(sources: typedSources,
92
144
  textTracks: textTrackDescriptions,
145
+ ads: adsDescriptions,
93
146
  poster: poster,
94
147
  metadata: nil) // TODO
95
148
  }
96
-
149
+
97
150
  // MARK: Private build methods
98
-
151
+
99
152
  /**
100
- Creates a THEOplayer TypedSource. This requires a source property for non SSAI strreams (either as a string or as an object contiaining a src property). For SSAI streams the TypeSource can be created from the ssai property.
153
+ Creates a THEOplayer TypedSource. This requires a source property for non SSAI strreams (either as a string or as an object contiaining a src property). For SSAI streams the TypeSource can be created from the ssai property.
101
154
  - returns: a THEOplayer TypedSource. In case of SSAI we support GoogleDAITypedSource with GoogleDAIVodConfiguration or GoogleDAILiveConfiguration
102
155
  */
103
156
  private static func buildTypedSource(_ typedSourceData: [String:Any]) -> TypedSource? {
@@ -107,33 +160,77 @@ class THEOplayerRCTSourceDescriptionBuilder {
107
160
  // check for a contentProtection
108
161
  var contentProtection: MultiplatformDRMConfiguration?
109
162
  if let contentProtectionData = typedSourceData[SD_PROP_CONTENT_PROTECTION] as? [String:Any] {
110
- contentProtection = THEOplayerRCTSourceDescriptionBuilder.buildContentProtection(contentProtectionData)
163
+ let sanitisedContentProtectionData = THEOplayerRCTSourceDescriptionBuilder.sanitiseContentProtectionData(contentProtectionData)
164
+ contentProtection = THEOplayerRCTSourceDescriptionBuilder.buildContentProtection(sanitisedContentProtectionData)
111
165
  }
112
-
166
+
113
167
  return TypedSource(src: src,
114
168
  type: type,
115
169
  drm: contentProtection)
116
170
  }
117
171
 
172
+ #if ADS && GOOGLE_DAI
173
+ // check for alternative Google DAI SSAI
174
+ if let ssaiData = typedSourceData[SD_PROP_SSAI] as? [String:Any] {
175
+ if let integration = ssaiData[SD_PROP_INTEGRATION] as? String,
176
+ integration == SSAIIntegrationId.GoogleDAISSAIIntegrationID._rawValue {
177
+ if let availabilityType = ssaiData[SD_PROP_AVAILABILITY_TYPE] as? String {
178
+ // build a GoogleDAIConfiguration
179
+ var googleDaiConfig: GoogleDAIConfiguration?
180
+ let authToken = ssaiData[SD_PROP_AUTH_TOKEN] as? String
181
+ let streamActivityMonitorID = ssaiData[SD_PROP_STREAM_ACTIVITY_MONITOR_ID] as? String
182
+ let adTagParameters = ssaiData[SD_PROP_AD_TAG_PARAMETERS] as? [String:String]
183
+ let apiKey = ssaiData[SD_PROP_APIKEY] as? String ?? ""
184
+ switch availabilityType {
185
+ case StreamType.vod._rawValue:
186
+ if let videoId = ssaiData[SD_PROP_VIDEOID] as? String,
187
+ let contentSourceID = ssaiData[SD_PROP_CONTENT_SOURCE_ID] as? String {
188
+ googleDaiConfig = GoogleDAIVodConfiguration(videoID: videoId,
189
+ contentSourceID: contentSourceID,
190
+ apiKey: apiKey,
191
+ authToken: authToken,
192
+ streamActivityMonitorID: streamActivityMonitorID,
193
+ adTagParameters: adTagParameters)
194
+ }
195
+ case StreamType.live._rawValue:
196
+ if let assetKey = ssaiData[SD_PROP_ASSET_KEY] as? String {
197
+ googleDaiConfig = GoogleDAILiveConfiguration(assetKey: assetKey,
198
+ apiKey: apiKey,
199
+ authToken: authToken,
200
+ streamActivityMonitorID: streamActivityMonitorID,
201
+ adTagParameters: adTagParameters)
202
+ }
203
+ default:
204
+ if DEBUG_SOURCE_DESCRIPTION_BUIDER {
205
+ print("[NATIVE] THEOplayer ssai 'availabilityType' must be 'live' or 'vod'")
206
+ }
207
+ return nil
208
+ }
209
+ // when valid, create a GoolgeDAITypedSource from the GoogleDAIConfiguration
210
+ if let config = googleDaiConfig {
211
+ return GoogleDAITypedSource(ssai: config)
212
+ }
213
+ }
214
+ }
215
+ }
216
+ #endif
118
217
  if DEBUG_SOURCE_DESCRIPTION_BUIDER {
119
218
  print("[NATIVE] THEOplayer TypedSource requires 'src' property in 'sources' description")
120
219
  }
121
220
  return nil
122
221
  }
123
-
222
+
124
223
  /**
125
- Creates a THEOplayer TextTrackDescription. This requires a textTracks property in the RN source description.
224
+ Creates a THEOplayer TextTrackDescription. This requires a textTracks property in the RN source description.
126
225
  - returns: a THEOplayer TextTrackDescription
127
226
  */
128
227
  private static func buildTextTrackDescriptions(_ textTracksData: [String:Any]) -> TextTrackDescription? {
129
- if let textTrackSrc = textTracksData[SD_PROP_SRC] as? String,
130
- let textTrackSrcLang = textTracksData[SD_PROP_SRC_LANG] as? String {
228
+ if let textTrackSrc = textTracksData[SD_PROP_SRC] as? String {
229
+ let textTrackSrcLang = textTracksData[SD_PROP_SRC_LANG] as? String ?? ""
131
230
  let textTrackIsDefault = textTracksData[SD_PROP_DEFAULT] as? Bool
132
231
  let textTrackLabel = textTracksData[SD_PROP_LABEL] as? String
133
232
  let textTrackKind = THEOplayerRCTSourceDescriptionBuilder.extractTextTrackKind(textTracksData[SD_PROP_KIND] as? String)
134
233
  let textTrackFormat = THEOplayerRCTSourceDescriptionBuilder.extractTextTrackFormat(textTracksData[SD_PROP_FORMAT] as? String)
135
- print(textTrackKind._rawValue)
136
- print(textTrackFormat._rawValue)
137
234
  return TextTrackDescription(src: textTrackSrc,
138
235
  srclang: textTrackSrcLang,
139
236
  isDefault: textTrackIsDefault,
@@ -143,9 +240,105 @@ class THEOplayerRCTSourceDescriptionBuilder {
143
240
  }
144
241
  return nil
145
242
  }
146
-
243
+
244
+ #if ADS && GOOGLE_IMA
147
245
  /**
148
- Creates a THEOplayer DRMConfiguration. This requires a contentProtection property in the RN source description.
246
+ Creates a THEOplayer GoogleImaAdDescription. This requires an ads property in the RN source description.
247
+ - returns: a THEOplayer GoogleImaAdDescription
248
+ */
249
+ static func buildAdDescription(_ adsData: [String:Any]) -> AdDescription? {
250
+ if let integration = adsData[SD_PROP_INTEGRATION] as? String,
251
+ integration == AdIntegration.google_ima._rawValue {
252
+ // timeOffset can be Int or String: 10, "01:32:54.78", "1234.56", "start", "end", "10%", ...
253
+ let timeOffset = adsData[SD_PROP_TIME_OFFSET] as? String ?? String(adsData[SD_PROP_TIME_OFFSET] as? Int ?? 0)
254
+ var srcString: String?
255
+ if let sourcesData = adsData[SD_PROP_SOURCES] as? [String:Any] {
256
+ srcString = sourcesData[SD_PROP_SRC] as? String
257
+ } else if let sourcesData = adsData[SD_PROP_SOURCES] as? String {
258
+ srcString = sourcesData
259
+ }
260
+ if let src = srcString {
261
+ return GoogleImaAdDescription(src: src, timeOffset: timeOffset)
262
+ } else {
263
+ if DEBUG_SOURCE_DESCRIPTION_BUIDER { print("[NATIVE] AdDescription requires 'src' property in 'ads' description.") }
264
+ }
265
+ }
266
+ if DEBUG_SOURCE_DESCRIPTION_BUIDER { print("[NATIVE] We currently require and only support the 'google-ima' integration in the 'ads' description.") }
267
+ return nil
268
+ }
269
+ #endif
270
+
271
+ /**
272
+ Updates the contentProtectionData to a valid iOS SDK contentProtectionData, flattening out cross SDK differences
273
+ - returns: a THEOplayer valid contentProtection data map
274
+ */
275
+ private static func sanitiseContentProtectionData(_ contentProtectionData: [String:Any]) -> [String:Any] {
276
+ var sanitisedContentProtectionData: [String:Any] = [:]
277
+ // integration
278
+ let sanitisedIntegration = contentProtectionData[SD_PROP_INTEGRATION] as? String
279
+ sanitisedContentProtectionData[SD_PROP_INTEGRATION] = sanitisedIntegration
280
+ // integrationParameters
281
+ let sanitisedIntegrationParameters = contentProtectionData[SD_PROP_INTEGRATION_PARAMETERS] as? [String:Any]
282
+ sanitisedContentProtectionData[SD_PROP_INTEGRATION_PARAMETERS] = sanitisedIntegrationParameters
283
+ // headers
284
+ if let headers = contentProtectionData[SD_PROP_HEADERS] as? [String:String] {
285
+ sanitisedContentProtectionData[SD_PROP_HEADERS] = headers
286
+ }
287
+ // fairplay
288
+ if let fairplayData = contentProtectionData[SD_PROP_FAIRPLAY] as? [String:Any] {
289
+ var sanitisedFairplayData: [String:Any] = [:]
290
+ // certificateUrl
291
+ if let certificateUrl = fairplayData[SD_PROP_CERTIFICATE_URL] as? String {
292
+ sanitisedFairplayData[SD_PROP_CERTIFICATE_URL] = certificateUrl
293
+ }
294
+ // convert certifiate into certificteUrl with marker prefix (also supported by THEOplayer Web SDK
295
+ if let certificate = fairplayData[SD_PROP_CERTIFICATE] as? String {
296
+ sanitisedFairplayData[SD_PROP_CERTIFICATE_URL] = "\(CERTIFICATE_MARKER)\(certificate)"
297
+ }
298
+ // licenseAcquisitionURL
299
+ if let licenseAcquisitionURL = fairplayData[SD_PROP_LICENSE_URL] as? String {
300
+ sanitisedFairplayData[SD_PROP_LICENSE_URL] = licenseAcquisitionURL
301
+ }
302
+ // headers
303
+ if let headers = fairplayData[SD_PROP_HEADERS] as? [String:String] {
304
+ sanitisedFairplayData[SD_PROP_HEADERS] = headers
305
+ }
306
+ // licenseType
307
+ if let licenseType = fairplayData[SD_PROP_LICENSE_TYPE] as? String {
308
+ sanitisedFairplayData[SD_PROP_LICENSE_TYPE] = licenseType
309
+ }
310
+ sanitisedContentProtectionData[SD_PROP_FAIRPLAY] = sanitisedFairplayData
311
+ }
312
+ // widevine
313
+ if let widevineData = contentProtectionData[SD_PROP_WIDEVINE] as? [String:Any] {
314
+ var sanitisedWidevineData: [String:Any] = [:]
315
+ // certificateUrl
316
+ if let certificateUrl = widevineData[SD_PROP_CERTIFICATE_URL] as? String {
317
+ sanitisedWidevineData[SD_PROP_CERTIFICATE_URL] = certificateUrl
318
+ }
319
+ // convert certifiate into certificteUrl with marker prefix (also supported by THEOplayer Web SDK
320
+ if let certificate = widevineData[SD_PROP_CERTIFICATE] as? String {
321
+ sanitisedWidevineData[SD_PROP_CERTIFICATE_URL] = "\(CERTIFICATE_MARKER)\(certificate)"
322
+ }
323
+ // licenseAcquisitionURL
324
+ if let licenseAcquisitionURL = widevineData[SD_PROP_LICENSE_URL] as? String {
325
+ sanitisedWidevineData[SD_PROP_LICENSE_URL] = licenseAcquisitionURL
326
+ }
327
+ // headers
328
+ if let headers = widevineData[SD_PROP_HEADERS] as? [String:String] {
329
+ sanitisedWidevineData[SD_PROP_HEADERS] = headers
330
+ }
331
+ // licenseType
332
+ if let licenseType = widevineData[SD_PROP_LICENSE_TYPE] as? String {
333
+ sanitisedWidevineData[SD_PROP_LICENSE_TYPE] = licenseType
334
+ }
335
+ sanitisedContentProtectionData[SD_PROP_WIDEVINE] = sanitisedWidevineData
336
+ }
337
+ return sanitisedContentProtectionData
338
+ }
339
+
340
+ /**
341
+ Creates a THEOplayer DRMConfiguration. This requires a contentProtection property in the RN source description.
149
342
  - returns: a THEOplayer DRMConfiguration
150
343
  */
151
344
  private static func buildContentProtection(_ contentProtectionData: [String:Any]) -> MultiplatformDRMConfiguration? {
@@ -156,7 +349,7 @@ class THEOplayerRCTSourceDescriptionBuilder {
156
349
  case DRM_INTEGRATION_ID_EZDRM: return try JSONDecoder().decode(EzdrmDRMConfiguration.self, from: data)
157
350
  case DRM_INTEGRATION_ID_KEYOS: return try JSONDecoder().decode(KeyOSDRMConfiguration.self, from: data)
158
351
  case DRM_INTEGRATION_ID_VERIMATRIX: return try JSONDecoder().decode(VerimatrixDRMConfiguration.self, from: data)
159
- default: print("[NATIVE] \(integration): unsupported drm integration")
352
+ default: return try JSONDecoder().decode(MultiplatformDRMConfiguration.self, from: data)
160
353
  }
161
354
  } else {
162
355
  print("[NATIVE] integration type not specified... trying default drm integration")
@@ -167,10 +360,10 @@ class THEOplayerRCTSourceDescriptionBuilder {
167
360
  }
168
361
  return nil
169
362
  }
170
-
171
-
363
+
364
+
172
365
  // MARK: Helper methods
173
-
366
+
174
367
  private static func extractMimeType(_ src: String) -> String {
175
368
  if src.suffix(5) == EXTENSION_HLS {
176
369
  return MIMETYPE_HLS
@@ -181,12 +374,12 @@ class THEOplayerRCTSourceDescriptionBuilder {
181
374
  }
182
375
  return MIMETYPE_HLS
183
376
  }
184
-
377
+
185
378
  private static func extractTextTrackKind(_ kindString: String?) -> THEOplayerSDK.TextTrackKind {
186
379
  guard let kind = kindString else {
187
380
  return THEOplayerSDK.TextTrackKind.none
188
381
  }
189
-
382
+
190
383
  switch kind {
191
384
  case "subtitles": return THEOplayerSDK.TextTrackKind.subtitles
192
385
  case "captions": return THEOplayerSDK.TextTrackKind.captions
@@ -194,15 +387,15 @@ class THEOplayerRCTSourceDescriptionBuilder {
194
387
  case "chapters": return THEOplayerSDK.TextTrackKind.chapters
195
388
  case "metadata": return THEOplayerSDK.TextTrackKind.metadata
196
389
  default: return THEOplayerSDK.TextTrackKind.none
197
-
390
+
198
391
  }
199
392
  }
200
-
393
+
201
394
  private static func extractTextTrackFormat(_ formatString: String?) -> THEOplayerSDK.TextTrackFormat {
202
395
  guard let format = formatString else {
203
396
  return THEOplayerSDK.TextTrackFormat.none
204
397
  }
205
-
398
+
206
399
  if format == "webvtt" {
207
400
  return THEOplayerSDK.TextTrackFormat.WebVTT
208
401
  } else {
@@ -0,0 +1,18 @@
1
+ // THEOplayerRCTTypeUtils.swift
2
+
3
+ import Foundation
4
+
5
+ let NAN_VALUE: Double = -1.0
6
+ let POS_INF_VALUE: Double = -2.0
7
+
8
+ class THEOplayerRCTTypeUtils {
9
+ class func encodeInfNan(_ value: Double) -> Double {
10
+ if value.isNaN {
11
+ return NAN_VALUE
12
+ }
13
+ if value.isInfinite {
14
+ return POS_INF_VALUE
15
+ }
16
+ return value
17
+ }
18
+ }