react-native-theoplayer 2.16.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -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 +203 -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 +5 -5
- 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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { DefaultEventDispatcher } from '../adapter/event/DefaultEventDispatcher';
|
|
2
|
+
import type {
|
|
3
|
+
CachingTask,
|
|
4
|
+
CachingTaskEventMap,
|
|
5
|
+
CachingTaskLicense,
|
|
6
|
+
CachingTaskParameters,
|
|
7
|
+
SourceDescription,
|
|
8
|
+
TimeRange,
|
|
9
|
+
} from 'react-native-theoplayer';
|
|
10
|
+
import type { CacheTaskStatus } from 'react-native-theoplayer';
|
|
11
|
+
import { NativeModules } from 'react-native';
|
|
12
|
+
import type { DRMConfiguration } from 'react-native-theoplayer';
|
|
13
|
+
import { fromNativeCachingTaskParameters, NativeCachingTaskParameters } from "./NativeCachingTaskParametersAdapter";
|
|
14
|
+
|
|
15
|
+
export interface NativeCachingTask {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
|
|
18
|
+
readonly status: CacheTaskStatus;
|
|
19
|
+
|
|
20
|
+
readonly source: SourceDescription;
|
|
21
|
+
|
|
22
|
+
readonly parameters: NativeCachingTaskParameters;
|
|
23
|
+
|
|
24
|
+
readonly duration: number;
|
|
25
|
+
|
|
26
|
+
readonly cached: TimeRange[];
|
|
27
|
+
|
|
28
|
+
readonly secondsCached: number;
|
|
29
|
+
|
|
30
|
+
readonly percentageCached: number;
|
|
31
|
+
|
|
32
|
+
readonly bytes: number;
|
|
33
|
+
|
|
34
|
+
readonly bytesCached: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class NativeCachingTaskAdapter extends DefaultEventDispatcher<CachingTaskEventMap> implements CachingTask {
|
|
38
|
+
readonly bytes: number;
|
|
39
|
+
readonly bytesCached: number;
|
|
40
|
+
readonly cached: TimeRange[];
|
|
41
|
+
readonly duration: number;
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly license: CachingTaskLicense;
|
|
44
|
+
readonly parameters: CachingTaskParameters;
|
|
45
|
+
readonly percentageCached: number;
|
|
46
|
+
readonly secondsCached: number;
|
|
47
|
+
readonly source: SourceDescription;
|
|
48
|
+
readonly status: CacheTaskStatus;
|
|
49
|
+
|
|
50
|
+
constructor(task: NativeCachingTask) {
|
|
51
|
+
super();
|
|
52
|
+
this.bytes = task.bytes;
|
|
53
|
+
this.cached = { ...task.cached };
|
|
54
|
+
this.duration = task.duration;
|
|
55
|
+
this.id = task.id;
|
|
56
|
+
this.bytesCached = task.bytesCached;
|
|
57
|
+
this.license = {
|
|
58
|
+
renew(drmConfiguration?: DRMConfiguration) {
|
|
59
|
+
NativeModules.CacheModule.renewLicense(task.id, drmConfiguration);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
this.parameters = fromNativeCachingTaskParameters(task.parameters);
|
|
63
|
+
this.percentageCached = task.percentageCached;
|
|
64
|
+
this.secondsCached = task.secondsCached;
|
|
65
|
+
// TODO!
|
|
66
|
+
this.source = { ...task.source };
|
|
67
|
+
this.status = task.status;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
pause(): void {
|
|
71
|
+
NativeModules.CacheModule.pauseCachingTask(this.id);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
remove(): void {
|
|
75
|
+
NativeModules.CacheModule.removeCachingTask(this.id);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
start(): void {
|
|
79
|
+
NativeModules.CacheModule.startCachingTask(this.id);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CachingTaskParameters,
|
|
3
|
+
} from 'react-native-theoplayer';
|
|
4
|
+
import type { CachingPreferredTrackSelection } from "../../api/cache/CachingPreferredTrackSelection";
|
|
5
|
+
|
|
6
|
+
export interface NativeCachingTaskParameters {
|
|
7
|
+
readonly amount: number | string;
|
|
8
|
+
readonly expirationDate: number | undefined;
|
|
9
|
+
readonly bandwidth: number | undefined;
|
|
10
|
+
readonly preferredTrackSelection: CachingPreferredTrackSelection | undefined;
|
|
11
|
+
readonly allowsCellularAccess: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function fromNativeCachingTaskParameters(parameters: NativeCachingTaskParameters): CachingTaskParameters {
|
|
15
|
+
return {
|
|
16
|
+
amount: parameters.amount,
|
|
17
|
+
expirationDate: parameters?.expirationDate? new Date(parameters?.expirationDate) : undefined,
|
|
18
|
+
bandwidth: parameters.bandwidth,
|
|
19
|
+
preferredTrackSelection: parameters.preferredTrackSelection,
|
|
20
|
+
allowsCellularAccess: parameters.allowsCellularAccess
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function toNativeCachingTaskParameters(parameters: CachingTaskParameters): NativeCachingTaskParameters {
|
|
25
|
+
return {
|
|
26
|
+
amount: parameters.amount,
|
|
27
|
+
expirationDate: parameters?.expirationDate?.getTime(),
|
|
28
|
+
bandwidth: parameters.bandwidth,
|
|
29
|
+
preferredTrackSelection: parameters.preferredTrackSelection,
|
|
30
|
+
allowsCellularAccess: parameters.allowsCellularAccess
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CachingTask,
|
|
3
|
+
CachingTaskEventMap,
|
|
4
|
+
CachingTaskLicense,
|
|
5
|
+
CachingTaskParameters,
|
|
6
|
+
SourceDescription,
|
|
7
|
+
TimeRange,
|
|
8
|
+
} from 'react-native-theoplayer';
|
|
9
|
+
|
|
10
|
+
import type { CachingTask as WebCachingTask, CachingTaskEventMap as WebCachingTaskEventMap } from 'theoplayer';
|
|
11
|
+
import type { CacheTaskStatus } from 'react-native-theoplayer';
|
|
12
|
+
import type { StringKeyOf } from '../../api/event/EventDispatcher';
|
|
13
|
+
import type { EventListener } from '../../api/event/EventListener';
|
|
14
|
+
|
|
15
|
+
export class WebCachingTaskAdapter implements CachingTask {
|
|
16
|
+
constructor(private webCachingTask: WebCachingTask) {}
|
|
17
|
+
|
|
18
|
+
get bytes(): number {
|
|
19
|
+
return this.webCachingTask.bytes;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get bytesCached(): number {
|
|
23
|
+
return this.webCachingTask.bytesCached;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get cached(): TimeRange[] {
|
|
27
|
+
return fromTimeRanges(this.webCachingTask.cached);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get duration(): number {
|
|
31
|
+
return this.webCachingTask.duration;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get id(): string {
|
|
35
|
+
return this.webCachingTask.id;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get license(): CachingTaskLicense {
|
|
39
|
+
return this.webCachingTask.license;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get parameters(): CachingTaskParameters {
|
|
43
|
+
return this.webCachingTask.parameters;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get percentageCached(): number {
|
|
47
|
+
return this.webCachingTask.percentageCached;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get secondsCached(): number {
|
|
51
|
+
return this.webCachingTask.secondsCached;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get source(): SourceDescription {
|
|
55
|
+
return this.webCachingTask.source as SourceDescription;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get status(): CacheTaskStatus {
|
|
59
|
+
return this.webCachingTask.status as CacheTaskStatus;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
start(): void {
|
|
63
|
+
this.webCachingTask.start();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
pause(): void {
|
|
67
|
+
this.webCachingTask.pause();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
remove(): void {
|
|
71
|
+
this.webCachingTask.remove();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
addEventListener<TType extends StringKeyOf<CachingTaskEventMap>>(type: TType[] | TType, listener: EventListener<CachingTaskEventMap[TType]>) {
|
|
75
|
+
this.webCachingTask.addEventListener(type, listener as EventListener<WebCachingTaskEventMap[TType]>);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
removeEventListener<TType extends StringKeyOf<CachingTaskEventMap>>(
|
|
79
|
+
type: TType[] | TType,
|
|
80
|
+
listener: EventListener<CachingTaskEventMap[TType]>,
|
|
81
|
+
): void {
|
|
82
|
+
this.webCachingTask.removeEventListener(type, listener as EventListener<WebCachingTaskEventMap[TType]>);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function fromTimeRanges(timeRanges: TimeRanges): TimeRange[] {
|
|
87
|
+
const result: TimeRange[] = [];
|
|
88
|
+
for (let i = 0; i < timeRanges.length; i++) {
|
|
89
|
+
result.push({
|
|
90
|
+
start: timeRanges.start(i) * 1e3,
|
|
91
|
+
end: timeRanges.end(i) * 1e3,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package com.theoplayer.track
|
|
2
|
-
|
|
3
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.Quality
|
|
4
|
-
import com.theoplayer.android.api.player.track.mediatrack.quality.QualityList
|
|
5
|
-
import com.facebook.react.bridge.ReadableArray
|
|
6
|
-
import java.util.ArrayList
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* QualityListFilter allows filtering a QualityList.
|
|
10
|
-
*/
|
|
11
|
-
class QualityListFilter<Q : Quality>(private val qualities: QualityList<Q>) {
|
|
12
|
-
|
|
13
|
-
fun filterQualityList(uids: ReadableArray): QualityList<Q> {
|
|
14
|
-
return QualityListAdapter(filterList(uids))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
private fun filterList(uids: ReadableArray): MutableList<Q> {
|
|
18
|
-
val filteredQualities: MutableList<Q> = ArrayList()
|
|
19
|
-
for (q in 0 until uids.size()) {
|
|
20
|
-
for (quality in qualities) {
|
|
21
|
-
if (uids.getInt(q) == quality.uid) {
|
|
22
|
-
filteredQualities.add(quality)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return filteredQualities
|
|
27
|
-
}
|
|
28
|
-
}
|