react-native-theoplayer 9.10.0 → 10.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 +16 -0
- package/README.md +2 -1
- package/android/build.gradle +8 -8
- 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/java/com/theoplayer/PlayerEventEmitter.kt +18 -1
- 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/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/player/PlayerModule.kt +16 -3
- package/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt +12 -3
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +15 -36
- package/android/src/main/java/com/theoplayer/theoads/THEOadsAdapter.kt +83 -0
- package/android/src/main/java/com/theoplayer/theoads/THEOadsEventAdapter.kt +52 -0
- package/android/src/main/java/com/theoplayer/theoads/THEOadsModule.kt +63 -0
- package/android/src/main/java/com/theoplayer/theolive/THEOliveModule.kt +16 -3
- package/ios/THEOplayerRCTBridge.m +19 -0
- package/ios/THEOplayerRCTDebug.swift +4 -1
- package/ios/THEOplayerRCTPlayerAPI.swift +3 -3
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +2 -1
- package/ios/THEOplayerRCTView.swift +12 -0
- 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/TheoAdsEvent.js +7 -0
- package/lib/commonjs/api/event/TheoAdsEvent.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/index.js +0 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +5 -0
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +8 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js +10 -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/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/TheoAdsEvent.js +8 -0
- package/lib/module/api/event/TheoAdsEvent.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/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +5 -0
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +9 -2
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/adapter/event/PlayerEvents.js +8 -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/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/TheoAdsEvent.d.ts +13 -0
- package/lib/typescript/api/event/TheoAdsEvent.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/index.d.ts +0 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/internal/THEOplayerView.d.ts +1 -0
- package/lib/typescript/internal/THEOplayerView.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts +7 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.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/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/TheoAdsEvent.ts +14 -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/index.tsx +0 -1
- package/src/internal/THEOplayerView.tsx +7 -0
- package/src/internal/adapter/WebEventForwarder.ts +7 -1
- package/src/internal/adapter/event/PlayerEvents.ts +11 -0
- package/src/internal/adapter/event/native/NativeTheoAdsEvent.ts +30 -0
- package/src/internal/adapter/theoads/THEOAdsNativeAdapter.ts +7 -12
- 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,22 @@ 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.0.0] - 25-09-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added support for player SDK v10. More info on the [migration documentation](./doc/migrating-to-react-native-theoplayer-10.md) page.
|
|
13
|
+
- Added iOS and Android support for THEOads API and THEOads events.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed an issue on Android where the app could still enter picture-in-picture presentation mode after closing the player.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Upgraded the example app to React-Native v0.81.
|
|
22
|
+
- All child views of `<THEOplayerView>` are being hidden when transitioning to picture-in-picture presentation mode on Android.
|
|
23
|
+
|
|
8
24
|
## [9.10.0] - 25-08-19
|
|
9
25
|
|
|
10
26
|
### 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
|
|
|
@@ -47,7 +47,7 @@ android {
|
|
|
47
47
|
namespace "com.theoplayer"
|
|
48
48
|
|
|
49
49
|
defaultConfig {
|
|
50
|
-
minSdkVersion safeExtGet('THEOplayer_minSdkVersion',
|
|
50
|
+
minSdkVersion safeExtGet('THEOplayer_minSdkVersion', 23)
|
|
51
51
|
targetSdkVersion safeExtGet('THEOplayer_targetSdkVersion', 35)
|
|
52
52
|
versionCode 1
|
|
53
53
|
versionName "1.0"
|
|
@@ -125,15 +125,15 @@ repositories {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
// The minimum supported THEOplayer version is 9.9.0
|
|
128
|
-
def theoVersion = safeExtGet('THEOplayer_sdk', '[9.9.0,
|
|
129
|
-
def theoMediaSessionVersion = safeExtGet('THEOplayer_mediasession', '[8.0.0,
|
|
130
|
-
def theoAdsWrapperVersion = "
|
|
128
|
+
def theoVersion = safeExtGet('THEOplayer_sdk', '[9.9.0, 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.
|
|
136
|
+
def millicastVersion = safeExtGet('millicastVersion', '2.5.0')
|
|
137
137
|
|
|
138
138
|
dependencies {
|
|
139
139
|
def addOptiViewIntegration = { enabled, notation, additional = null ->
|
|
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>
|
|
@@ -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,6 +79,7 @@ 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
85
|
private const val EVENT_RESIZE = "onNativeResize"
|
|
@@ -120,6 +123,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
120
123
|
EVENT_AD_EVENT,
|
|
121
124
|
EVENT_CAST_EVENT,
|
|
122
125
|
EVENT_THEOLIVE_EVENT,
|
|
126
|
+
EVENT_THEOADS_EVENT,
|
|
123
127
|
EVENT_PRESENTATIONMODECHANGE,
|
|
124
128
|
EVENT_VOLUMECHANGE,
|
|
125
129
|
EVENT_RESIZE
|
|
@@ -155,6 +159,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
155
159
|
EVENT_AD_EVENT,
|
|
156
160
|
EVENT_CAST_EVENT,
|
|
157
161
|
EVENT_THEOLIVE_EVENT,
|
|
162
|
+
EVENT_THEOADS_EVENT,
|
|
158
163
|
EVENT_PRESENTATIONMODECHANGE,
|
|
159
164
|
EVENT_VOLUMECHANGE,
|
|
160
165
|
EVENT_RESIZE
|
|
@@ -169,6 +174,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
169
174
|
private var adEventAdapter: AdEventAdapter? = null
|
|
170
175
|
private var castEventAdapter: CastEventAdapter? = null
|
|
171
176
|
private var theoLiveEventAdapter: THEOliveEventAdapter? = null
|
|
177
|
+
private var theoAdsEventAdapter: THEOadsEventAdapter? = null
|
|
172
178
|
private var lastTimeUpdate: Long = 0
|
|
173
179
|
private var lastCurrentTime = 0.0
|
|
174
180
|
private var resizeListener = View.OnLayoutChangeListener { v, _, _, _, _, oldLeft, oldTop, oldRight, oldBottom ->
|
|
@@ -614,7 +620,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
614
620
|
if (BuildConfig.LOG_PLAYER_EVENTS) {
|
|
615
621
|
try {
|
|
616
622
|
Log.d(TAG, "receiveEvent $type $event")
|
|
617
|
-
} catch (
|
|
623
|
+
} catch (_: RuntimeException) {
|
|
618
624
|
}
|
|
619
625
|
}
|
|
620
626
|
UIManagerHelper.getUIManager(
|
|
@@ -622,6 +628,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
622
628
|
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
623
629
|
UIManagerType.FABRIC
|
|
624
630
|
} else {
|
|
631
|
+
@Suppress("DEPRECATION")
|
|
625
632
|
UIManagerType.DEFAULT
|
|
626
633
|
})?.receiveEvent(UIManagerHelper.getSurfaceId(playerView), viewId, type, event)
|
|
627
634
|
}
|
|
@@ -683,6 +690,15 @@ class PlayerEventEmitter internal constructor(
|
|
|
683
690
|
}
|
|
684
691
|
})
|
|
685
692
|
|
|
693
|
+
if (BuildConfig.EXTENSION_THEOADS) {
|
|
694
|
+
theoAdsEventAdapter =
|
|
695
|
+
THEOadsEventAdapter(player.theoAds, object : THEOadsEventAdapter.Emitter {
|
|
696
|
+
override fun emit(payload: WritableMap?) {
|
|
697
|
+
receiveEvent(EVENT_THEOADS_EVENT, payload)
|
|
698
|
+
}
|
|
699
|
+
})
|
|
700
|
+
}
|
|
701
|
+
|
|
686
702
|
// Attach view size listener
|
|
687
703
|
playerView.addOnLayoutChangeListener(resizeListener)
|
|
688
704
|
}
|
|
@@ -726,5 +742,6 @@ class PlayerEventEmitter internal constructor(
|
|
|
726
742
|
castEventAdapter?.destroy()
|
|
727
743
|
adEventAdapter?.destroy()
|
|
728
744
|
theoLiveEventAdapter?.destroy()
|
|
745
|
+
theoAdsEventAdapter?.destroy()
|
|
729
746
|
}
|
|
730
747
|
}
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
@file:Suppress("unused")
|
|
2
|
-
|
|
3
1
|
package com.theoplayer.cast
|
|
4
2
|
|
|
5
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
@@ -7,14 +5,30 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
7
5
|
import com.theoplayer.util.ViewResolver
|
|
8
6
|
import com.facebook.react.bridge.ReactMethod
|
|
9
7
|
import com.facebook.react.bridge.Promise
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
9
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
10
10
|
import com.theoplayer.ReactTHEOplayerView
|
|
11
11
|
import com.theoplayer.android.api.cast.chromecast.PlayerCastState
|
|
12
12
|
|
|
13
|
+
@Suppress("unused")
|
|
14
|
+
@ReactModule(name = CastModule.NAME)
|
|
13
15
|
class CastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
16
|
+
companion object {
|
|
17
|
+
const val NAME = "THEORCTCastModule"
|
|
18
|
+
val INFO = ReactModuleInfo(
|
|
19
|
+
name = NAME,
|
|
20
|
+
className = NAME,
|
|
21
|
+
canOverrideExistingModule = false,
|
|
22
|
+
needsEagerInit = false,
|
|
23
|
+
isCxxModule = false,
|
|
24
|
+
isTurboModule = false,
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
14
28
|
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
15
29
|
|
|
16
30
|
override fun getName(): String {
|
|
17
|
-
return
|
|
31
|
+
return NAME
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
@ReactMethod
|
|
@@ -165,7 +165,7 @@ object ContentProtectionAdapter {
|
|
|
165
165
|
if (widevine != null) {
|
|
166
166
|
putMap(PROP_WIDEVINE, Arguments.createMap().apply {
|
|
167
167
|
putString(PROP_LA_URL, widevine.licenseAcquisitionURL)
|
|
168
|
-
putBoolean(PROP_USE_CREDENTIALS, widevine.
|
|
168
|
+
putBoolean(PROP_USE_CREDENTIALS, widevine.useCredentials)
|
|
169
169
|
})
|
|
170
170
|
}
|
|
171
171
|
}
|
|
@@ -5,6 +5,8 @@ import android.os.Looper
|
|
|
5
5
|
import android.util.Base64
|
|
6
6
|
import android.util.Log
|
|
7
7
|
import com.facebook.react.bridge.*
|
|
8
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
9
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
8
10
|
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
|
|
9
11
|
import com.theoplayer.BuildConfig
|
|
10
12
|
import com.theoplayer.android.api.THEOplayerGlobal
|
|
@@ -19,11 +21,11 @@ data class BridgeRequest(
|
|
|
19
21
|
val onTimeout: Runnable
|
|
20
22
|
)
|
|
21
23
|
|
|
22
|
-
private const val TAG = "ContentProtectionModule"
|
|
23
|
-
|
|
24
24
|
private const val EVENT_CERTIFICATE_REQUEST = "onCertificateRequest"
|
|
25
|
-
private const val EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_REQUEST =
|
|
26
|
-
|
|
25
|
+
private const val EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_REQUEST =
|
|
26
|
+
"onCertificateRequestProcessedAsRequest"
|
|
27
|
+
private const val EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_CERTIFICATE =
|
|
28
|
+
"onCertificateRequestProcessedAsCertificate"
|
|
27
29
|
private const val EVENT_CERTIFICATE_RESPONSE = "onCertificateResponse"
|
|
28
30
|
private const val EVENT_CERTIFICATE_RESPONSE_PROCESSED = "onCertificateResponseProcessed"
|
|
29
31
|
private const val EVENT_BUILD_INTEGRATION = "onBuildIntegration"
|
|
@@ -35,10 +37,20 @@ private const val EVENT_LICENSE_RESPONSE = "onLicenseResponse"
|
|
|
35
37
|
private const val EVENT_LICENSE_RESPONSE_PROCESSED = "onLicenseResponseProcessed"
|
|
36
38
|
|
|
37
39
|
@Suppress("unused")
|
|
40
|
+
@ReactModule(name = ContentProtectionModule.NAME)
|
|
38
41
|
class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
39
42
|
ReactContextBaseJavaModule(context) {
|
|
40
43
|
|
|
41
44
|
companion object {
|
|
45
|
+
const val NAME = "THEORCTContentProtectionModule"
|
|
46
|
+
val INFO = ReactModuleInfo(
|
|
47
|
+
name = NAME,
|
|
48
|
+
className = ContentProtectionModule::class.qualifiedName!!,
|
|
49
|
+
canOverrideExistingModule = false,
|
|
50
|
+
needsEagerInit = false,
|
|
51
|
+
isCxxModule = false,
|
|
52
|
+
isTurboModule = false,
|
|
53
|
+
)
|
|
42
54
|
const val REQUEST_TIMEOUT_MS = 10000L
|
|
43
55
|
}
|
|
44
56
|
|
|
@@ -49,7 +61,7 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
49
61
|
private val requestQueue: HashMap<String, BridgeRequest> = HashMap()
|
|
50
62
|
|
|
51
63
|
override fun getName(): String {
|
|
52
|
-
return
|
|
64
|
+
return NAME
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
@ReactMethod
|
|
@@ -66,7 +78,7 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
66
78
|
.registerContentProtectionIntegration(integrationId, keySystemId, factory)
|
|
67
79
|
}
|
|
68
80
|
} else {
|
|
69
|
-
Log.e(
|
|
81
|
+
Log.e(NAME, "Invalid keySystemId $keySystemIdStr")
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
84
|
|
|
@@ -131,7 +143,8 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
131
143
|
EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_REQUEST to { result ->
|
|
132
144
|
request.url = result.getString(PROP_URL)!!
|
|
133
145
|
request.method = RequestMethodAdapter.fromString(result.getString(PROP_METHOD))
|
|
134
|
-
val headers =
|
|
146
|
+
val headers =
|
|
147
|
+
result.getMap(PROP_HEADERS)?.toHashMap()?.mapValues { entry -> entry.value as? String }
|
|
135
148
|
if (headers != null) {
|
|
136
149
|
request.headers = headers
|
|
137
150
|
}
|
|
@@ -180,7 +193,8 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
180
193
|
EVENT_LICENSE_REQUEST_PROCESSED_AS_REQUEST to { result ->
|
|
181
194
|
request.url = result.getString(PROP_URL)!!
|
|
182
195
|
request.method = RequestMethodAdapter.fromString(result.getString(PROP_METHOD))
|
|
183
|
-
val headers =
|
|
196
|
+
val headers =
|
|
197
|
+
result.getMap(PROP_HEADERS)?.toHashMap()?.mapValues { entry -> entry.value as? String }
|
|
184
198
|
if (headers != null) {
|
|
185
199
|
request.headers = headers
|
|
186
200
|
}
|
|
@@ -234,7 +248,7 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
234
248
|
) {
|
|
235
249
|
val requestId = createRequestId()
|
|
236
250
|
if (BuildConfig.DEBUG) {
|
|
237
|
-
Log.d(
|
|
251
|
+
Log.d(NAME, "emit $eventName ($requestId)")
|
|
238
252
|
}
|
|
239
253
|
payload.putString(PROP_REQUEST_ID, requestId)
|
|
240
254
|
val onTimeout = Runnable {
|
|
@@ -252,7 +266,7 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
252
266
|
private fun receive(eventName: String, payload: ReadableMap) {
|
|
253
267
|
val requestId = payload.getString(PROP_REQUEST_ID)
|
|
254
268
|
if (BuildConfig.DEBUG) {
|
|
255
|
-
Log.d(
|
|
269
|
+
Log.d(NAME, "receive $eventName ($requestId)")
|
|
256
270
|
}
|
|
257
271
|
val request = requestQueue.remove(requestId)
|
|
258
272
|
if (request != null) {
|
|
@@ -262,7 +276,10 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
262
276
|
onEventResult(payload)
|
|
263
277
|
} else {
|
|
264
278
|
request.onError(
|
|
265
|
-
THEOplayerException(
|
|
279
|
+
THEOplayerException(
|
|
280
|
+
ErrorCode.CONTENT_PROTECTION_ERROR,
|
|
281
|
+
"Unknown bridge event: $eventName."
|
|
282
|
+
)
|
|
266
283
|
)
|
|
267
284
|
}
|
|
268
285
|
}
|