react-native-theoplayer 9.10.0 → 10.1.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 +35 -0
- package/README.md +2 -1
- package/android/build.gradle +11 -12
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/10.0.0/ads-wrapper-10.0.0.aar +0 -0
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/{9.0.0/ads-wrapper-9.0.0.pom → 10.0.0/ads-wrapper-10.0.0.pom} +3 -3
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +4 -4
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +39 -10
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerPackage.kt +32 -14
- package/android/src/main/java/com/theoplayer/ads/AdsModule.kt +18 -6
- package/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt +15 -5
- package/android/src/main/java/com/theoplayer/cache/CacheAdapter.kt +0 -12
- package/android/src/main/java/com/theoplayer/cache/CacheModule.kt +20 -7
- package/android/src/main/java/com/theoplayer/cast/CastEventAdapter.kt +11 -7
- package/android/src/main/java/com/theoplayer/cast/CastModule.kt +17 -3
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +1 -1
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +28 -11
- package/android/src/main/java/com/theoplayer/media/ConditionalMediaButtonReceiver.kt +38 -0
- package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +17 -4
- package/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt +12 -3
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +16 -37
- package/android/src/main/java/com/theoplayer/theoads/THEOadsAdapter.kt +83 -0
- package/android/src/main/java/com/theoplayer/theoads/THEOadsEventAdapter.kt +55 -0
- package/android/src/main/java/com/theoplayer/theoads/THEOadsModule.kt +63 -0
- package/android/src/main/java/com/theoplayer/theolive/THEOliveEventAdapter.kt +21 -8
- package/android/src/main/java/com/theoplayer/theolive/THEOliveModule.kt +16 -3
- package/android/src/main/java/com/theoplayer/track/TextTrackStyleAdapter.kt +8 -1
- package/android/src/main/java/com/theoplayer/util/PayloadBuilder.kt +8 -0
- package/ios/THEOplayerRCTBridge.m +21 -1
- package/ios/THEOplayerRCTDebug.swift +4 -1
- package/ios/THEOplayerRCTMainEventHandler.swift +24 -21
- package/ios/THEOplayerRCTPlayerAPI.swift +3 -3
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +2 -1
- package/ios/THEOplayerRCTView.swift +22 -4
- package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +96 -50
- package/ios/backgroundAudio/THEOplayerRCTRemoteCommandsManager.swift +0 -1
- package/ios/casting/THEOplayerRCTCastEventHandler.swift +1 -1
- package/ios/presentationMode/THEOplayerRCTPresentationModeManager.swift +24 -6
- package/ios/theoAds/THEOplayerRCTTHEOAdsAPI.swift +101 -0
- package/ios/theoAds/THEOplayerRCTTHEOAdsEventAdapter.swift +118 -0
- package/ios/theoAds/THEOplayerRCTTHEOAdsEventHandler.swift +174 -0
- package/ios/theolive/THEOplayerRCTSourceDescriptionBuilder+Theolive.swift +0 -1
- package/ios/theolive/THEOplayerRCTTHEOliveEventHandler.swift +1 -1
- package/ios/theolive/THEOplayerRCTView+THEOlive.swift +1 -5
- package/ios/theolive/THEOplayerRCTView+THEOliveConfig.swift +0 -2
- package/lib/commonjs/api/barrel.js +45 -56
- package/lib/commonjs/api/barrel.js.map +1 -1
- package/lib/commonjs/api/cache/CachingTaskParameters.js +0 -19
- package/lib/commonjs/api/cache/CachingTaskParameters.js.map +1 -1
- package/lib/commonjs/api/event/PlayerEvent.js +16 -0
- package/lib/commonjs/api/event/PlayerEvent.js.map +1 -1
- package/lib/commonjs/api/event/TheoAdsEvent.js +7 -0
- package/lib/commonjs/api/event/TheoAdsEvent.js.map +1 -1
- package/lib/commonjs/api/player/PlayerEventMap.js +2 -0
- package/lib/commonjs/api/player/PlayerEventMap.js.map +1 -1
- package/lib/commonjs/api/source/SourceDescription.js +1 -13
- package/lib/commonjs/api/source/SourceDescription.js.map +1 -1
- package/lib/commonjs/api/source/ads/{THEOplayerAdDescription.js → CsaiAdDescription.js} +1 -1
- package/lib/commonjs/api/source/ads/CsaiAdDescription.js.map +1 -0
- package/lib/commonjs/api/source/ads/barrel.js +4 -4
- package/lib/commonjs/api/source/ads/barrel.js.map +1 -1
- package/lib/commonjs/api/track/Quality.js +37 -0
- package/lib/commonjs/api/track/Quality.js.map +1 -1
- package/lib/commonjs/api/track/TextTrackStyle.js.map +1 -1
- package/lib/commonjs/index.js +0 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +15 -3
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
- package/lib/commonjs/internal/adapter/DefaultNativePlayerState.js +2 -0
- package/lib/commonjs/internal/adapter/DefaultNativePlayerState.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +27 -9
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +18 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +15 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js +30 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/native/NativeTheoAdsEvent.js +20 -0
- package/lib/commonjs/internal/adapter/event/native/NativeTheoAdsEvent.js.map +1 -0
- package/lib/commonjs/internal/adapter/theoads/THEOAdsNativeAdapter.js +6 -12
- package/lib/commonjs/internal/adapter/theoads/THEOAdsNativeAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +10 -0
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/commonjs/internal/utils/TypeUtils.js +4 -1
- package/lib/commonjs/internal/utils/TypeUtils.js.map +1 -1
- package/lib/commonjs/manifest.json +1 -1
- package/lib/module/api/barrel.js +0 -1
- package/lib/module/api/barrel.js.map +1 -1
- package/lib/module/api/cache/CachingTaskParameters.js +1 -19
- package/lib/module/api/cache/CachingTaskParameters.js.map +1 -1
- package/lib/module/api/event/PlayerEvent.js +18 -0
- package/lib/module/api/event/PlayerEvent.js.map +1 -1
- package/lib/module/api/event/TheoAdsEvent.js +8 -0
- package/lib/module/api/event/TheoAdsEvent.js.map +1 -1
- package/lib/module/api/player/PlayerEventMap.js +2 -0
- package/lib/module/api/player/PlayerEventMap.js.map +1 -1
- package/lib/module/api/source/SourceDescription.js +0 -13
- package/lib/module/api/source/SourceDescription.js.map +1 -1
- package/lib/module/api/source/ads/CsaiAdDescription.js +4 -0
- package/lib/module/api/source/ads/CsaiAdDescription.js.map +1 -0
- package/lib/module/api/source/ads/barrel.js +1 -1
- package/lib/module/api/source/ads/barrel.js.map +1 -1
- package/lib/module/api/track/Quality.js +34 -0
- package/lib/module/api/track/Quality.js.map +1 -1
- package/lib/module/api/track/TextTrackStyle.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +16 -4
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/THEOplayerView.web.js +1 -1
- package/lib/module/internal/THEOplayerView.web.js.map +1 -1
- package/lib/module/internal/adapter/DefaultNativePlayerState.js +2 -0
- package/lib/module/internal/adapter/DefaultNativePlayerState.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +28 -10
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js +18 -1
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +16 -2
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/adapter/event/PlayerEvents.js +26 -0
- package/lib/module/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/module/internal/adapter/event/native/NativeTheoAdsEvent.js +16 -0
- package/lib/module/internal/adapter/event/native/NativeTheoAdsEvent.js.map +1 -0
- package/lib/module/internal/adapter/theoads/THEOAdsNativeAdapter.js +6 -12
- package/lib/module/internal/adapter/theoads/THEOAdsNativeAdapter.js.map +1 -1
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js +10 -0
- package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/module/internal/utils/TypeUtils.js +3 -0
- package/lib/module/internal/utils/TypeUtils.js.map +1 -1
- package/lib/module/manifest.json +1 -1
- package/lib/typescript/api/barrel.d.ts +0 -1
- package/lib/typescript/api/barrel.d.ts.map +1 -1
- package/lib/typescript/api/cache/CachingTaskParameters.d.ts +0 -34
- package/lib/typescript/api/cache/CachingTaskParameters.d.ts.map +1 -1
- package/lib/typescript/api/event/PlayerEvent.d.ts +36 -0
- package/lib/typescript/api/event/PlayerEvent.d.ts.map +1 -1
- package/lib/typescript/api/event/TheoAdsEvent.d.ts +13 -0
- package/lib/typescript/api/event/TheoAdsEvent.d.ts.map +1 -1
- package/lib/typescript/api/player/PlayerEventMap.d.ts +17 -2
- package/lib/typescript/api/player/PlayerEventMap.d.ts.map +1 -1
- package/lib/typescript/api/player/THEOplayer.d.ts +8 -0
- package/lib/typescript/api/player/THEOplayer.d.ts.map +1 -1
- package/lib/typescript/api/source/SourceDescription.d.ts +0 -20
- package/lib/typescript/api/source/SourceDescription.d.ts.map +1 -1
- package/lib/typescript/api/source/ads/{THEOplayerAdDescription.d.ts → CsaiAdDescription.d.ts} +2 -2
- package/lib/typescript/api/source/ads/CsaiAdDescription.d.ts.map +1 -0
- package/lib/typescript/api/source/ads/barrel.d.ts +1 -1
- package/lib/typescript/api/source/ads/barrel.d.ts.map +1 -1
- package/lib/typescript/api/track/Quality.d.ts +1 -0
- package/lib/typescript/api/track/Quality.d.ts.map +1 -1
- package/lib/typescript/api/track/TextTrackStyle.d.ts +7 -0
- package/lib/typescript/api/track/TextTrackStyle.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/internal/THEOplayerView.d.ts +3 -1
- package/lib/typescript/internal/THEOplayerView.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/DefaultNativePlayerState.d.ts +2 -0
- package/lib/typescript/internal/adapter/DefaultNativePlayerState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/NativePlayerState.d.ts +2 -0
- package/lib/typescript/internal/adapter/NativePlayerState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +5 -3
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +5 -0
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +1 -0
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts +20 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts +11 -1
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/native/NativeTheoAdsEvent.d.ts +18 -0
- package/lib/typescript/internal/adapter/event/native/NativeTheoAdsEvent.d.ts.map +1 -0
- package/lib/typescript/internal/adapter/theoads/THEOAdsNativeAdapter.d.ts +1 -1
- package/lib/typescript/internal/adapter/theoads/THEOAdsNativeAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/track/TextTrackStyleAdapter.d.ts +3 -0
- package/lib/typescript/internal/adapter/track/TextTrackStyleAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/utils/TypeUtils.d.ts +1 -0
- package/lib/typescript/internal/utils/TypeUtils.d.ts.map +1 -1
- package/package.json +6 -6
- package/react-native-theoplayer.podspec +7 -7
- package/src/api/barrel.ts +0 -1
- package/src/api/cache/CachingTaskParameters.ts +0 -37
- package/src/api/event/PlayerEvent.ts +40 -0
- package/src/api/event/TheoAdsEvent.ts +14 -0
- package/src/api/player/PlayerEventMap.ts +19 -0
- package/src/api/player/THEOplayer.ts +10 -0
- package/src/api/source/SourceDescription.ts +0 -22
- package/src/api/source/ads/{THEOplayerAdDescription.ts → CsaiAdDescription.ts} +1 -1
- package/src/api/source/ads/barrel.ts +1 -1
- package/src/api/track/Quality.ts +15 -0
- package/src/api/track/TextTrackStyle.ts +8 -0
- package/src/index.tsx +0 -1
- package/src/internal/THEOplayerView.tsx +24 -5
- package/src/internal/THEOplayerView.web.tsx +1 -1
- package/src/internal/adapter/DefaultNativePlayerState.ts +2 -0
- package/src/internal/adapter/NativePlayerState.ts +2 -0
- package/src/internal/adapter/THEOplayerAdapter.ts +43 -21
- package/src/internal/adapter/THEOplayerWebAdapter.ts +22 -2
- package/src/internal/adapter/WebEventForwarder.ts +17 -1
- package/src/internal/adapter/event/PlayerEvents.ts +34 -0
- package/src/internal/adapter/event/native/NativePlayerEvent.ts +13 -1
- package/src/internal/adapter/event/native/NativeTheoAdsEvent.ts +30 -0
- package/src/internal/adapter/theoads/THEOAdsNativeAdapter.ts +7 -12
- package/src/internal/adapter/track/TextTrackStyleAdapter.ts +12 -0
- package/src/internal/utils/TypeUtils.ts +6 -0
- package/src/manifest.json +1 -1
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/9.0.0/ads-wrapper-9.0.0.aar +0 -0
- package/android/src/main/java/com/theoplayer/playback/PlaybackSettingsModule.kt +0 -28
- package/lib/commonjs/api/playback/PlaybackSettingsAPI.js +0 -2
- package/lib/commonjs/api/playback/PlaybackSettingsAPI.js.map +0 -1
- package/lib/commonjs/api/playback/barrel.js +0 -17
- package/lib/commonjs/api/playback/barrel.js.map +0 -1
- package/lib/commonjs/api/source/ads/THEOplayerAdDescription.js.map +0 -1
- package/lib/commonjs/internal/playback/PlaybackSettings.js +0 -28
- package/lib/commonjs/internal/playback/PlaybackSettings.js.map +0 -1
- package/lib/module/api/playback/PlaybackSettingsAPI.js +0 -2
- package/lib/module/api/playback/PlaybackSettingsAPI.js.map +0 -1
- package/lib/module/api/playback/barrel.js +0 -4
- package/lib/module/api/playback/barrel.js.map +0 -1
- package/lib/module/api/source/ads/THEOplayerAdDescription.js +0 -4
- package/lib/module/api/source/ads/THEOplayerAdDescription.js.map +0 -1
- package/lib/module/internal/playback/PlaybackSettings.js +0 -23
- package/lib/module/internal/playback/PlaybackSettings.js.map +0 -1
- package/lib/typescript/api/playback/PlaybackSettingsAPI.d.ts +0 -35
- package/lib/typescript/api/playback/PlaybackSettingsAPI.d.ts.map +0 -1
- package/lib/typescript/api/playback/barrel.d.ts +0 -2
- package/lib/typescript/api/playback/barrel.d.ts.map +0 -1
- package/lib/typescript/api/source/ads/THEOplayerAdDescription.d.ts.map +0 -1
- package/lib/typescript/internal/playback/PlaybackSettings.d.ts +0 -7
- package/lib/typescript/internal/playback/PlaybackSettings.d.ts.map +0 -1
- package/src/api/playback/PlaybackSettingsAPI.ts +0 -36
- package/src/api/playback/barrel.ts +0 -1
- package/src/internal/playback/PlaybackSettings.ts +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@ 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
|
+
## [10.1.0] - 25-10-06
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added an explicit clearing of the NowPlayingInfo on iOS, when the app receives a `willTerminateNotification`, to make sure all NowPlayingInfo is removed from the lock screen when an app is closed.
|
|
13
|
+
- Added `videoWidth` and `videoHeight` properties to `THEOplayer` containing the active video's resolution in pixels.
|
|
14
|
+
- Added `videoresize` player event enabling monitoring of video rendition resizes.
|
|
15
|
+
- Added `dimensionchange` player event enabling monitoring of player resizes. This event is set to replace the now deprecated `resize` player event.
|
|
16
|
+
- Added `fontPath` to `TextTrackStyle` to allow loading custom fonts from the Android assets folder.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fixed an issue on Android where play-out of Millicast sources in the example app would fail. The Android NDK version needs to be at least v28.
|
|
21
|
+
- Fixed an issue on Web where on older devices the `display: contents` style property is sometimes not supported.
|
|
22
|
+
- Fixed an issue on Android where the `MediaPlaybackService` could be restarted after the app was closed, in some cases causing a `ForegroundServiceDidNotStartInTimeException`. A conditional receiver makes sure the service is never restarted.
|
|
23
|
+
- Fixed an issue on iOS where a setup with multiple players could cause a view index NSInternalInconsistencyException after moving players in and out of fullscreen.
|
|
24
|
+
- Fixed an issue on Android where some event listeners were not properly disposed of after destroying the player.
|
|
25
|
+
- Fixed an issue on Web where the `width` and `height` properties on `THEOplayer` would show the active video rendition's resolution width and height instead of the width and height of the video element.
|
|
26
|
+
|
|
27
|
+
## [10.0.0] - 25-09-15
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Added support for player SDK v10. More info on the [migration documentation](./doc/migrating-to-react-native-theoplayer-10.md) page.
|
|
32
|
+
- Added iOS and Android support for THEOads API and THEOads events.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Fixed an issue on Android where the app could still enter picture-in-picture presentation mode after closing the player.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- Upgraded the example app to React-Native v0.81.
|
|
41
|
+
- All child views of `<THEOplayerView>` are being hidden when transitioning to picture-in-picture presentation mode on Android.
|
|
42
|
+
|
|
8
43
|
## [9.10.0] - 25-08-19
|
|
9
44
|
|
|
10
45
|
### Fixed
|
package/README.md
CHANGED
|
@@ -183,10 +183,11 @@ This section gives an overview of features, limitations and known issues:
|
|
|
183
183
|
- [Casting with Chromecast and Airplay](./doc/cast.md)
|
|
184
184
|
- [Common Media Client Data (CMCD)](./doc/cmcd.md)
|
|
185
185
|
- [Digital Rights Management (DRM)](./doc/drm.md)
|
|
186
|
-
- [Expo
|
|
186
|
+
- [Expo](./doc/expo.md)
|
|
187
187
|
- [Fullscreen presentation](./doc/fullscreen.md)
|
|
188
188
|
- [Media Caching](./doc/media-caching.md)
|
|
189
189
|
- [Migrating to THEOplayer 9.x](./doc/migrating-to-react-native-theoplayer-9.md)
|
|
190
|
+
- [Migrating to THEOplayer 10.x🔥](./doc/migrating-to-react-native-theoplayer-10.md)
|
|
190
191
|
- [Millicast](./doc/millicast.md)
|
|
191
192
|
- [Picture-in-Picture (PiP)](./doc/pip.md)
|
|
192
193
|
- [Subtitles, Closed Captions and Metadata tracks](./doc/texttracks.md)
|
package/android/build.gradle
CHANGED
|
@@ -9,8 +9,8 @@ buildscript {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
dependencies {
|
|
12
|
-
classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '8.3
|
|
13
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '
|
|
12
|
+
classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '8.12.3')}"
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '2.2.10')}"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -43,12 +43,12 @@ def enabledMediaSession = safeExtGet("THEOplayer_extensionMediaSession", 'true')
|
|
|
43
43
|
def enabledMillicast = safeExtGet("THEOplayer_extensionMillicast", 'false').toBoolean()
|
|
44
44
|
|
|
45
45
|
android {
|
|
46
|
-
compileSdk safeExtGet('THEOplayer_compileSdkVersion',
|
|
46
|
+
compileSdk safeExtGet('THEOplayer_compileSdkVersion', 36)
|
|
47
47
|
namespace "com.theoplayer"
|
|
48
48
|
|
|
49
49
|
defaultConfig {
|
|
50
|
-
minSdkVersion safeExtGet('THEOplayer_minSdkVersion',
|
|
51
|
-
targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion',
|
|
50
|
+
minSdkVersion safeExtGet('THEOplayer_minSdkVersion', 23)
|
|
51
|
+
targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion', 36)
|
|
52
52
|
versionCode 1
|
|
53
53
|
versionName "1.0"
|
|
54
54
|
|
|
@@ -124,16 +124,15 @@ repositories {
|
|
|
124
124
|
mavenLocal()
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
// The minimum supported THEOplayer version is
|
|
128
|
-
def theoVersion = safeExtGet('THEOplayer_sdk', '[
|
|
129
|
-
def theoMediaSessionVersion = safeExtGet('THEOplayer_mediasession', '[8.0.0,
|
|
130
|
-
def theoAdsWrapperVersion = "
|
|
127
|
+
// The minimum supported THEOplayer version is 10.0.1
|
|
128
|
+
def theoVersion = safeExtGet('THEOplayer_sdk', '[10.0.1, 11.0.0)')
|
|
129
|
+
def theoMediaSessionVersion = safeExtGet('THEOplayer_mediasession', '[8.0.0, 11.0.0)')
|
|
130
|
+
def theoAdsWrapperVersion = "10.0.0"
|
|
131
131
|
def coroutinesVersion = safeExtGet('coroutinesVersion', '1.10.2')
|
|
132
132
|
def appcompatVersion = safeExtGet('appcompatVersion', '1.7.1')
|
|
133
|
-
def corektxVersion = safeExtGet('corektxVersion', '1.
|
|
133
|
+
def corektxVersion = safeExtGet('corektxVersion', '1.16.0')
|
|
134
134
|
def gsonVersion = safeExtGet('gsonVersion', '2.13.1')
|
|
135
135
|
def activityktxVersion = safeExtGet('activityktxVersion', '1.10.1')
|
|
136
|
-
def millicastVersion = safeExtGet('millicastVersion', '2.4.3')
|
|
137
136
|
|
|
138
137
|
dependencies {
|
|
139
138
|
def addOptiViewIntegration = { enabled, notation, additional = null ->
|
|
@@ -169,5 +168,5 @@ dependencies {
|
|
|
169
168
|
addOptiViewIntegration(enabledGoogleDAI || enabledTHEOads, 'integration-ads-dai')
|
|
170
169
|
addOptiViewIntegration(enabledTHEOads, 'integration-ads-theoads')
|
|
171
170
|
addOptiViewIntegration(enabledCast, 'integration-cast')
|
|
172
|
-
addOptiViewIntegration(enabledMillicast, 'integration-millicast'
|
|
171
|
+
addOptiViewIntegration(enabledMillicast, 'integration-millicast')
|
|
173
172
|
}
|
|
Binary file
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
4
|
-
<modelVersion>
|
|
4
|
+
<modelVersion>10.0.0</modelVersion>
|
|
5
5
|
<groupId>com.theoplayer.theoplayer-sdk-android</groupId>
|
|
6
6
|
<artifactId>ads-wrapper</artifactId>
|
|
7
|
-
<version>
|
|
7
|
+
<version>10.0.0</version>
|
|
8
8
|
<packaging>aar</packaging>
|
|
9
9
|
<dependencies>
|
|
10
10
|
<!-- Include transitive dependencies -->
|
|
11
11
|
<dependency>
|
|
12
12
|
<groupId>com.theoplayer.theoplayer-sdk-android</groupId>
|
|
13
13
|
<artifactId>integration-ads-ima</artifactId>
|
|
14
|
-
<version>[
|
|
14
|
+
<version>[10.0.0,11.0.0)</version>
|
|
15
15
|
<scope>runtime</scope>
|
|
16
16
|
</dependency>
|
|
17
17
|
</dependencies>
|
package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>com.theoplayer.theoplayer-sdk-android</groupId>
|
|
4
4
|
<artifactId>ads-wrapper</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>
|
|
7
|
-
<release>
|
|
6
|
+
<latest>10.0.0</latest>
|
|
7
|
+
<release>10.0.0</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>
|
|
9
|
+
<version>10.0.0</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250913190622</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</intent-filter>
|
|
42
42
|
</service>
|
|
43
43
|
|
|
44
|
-
<receiver android:name="
|
|
44
|
+
<receiver android:name=".media.ConditionalMediaButtonReceiver"
|
|
45
45
|
android:exported="false">
|
|
46
46
|
<intent-filter>
|
|
47
47
|
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
|
@@ -12,6 +12,7 @@ import com.facebook.react.uimanager.common.UIManagerType
|
|
|
12
12
|
import com.theoplayer.ads.AdEventAdapter
|
|
13
13
|
import com.theoplayer.ads.AdEventAdapter.AdEventEmitter
|
|
14
14
|
import com.theoplayer.android.api.THEOplayerGlobal
|
|
15
|
+
import com.theoplayer.android.api.ads.theoads.theoAds
|
|
15
16
|
import com.theoplayer.android.api.error.THEOplayerException
|
|
16
17
|
import com.theoplayer.android.api.event.EventListener
|
|
17
18
|
import com.theoplayer.android.api.event.EventType
|
|
@@ -43,6 +44,7 @@ import com.theoplayer.android.api.player.track.texttrack.TextTrackKind
|
|
|
43
44
|
import com.theoplayer.android.api.player.track.texttrack.TextTrackMode
|
|
44
45
|
import com.theoplayer.cast.CastEventAdapter
|
|
45
46
|
import com.theoplayer.presentation.PresentationModeChangeContext
|
|
47
|
+
import com.theoplayer.theoads.THEOadsEventAdapter
|
|
46
48
|
import com.theoplayer.theolive.THEOliveEventAdapter
|
|
47
49
|
import com.theoplayer.track.*
|
|
48
50
|
import com.theoplayer.util.PayloadBuilder
|
|
@@ -77,9 +79,11 @@ private const val EVENT_MEDIATRACK_EVENT = "onNativeMediaTrackEvent"
|
|
|
77
79
|
private const val EVENT_AD_EVENT = "onNativeAdEvent"
|
|
78
80
|
private const val EVENT_CAST_EVENT = "onNativeCastEvent"
|
|
79
81
|
private const val EVENT_THEOLIVE_EVENT = "onNativeTHEOliveEvent"
|
|
82
|
+
private const val EVENT_THEOADS_EVENT = "onNativeTHEOadsEvent"
|
|
80
83
|
private const val EVENT_PRESENTATIONMODECHANGE = "onNativePresentationModeChange"
|
|
81
84
|
private const val EVENT_VOLUMECHANGE = "onNativeVolumeChange"
|
|
82
|
-
private const val
|
|
85
|
+
private const val EVENT_DIMENSIONCHANGE = "onNativeDimensionChange"
|
|
86
|
+
private const val EVENT_VIDEORESIZE = "onNativeVideoResize"
|
|
83
87
|
|
|
84
88
|
private const val EVENT_PROP_TYPE = "type"
|
|
85
89
|
private const val EVENT_PROP_STATE = "state"
|
|
@@ -120,9 +124,11 @@ class PlayerEventEmitter internal constructor(
|
|
|
120
124
|
EVENT_AD_EVENT,
|
|
121
125
|
EVENT_CAST_EVENT,
|
|
122
126
|
EVENT_THEOLIVE_EVENT,
|
|
127
|
+
EVENT_THEOADS_EVENT,
|
|
123
128
|
EVENT_PRESENTATIONMODECHANGE,
|
|
124
129
|
EVENT_VOLUMECHANGE,
|
|
125
|
-
|
|
130
|
+
EVENT_DIMENSIONCHANGE,
|
|
131
|
+
EVENT_VIDEORESIZE
|
|
126
132
|
)
|
|
127
133
|
annotation class VideoEvents
|
|
128
134
|
|
|
@@ -155,9 +161,11 @@ class PlayerEventEmitter internal constructor(
|
|
|
155
161
|
EVENT_AD_EVENT,
|
|
156
162
|
EVENT_CAST_EVENT,
|
|
157
163
|
EVENT_THEOLIVE_EVENT,
|
|
164
|
+
EVENT_THEOADS_EVENT,
|
|
158
165
|
EVENT_PRESENTATIONMODECHANGE,
|
|
159
166
|
EVENT_VOLUMECHANGE,
|
|
160
|
-
|
|
167
|
+
EVENT_DIMENSIONCHANGE,
|
|
168
|
+
EVENT_VIDEORESIZE
|
|
161
169
|
)
|
|
162
170
|
}
|
|
163
171
|
|
|
@@ -169,11 +177,12 @@ class PlayerEventEmitter internal constructor(
|
|
|
169
177
|
private var adEventAdapter: AdEventAdapter? = null
|
|
170
178
|
private var castEventAdapter: CastEventAdapter? = null
|
|
171
179
|
private var theoLiveEventAdapter: THEOliveEventAdapter? = null
|
|
180
|
+
private var theoAdsEventAdapter: THEOadsEventAdapter? = null
|
|
172
181
|
private var lastTimeUpdate: Long = 0
|
|
173
182
|
private var lastCurrentTime = 0.0
|
|
174
|
-
private var
|
|
183
|
+
private var dimensionChangeListener = View.OnLayoutChangeListener { v, _, _, _, _, oldLeft, oldTop, oldRight, oldBottom ->
|
|
175
184
|
if (v.width != oldRight - oldLeft || v.height != oldBottom - oldTop) {
|
|
176
|
-
|
|
185
|
+
onDimensionChange(v.width, v.height)
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
|
|
@@ -227,6 +236,8 @@ class PlayerEventEmitter internal constructor(
|
|
|
227
236
|
EventListener { event: PresentationModeChange -> onPresentationModeChange(event) }
|
|
228
237
|
playerListeners[PlayerEventTypes.VOLUMECHANGE] =
|
|
229
238
|
EventListener { event: VolumeChangeEvent -> onVolumeChange(event) }
|
|
239
|
+
playerListeners[PlayerEventTypes.RESIZE] =
|
|
240
|
+
EventListener { event: ResizeEvent -> onResize(event) }
|
|
230
241
|
textTrackListeners[TextTrackListEventTypes.ADDTRACK] =
|
|
231
242
|
EventListener { event: AddTrackEvent -> onTextTrackAdd(event) }
|
|
232
243
|
textTrackListeners[TextTrackListEventTypes.REMOVETRACK] =
|
|
@@ -432,13 +443,20 @@ class PlayerEventEmitter internal constructor(
|
|
|
432
443
|
)
|
|
433
444
|
}
|
|
434
445
|
|
|
435
|
-
private fun
|
|
446
|
+
private fun onDimensionChange(width: Int, height: Int) {
|
|
436
447
|
receiveEvent(
|
|
437
|
-
|
|
448
|
+
EVENT_DIMENSIONCHANGE,
|
|
438
449
|
PayloadBuilder().size(width, height).build()
|
|
439
450
|
)
|
|
440
451
|
}
|
|
441
452
|
|
|
453
|
+
private fun onResize(event: ResizeEvent) {
|
|
454
|
+
receiveEvent(
|
|
455
|
+
EVENT_VIDEORESIZE,
|
|
456
|
+
PayloadBuilder().videoSize(event.width, event.height).build()
|
|
457
|
+
)
|
|
458
|
+
}
|
|
459
|
+
|
|
442
460
|
private val onTextTrackAddCue = EventListener<AddCueEvent> { event ->
|
|
443
461
|
val payload = PayloadBuilder().textTrackCue(event.cue, event.track).build().apply {
|
|
444
462
|
putInt(EVENT_PROP_TYPE, TextTrackCueEventType.ADD_CUE.type)
|
|
@@ -614,7 +632,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
614
632
|
if (BuildConfig.LOG_PLAYER_EVENTS) {
|
|
615
633
|
try {
|
|
616
634
|
Log.d(TAG, "receiveEvent $type $event")
|
|
617
|
-
} catch (
|
|
635
|
+
} catch (_: RuntimeException) {
|
|
618
636
|
}
|
|
619
637
|
}
|
|
620
638
|
UIManagerHelper.getUIManager(
|
|
@@ -622,6 +640,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
622
640
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
623
641
|
UIManagerType.FABRIC
|
|
624
642
|
} else {
|
|
643
|
+
@Suppress("DEPRECATION")
|
|
625
644
|
UIManagerType.DEFAULT
|
|
626
645
|
})?.receiveEvent(UIManagerHelper.getSurfaceId(playerView), viewId, type, event)
|
|
627
646
|
}
|
|
@@ -683,8 +702,17 @@ class PlayerEventEmitter internal constructor(
|
|
|
683
702
|
}
|
|
684
703
|
})
|
|
685
704
|
|
|
705
|
+
if (BuildConfig.EXTENSION_THEOADS) {
|
|
706
|
+
theoAdsEventAdapter =
|
|
707
|
+
THEOadsEventAdapter(player.theoAds, object : THEOadsEventAdapter.Emitter {
|
|
708
|
+
override fun emit(payload: WritableMap?) {
|
|
709
|
+
receiveEvent(EVENT_THEOADS_EVENT, payload)
|
|
710
|
+
}
|
|
711
|
+
})
|
|
712
|
+
}
|
|
713
|
+
|
|
686
714
|
// Attach view size listener
|
|
687
|
-
playerView.addOnLayoutChangeListener(
|
|
715
|
+
playerView.addOnLayoutChangeListener(dimensionChangeListener)
|
|
688
716
|
}
|
|
689
717
|
|
|
690
718
|
fun removeListeners(player: Player?) {
|
|
@@ -721,10 +749,11 @@ class PlayerEventEmitter internal constructor(
|
|
|
721
749
|
}
|
|
722
750
|
|
|
723
751
|
// Remove view size listener
|
|
724
|
-
playerView.removeOnLayoutChangeListener(
|
|
752
|
+
playerView.removeOnLayoutChangeListener(dimensionChangeListener)
|
|
725
753
|
|
|
726
754
|
castEventAdapter?.destroy()
|
|
727
755
|
adEventAdapter?.destroy()
|
|
728
756
|
theoLiveEventAdapter?.destroy()
|
|
757
|
+
theoAdsEventAdapter?.destroy()
|
|
729
758
|
}
|
|
730
759
|
}
|
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
package com.theoplayer
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
import com.facebook.react.bridge.NativeModule
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
6
7
|
import com.facebook.react.uimanager.ViewManager
|
|
7
8
|
import com.theoplayer.ads.AdsModule
|
|
8
9
|
import com.theoplayer.cache.CacheModule
|
|
9
10
|
import com.theoplayer.drm.ContentProtectionModule
|
|
10
11
|
import com.theoplayer.cast.CastModule
|
|
11
12
|
import com.theoplayer.broadcast.EventBroadcastModule
|
|
12
|
-
import com.theoplayer.playback.PlaybackSettingsModule
|
|
13
13
|
import com.theoplayer.player.PlayerModule
|
|
14
14
|
import com.theoplayer.theolive.THEOliveModule
|
|
15
|
+
import com.theoplayer.theoads.THEOadsModule
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
THEOliveModule(reactContext)
|
|
27
|
-
|
|
17
|
+
@Suppress("unused")
|
|
18
|
+
class ReactTHEOplayerPackage : BaseReactPackage() {
|
|
19
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
20
|
+
return when (name) {
|
|
21
|
+
PlayerModule.NAME -> PlayerModule(reactContext)
|
|
22
|
+
AdsModule.NAME -> AdsModule(reactContext)
|
|
23
|
+
ContentProtectionModule.NAME -> ContentProtectionModule(reactContext)
|
|
24
|
+
CastModule.NAME -> CastModule(reactContext)
|
|
25
|
+
CacheModule.NAME -> CacheModule(reactContext)
|
|
26
|
+
EventBroadcastModule.NAME -> EventBroadcastModule(reactContext)
|
|
27
|
+
THEOliveModule.NAME -> THEOliveModule(reactContext)
|
|
28
|
+
THEOadsModule.NAME -> THEOadsModule(reactContext)
|
|
29
|
+
else -> null
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
31
34
|
return listOf<ViewManager<*, *>>(ReactTHEOplayerViewManager())
|
|
32
35
|
}
|
|
36
|
+
|
|
37
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
38
|
+
return ReactModuleInfoProvider {
|
|
39
|
+
mapOf(
|
|
40
|
+
PlayerModule.NAME to PlayerModule.INFO,
|
|
41
|
+
AdsModule.NAME to AdsModule.INFO,
|
|
42
|
+
ContentProtectionModule.NAME to ContentProtectionModule.INFO,
|
|
43
|
+
CastModule.NAME to CastModule.INFO,
|
|
44
|
+
CacheModule.NAME to CacheModule.INFO,
|
|
45
|
+
EventBroadcastModule.NAME to EventBroadcastModule.INFO,
|
|
46
|
+
THEOliveModule.NAME to THEOliveModule.INFO,
|
|
47
|
+
THEOadsModule.NAME to THEOadsModule.INFO,
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
33
51
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@file:Suppress("unused")
|
|
2
|
-
|
|
3
1
|
package com.theoplayer.ads
|
|
4
2
|
|
|
5
3
|
import android.util.Log
|
|
6
4
|
import android.view.View
|
|
7
5
|
import com.facebook.react.bridge.*
|
|
6
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
8
8
|
import com.theoplayer.source.SourceAdapter
|
|
9
9
|
import com.theoplayer.util.ViewResolver
|
|
10
10
|
import com.theoplayer.ReactTHEOplayerView
|
|
@@ -12,18 +12,30 @@ import com.theoplayer.android.api.ads.OmidFriendlyObstruction
|
|
|
12
12
|
import com.theoplayer.android.api.ads.OmidFriendlyObstructionPurpose
|
|
13
13
|
import com.theoplayer.android.api.error.THEOplayerException
|
|
14
14
|
|
|
15
|
-
private const val TAG = "THEORCTAdsModule"
|
|
16
|
-
|
|
17
15
|
private const val PROP_OMID_VIEW = "view"
|
|
18
16
|
private const val PROP_OMID_PURPOSE = "purpose"
|
|
19
17
|
private const val PROP_OMID_REASON = "reason"
|
|
20
18
|
|
|
19
|
+
@Suppress("unused")
|
|
20
|
+
@ReactModule(name = AdsModule.NAME)
|
|
21
21
|
class AdsModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
22
|
+
companion object {
|
|
23
|
+
const val NAME = "THEORCTAdsModule"
|
|
24
|
+
val INFO = ReactModuleInfo(
|
|
25
|
+
name = NAME,
|
|
26
|
+
className = NAME,
|
|
27
|
+
canOverrideExistingModule = false,
|
|
28
|
+
needsEagerInit = false,
|
|
29
|
+
isCxxModule = false,
|
|
30
|
+
isTurboModule = false,
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
private val sourceHelper = SourceAdapter()
|
|
23
35
|
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
24
36
|
|
|
25
37
|
override fun getName(): String {
|
|
26
|
-
return
|
|
38
|
+
return NAME
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
// Add an ad break request.
|
|
@@ -34,7 +46,7 @@ class AdsModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(c
|
|
|
34
46
|
try {
|
|
35
47
|
view.adsApi.schedule(sourceHelper.parseAdFromJS(ad))
|
|
36
48
|
} catch (exception: THEOplayerException) {
|
|
37
|
-
Log.e(
|
|
49
|
+
Log.e(NAME, exception.message!!)
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
52
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@file:Suppress("unused")
|
|
2
1
|
package com.theoplayer.broadcast
|
|
3
2
|
|
|
4
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -6,18 +5,29 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
6
5
|
import com.facebook.react.bridge.ReactMethod
|
|
7
6
|
import com.facebook.react.bridge.ReadableMap
|
|
8
7
|
import com.facebook.react.module.annotations.ReactModule
|
|
8
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
9
9
|
import com.theoplayer.ReactTHEOplayerView
|
|
10
10
|
import com.theoplayer.util.ViewResolver
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@ReactModule(name = TAG)
|
|
12
|
+
@Suppress("unused")
|
|
13
|
+
@ReactModule(name = EventBroadcastModule.NAME)
|
|
15
14
|
class EventBroadcastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
15
|
+
companion object {
|
|
16
|
+
const val NAME = "THEORCTEventBroadcastModule"
|
|
17
|
+
val INFO = ReactModuleInfo(
|
|
18
|
+
name = NAME,
|
|
19
|
+
className = NAME,
|
|
20
|
+
canOverrideExistingModule = false,
|
|
21
|
+
needsEagerInit = false,
|
|
22
|
+
isCxxModule = false,
|
|
23
|
+
isTurboModule = false,
|
|
24
|
+
)
|
|
25
|
+
}
|
|
16
26
|
|
|
17
27
|
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
18
28
|
|
|
19
29
|
override fun getName(): String {
|
|
20
|
-
return
|
|
30
|
+
return NAME
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
/**
|
|
@@ -6,7 +6,6 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
6
6
|
import com.facebook.react.bridge.WritableArray
|
|
7
7
|
import com.facebook.react.bridge.WritableMap
|
|
8
8
|
import com.theoplayer.android.api.cache.CacheStatus
|
|
9
|
-
import com.theoplayer.android.api.cache.CacheStorageType
|
|
10
9
|
import com.theoplayer.android.api.cache.CachingParameters
|
|
11
10
|
import com.theoplayer.android.api.cache.CachingPreferredTrackSelection
|
|
12
11
|
import com.theoplayer.android.api.cache.CachingTask
|
|
@@ -27,7 +26,6 @@ private const val PROP_PARAMETERS_BANDWIDTH = "bandwidth"
|
|
|
27
26
|
private const val PROP_PARAMETERS_PREFERRED_TRACK_SELECTION = "preferredTrackSelection"
|
|
28
27
|
private const val PROP_PARAMETERS_AUDIO_TRACK_SELECTION = "audioTrackSelection"
|
|
29
28
|
private const val PROP_PARAMETERS_TEXT_TRACK_SELECTION = "textTrackSelection"
|
|
30
|
-
private const val PROP_PARAMETERS_STORAGE_TYPE = "storageType"
|
|
31
29
|
private const val PROP_DURATION = "duration"
|
|
32
30
|
private const val PROP_CACHED = "cached"
|
|
33
31
|
private const val PROP_SECONDS_CACHED = "secondsCached"
|
|
@@ -103,12 +101,6 @@ object CacheAdapter {
|
|
|
103
101
|
if (parameters.hasKey(PROP_PARAMETERS_PREFERRED_TRACK_SELECTION)) {
|
|
104
102
|
preferredTrackSelection(parsePreferredTrackSelection(parameters.getMap(PROP_PARAMETERS_PREFERRED_TRACK_SELECTION)))
|
|
105
103
|
}
|
|
106
|
-
if (parameters.hasKey(PROP_PARAMETERS_STORAGE_TYPE)) {
|
|
107
|
-
storageType(when (parameters.getString(PROP_PARAMETERS_STORAGE_TYPE)) {
|
|
108
|
-
"legacy" -> CacheStorageType.LEGACY
|
|
109
|
-
else -> CacheStorageType.MEDIA3
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
104
|
}.build()
|
|
113
105
|
}
|
|
114
106
|
|
|
@@ -129,10 +121,6 @@ object CacheAdapter {
|
|
|
129
121
|
putString(PROP_PARAMETERS_AMOUNT, parameters.amount)
|
|
130
122
|
putDouble(PROP_PARAMETERS_BANDWIDTH, parameters.bandwidth.toDouble())
|
|
131
123
|
putDouble(PROP_PARAMETERS_EXPIRATION_DATE, parameters.expirationDate.time.toDouble())
|
|
132
|
-
putString(PROP_PARAMETERS_STORAGE_TYPE, when (parameters.storageType) {
|
|
133
|
-
CacheStorageType.LEGACY -> "legacy"
|
|
134
|
-
CacheStorageType.MEDIA3 -> "media3"
|
|
135
|
-
})
|
|
136
124
|
}
|
|
137
125
|
}
|
|
138
126
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@file:Suppress("unused")
|
|
2
|
-
|
|
3
1
|
package com.theoplayer.cache
|
|
4
2
|
|
|
5
3
|
import android.os.Handler
|
|
@@ -12,8 +10,11 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
12
10
|
import com.facebook.react.bridge.ReactMethod
|
|
13
11
|
import com.facebook.react.bridge.ReadableMap
|
|
14
12
|
import com.facebook.react.bridge.WritableMap
|
|
13
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
14
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
15
15
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
16
16
|
import com.google.gson.Gson
|
|
17
|
+
import com.theoplayer.ads.AdsModule
|
|
17
18
|
import com.theoplayer.util.ViewResolver
|
|
18
19
|
import com.theoplayer.android.api.THEOplayerGlobal
|
|
19
20
|
import com.theoplayer.android.api.cache.Cache
|
|
@@ -30,8 +31,6 @@ import com.theoplayer.source.SourceAdapter
|
|
|
30
31
|
import org.json.JSONException
|
|
31
32
|
import org.json.JSONObject
|
|
32
33
|
|
|
33
|
-
private const val TAG = "THEORCTCacheModule"
|
|
34
|
-
|
|
35
34
|
private const val PROP_STATUS = "status"
|
|
36
35
|
private const val PROP_ID = "id"
|
|
37
36
|
private const val PROP_TASK = "task"
|
|
@@ -39,8 +38,22 @@ private const val PROP_TASKS = "tasks"
|
|
|
39
38
|
private const val PROP_PROGRESS = "progress"
|
|
40
39
|
private const val PROP_ERROR = "error"
|
|
41
40
|
|
|
41
|
+
@Suppress("unused")
|
|
42
|
+
@ReactModule(name = CacheModule.NAME)
|
|
42
43
|
class CacheModule(private val context: ReactApplicationContext) :
|
|
43
44
|
ReactContextBaseJavaModule(context) {
|
|
45
|
+
companion object {
|
|
46
|
+
const val NAME = "THEORCTCacheModule"
|
|
47
|
+
val INFO = ReactModuleInfo(
|
|
48
|
+
name = NAME,
|
|
49
|
+
className = NAME,
|
|
50
|
+
canOverrideExistingModule = false,
|
|
51
|
+
needsEagerInit = false,
|
|
52
|
+
isCxxModule = false,
|
|
53
|
+
isTurboModule = false,
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
45
58
|
private val onTaskProgress = mutableMapOf<String, EventListener<CachingTaskProgressEvent>>()
|
|
46
59
|
private val onTaskError = mutableMapOf<String, EventListener<CachingTaskErrorEvent>>()
|
|
@@ -59,7 +72,7 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
59
72
|
emit("onCacheStatusChange", Arguments.createMap().apply {
|
|
60
73
|
putString(PROP_STATUS, CacheAdapter.fromCacheStatus(event.status))
|
|
61
74
|
})
|
|
62
|
-
|
|
75
|
+
}
|
|
63
76
|
// Listen for add task events
|
|
64
77
|
tasks.addEventListener(CachingTaskListEventTypes.ADD_TASK) { event ->
|
|
65
78
|
event.task?.let { task ->
|
|
@@ -88,7 +101,7 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
88
101
|
}
|
|
89
102
|
|
|
90
103
|
override fun getName(): String {
|
|
91
|
-
return
|
|
104
|
+
return NAME
|
|
92
105
|
}
|
|
93
106
|
|
|
94
107
|
private fun addCachingTaskListeners(task: CachingTask) {
|
|
@@ -233,7 +246,7 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
233
246
|
|
|
234
247
|
private fun taskById(id: String): CachingTask? {
|
|
235
248
|
return cache.tasks.getTaskById(id) ?: run {
|
|
236
|
-
Log.w(
|
|
249
|
+
Log.w(NAME, "CachingTask with id $id not found")
|
|
237
250
|
return null
|
|
238
251
|
}
|
|
239
252
|
}
|
|
@@ -6,6 +6,7 @@ import com.theoplayer.android.api.cast.Cast
|
|
|
6
6
|
import com.theoplayer.android.api.cast.chromecast.CastError
|
|
7
7
|
import com.theoplayer.android.api.cast.chromecast.ErrorCode
|
|
8
8
|
import com.theoplayer.android.api.cast.chromecast.PlayerCastState
|
|
9
|
+
import com.theoplayer.android.api.event.EventListener
|
|
9
10
|
import com.theoplayer.android.api.event.chromecast.CastErrorEvent
|
|
10
11
|
import com.theoplayer.android.api.event.chromecast.CastStateChangeEvent
|
|
11
12
|
import com.theoplayer.android.api.event.chromecast.ChromecastEventTypes
|
|
@@ -22,24 +23,27 @@ class CastEventAdapter(private val castApi: Cast, private val emitter: Emitter)
|
|
|
22
23
|
fun emit(payload: WritableMap?)
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
private val onCastError = EventListener<CastErrorEvent> { handleCastError(it) }
|
|
27
|
+
private val onStateChange = EventListener<CastStateChangeEvent> { handleStateChange(it) }
|
|
28
|
+
|
|
25
29
|
init {
|
|
26
|
-
castApi.chromecast.addEventListener(ChromecastEventTypes.ERROR,
|
|
27
|
-
castApi.chromecast.addEventListener(ChromecastEventTypes.STATECHANGE,
|
|
30
|
+
castApi.chromecast.addEventListener(ChromecastEventTypes.ERROR, onCastError)
|
|
31
|
+
castApi.chromecast.addEventListener(ChromecastEventTypes.STATECHANGE, onStateChange)
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
fun destroy() {
|
|
31
|
-
castApi.chromecast.removeEventListener(ChromecastEventTypes.ERROR,
|
|
32
|
-
castApi.chromecast.removeEventListener(ChromecastEventTypes.STATECHANGE,
|
|
35
|
+
castApi.chromecast.removeEventListener(ChromecastEventTypes.ERROR, onCastError)
|
|
36
|
+
castApi.chromecast.removeEventListener(ChromecastEventTypes.STATECHANGE, onStateChange)
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
private fun
|
|
39
|
+
private fun handleCastError(event: CastErrorEvent) {
|
|
36
40
|
val payload = Arguments.createMap()
|
|
37
41
|
payload.putString(EVENT_PROP_TYPE, "chromecasterror")
|
|
38
42
|
payload.putMap(EVENT_PROP_ERROR, serializeError(event.error))
|
|
39
43
|
emitter.emit(payload)
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
private fun serializeError(error: CastError): WritableMap
|
|
46
|
+
private fun serializeError(error: CastError): WritableMap {
|
|
43
47
|
val errorPayload = Arguments.createMap()
|
|
44
48
|
@Suppress("SENSELESS_NULL_IN_WHEN")
|
|
45
49
|
errorPayload.putString(
|
|
@@ -62,7 +66,7 @@ class CastEventAdapter(private val castApi: Cast, private val emitter: Emitter)
|
|
|
62
66
|
return errorPayload
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
private fun
|
|
69
|
+
private fun handleStateChange(event: CastStateChangeEvent) {
|
|
66
70
|
val payload = Arguments.createMap()
|
|
67
71
|
payload.putString(EVENT_PROP_TYPE, "chromecaststatechange")
|
|
68
72
|
if (event.state != null) {
|