react-native-theoplayer 2.16.1 → 3.0.0-pre1
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/CHANGELOG.md +10 -0
- package/README.md +1 -0
- package/android/build.gradle +19 -22
- package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +87 -101
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +30 -30
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerPackage.kt +3 -1
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt +1 -1
- package/android/src/main/java/com/theoplayer/cache/CacheAdapter.kt +127 -0
- package/android/src/main/java/com/theoplayer/cache/CacheModule.kt +238 -0
- package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +27 -12
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +16 -37
- package/android/src/main/java/com/theoplayer/util/BridgeUtils.kt +60 -0
- package/android/src/main/java/com/theoplayer/util/PayloadBuilder.kt +10 -10
- package/ios/THEOplayerRCTBridge.m +22 -0
- package/ios/THEOplayerRCTDebug.swift +7 -1
- package/ios/THEOplayerRCTMainEventHandler.swift +25 -27
- package/ios/THEOplayerRCTSourceDescriptionAggregator.swift +41 -0
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +3 -2
- package/ios/THEOplayerRCTTypeUtils.swift +37 -0
- package/ios/THEOplayerRCTView.swift +1 -2
- package/ios/ads/THEOplayerRCTAdsAPI+DAI.swift +3 -13
- package/ios/ads/THEOplayerRCTAdsAPI.swift +14 -48
- package/ios/ads/THEOplayerRCTView+AdsConfig.swift +0 -13
- package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +24 -36
- package/ios/backgroundAudio/THEOplayerRCTRemoteCommandsManager.swift +2 -10
- package/ios/cache/THEOplayerRCTCacheAPI.swift +202 -0
- package/ios/cache/THEOplayerRCTCacheAggregator.swift +87 -0
- package/ios/cache/THEOplayerRCTCachingParametersBuilder.swift +27 -0
- package/ios/pip/THEOplayerRCTPipControlsManager.swift +2 -4
- package/lib/commonjs/api/abr/ABRConfiguration.js +21 -7
- package/lib/commonjs/api/abr/ABRConfiguration.js.map +1 -1
- package/lib/commonjs/api/ads/GoogleImaConfiguration.js.map +1 -1
- package/lib/commonjs/api/barrel.js +30 -19
- package/lib/commonjs/api/barrel.js.map +1 -1
- package/lib/commonjs/api/cache/CachingPreferredTrackSelection.js +2 -0
- package/lib/commonjs/api/cache/CachingPreferredTrackSelection.js.map +1 -0
- package/lib/commonjs/api/cache/CachingTask.js +30 -0
- package/lib/commonjs/api/cache/CachingTask.js.map +1 -0
- package/lib/commonjs/api/cache/CachingTaskLicense.js +6 -0
- package/lib/commonjs/api/cache/CachingTaskLicense.js.map +1 -0
- package/lib/commonjs/api/cache/CachingTaskList.js +6 -0
- package/lib/commonjs/api/cache/CachingTaskList.js.map +1 -0
- package/lib/commonjs/api/cache/CachingTaskParameters.js +6 -0
- package/lib/commonjs/api/cache/CachingTaskParameters.js.map +1 -0
- package/lib/commonjs/api/cache/MediaCacheAPI.js +24 -0
- package/lib/commonjs/api/cache/MediaCacheAPI.js.map +1 -0
- package/lib/commonjs/api/cache/barrel.js +83 -0
- package/lib/commonjs/api/cache/barrel.js.map +1 -0
- package/lib/commonjs/api/cache/events/CacheEvent.js +28 -0
- package/lib/commonjs/api/cache/events/CacheEvent.js.map +1 -0
- package/lib/commonjs/api/cache/events/CachingTaskEvent.js +17 -0
- package/lib/commonjs/api/cache/events/CachingTaskEvent.js.map +1 -0
- package/lib/commonjs/api/cache/events/barrel.js +28 -0
- package/lib/commonjs/api/cache/events/barrel.js.map +1 -0
- package/lib/commonjs/api/cache/hooks/barrel.js +39 -0
- package/lib/commonjs/api/cache/hooks/barrel.js.map +1 -0
- package/lib/commonjs/api/cache/hooks/useCachingTaskList.js +31 -0
- package/lib/commonjs/api/cache/hooks/useCachingTaskList.js.map +1 -0
- package/lib/commonjs/api/cache/hooks/useCachingTaskProgress.js +28 -0
- package/lib/commonjs/api/cache/hooks/useCachingTaskProgress.js.map +1 -0
- package/lib/commonjs/api/cache/hooks/useCachingTaskStatus.js +28 -0
- package/lib/commonjs/api/cache/hooks/useCachingTaskStatus.js.map +1 -0
- package/lib/commonjs/api/cast/CastState.js +3 -4
- package/lib/commonjs/api/cast/CastState.js.map +1 -1
- package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/commonjs/api/event/AdEvent.js +3 -4
- package/lib/commonjs/api/event/AdEvent.js.map +1 -1
- package/lib/commonjs/api/event/CastEvent.js +3 -4
- package/lib/commonjs/api/event/CastEvent.js.map +1 -1
- package/lib/commonjs/api/event/PlayerEvent.js +3 -4
- package/lib/commonjs/api/event/PlayerEvent.js.map +1 -1
- package/lib/commonjs/api/event/TrackEvent.js +12 -16
- package/lib/commonjs/api/event/TrackEvent.js.map +1 -1
- package/lib/commonjs/api/player/PlayerEventMap.js +7 -8
- package/lib/commonjs/api/player/PlayerEventMap.js.map +1 -1
- package/lib/commonjs/api/player/THEOplayer.js +6 -4
- package/lib/commonjs/api/player/THEOplayer.js.map +1 -1
- package/lib/commonjs/api/presentation/PresentationMode.js +3 -4
- package/lib/commonjs/api/presentation/PresentationMode.js.map +1 -1
- package/lib/commonjs/api/source/ads/Ads.js +3 -4
- package/lib/commonjs/api/source/ads/Ads.js.map +1 -1
- package/lib/commonjs/api/track/TextTrack.js +9 -12
- package/lib/commonjs/api/track/TextTrack.js.map +1 -1
- package/lib/commonjs/api/track/TextTrackStyle.js +3 -4
- package/lib/commonjs/api/track/TextTrackStyle.js.map +1 -1
- package/lib/commonjs/index.js +9 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +1 -1
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.style.js +1 -2
- package/lib/commonjs/internal/THEOplayerView.style.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js +5 -5
- package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +12 -13
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +10 -10
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/adapter/abr/AbrAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/ads/THEOplayerWebAdsAdapter.js +2 -2
- package/lib/commonjs/internal/adapter/ads/THEOplayerWebAdsAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeCastAdapter.js +1 -1
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeCastAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/cast/THEOplayerWebCastAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/BaseEvent.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/DefaultEventDispatcher.js +1 -1
- package/lib/commonjs/internal/adapter/event/DefaultEventDispatcher.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/native/NativeTrackEvent.js +12 -16
- package/lib/commonjs/internal/adapter/event/native/NativeTrackEvent.js.map +1 -1
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/web/FullscreenAPI.js +1 -2
- package/lib/commonjs/internal/adapter/web/FullscreenAPI.js.map +1 -1
- package/lib/commonjs/internal/adapter/web/WebMediaSession.js +9 -11
- package/lib/commonjs/internal/adapter/web/WebMediaSession.js.map +1 -1
- package/lib/commonjs/internal/adapter/web/WebPresentationModeManager.js +4 -4
- package/lib/commonjs/internal/adapter/web/WebPresentationModeManager.js.map +1 -1
- package/lib/commonjs/internal/cache/MediaCache.js +117 -0
- package/lib/commonjs/internal/cache/MediaCache.js.map +1 -0
- package/lib/commonjs/internal/cache/MediaCache.web.js +54 -0
- package/lib/commonjs/internal/cache/MediaCache.web.js.map +1 -0
- package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js +59 -0
- package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js.map +1 -0
- package/lib/commonjs/internal/cache/NativeCachingTaskParametersAdapter.js +27 -0
- package/lib/commonjs/internal/cache/NativeCachingTaskParametersAdapter.js.map +1 -0
- package/lib/commonjs/internal/cache/WebCachingTaskAdapter.js +71 -0
- package/lib/commonjs/internal/cache/WebCachingTaskAdapter.js.map +1 -0
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +1 -2
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.web.js +1 -2
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.web.js.map +1 -1
- package/lib/commonjs/internal/drm/NativeCertificateResponse.js.map +1 -1
- package/lib/commonjs/internal/drm/NativeLicenseResponse.js.map +1 -1
- package/lib/commonjs/internal/utils/TypeUtils.js +2 -4
- package/lib/commonjs/internal/utils/TypeUtils.js.map +1 -1
- package/lib/module/api/abr/ABRConfiguration.js +24 -6
- package/lib/module/api/abr/ABRConfiguration.js.map +1 -1
- package/lib/module/api/ads/GoogleImaConfiguration.js.map +1 -1
- package/lib/module/api/barrel.js +1 -0
- package/lib/module/api/barrel.js.map +1 -1
- package/lib/module/api/cache/CachingPreferredTrackSelection.js +2 -0
- package/lib/module/api/cache/CachingPreferredTrackSelection.js.map +1 -0
- package/lib/module/api/cache/CachingTask.js +25 -0
- package/lib/module/api/cache/CachingTask.js.map +1 -0
- package/lib/module/api/cache/CachingTaskLicense.js +2 -0
- package/lib/module/api/cache/CachingTaskLicense.js.map +1 -0
- package/lib/module/api/cache/CachingTaskList.js +2 -0
- package/lib/module/api/cache/CachingTaskList.js.map +1 -0
- package/lib/module/api/cache/CachingTaskParameters.js +2 -0
- package/lib/module/api/cache/CachingTaskParameters.js.map +1 -0
- package/lib/module/api/cache/MediaCacheAPI.js +19 -0
- package/lib/module/api/cache/MediaCacheAPI.js.map +1 -0
- package/lib/module/api/cache/barrel.js +8 -0
- package/lib/module/api/cache/barrel.js.map +1 -0
- package/lib/module/api/cache/events/CacheEvent.js +25 -0
- package/lib/module/api/cache/events/CacheEvent.js.map +1 -0
- package/lib/module/api/cache/events/CachingTaskEvent.js +12 -0
- package/lib/module/api/cache/events/CachingTaskEvent.js.map +1 -0
- package/lib/module/api/cache/events/barrel.js +3 -0
- package/lib/module/api/cache/events/barrel.js.map +1 -0
- package/lib/module/api/cache/hooks/barrel.js +4 -0
- package/lib/module/api/cache/hooks/barrel.js.map +1 -0
- package/lib/module/api/cache/hooks/useCachingTaskList.js +24 -0
- package/lib/module/api/cache/hooks/useCachingTaskList.js.map +1 -0
- package/lib/module/api/cache/hooks/useCachingTaskProgress.js +21 -0
- package/lib/module/api/cache/hooks/useCachingTaskProgress.js.map +1 -0
- package/lib/module/api/cache/hooks/useCachingTaskStatus.js +21 -0
- package/lib/module/api/cache/hooks/useCachingTaskStatus.js.map +1 -0
- package/lib/module/api/cast/CastState.js +3 -3
- package/lib/module/api/cast/CastState.js.map +1 -1
- package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
- package/lib/module/api/event/AdEvent.js +3 -3
- package/lib/module/api/event/AdEvent.js.map +1 -1
- package/lib/module/api/event/CastEvent.js +3 -3
- package/lib/module/api/event/CastEvent.js.map +1 -1
- package/lib/module/api/event/PlayerEvent.js +3 -3
- package/lib/module/api/event/PlayerEvent.js.map +1 -1
- package/lib/module/api/event/TrackEvent.js +12 -12
- package/lib/module/api/event/TrackEvent.js.map +1 -1
- package/lib/module/api/player/PlayerEventMap.js +8 -8
- package/lib/module/api/player/PlayerEventMap.js.map +1 -1
- package/lib/module/api/player/THEOplayer.js +7 -3
- package/lib/module/api/player/THEOplayer.js.map +1 -1
- package/lib/module/api/presentation/PresentationMode.js +3 -3
- package/lib/module/api/presentation/PresentationMode.js.map +1 -1
- package/lib/module/api/source/ads/Ads.js +3 -3
- package/lib/module/api/source/ads/Ads.js.map +1 -1
- package/lib/module/api/track/TextTrack.js +9 -9
- package/lib/module/api/track/TextTrack.js.map +1 -1
- package/lib/module/api/track/TextTrackStyle.js +3 -3
- package/lib/module/api/track/TextTrackStyle.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +1 -1
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/THEOplayerView.web.js +5 -5
- package/lib/module/internal/THEOplayerView.web.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js +12 -11
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +10 -10
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/adapter/abr/AbrAdapter.js.map +1 -1
- package/lib/module/internal/adapter/ads/THEOplayerWebAdsAdapter.js +2 -2
- package/lib/module/internal/adapter/ads/THEOplayerWebAdsAdapter.js.map +1 -1
- package/lib/module/internal/adapter/cast/THEOplayerNativeCastAdapter.js +1 -1
- package/lib/module/internal/adapter/cast/THEOplayerNativeCastAdapter.js.map +1 -1
- package/lib/module/internal/adapter/cast/THEOplayerWebCastAdapter.js.map +1 -1
- package/lib/module/internal/adapter/event/BaseEvent.js.map +1 -1
- package/lib/module/internal/adapter/event/DefaultEventDispatcher.js +1 -1
- package/lib/module/internal/adapter/event/DefaultEventDispatcher.js.map +1 -1
- package/lib/module/internal/adapter/event/native/NativeTrackEvent.js +12 -12
- package/lib/module/internal/adapter/event/native/NativeTrackEvent.js.map +1 -1
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/module/internal/adapter/web/FullscreenAPI.js.map +1 -1
- package/lib/module/internal/adapter/web/WebMediaSession.js +8 -9
- package/lib/module/internal/adapter/web/WebMediaSession.js.map +1 -1
- package/lib/module/internal/adapter/web/WebPresentationModeManager.js +4 -4
- package/lib/module/internal/adapter/web/WebPresentationModeManager.js.map +1 -1
- package/lib/module/internal/cache/MediaCache.js +110 -0
- package/lib/module/internal/cache/MediaCache.js.map +1 -0
- package/lib/module/internal/cache/MediaCache.web.js +45 -0
- package/lib/module/internal/cache/MediaCache.web.js.map +1 -0
- package/lib/module/internal/cache/NativeCachingTaskAdapter.js +52 -0
- package/lib/module/internal/cache/NativeCachingTaskAdapter.js.map +1 -0
- package/lib/module/internal/cache/NativeCachingTaskParametersAdapter.js +20 -0
- package/lib/module/internal/cache/NativeCachingTaskParametersAdapter.js.map +1 -0
- package/lib/module/internal/cache/WebCachingTaskAdapter.js +64 -0
- package/lib/module/internal/cache/WebCachingTaskAdapter.js.map +1 -0
- package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/module/internal/drm/ContentProtectionRegistry.web.js.map +1 -1
- package/lib/module/internal/drm/NativeCertificateResponse.js.map +1 -1
- package/lib/module/internal/drm/NativeLicenseResponse.js.map +1 -1
- package/lib/typescript/api/abr/ABRConfiguration.d.ts +1 -1
- package/lib/typescript/api/ads/Ad.d.ts +2 -2
- package/lib/typescript/api/ads/AdsConfiguration.d.ts +2 -2
- package/lib/typescript/api/ads/GoogleImaConfiguration.d.ts +1 -0
- package/lib/typescript/api/barrel.d.ts +1 -0
- package/lib/typescript/api/cache/CachingPreferredTrackSelection.d.ts +23 -0
- package/lib/typescript/api/cache/CachingTask.d.ts +93 -0
- package/lib/typescript/api/cache/CachingTaskLicense.d.ts +14 -0
- package/lib/typescript/api/cache/CachingTaskList.d.ts +7 -0
- package/lib/typescript/api/cache/CachingTaskParameters.d.ts +57 -0
- package/lib/typescript/api/cache/MediaCacheAPI.d.ts +39 -0
- package/lib/typescript/api/cache/barrel.d.ts +7 -0
- package/lib/typescript/api/cache/events/CacheEvent.d.ts +55 -0
- package/lib/typescript/api/cache/events/CachingTaskEvent.d.ts +22 -0
- package/lib/typescript/api/cache/events/barrel.d.ts +2 -0
- package/lib/typescript/api/cache/hooks/barrel.d.ts +3 -0
- package/lib/typescript/api/cache/hooks/useCachingTaskList.d.ts +1 -0
- package/lib/typescript/api/cache/hooks/useCachingTaskProgress.d.ts +2 -0
- package/lib/typescript/api/cache/hooks/useCachingTaskStatus.d.ts +2 -0
- package/lib/typescript/api/cast/CastConfiguration.d.ts +1 -1
- package/lib/typescript/api/config/PlayerConfiguration.d.ts +4 -1
- package/lib/typescript/api/drm/ContentProtectionIntegration.d.ts +2 -2
- package/lib/typescript/api/drm/ContentProtectionRequest.d.ts +1 -1
- package/lib/typescript/api/error/ChromecastError.d.ts +1 -1
- package/lib/typescript/api/event/CastEvent.d.ts +1 -1
- package/lib/typescript/api/event/EventDispatcher.d.ts +2 -2
- package/lib/typescript/api/event/EventListener.d.ts +1 -1
- package/lib/typescript/api/player/THEOplayer.d.ts +2 -2
- package/lib/typescript/api/source/SourceDescription.d.ts +3 -3
- package/lib/typescript/api/source/ads/Ads.d.ts +1 -1
- package/lib/typescript/api/source/ads/FreeWheelAdDescription.d.ts +1 -1
- package/lib/typescript/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +2 -2
- package/lib/typescript/api/source/ads/ssai/ImagineServerSideAdInsertionConfiguration.d.ts +1 -1
- package/lib/typescript/api/source/ads/ssai/ServerSideAdInsertionConfiguration.d.ts +1 -1
- package/lib/typescript/api/source/ads/ssai/YospaceServerSideAdInsertionConfiguration.d.ts +2 -2
- package/lib/typescript/api/source/dash/DashPlaybackConfiguration.d.ts +1 -1
- package/lib/typescript/api/source/drm/DRMConfiguration.d.ts +3 -3
- package/lib/typescript/api/source/hls/HlsPlaybackConfiguration.d.ts +1 -1
- package/lib/typescript/api/track/MediaTrack.d.ts +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/internal/THEOplayerView.web.d.ts +1 -1
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +2 -2
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +2 -2
- package/lib/typescript/internal/adapter/ads/THEOplayerWebAdsAdapter.d.ts +2 -2
- package/lib/typescript/internal/adapter/cast/THEOplayerWebCastAdapter.d.ts +2 -2
- package/lib/typescript/internal/adapter/event/native/NativeCastEvent.d.ts +1 -1
- package/lib/typescript/internal/adapter/web/WebPresentationModeManager.d.ts +2 -2
- package/lib/typescript/internal/cache/MediaCache.d.ts +25 -0
- package/lib/typescript/internal/cache/MediaCache.web.d.ts +16 -0
- package/lib/typescript/internal/cache/NativeCachingTaskAdapter.d.ts +33 -0
- package/lib/typescript/internal/cache/NativeCachingTaskParametersAdapter.d.ts +11 -0
- package/lib/typescript/internal/cache/WebCachingTaskAdapter.d.ts +25 -0
- package/package.json +16 -15
- package/react-native-theoplayer.podspec +4 -4
- package/src/api/ads/GoogleImaConfiguration.ts +1 -0
- package/src/api/barrel.ts +1 -0
- package/src/api/cache/CachingPreferredTrackSelection.ts +24 -0
- package/src/api/cache/CachingTask.ts +107 -0
- package/src/api/cache/CachingTaskLicense.ts +15 -0
- package/src/api/cache/CachingTaskList.ts +8 -0
- package/src/api/cache/CachingTaskParameters.ts +62 -0
- package/src/api/cache/MediaCacheAPI.ts +43 -0
- package/src/api/cache/barrel.ts +7 -0
- package/src/api/cache/events/CacheEvent.ts +62 -0
- package/src/api/cache/events/CachingTaskEvent.ts +27 -0
- package/src/api/cache/events/barrel.ts +2 -0
- package/src/api/cache/hooks/barrel.ts +3 -0
- package/src/api/cache/hooks/useCachingTaskList.ts +23 -0
- package/src/api/cache/hooks/useCachingTaskProgress.ts +20 -0
- package/src/api/cache/hooks/useCachingTaskStatus.ts +20 -0
- package/src/api/config/PlayerConfiguration.ts +3 -0
- package/src/index.tsx +1 -0
- package/src/internal/THEOplayerView.web.tsx +5 -5
- package/src/internal/adapter/THEOplayerWebAdapter.ts +6 -6
- package/src/internal/adapter/WebEventForwarder.ts +3 -3
- package/src/internal/adapter/ads/THEOplayerWebAdsAdapter.ts +3 -3
- package/src/internal/adapter/cast/THEOplayerWebCastAdapter.ts +3 -3
- package/src/internal/adapter/web/WebPresentationModeManager.ts +3 -3
- package/src/internal/cache/MediaCache.ts +151 -0
- package/src/internal/cache/MediaCache.web.ts +54 -0
- package/src/internal/cache/NativeCachingTaskAdapter.ts +81 -0
- package/src/internal/cache/NativeCachingTaskParametersAdapter.ts +32 -0
- package/src/internal/cache/WebCachingTaskAdapter.ts +95 -0
- package/android/src/main/java/com/theoplayer/track/QualityListFilter.kt +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.0.0-pre1] - 23-10-05
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Added support for THEOplayer 6.0. See [THEOplayer's changelog](https://docs.theoplayer.com/changelog.md) for details.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Added `MediaCache` API, enabling download of media assets for offline playback.
|
|
17
|
+
|
|
8
18
|
## [2.16.1] - 23-09-27
|
|
9
19
|
|
|
10
20
|
### Added
|
package/README.md
CHANGED
|
@@ -101,6 +101,7 @@ and discussed in the next section. Finally, an overview of features, limitations
|
|
|
101
101
|
- [Casting with Chromecast and Airplay](./doc/cast.md)
|
|
102
102
|
- [Custom iOS framework](./doc/custom-ios-framework.md)
|
|
103
103
|
- [Digital Rights Management (DRM)](./doc/drm.md)
|
|
104
|
+
- [Media Caching](./doc/media_caching.md)
|
|
104
105
|
- [Migrating to `react-native-theoplayer` v2.x](./doc/migrating_v2.md)
|
|
105
106
|
- [Picture-in-Picture (PiP)](./doc/pip.md)
|
|
106
107
|
- [Styling subtitles and closed captions](./doc/texttrackstyles.md)
|
package/android/build.gradle
CHANGED
|
@@ -29,11 +29,11 @@ def enabledCast = safeExtGet("THEOplayer_extensionCast", 'false').toBoolean()
|
|
|
29
29
|
def enabledMediaSession = safeExtGet("THEOplayer_extensionMediaSession", 'true').toBoolean()
|
|
30
30
|
|
|
31
31
|
android {
|
|
32
|
-
|
|
32
|
+
compileSdk safeExtGet('THEOplayer_compileSdkVersion', 33)
|
|
33
33
|
|
|
34
34
|
defaultConfig {
|
|
35
35
|
minSdkVersion safeExtGet('THEOplayer_minSdkVersion', 21)
|
|
36
|
-
targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion',
|
|
36
|
+
targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion', 33)
|
|
37
37
|
versionCode 1
|
|
38
38
|
versionName "1.0"
|
|
39
39
|
|
|
@@ -67,7 +67,7 @@ android {
|
|
|
67
67
|
minifyEnabled false
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
lint {
|
|
71
71
|
disable 'GradleCompatible'
|
|
72
72
|
}
|
|
73
73
|
compileOptions {
|
|
@@ -102,20 +102,18 @@ dependencies {
|
|
|
102
102
|
//noinspection GradleDynamicVersion
|
|
103
103
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
104
104
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
|
|
105
|
-
implementation "
|
|
106
|
-
implementation "androidx.appcompat:appcompat:1.4.+"
|
|
105
|
+
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
107
106
|
|
|
108
|
-
// The minimum supported version is
|
|
109
|
-
def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[
|
|
107
|
+
// The minimum supported THEOplayer version is 6.0.0
|
|
108
|
+
def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[6.0.0,7.0)')
|
|
110
109
|
|
|
111
110
|
// def theoplayer_mediasession_version = safeExtGet('THEOplayer_mediasession', theoplayer_sdk_version)
|
|
112
111
|
def theoplayer_mediasession_version = "5.11.0-local"
|
|
113
|
-
def enabledV4 = theoplayer_sdk_version.toString().startsWith("4.")
|
|
114
|
-
def core_prefix = enabledV4 ? 'unified' : 'core'
|
|
115
|
-
def integration_prefix = enabledV4 ? 'unified' : 'integration'
|
|
116
112
|
|
|
117
113
|
println("Using THEOplayer (${versionString(theoplayer_sdk_version)})")
|
|
118
|
-
implementation "com.theoplayer.theoplayer-sdk-android:${
|
|
114
|
+
implementation "com.theoplayer.theoplayer-sdk-android:core:${theoplayer_sdk_version}"
|
|
115
|
+
|
|
116
|
+
implementation "com.theoplayer.theoplayer-sdk-android:ads-wrapper:4.8.0"
|
|
119
117
|
|
|
120
118
|
if (enabledMediaSession) {
|
|
121
119
|
println("Enable THEOplayer MediaSession extension (${versionString(theoplayer_mediasession_version)})")
|
|
@@ -127,30 +125,29 @@ dependencies {
|
|
|
127
125
|
|
|
128
126
|
if (enabledGoogleIMA) {
|
|
129
127
|
println('Enable THEOplayer IMA extension.')
|
|
130
|
-
implementation "com.theoplayer.theoplayer-sdk-android
|
|
131
|
-
implementation "com.theoplayer.theoplayer-sdk-android
|
|
128
|
+
implementation "com.theoplayer.theoplayer-sdk-android:integration-ads:${theoplayer_sdk_version}"
|
|
129
|
+
implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:${theoplayer_sdk_version}"
|
|
132
130
|
} else {
|
|
133
131
|
println('Disable THEOplayer IMA extension.')
|
|
134
|
-
compileOnly "com.theoplayer.theoplayer-sdk-android
|
|
135
|
-
compileOnly "com.theoplayer.theoplayer-sdk-android
|
|
132
|
+
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads:${theoplayer_sdk_version}"
|
|
133
|
+
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:${theoplayer_sdk_version}"
|
|
136
134
|
}
|
|
137
135
|
|
|
138
|
-
// NOTE: The DAI extension module is available on Maven as of SDK v4.3.0
|
|
139
136
|
if (enabledGoogleDAI) {
|
|
140
137
|
println('Enable THEOplayer DAI extension.')
|
|
141
|
-
implementation "com.theoplayer.theoplayer-sdk-android
|
|
142
|
-
implementation "com.theoplayer.theoplayer-sdk-android
|
|
138
|
+
implementation "com.theoplayer.theoplayer-sdk-android:integration-ads:${theoplayer_sdk_version}"
|
|
139
|
+
implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
|
|
143
140
|
} else {
|
|
144
141
|
println('Disable THEOplayer DAI extension.')
|
|
145
|
-
compileOnly "com.theoplayer.theoplayer-sdk-android
|
|
146
|
-
compileOnly "com.theoplayer.theoplayer-sdk-android
|
|
142
|
+
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads:${theoplayer_sdk_version}"
|
|
143
|
+
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
|
|
147
144
|
}
|
|
148
145
|
|
|
149
146
|
if (enabledCast) {
|
|
150
147
|
println('Enable THEOplayer cast extension.')
|
|
151
|
-
implementation "com.theoplayer.theoplayer-sdk-android
|
|
148
|
+
implementation "com.theoplayer.theoplayer-sdk-android:integration-cast:${theoplayer_sdk_version}"
|
|
152
149
|
} else {
|
|
153
150
|
println('Disable THEOplayer cast extension.')
|
|
154
|
-
compileOnly "com.theoplayer.theoplayer-sdk-android
|
|
151
|
+
compileOnly "com.theoplayer.theoplayer-sdk-android:integration-cast:${theoplayer_sdk_version}"
|
|
155
152
|
}
|
|
156
153
|
}
|
|
@@ -1,127 +1,123 @@
|
|
|
1
1
|
package com.theoplayer
|
|
2
2
|
|
|
3
3
|
import android.text.TextUtils
|
|
4
|
-
import android.util.Log
|
|
5
4
|
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings
|
|
6
|
+
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory
|
|
6
7
|
import com.theoplayer.android.api.THEOplayerConfig
|
|
7
8
|
import com.theoplayer.android.api.ads.AdsConfiguration
|
|
8
9
|
import com.theoplayer.android.api.ads.AdPreloadType
|
|
9
|
-
import com.theoplayer.android.api.ads.GoogleImaConfiguration
|
|
10
10
|
import com.theoplayer.android.api.cast.CastStrategy
|
|
11
|
-
import com.
|
|
11
|
+
import com.theoplayer.android.api.cast.CastConfiguration
|
|
12
12
|
import com.theoplayer.android.api.pip.PipConfiguration
|
|
13
13
|
import com.theoplayer.android.api.player.NetworkConfiguration
|
|
14
14
|
|
|
15
|
-
private const val TAG = "PlayerConfigAdapter"
|
|
16
|
-
private const val PROP_ADS_CONFIGURATION = "ads"
|
|
17
15
|
private const val PROP_LICENSE = "license"
|
|
18
16
|
private const val PROP_LICENSE_URL = "licenseUrl"
|
|
19
|
-
private const val PROP_CHROMELESS = "chromeless"
|
|
20
17
|
private const val PROP_PRELOAD = "preload"
|
|
21
18
|
private const val PROP_UI_ENABLED = "uiEnabled"
|
|
22
|
-
private const val PROP_GOOGLE_IMA_CONFIGURATION = "googleImaConfiguration"
|
|
23
|
-
private const val PROP_USE_NATIVE_IMA = "useNativeIma"
|
|
24
|
-
private const val PROP_CAST_CONFIGURATION = "cast"
|
|
25
19
|
private const val PROP_CAST_STRATEGY = "strategy"
|
|
26
|
-
private const val PROP_CHROMECAST_CONFIG = "chromecast"
|
|
27
|
-
private const val PROP_CHROMECAST_APPID = "appID"
|
|
28
20
|
private const val PROP_RETRY_CONFIG = "retryConfiguration"
|
|
29
21
|
private const val PROP_RETRY_MAX_RETRIES = "maxRetries"
|
|
30
22
|
private const val PROP_RETRY_MIN_BACKOFF = "minimumBackoff"
|
|
31
23
|
private const val PROP_RETRY_MAX_BACKOFF = "maximumBackoff"
|
|
24
|
+
private const val PROP_CAST_CONFIGURATION = "cast"
|
|
25
|
+
private const val PROP_ADS_CONFIGURATION = "ads"
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
class PlayerConfigAdapter(private val configProps: ReadableMap?) {
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Get general THEOplayerConfig object; these properties apply:
|
|
31
|
+
* - license: The license for the player.
|
|
32
|
+
* - licenseUrl: The url to fetch the license for the player.
|
|
33
|
+
* - retryConfiguration: The retry configuration for the player.
|
|
34
|
+
*/
|
|
35
|
+
fun playerConfig(): THEOplayerConfig {
|
|
36
|
+
return THEOplayerConfig.Builder().apply {
|
|
37
|
+
configProps?.run {
|
|
38
|
+
getString(PROP_LICENSE)?.let { license ->
|
|
39
|
+
license(license)
|
|
40
|
+
}
|
|
41
|
+
getString(PROP_LICENSE_URL)?.let { licenseUrl ->
|
|
42
|
+
licenseUrl(licenseUrl)
|
|
43
|
+
}
|
|
44
|
+
if (hasKey(PROP_RETRY_CONFIG)) {
|
|
45
|
+
networkConfiguration(networkConfig())
|
|
46
|
+
}
|
|
47
|
+
pipConfiguration(PipConfiguration.Builder().build())
|
|
52
48
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
}.build()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get NetworkConfiguration object; there properties apply:
|
|
54
|
+
* - maxRetries: The maximum amount of retries before the player throws a fatal error.
|
|
55
|
+
* - minimumBackoff: The initial delay in milliseconds before a retry request occurs.
|
|
56
|
+
* - maximumBackoff: The maximum amount of delay in milliseconds between retry requests.
|
|
57
|
+
*/
|
|
58
|
+
private fun networkConfig(): NetworkConfiguration {
|
|
59
|
+
return NetworkConfiguration.Builder().apply {
|
|
60
|
+
configProps?.getMap(PROP_RETRY_CONFIG)?.run {
|
|
61
|
+
if (hasKey(PROP_RETRY_MAX_RETRIES)) {
|
|
62
|
+
maxRetries(getInt(PROP_RETRY_MAX_RETRIES))
|
|
63
|
+
}
|
|
64
|
+
if (hasKey(PROP_RETRY_MIN_BACKOFF)) {
|
|
65
|
+
minimumBackOff(getDouble(PROP_RETRY_MIN_BACKOFF).toLong())
|
|
66
|
+
}
|
|
67
|
+
if (hasKey(PROP_RETRY_MAX_BACKOFF)) {
|
|
68
|
+
maximumBackOff(getDouble(PROP_RETRY_MAX_BACKOFF).toLong())
|
|
57
69
|
}
|
|
58
70
|
}
|
|
59
|
-
|
|
60
|
-
configBuilder.pipConfiguration(PipConfiguration.Builder().build())
|
|
61
|
-
}
|
|
62
|
-
return configBuilder.build()
|
|
71
|
+
}.build()
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Get AdsConfiguration object; these properties apply:
|
|
76
|
+
* - preload: Whether media files of mid- and postrolls are preloaded.
|
|
77
|
+
* - uiEnabled: Whether an advertisement UI is shown.
|
|
78
|
+
*/
|
|
79
|
+
fun adsConfig(): AdsConfiguration {
|
|
80
|
+
return AdsConfiguration.Builder().apply {
|
|
81
|
+
configProps?.getMap(PROP_ADS_CONFIGURATION)?.run {
|
|
82
|
+
if (hasKey(PROP_PRELOAD)) {
|
|
83
|
+
val preloadTypeString = getString(PROP_PRELOAD)
|
|
84
|
+
if (!TextUtils.isEmpty(preloadTypeString)) {
|
|
85
|
+
preload(AdPreloadType.from(preloadTypeString))
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (hasKey(PROP_UI_ENABLED)) {
|
|
89
|
+
showCountdown(getBoolean(PROP_UI_ENABLED))
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}.build()
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (configProps.hasKey(PROP_RETRY_MAX_BACKOFF)) {
|
|
98
|
-
builder.maximumBackOff(configProps.getDouble(PROP_RETRY_MAX_BACKOFF).toLong())
|
|
95
|
+
/**
|
|
96
|
+
* Create a AdsRenderingSettings object.
|
|
97
|
+
*/
|
|
98
|
+
fun adsRenderSettings(): AdsRenderingSettings {
|
|
99
|
+
return ImaSdkFactory.getInstance().createAdsRenderingSettings().apply {
|
|
100
|
+
configProps?.getMap(PROP_ADS_CONFIGURATION)?.run {
|
|
101
|
+
if (hasKey(PROP_UI_ENABLED) && !getBoolean(PROP_UI_ENABLED)) {
|
|
102
|
+
setUiElements(emptySet())
|
|
103
|
+
disableUi = true
|
|
104
|
+
}
|
|
105
|
+
}
|
|
99
106
|
}
|
|
100
|
-
return builder.build()
|
|
101
107
|
}
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
configBuilder.castStrategy(castStrategy)
|
|
114
|
-
} else {
|
|
115
|
-
Log.e(TAG, "Unknown cast strategy: $strStrategy")
|
|
116
|
-
}
|
|
117
|
-
val chromecastConfig = castConfig.getMap(PROP_CHROMECAST_CONFIG)
|
|
118
|
-
if (chromecastConfig != null) {
|
|
119
|
-
val appID = chromecastConfig.getString(PROP_CHROMECAST_APPID)
|
|
120
|
-
val castContext = CastContext.getSharedInstance()
|
|
121
|
-
if (appID != null && castContext != null) {
|
|
122
|
-
castContext.setReceiverApplicationId(appID)
|
|
109
|
+
/**
|
|
110
|
+
* Get CastConfiguration object; these properties apply:
|
|
111
|
+
* - strategy: The join strategy of the player.
|
|
112
|
+
*/
|
|
113
|
+
fun castConfig(): CastConfiguration {
|
|
114
|
+
return CastConfiguration.Builder().apply {
|
|
115
|
+
configProps?.getMap(PROP_CAST_CONFIGURATION)?.run {
|
|
116
|
+
castStrategyFromString(getString(PROP_CAST_STRATEGY))?.let { strategy ->
|
|
117
|
+
castStrategy(strategy)
|
|
118
|
+
}
|
|
123
119
|
}
|
|
124
|
-
}
|
|
120
|
+
}.build()
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
private fun castStrategyFromString(strStrategy: String?): CastStrategy? {
|
|
@@ -132,14 +128,4 @@ object PlayerConfigAdapter {
|
|
|
132
128
|
else -> null
|
|
133
129
|
}
|
|
134
130
|
}
|
|
135
|
-
|
|
136
|
-
private fun googleImaConfigurationFromProps(configProps: ReadableMap?): GoogleImaConfiguration? {
|
|
137
|
-
return if (configProps == null) {
|
|
138
|
-
null
|
|
139
|
-
} else GoogleImaConfiguration.Builder()
|
|
140
|
-
.useNativeIma(
|
|
141
|
-
configProps.hasKey(PROP_USE_NATIVE_IMA) && configProps.getBoolean(PROP_USE_NATIVE_IMA)
|
|
142
|
-
)
|
|
143
|
-
.build()
|
|
144
|
-
}
|
|
145
131
|
}
|
|
@@ -12,10 +12,8 @@ import android.os.IBinder
|
|
|
12
12
|
import android.os.Looper
|
|
13
13
|
import android.support.v4.media.session.MediaSessionCompat
|
|
14
14
|
import android.support.v4.media.session.PlaybackStateCompat
|
|
15
|
+
import android.util.Log
|
|
15
16
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
16
|
-
import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings
|
|
17
|
-
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory
|
|
18
|
-
import com.theoplayer.android.api.THEOplayerConfig
|
|
19
17
|
import com.theoplayer.android.api.THEOplayerView
|
|
20
18
|
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration
|
|
21
19
|
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegrationFactory
|
|
@@ -86,10 +84,10 @@ class ReactTHEOplayerContext private constructor(
|
|
|
86
84
|
companion object {
|
|
87
85
|
fun create(
|
|
88
86
|
reactContext: ThemedReactContext,
|
|
89
|
-
|
|
87
|
+
configAdapter: PlayerConfigAdapter
|
|
90
88
|
): ReactTHEOplayerContext {
|
|
91
89
|
return ReactTHEOplayerContext(reactContext).apply {
|
|
92
|
-
initializePlayerView(
|
|
90
|
+
initializePlayerView(configAdapter)
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
}
|
|
@@ -213,8 +211,8 @@ class ReactTHEOplayerContext private constructor(
|
|
|
213
211
|
binder = null
|
|
214
212
|
}
|
|
215
213
|
|
|
216
|
-
private fun initializePlayerView(
|
|
217
|
-
playerView = object : THEOplayerView(reactContext.currentActivity!!, playerConfig) {
|
|
214
|
+
private fun initializePlayerView(configAdapter: PlayerConfigAdapter) {
|
|
215
|
+
playerView = object : THEOplayerView(reactContext.currentActivity!!, configAdapter.playerConfig()) {
|
|
218
216
|
private fun measureAndLayout() {
|
|
219
217
|
measure(
|
|
220
218
|
MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY),
|
|
@@ -234,7 +232,7 @@ class ReactTHEOplayerContext private constructor(
|
|
|
234
232
|
// By default, the screen should remain on.
|
|
235
233
|
playerView.keepScreenOn = true
|
|
236
234
|
|
|
237
|
-
addIntegrations(
|
|
235
|
+
addIntegrations(configAdapter)
|
|
238
236
|
addListeners()
|
|
239
237
|
|
|
240
238
|
audioFocusManager = AudioFocusManager(reactContext, player)
|
|
@@ -268,34 +266,45 @@ class ReactTHEOplayerContext private constructor(
|
|
|
268
266
|
}
|
|
269
267
|
}
|
|
270
268
|
|
|
271
|
-
private fun addIntegrations(
|
|
269
|
+
private fun addIntegrations(configAdapter: PlayerConfigAdapter) {
|
|
272
270
|
try {
|
|
273
271
|
if (BuildConfig.EXTENSION_GOOGLE_IMA) {
|
|
274
|
-
imaIntegration = GoogleImaIntegrationFactory.createGoogleImaIntegration(
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
imaIntegration = GoogleImaIntegrationFactory.createGoogleImaIntegration(
|
|
273
|
+
playerView, configAdapter.adsConfig()
|
|
274
|
+
).apply {
|
|
275
|
+
setAdsRenderingSettings(configAdapter.adsRenderSettings())
|
|
276
|
+
}.also {
|
|
277
|
+
playerView.player.addIntegration(it)
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
|
-
} catch (
|
|
280
|
+
} catch (e: Exception) {
|
|
281
|
+
Log.w(TAG, "Failed to configure Google IMA integration ${e.message}")
|
|
280
282
|
}
|
|
281
283
|
try {
|
|
282
284
|
if (BuildConfig.EXTENSION_GOOGLE_DAI) {
|
|
283
|
-
daiIntegration = GoogleDaiIntegrationFactory.createGoogleDaiIntegration(
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
daiIntegration = GoogleDaiIntegrationFactory.createGoogleDaiIntegration(
|
|
286
|
+
playerView, configAdapter.adsConfig()
|
|
287
|
+
).apply {
|
|
288
|
+
setAdsRenderingSettings(configAdapter.adsRenderSettings())
|
|
289
|
+
}.also {
|
|
290
|
+
playerView.player.addIntegration(it)
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
|
-
} catch (
|
|
293
|
+
} catch (e: Exception) {
|
|
294
|
+
Log.w(TAG, "Failed to configure Google DAI integration ${e.message}")
|
|
289
295
|
}
|
|
290
296
|
try {
|
|
291
297
|
if (BuildConfig.EXTENSION_CAST) {
|
|
292
|
-
castIntegration = CastIntegrationFactory.createCastIntegration(
|
|
293
|
-
playerView.
|
|
298
|
+
castIntegration = CastIntegrationFactory.createCastIntegration(
|
|
299
|
+
playerView, configAdapter.castConfig()
|
|
300
|
+
).also {
|
|
301
|
+
playerView.player.addIntegration(it)
|
|
294
302
|
}
|
|
295
303
|
}
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
} catch (e: Exception) {
|
|
305
|
+
Log.w(TAG, "Failed to configure Cast integration ${e.message}")
|
|
298
306
|
}
|
|
307
|
+
// Add other future integrations here.
|
|
299
308
|
}
|
|
300
309
|
|
|
301
310
|
private val onSourceChange = EventListener<SourceChangeEvent> {
|
|
@@ -343,15 +352,6 @@ class ReactTHEOplayerContext private constructor(
|
|
|
343
352
|
}
|
|
344
353
|
}
|
|
345
354
|
|
|
346
|
-
private fun createRenderSettings(playerConfig: THEOplayerConfig): AdsRenderingSettings {
|
|
347
|
-
val renderingSettings = ImaSdkFactory.getInstance().createAdsRenderingSettings()
|
|
348
|
-
if (playerConfig.ads != null && !playerConfig.ads!!.isShowCountdown) {
|
|
349
|
-
renderingSettings.setUiElements(emptySet())
|
|
350
|
-
renderingSettings.disableUi = true
|
|
351
|
-
}
|
|
352
|
-
return renderingSettings
|
|
353
|
-
}
|
|
354
|
-
|
|
355
355
|
/**
|
|
356
356
|
* The host activity is paused.
|
|
357
357
|
*/
|
|
@@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.NativeModule
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
7
|
import com.theoplayer.ads.AdsModule
|
|
8
|
+
import com.theoplayer.cache.CacheModule
|
|
8
9
|
import com.theoplayer.drm.ContentProtectionModule
|
|
9
10
|
import com.theoplayer.cast.CastModule
|
|
10
11
|
import com.theoplayer.player.PlayerModule
|
|
@@ -15,7 +16,8 @@ class ReactTHEOplayerPackage : ReactPackage {
|
|
|
15
16
|
PlayerModule(reactContext),
|
|
16
17
|
AdsModule(reactContext),
|
|
17
18
|
ContentProtectionModule(reactContext),
|
|
18
|
-
CastModule(reactContext)
|
|
19
|
+
CastModule(reactContext),
|
|
20
|
+
CacheModule(reactContext)
|
|
19
21
|
)
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -51,7 +51,7 @@ class ReactTHEOplayerView(private val reactContext: ThemedReactContext) :
|
|
|
51
51
|
isInitialized = true
|
|
52
52
|
playerContext = ReactTHEOplayerContext.create(
|
|
53
53
|
reactContext,
|
|
54
|
-
PlayerConfigAdapter
|
|
54
|
+
PlayerConfigAdapter(configProps)
|
|
55
55
|
)
|
|
56
56
|
playerContext?.let {
|
|
57
57
|
if (BuildConfig.EXTENSION_ADS) {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
package com.theoplayer.cache
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments
|
|
4
|
+
import com.facebook.react.bridge.ReadableArray
|
|
5
|
+
import com.facebook.react.bridge.ReadableMap
|
|
6
|
+
import com.facebook.react.bridge.WritableArray
|
|
7
|
+
import com.facebook.react.bridge.WritableMap
|
|
8
|
+
import com.theoplayer.android.api.cache.CacheStatus
|
|
9
|
+
import com.theoplayer.android.api.cache.CachingParameters
|
|
10
|
+
import com.theoplayer.android.api.cache.CachingPreferredTrackSelection
|
|
11
|
+
import com.theoplayer.android.api.cache.CachingTask
|
|
12
|
+
import com.theoplayer.android.api.cache.CachingTaskList
|
|
13
|
+
import com.theoplayer.android.api.cache.CachingTaskProgress
|
|
14
|
+
import com.theoplayer.android.api.cache.CachingTaskStatus
|
|
15
|
+
import com.theoplayer.source.SourceAdapter
|
|
16
|
+
import com.theoplayer.util.fromTimeRanges
|
|
17
|
+
import java.util.Date
|
|
18
|
+
|
|
19
|
+
private const val PROP_ID = "id"
|
|
20
|
+
private const val PROP_STATUS = "status"
|
|
21
|
+
private const val PROP_SOURCE = "source"
|
|
22
|
+
private const val PROP_PARAMETERS = "parameters"
|
|
23
|
+
private const val PROP_PARAMETERS_AMOUNT = "amount"
|
|
24
|
+
private const val PROP_PARAMETERS_EXPIRATION_DATE = "expirationDate"
|
|
25
|
+
private const val PROP_PARAMETERS_BANDWIDTH = "bandwidth"
|
|
26
|
+
private const val PROP_PARAMETERS_PREFERRED_TRACK_SELECTION = "preferredTrackSelection"
|
|
27
|
+
private const val PROP_PARAMETERS_AUDIO_TRACK_SELECTION = "audioTrackSelection"
|
|
28
|
+
private const val PROP_PARAMETERS_TEXT_TRACK_SELECTION = "textTrackSelection"
|
|
29
|
+
private const val PROP_DURATION = "duration"
|
|
30
|
+
private const val PROP_CACHED = "cached"
|
|
31
|
+
private const val PROP_SECONDS_CACHED = "secondsCached"
|
|
32
|
+
private const val PROP_PERCENTAGE_CACHED = "percentageCached"
|
|
33
|
+
private const val PROP_BYTES = "bytes"
|
|
34
|
+
private const val PROP_BYTES_CACHED = "bytesCached"
|
|
35
|
+
|
|
36
|
+
object CacheAdapter {
|
|
37
|
+
|
|
38
|
+
fun fromCachingTask(task: CachingTask?): WritableMap {
|
|
39
|
+
if (task == null) {
|
|
40
|
+
return Arguments.createMap()
|
|
41
|
+
}
|
|
42
|
+
return Arguments.createMap().apply {
|
|
43
|
+
putString(PROP_ID, task.id)
|
|
44
|
+
putString(PROP_STATUS, fromCacheTaskStatus(task.status))
|
|
45
|
+
putMap(PROP_SOURCE, SourceAdapter().fromSourceDescription(task.source))
|
|
46
|
+
putMap(PROP_PARAMETERS, fromCachingParameters(task.parameters))
|
|
47
|
+
putDouble(PROP_DURATION, task.duration)
|
|
48
|
+
putArray(PROP_CACHED, fromTimeRanges(task.cached))
|
|
49
|
+
putDouble(PROP_SECONDS_CACHED, task.secondsCached)
|
|
50
|
+
putDouble(PROP_PERCENTAGE_CACHED, task.percentageCached)
|
|
51
|
+
putDouble(PROP_BYTES, task.bytes.toDouble())
|
|
52
|
+
putDouble(PROP_BYTES_CACHED, task.bytesCached.toDouble())
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
fun fromCachingTaskList(taskList: CachingTaskList?): WritableArray {
|
|
57
|
+
return Arguments.createArray().apply {
|
|
58
|
+
taskList?.forEach { task ->
|
|
59
|
+
pushMap(fromCachingTask(task))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fun fromCacheStatus(status: CacheStatus): String {
|
|
65
|
+
return when (status) {
|
|
66
|
+
CacheStatus.INITIALISED -> "initialised"
|
|
67
|
+
else -> "uninitialised"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fun fromCachingTaskProgress(progress: CachingTaskProgress): WritableMap {
|
|
72
|
+
return Arguments.createMap().apply {
|
|
73
|
+
putDouble(PROP_DURATION, progress.duration)
|
|
74
|
+
putArray(PROP_CACHED, fromTimeRanges(progress.cached))
|
|
75
|
+
putDouble(PROP_SECONDS_CACHED, progress.secondsCached)
|
|
76
|
+
putDouble(PROP_PERCENTAGE_CACHED, progress.percentageCached)
|
|
77
|
+
putDouble(PROP_BYTES, progress.bytes.toDouble())
|
|
78
|
+
putDouble(PROP_BYTES_CACHED, progress.bytesCached.toDouble())
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fun fromCacheTaskStatus(status: CachingTaskStatus): String {
|
|
83
|
+
return when (status) {
|
|
84
|
+
CachingTaskStatus.ERROR -> "error"
|
|
85
|
+
CachingTaskStatus.DONE -> "done"
|
|
86
|
+
CachingTaskStatus.EVICTED -> "evicted"
|
|
87
|
+
CachingTaskStatus.LOADING -> "loading"
|
|
88
|
+
else -> "idle"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
fun parseCachingParameters(parameters: ReadableMap): CachingParameters {
|
|
93
|
+
return CachingParameters.Builder().apply {
|
|
94
|
+
amount(parameters.getString(PROP_PARAMETERS_AMOUNT))
|
|
95
|
+
if (parameters.hasKey(PROP_PARAMETERS_BANDWIDTH)) {
|
|
96
|
+
bandwidth(parameters.getDouble(PROP_PARAMETERS_BANDWIDTH).toLong())
|
|
97
|
+
}
|
|
98
|
+
if (parameters.hasKey(PROP_PARAMETERS_EXPIRATION_DATE)) {
|
|
99
|
+
expirationDate(Date(parameters.getDouble(PROP_PARAMETERS_EXPIRATION_DATE).toLong()))
|
|
100
|
+
}
|
|
101
|
+
if (parameters.hasKey(PROP_PARAMETERS_PREFERRED_TRACK_SELECTION)) {
|
|
102
|
+
preferredTrackSelection(parsePreferredTrackSelection(parameters.getMap(PROP_PARAMETERS_PREFERRED_TRACK_SELECTION)))
|
|
103
|
+
}
|
|
104
|
+
}.build()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private fun parsePreferredTrackSelection(parameters: ReadableMap?): CachingPreferredTrackSelection {
|
|
108
|
+
return CachingPreferredTrackSelection.Builder().apply {
|
|
109
|
+
audioTrackSelection(fromReadableStringArray(parameters?.getArray(PROP_PARAMETERS_AUDIO_TRACK_SELECTION)))
|
|
110
|
+
textTrackSelection(fromReadableStringArray(parameters?.getArray(PROP_PARAMETERS_TEXT_TRACK_SELECTION)))
|
|
111
|
+
}.build()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private fun fromReadableStringArray(array: ReadableArray?): Array<String>? {
|
|
115
|
+
return array?.toArrayList()?.map { it.toString() }?.toTypedArray()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private fun fromCachingParameters(parameters: CachingParameters?): WritableMap {
|
|
119
|
+
return Arguments.createMap().apply {
|
|
120
|
+
if (parameters != null) {
|
|
121
|
+
putString(PROP_PARAMETERS_AMOUNT, parameters.amount)
|
|
122
|
+
putDouble(PROP_PARAMETERS_BANDWIDTH, parameters.bandwidth.toDouble())
|
|
123
|
+
putDouble(PROP_PARAMETERS_EXPIRATION_DATE, parameters.expirationDate.time.toDouble())
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|