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.
- package/README.md +4 -0
- package/android/build.gradle +76 -33
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.3.0/ads-wrapper-4.3.0.aar +0 -0
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.3.0/ads-wrapper-4.3.0.pom +9 -0
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +13 -0
- package/android/src/main/java/com/theoplayer/PlayerConfigHelper.java +40 -0
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerPackage.java +8 -3
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerView.java +131 -28
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerViewManager.java +14 -1
- package/android/src/main/java/com/theoplayer/SourceHelper.java +137 -86
- package/android/src/main/java/com/theoplayer/VideoEventEmitter.java +44 -12
- package/android/src/main/java/com/theoplayer/abr/ABRConfigurationAdapter.kt +72 -0
- package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.java +92 -0
- package/android/src/main/java/com/theoplayer/ads/AdInfo.java +168 -0
- package/android/src/main/java/com/theoplayer/ads/AdsModule.java +152 -0
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +143 -0
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +273 -0
- package/android/src/main/java/com/theoplayer/drm/KeySystemAdapter.kt +22 -0
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +33 -0
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +19 -0
- package/android/src/main/java/com/theoplayer/drm/RequestMethodAdapter.kt +28 -0
- package/android/src/main/java/com/theoplayer/track/QualityListAdapter.java +54 -0
- package/android/src/main/java/com/theoplayer/track/QualityListFilter.java +40 -0
- package/android/src/main/java/com/theoplayer/track/TrackListInfo.java +10 -2
- package/android/src/main/java/com/theoplayer/util/TypeUtils.kt +17 -0
- package/android/src/main/java/com/theoplayer/util/ViewResolver.java +42 -0
- package/ios/THEOplayerRCTAdAggregator.swift +158 -0
- package/ios/THEOplayerRCTAdsAPI.swift +296 -0
- package/ios/THEOplayerRCTBridge.m +65 -0
- package/ios/THEOplayerRCTContentProtectionAPI.swift +359 -0
- package/ios/THEOplayerRCTContentProtectionAggregator.swift +119 -0
- package/ios/THEOplayerRCTDebug.swift +11 -5
- package/ios/THEOplayerRCTMetadataAggregator.swift +1 -1
- package/ios/THEOplayerRCTNetworkUtils.swift +54 -0
- package/ios/THEOplayerRCTProxyContentProtectionIntegration.swift +155 -0
- package/ios/THEOplayerRCTProxyContentProtectionIntegrationFactory.swift +32 -0
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +223 -30
- package/ios/THEOplayerRCTTypeUtils.swift +18 -0
- package/ios/THEOplayerRCTView.swift +109 -49
- package/ios/THEOplayerRCTViewAdEventHandler.swift +238 -0
- package/ios/{THEOplayerRCTViewEventHandler.swift → THEOplayerRCTViewMainEventHandler.swift} +7 -119
- package/ios/THEOplayerRCTViewTextTrackEventHandler.swift +134 -0
- package/ios/Theoplayer-Bridging-Header.h +3 -1
- package/ios/custom/Frameworks/ios/put_custom_ios_xcframework_here.txt +2 -0
- package/ios/custom/react-native-theoplayer_custom_ios.podspec +36 -0
- package/ios/custom/theofeatures.sh +14 -0
- package/lib/commonjs/api/THEOplayerView.js.map +1 -1
- package/lib/commonjs/api/abr/ABRConfiguration.js +2 -0
- package/lib/commonjs/api/abr/ABRConfiguration.js.map +1 -0
- package/lib/commonjs/api/abr/barrel.js +19 -0
- package/lib/commonjs/api/abr/barrel.js.map +1 -0
- package/lib/commonjs/api/ads/Ad.js +6 -0
- package/lib/commonjs/api/ads/Ad.js.map +1 -0
- package/lib/commonjs/api/ads/AdBreak.js +6 -0
- package/lib/commonjs/api/ads/AdBreak.js.map +1 -0
- package/lib/commonjs/api/ads/AdsAPI.js +6 -0
- package/lib/commonjs/api/ads/AdsAPI.js.map +1 -0
- package/lib/commonjs/api/ads/AdsConfiguration.js +6 -0
- package/lib/commonjs/api/ads/AdsConfiguration.js.map +1 -0
- package/lib/commonjs/api/ads/CompanionAd.js +2 -0
- package/lib/commonjs/api/ads/CompanionAd.js.map +1 -0
- package/lib/commonjs/api/ads/GoogleDai.js +2 -0
- package/lib/commonjs/api/ads/GoogleDai.js.map +1 -0
- package/lib/commonjs/api/ads/GoogleImaAd.js +6 -0
- package/lib/commonjs/api/ads/GoogleImaAd.js.map +1 -0
- package/lib/commonjs/api/ads/GoogleImaConfiguration.js +2 -0
- package/lib/commonjs/api/ads/GoogleImaConfiguration.js.map +1 -0
- package/lib/commonjs/api/ads/barrel.js +110 -0
- package/lib/commonjs/api/ads/barrel.js.map +1 -0
- package/lib/commonjs/api/barrel.js +58 -6
- package/lib/commonjs/api/barrel.js.map +1 -1
- package/lib/commonjs/api/config/PlayerConfiguration.js +4 -0
- package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/commonjs/api/drm/ContentProtectionAPI.js +6 -0
- package/lib/commonjs/api/drm/ContentProtectionAPI.js.map +1 -0
- package/lib/commonjs/api/drm/ContentProtectionIntegration.js +6 -0
- package/lib/commonjs/api/drm/ContentProtectionIntegration.js.map +1 -0
- package/lib/commonjs/api/drm/ContentProtectionIntegrationFactory.js +6 -0
- package/lib/commonjs/api/drm/ContentProtectionIntegrationFactory.js.map +1 -0
- package/lib/commonjs/api/drm/ContentProtectionRequest.js +2 -0
- package/lib/commonjs/api/drm/ContentProtectionRequest.js.map +1 -0
- package/lib/commonjs/api/drm/ContentProtectionResponse.js +6 -0
- package/lib/commonjs/api/drm/ContentProtectionResponse.js.map +1 -0
- package/lib/commonjs/api/drm/barrel.js +71 -0
- package/lib/commonjs/api/drm/barrel.js.map +1 -0
- package/lib/commonjs/api/event/AdEvent.js +89 -0
- package/lib/commonjs/api/event/AdEvent.js.map +1 -0
- package/lib/commonjs/api/event/barrel.js +13 -0
- package/lib/commonjs/api/event/barrel.js.map +1 -1
- package/lib/commonjs/api/source/SourceDescription.js.map +1 -1
- package/lib/commonjs/api/source/ads/FreeWheelAdDescription.js +6 -0
- package/lib/commonjs/api/source/ads/FreeWheelAdDescription.js.map +1 -0
- package/lib/commonjs/api/source/ads/IMAAdDescription.js +6 -0
- package/lib/commonjs/api/source/ads/IMAAdDescription.js.map +1 -0
- package/lib/commonjs/api/source/ads/SpotXAdDescription.js +6 -0
- package/lib/commonjs/api/source/ads/SpotXAdDescription.js.map +1 -0
- package/lib/commonjs/api/source/ads/THEOplayerAdDescription.js +6 -0
- package/lib/commonjs/api/source/ads/THEOplayerAdDescription.js.map +1 -0
- package/lib/commonjs/api/source/ads/barrel.js +84 -0
- package/lib/commonjs/api/source/ads/barrel.js.map +1 -0
- package/lib/commonjs/api/source/ads/ssai/GoogleDAIConfiguration.js +6 -0
- package/lib/commonjs/api/source/ads/ssai/GoogleDAIConfiguration.js.map +1 -0
- package/lib/commonjs/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js +6 -0
- package/lib/commonjs/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js.map +1 -0
- package/lib/commonjs/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js +6 -0
- package/lib/commonjs/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js.map +1 -0
- package/lib/commonjs/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js +6 -0
- package/lib/commonjs/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js.map +1 -0
- package/lib/commonjs/api/source/ads/ssai/barrel.js +58 -0
- package/lib/commonjs/api/source/ads/ssai/barrel.js.map +1 -0
- package/lib/commonjs/api/source/barrel.js +16 -3
- package/lib/commonjs/api/source/barrel.js.map +1 -1
- package/lib/commonjs/api/source/drm/DRMConfiguration.js.map +1 -1
- package/lib/commonjs/api/track/MediaTrack.js +29 -0
- package/lib/commonjs/api/track/MediaTrack.js.map +1 -1
- package/lib/commonjs/api/utils/TypeUtils.js +62 -0
- package/lib/commonjs/api/utils/TypeUtils.js.map +1 -0
- package/lib/commonjs/api/utils/barrel.js +19 -0
- package/lib/commonjs/api/utils/barrel.js.map +1 -0
- package/lib/commonjs/index.js +10 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +42 -3
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js +41 -2
- package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
- package/lib/commonjs/internal/ads/THEOplayerNativeAdsAPI.js +54 -0
- package/lib/commonjs/internal/ads/THEOplayerNativeAdsAPI.js.map +1 -0
- package/lib/commonjs/internal/ads/THEOplayerNativeGoogleDAI.js +34 -0
- package/lib/commonjs/internal/ads/THEOplayerNativeGoogleDAI.js.map +1 -0
- package/lib/commonjs/internal/ads/THEOplayerWebAdsAPI.js +78 -0
- package/lib/commonjs/internal/ads/THEOplayerWebAdsAPI.js.map +1 -0
- package/lib/commonjs/internal/ads/THEOplayerWebGoogleDAI.js +32 -0
- package/lib/commonjs/internal/ads/THEOplayerWebGoogleDAI.js.map +1 -0
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +214 -0
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -0
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.web.js +20 -0
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.web.js.map +1 -0
- package/lib/commonjs/internal/drm/NativeCertificateRequest.js +41 -0
- package/lib/commonjs/internal/drm/NativeCertificateRequest.js.map +1 -0
- package/lib/commonjs/internal/drm/NativeCertificateResponse.js +41 -0
- package/lib/commonjs/internal/drm/NativeCertificateResponse.js.map +1 -0
- package/lib/commonjs/internal/drm/NativeContentProtectionEvent.js +2 -0
- package/lib/commonjs/internal/drm/NativeContentProtectionEvent.js.map +1 -0
- package/lib/commonjs/internal/drm/NativeLicenseRequest.js +44 -0
- package/lib/commonjs/internal/drm/NativeLicenseRequest.js.map +1 -0
- package/lib/commonjs/internal/drm/NativeLicenseResponse.js +41 -0
- package/lib/commonjs/internal/drm/NativeLicenseResponse.js.map +1 -0
- package/lib/commonjs/internal/utils/TypeUtils.js +41 -0
- package/lib/commonjs/internal/utils/TypeUtils.js.map +1 -0
- package/lib/commonjs/internal/web/TrackUtils.js +19 -0
- package/lib/commonjs/internal/web/TrackUtils.js.map +1 -1
- package/lib/module/api/THEOplayerView.js.map +1 -1
- package/lib/module/api/abr/ABRConfiguration.js +2 -0
- package/lib/module/api/abr/ABRConfiguration.js.map +1 -0
- package/lib/module/api/abr/barrel.js +2 -0
- package/lib/module/api/abr/barrel.js.map +1 -0
- package/lib/module/api/ads/Ad.js +2 -0
- package/lib/module/api/ads/Ad.js.map +1 -0
- package/lib/module/api/ads/AdBreak.js +2 -0
- package/lib/module/api/ads/AdBreak.js.map +1 -0
- package/lib/module/api/ads/AdsAPI.js +2 -0
- package/lib/module/api/ads/AdsAPI.js.map +1 -0
- package/lib/module/api/ads/AdsConfiguration.js +2 -0
- package/lib/module/api/ads/AdsConfiguration.js.map +1 -0
- package/lib/module/api/ads/CompanionAd.js +2 -0
- package/lib/module/api/ads/CompanionAd.js.map +1 -0
- package/lib/module/api/ads/GoogleDai.js +2 -0
- package/lib/module/api/ads/GoogleDai.js.map +1 -0
- package/lib/module/api/ads/GoogleImaAd.js +2 -0
- package/lib/module/api/ads/GoogleImaAd.js.map +1 -0
- package/lib/module/api/ads/GoogleImaConfiguration.js +2 -0
- package/lib/module/api/ads/GoogleImaConfiguration.js.map +1 -0
- package/lib/module/api/ads/barrel.js +9 -0
- package/lib/module/api/ads/barrel.js.map +1 -0
- package/lib/module/api/barrel.js +5 -1
- package/lib/module/api/barrel.js.map +1 -1
- package/lib/module/api/config/PlayerConfiguration.js +1 -1
- package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/module/api/drm/ContentProtectionAPI.js +2 -0
- package/lib/module/api/drm/ContentProtectionAPI.js.map +1 -0
- package/lib/module/api/drm/ContentProtectionIntegration.js +2 -0
- package/lib/module/api/drm/ContentProtectionIntegration.js.map +1 -0
- package/lib/module/api/drm/ContentProtectionIntegrationFactory.js +2 -0
- package/lib/module/api/drm/ContentProtectionIntegrationFactory.js.map +1 -0
- package/lib/module/api/drm/ContentProtectionRequest.js +2 -0
- package/lib/module/api/drm/ContentProtectionRequest.js.map +1 -0
- package/lib/module/api/drm/ContentProtectionResponse.js +2 -0
- package/lib/module/api/drm/ContentProtectionResponse.js.map +1 -0
- package/lib/module/api/drm/barrel.js +6 -0
- package/lib/module/api/drm/barrel.js.map +1 -0
- package/lib/module/api/event/AdEvent.js +82 -0
- package/lib/module/api/event/AdEvent.js.map +1 -0
- package/lib/module/api/event/barrel.js +1 -0
- package/lib/module/api/event/barrel.js.map +1 -1
- package/lib/module/api/source/SourceDescription.js.map +1 -1
- package/lib/module/api/source/ads/FreeWheelAdDescription.js +2 -0
- package/lib/module/api/source/ads/FreeWheelAdDescription.js.map +1 -0
- package/lib/module/api/source/ads/IMAAdDescription.js +2 -0
- package/lib/module/api/source/ads/IMAAdDescription.js.map +1 -0
- package/lib/module/api/source/ads/SpotXAdDescription.js +2 -0
- package/lib/module/api/source/ads/SpotXAdDescription.js.map +1 -0
- package/lib/module/api/source/ads/THEOplayerAdDescription.js +2 -0
- package/lib/module/api/source/ads/THEOplayerAdDescription.js.map +1 -0
- package/lib/module/api/source/ads/barrel.js +7 -0
- package/lib/module/api/source/ads/barrel.js.map +1 -0
- package/lib/module/api/source/ads/ssai/GoogleDAIConfiguration.js +2 -0
- package/lib/module/api/source/ads/ssai/GoogleDAIConfiguration.js.map +1 -0
- package/lib/module/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js +2 -0
- package/lib/module/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.js.map +1 -0
- package/lib/module/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js +2 -0
- package/lib/module/api/source/ads/ssai/ServerSideAdInsertionConfiguration.js.map +1 -0
- package/lib/module/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js +2 -0
- package/lib/module/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.js.map +1 -0
- package/lib/module/api/source/ads/ssai/barrel.js +5 -0
- package/lib/module/api/source/ads/ssai/barrel.js.map +1 -0
- package/lib/module/api/source/barrel.js +1 -0
- package/lib/module/api/source/barrel.js.map +1 -1
- package/lib/module/api/source/drm/DRMConfiguration.js.map +1 -1
- package/lib/module/api/track/MediaTrack.js +23 -1
- package/lib/module/api/track/MediaTrack.js.map +1 -1
- package/lib/module/api/utils/TypeUtils.js +36 -0
- package/lib/module/api/utils/TypeUtils.js.map +1 -0
- package/lib/module/api/utils/barrel.js +2 -0
- package/lib/module/api/utils/barrel.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +40 -3
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/THEOplayerView.web.js +42 -4
- package/lib/module/internal/THEOplayerView.web.js.map +1 -1
- package/lib/module/internal/ads/THEOplayerNativeAdsAPI.js +43 -0
- package/lib/module/internal/ads/THEOplayerNativeAdsAPI.js.map +1 -0
- package/lib/module/internal/ads/THEOplayerNativeGoogleDAI.js +24 -0
- package/lib/module/internal/ads/THEOplayerNativeGoogleDAI.js.map +1 -0
- package/lib/module/internal/ads/THEOplayerWebAdsAPI.js +68 -0
- package/lib/module/internal/ads/THEOplayerWebAdsAPI.js.map +1 -0
- package/lib/module/internal/ads/THEOplayerWebGoogleDAI.js +23 -0
- package/lib/module/internal/ads/THEOplayerWebGoogleDAI.js.map +1 -0
- package/lib/module/internal/drm/ContentProtectionRegistry.js +188 -0
- package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -0
- package/lib/module/internal/drm/ContentProtectionRegistry.web.js +9 -0
- package/lib/module/internal/drm/ContentProtectionRegistry.web.js.map +1 -0
- package/lib/module/internal/drm/NativeCertificateRequest.js +31 -0
- package/lib/module/internal/drm/NativeCertificateRequest.js.map +1 -0
- package/lib/module/internal/drm/NativeCertificateResponse.js +30 -0
- package/lib/module/internal/drm/NativeCertificateResponse.js.map +1 -0
- package/lib/module/internal/drm/NativeContentProtectionEvent.js +2 -0
- package/lib/module/internal/drm/NativeContentProtectionEvent.js.map +1 -0
- package/lib/module/internal/drm/NativeLicenseRequest.js +34 -0
- package/lib/module/internal/drm/NativeLicenseRequest.js.map +1 -0
- package/lib/module/internal/drm/NativeLicenseResponse.js +30 -0
- package/lib/module/internal/drm/NativeLicenseResponse.js.map +1 -0
- package/lib/module/internal/utils/TypeUtils.js +24 -0
- package/lib/module/internal/utils/TypeUtils.js.map +1 -0
- package/lib/module/internal/web/TrackUtils.js +15 -0
- package/lib/module/internal/web/TrackUtils.js.map +1 -1
- package/lib/typescript/lib/commonjs/api/abr/ABRConfiguration.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/abr/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/ads/Ad.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/ads/AdBreak.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/ads/AdsAPI.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/ads/AdsConfiguration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/ads/CompanionAd.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/ads/GoogleDai.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/ads/GoogleImaAd.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/ads/GoogleImaConfiguration.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/ads/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/config/PlayerConfiguration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/drm/ContentProtectionAPI.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/drm/ContentProtectionIntegration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/drm/ContentProtectionIntegrationFactory.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/drm/ContentProtectionRequest.d.ts +0 -0
- package/lib/typescript/lib/commonjs/api/drm/ContentProtectionResponse.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/drm/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/event/AdEvent.d.ts +2 -0
- package/lib/typescript/lib/commonjs/api/source/ads/FreeWheelAdDescription.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/IMAAdDescription.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/SpotXAdDescription.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/THEOplayerAdDescription.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/source/ads/ssai/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/api/track/MediaTrack.d.ts +8 -0
- package/lib/typescript/lib/commonjs/api/utils/TypeUtils.d.ts +13 -0
- package/lib/typescript/lib/commonjs/api/utils/barrel.d.ts +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/internal/THEOplayerView.d.ts +5 -0
- package/lib/typescript/lib/commonjs/internal/THEOplayerView.web.d.ts +4 -0
- package/lib/typescript/lib/commonjs/internal/ads/THEOplayerNativeAdsAPI.d.ts +14 -0
- package/lib/typescript/lib/commonjs/internal/ads/THEOplayerNativeGoogleDAI.d.ts +9 -0
- package/lib/typescript/lib/commonjs/internal/ads/THEOplayerWebAdsAPI.d.ts +14 -0
- package/lib/typescript/lib/commonjs/internal/ads/THEOplayerWebGoogleDAI.d.ts +9 -0
- package/lib/typescript/lib/commonjs/internal/drm/ContentProtectionRegistry.d.ts +14 -0
- package/lib/typescript/lib/commonjs/internal/drm/ContentProtectionRegistry.web.d.ts +5 -0
- package/lib/typescript/lib/commonjs/internal/drm/NativeCertificateRequest.d.ts +18 -0
- package/lib/typescript/lib/commonjs/internal/drm/NativeCertificateResponse.d.ts +21 -0
- package/lib/typescript/lib/commonjs/internal/drm/NativeContentProtectionEvent.d.ts +0 -0
- package/lib/typescript/lib/commonjs/internal/drm/NativeLicenseRequest.d.ts +20 -0
- package/lib/typescript/lib/commonjs/internal/drm/NativeLicenseResponse.d.ts +22 -0
- package/lib/typescript/lib/commonjs/internal/utils/TypeUtils.d.ts +6 -0
- package/lib/typescript/lib/commonjs/internal/web/TrackUtils.d.ts +2 -0
- package/lib/typescript/lib/module/api/abr/ABRConfiguration.d.ts +0 -0
- package/lib/typescript/lib/module/api/abr/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/api/ads/Ad.d.ts +1 -0
- package/lib/typescript/lib/module/api/ads/AdBreak.d.ts +1 -0
- package/lib/typescript/lib/module/api/ads/AdsAPI.d.ts +1 -0
- package/lib/typescript/lib/module/api/ads/AdsConfiguration.d.ts +1 -0
- package/lib/typescript/lib/module/api/ads/CompanionAd.d.ts +0 -0
- package/lib/typescript/lib/module/api/ads/GoogleDai.d.ts +0 -0
- package/lib/typescript/lib/module/api/ads/GoogleImaAd.d.ts +1 -0
- package/lib/typescript/lib/module/api/ads/GoogleImaConfiguration.d.ts +0 -0
- package/lib/typescript/lib/module/api/ads/barrel.d.ts +5 -0
- package/lib/typescript/lib/module/api/barrel.d.ts +5 -1
- package/lib/typescript/lib/module/api/config/PlayerConfiguration.d.ts +1 -0
- package/lib/typescript/lib/module/api/config/barrel.d.ts +1 -1
- package/lib/typescript/lib/module/api/drm/ContentProtectionAPI.d.ts +1 -0
- package/lib/typescript/lib/module/api/drm/ContentProtectionIntegration.d.ts +1 -0
- package/lib/typescript/lib/module/api/drm/ContentProtectionIntegrationFactory.d.ts +1 -0
- package/lib/typescript/lib/module/api/drm/ContentProtectionRequest.d.ts +0 -0
- package/lib/typescript/lib/module/api/drm/ContentProtectionResponse.d.ts +1 -0
- package/lib/typescript/lib/module/api/drm/barrel.d.ts +4 -0
- package/lib/typescript/lib/module/api/event/AdEvent.d.ts +1 -0
- package/lib/typescript/lib/module/api/event/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/FreeWheelAdDescription.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/IMAAdDescription.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/SpotXAdDescription.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/THEOplayerAdDescription.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/barrel.d.ts +5 -0
- package/lib/typescript/lib/module/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +1 -0
- package/lib/typescript/lib/module/api/source/ads/ssai/barrel.d.ts +4 -0
- package/lib/typescript/lib/module/api/source/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/api/track/MediaTrack.d.ts +8 -1
- package/lib/typescript/lib/module/api/utils/TypeUtils.d.ts +12 -0
- package/lib/typescript/lib/module/api/utils/barrel.d.ts +1 -0
- package/lib/typescript/lib/module/index.d.ts +1 -0
- package/lib/typescript/lib/module/internal/THEOplayerView.d.ts +8 -0
- package/lib/typescript/lib/module/internal/THEOplayerView.web.d.ts +4 -0
- package/lib/typescript/lib/module/internal/ads/THEOplayerNativeAdsAPI.d.ts +13 -0
- package/lib/typescript/lib/module/internal/ads/THEOplayerNativeGoogleDAI.d.ts +8 -0
- package/lib/typescript/lib/module/internal/ads/THEOplayerWebAdsAPI.d.ts +13 -0
- package/lib/typescript/lib/module/internal/ads/THEOplayerWebGoogleDAI.d.ts +8 -0
- package/lib/typescript/lib/module/internal/drm/ContentProtectionRegistry.d.ts +13 -0
- package/lib/typescript/lib/module/internal/drm/ContentProtectionRegistry.web.d.ts +4 -0
- package/lib/typescript/lib/module/internal/drm/NativeCertificateRequest.d.ts +17 -0
- package/lib/typescript/lib/module/internal/drm/NativeCertificateResponse.d.ts +20 -0
- package/lib/typescript/lib/module/internal/drm/NativeContentProtectionEvent.d.ts +0 -0
- package/lib/typescript/lib/module/internal/drm/NativeLicenseRequest.d.ts +19 -0
- package/lib/typescript/lib/module/internal/drm/NativeLicenseResponse.d.ts +21 -0
- package/lib/typescript/lib/module/internal/utils/TypeUtils.d.ts +5 -0
- package/lib/typescript/lib/module/internal/web/TrackUtils.d.ts +2 -0
- package/lib/typescript/src/api/THEOplayerView.d.ts +25 -4
- package/lib/typescript/src/api/abr/ABRConfiguration.d.ts +95 -0
- package/lib/typescript/src/api/abr/barrel.d.ts +1 -0
- package/lib/typescript/src/api/ads/Ad.d.ts +238 -0
- package/lib/typescript/src/api/ads/AdBreak.d.ts +39 -0
- package/lib/typescript/src/api/ads/AdsAPI.d.ts +46 -0
- package/lib/typescript/src/api/ads/AdsConfiguration.d.ts +69 -0
- package/lib/typescript/src/api/ads/CompanionAd.d.ts +59 -0
- package/lib/typescript/src/api/ads/GoogleDai.d.ts +29 -0
- package/lib/typescript/src/api/ads/GoogleImaAd.d.ts +78 -0
- package/lib/typescript/src/api/ads/GoogleImaConfiguration.d.ts +13 -0
- package/lib/typescript/src/api/ads/barrel.d.ts +8 -0
- package/lib/typescript/src/api/barrel.d.ts +5 -1
- package/lib/typescript/src/api/config/PlayerConfiguration.d.ts +5 -0
- package/lib/typescript/src/api/drm/ContentProtectionAPI.d.ts +5 -0
- package/lib/typescript/src/api/drm/ContentProtectionIntegration.d.ts +86 -0
- package/lib/typescript/src/api/drm/ContentProtectionIntegrationFactory.d.ts +15 -0
- package/lib/typescript/src/api/drm/ContentProtectionRequest.d.ts +56 -0
- package/lib/typescript/src/api/drm/ContentProtectionResponse.d.ts +56 -0
- package/lib/typescript/src/api/drm/barrel.d.ts +5 -0
- package/lib/typescript/src/api/event/AdEvent.d.ts +13 -0
- package/lib/typescript/src/api/event/barrel.d.ts +1 -0
- package/lib/typescript/src/api/source/SourceDescription.d.ts +8 -0
- package/lib/typescript/src/api/source/ads/FreeWheelAdDescription.d.ts +85 -0
- package/lib/typescript/src/api/source/ads/IMAAdDescription.d.ts +25 -0
- package/lib/typescript/src/api/source/ads/SpotXAdDescription.d.ts +115 -0
- package/lib/typescript/src/api/source/ads/THEOplayerAdDescription.d.ts +32 -0
- package/lib/typescript/src/api/source/ads/barrel.d.ts +6 -0
- package/lib/typescript/src/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +130 -0
- package/lib/typescript/src/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +27 -0
- package/lib/typescript/src/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +26 -0
- package/lib/typescript/src/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +46 -0
- package/lib/typescript/src/api/source/ads/ssai/barrel.d.ts +4 -0
- package/lib/typescript/src/api/source/barrel.d.ts +1 -0
- package/lib/typescript/src/api/source/drm/DRMConfiguration.d.ts +0 -30
- package/lib/typescript/src/api/track/MediaTrack.d.ts +5 -2
- package/lib/typescript/src/api/utils/TypeUtils.d.ts +20 -0
- package/lib/typescript/src/api/utils/barrel.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/internal/THEOplayerView.d.ts +10 -4
- package/lib/typescript/src/internal/THEOplayerView.web.d.ts +7 -2
- package/lib/typescript/src/internal/ads/THEOplayerNativeAdsAPI.d.ts +17 -0
- package/lib/typescript/src/internal/ads/THEOplayerNativeGoogleDAI.d.ts +10 -0
- package/lib/typescript/src/internal/ads/THEOplayerWebAdsAPI.d.ts +15 -0
- package/lib/typescript/src/internal/ads/THEOplayerWebGoogleDAI.d.ts +10 -0
- package/lib/typescript/src/internal/drm/ContentProtectionRegistry.d.ts +19 -0
- package/lib/typescript/src/internal/drm/ContentProtectionRegistry.web.d.ts +5 -0
- package/lib/typescript/src/internal/drm/NativeCertificateRequest.d.ts +13 -0
- package/lib/typescript/src/internal/drm/NativeCertificateResponse.d.ts +18 -0
- package/lib/typescript/src/internal/drm/NativeContentProtectionEvent.d.ts +5 -0
- package/lib/typescript/src/internal/drm/NativeLicenseRequest.d.ts +14 -0
- package/lib/typescript/src/internal/drm/NativeLicenseResponse.d.ts +18 -0
- package/lib/typescript/src/internal/utils/TypeUtils.d.ts +5 -0
- package/lib/typescript/src/internal/web/TrackUtils.d.ts +3 -1
- package/package.json +4 -3
- package/src/api/THEOplayerView.ts +29 -4
- package/src/api/abr/ABRConfiguration.ts +103 -0
- package/src/api/abr/barrel.ts +1 -0
- package/src/api/ads/Ad.ts +267 -0
- package/src/api/ads/AdBreak.ts +44 -0
- package/src/api/ads/AdsAPI.ts +53 -0
- package/src/api/ads/AdsConfiguration.ts +76 -0
- package/src/api/ads/CompanionAd.ts +65 -0
- package/src/api/ads/GoogleDai.ts +32 -0
- package/src/api/ads/GoogleImaAd.ts +86 -0
- package/src/api/ads/GoogleImaConfiguration.ts +13 -0
- package/src/api/ads/barrel.ts +8 -0
- package/src/api/barrel.ts +5 -1
- package/src/api/config/PlayerConfiguration.ts +7 -0
- package/src/api/drm/ContentProtectionAPI.ts +6 -0
- package/src/api/drm/ContentProtectionIntegration.ts +93 -0
- package/src/api/drm/ContentProtectionIntegrationFactory.ts +16 -0
- package/src/api/drm/ContentProtectionRequest.ts +60 -0
- package/src/api/drm/ContentProtectionResponse.ts +62 -0
- package/src/api/drm/barrel.ts +5 -0
- package/src/api/event/AdEvent.ts +117 -0
- package/src/api/event/barrel.ts +1 -0
- package/src/api/source/SourceDescription.ts +9 -0
- package/src/api/source/ads/FreeWheelAdDescription.ts +97 -0
- package/src/api/source/ads/IMAAdDescription.ts +26 -0
- package/src/api/source/ads/SpotXAdDescription.ts +126 -0
- package/src/api/source/ads/THEOplayerAdDescription.ts +34 -0
- package/src/api/source/ads/barrel.ts +6 -0
- package/src/api/source/ads/ssai/GoogleDAIConfiguration.ts +145 -0
- package/src/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.ts +30 -0
- package/src/api/source/ads/ssai/ServerSideAdInsertionConfiguration.ts +28 -0
- package/src/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.ts +51 -0
- package/src/api/source/ads/ssai/barrel.ts +4 -0
- package/src/api/source/barrel.ts +1 -0
- package/src/api/source/drm/DRMConfiguration.ts +0 -35
- package/src/api/track/MediaTrack.ts +22 -2
- package/src/api/utils/TypeUtils.ts +39 -0
- package/src/api/utils/barrel.ts +1 -0
- package/src/index.tsx +1 -0
- package/src/internal/THEOplayerView.tsx +49 -8
- package/src/internal/THEOplayerView.web.tsx +37 -7
- package/src/internal/ads/THEOplayerNativeAdsAPI.ts +44 -0
- package/src/internal/ads/THEOplayerNativeGoogleDAI.ts +23 -0
- package/src/internal/ads/THEOplayerWebAdsAPI.ts +51 -0
- package/src/internal/ads/THEOplayerWebGoogleDAI.ts +22 -0
- package/src/internal/drm/ContentProtectionRegistry.ts +173 -0
- package/src/internal/drm/ContentProtectionRegistry.web.ts +10 -0
- package/src/internal/drm/NativeCertificateRequest.ts +41 -0
- package/src/internal/drm/NativeCertificateResponse.ts +45 -0
- package/src/internal/drm/NativeContentProtectionEvent.ts +5 -0
- package/src/internal/drm/NativeLicenseRequest.ts +39 -0
- package/src/internal/drm/NativeLicenseResponse.ts +45 -0
- package/src/internal/utils/TypeUtils.ts +39 -0
- 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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
+
}
|