react-native-theoplayer 7.9.0 → 8.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 +14 -0
- package/README.md +9 -1
- package/android/build.gradle +2 -2
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/8.0.0/ads-wrapper-8.0.0.aar +0 -0
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/{7.6.1/ads-wrapper-7.6.1.pom → 8.0.0/ads-wrapper-8.0.0.pom} +2 -2
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +4 -4
- package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +0 -26
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +1 -3
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerView.kt +0 -1
- package/android/src/main/java/com/theoplayer/ads/AdAdapter.kt +13 -6
- package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +23 -24
- package/android/src/main/java/com/theoplayer/ads/AdsModule.kt +1 -5
- package/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt +1 -5
- package/android/src/main/java/com/theoplayer/cache/CacheModule.kt +8 -8
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +2 -1
- package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +1 -5
- package/android/src/main/java/com/theoplayer/source/GoogleDaiSourceAdapter.kt +1 -0
- package/android/src/main/java/com/theoplayer/source/SSAIAdapterRegistry.kt +1 -1
- package/android/src/main/java/com/theoplayer/track/QualityListAdapter.kt +3 -20
- package/android/src/main/java/com/theoplayer/track/TextTrackStyleAdapter.kt +12 -12
- package/android/src/main/java/com/theoplayer/util/BridgeUtils.kt +1 -1
- package/app.plugin.js +32 -35
- package/ios/THEOplayerRCTTypeUtils.swift +2 -8
- package/ios/THEOplayerRCTView.swift +0 -2
- package/ios/ads/THEOplayerRCTAdAdapter.swift +19 -18
- package/ios/ads/THEOplayerRCTAdsNative.swift +11 -11
- package/ios/ads/THEOplayerRCTView+AdsConfig.swift +0 -30
- package/ios/style.css +0 -1
- package/lib/commonjs/api/source/ads/Ads.js +6 -2
- package/lib/commonjs/api/source/ads/Ads.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/adapter/DefaultNativePlayerState.js +1 -1
- package/lib/commonjs/internal/adapter/DefaultNativePlayerState.js.map +1 -1
- package/lib/commonjs/internal/adapter/DefaultTextTrackState.js.map +1 -1
- package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.web.js.map +1 -1
- package/lib/commonjs/internal/adapter/broadcast/web/DefaultWebEventDispatcher.js.map +1 -1
- package/lib/commonjs/internal/adapter/cast/THEOplayerNativeCastAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/BaseEvent.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +1 -1
- package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
- package/lib/commonjs/internal/cache/MediaCache.js.map +1 -1
- package/lib/commonjs/internal/cache/NativeCachingTaskParametersAdapter.js.map +1 -1
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/commonjs/internal/poster/Poster.js +1 -1
- package/lib/commonjs/internal/poster/Poster.js.map +1 -1
- package/lib/commonjs/internal/utils/Dimensions.js.map +1 -1
- package/lib/module/api/source/ads/Ads.js +6 -2
- package/lib/module/api/source/ads/Ads.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/adapter/DefaultNativePlayerState.js +1 -1
- package/lib/module/internal/adapter/DefaultNativePlayerState.js.map +1 -1
- package/lib/module/internal/adapter/DefaultTextTrackState.js.map +1 -1
- package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
- package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.web.js +2 -2
- package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.web.js.map +1 -1
- package/lib/module/internal/adapter/broadcast/web/DefaultWebEventDispatcher.js.map +1 -1
- package/lib/module/internal/adapter/cast/THEOplayerNativeCastAdapter.js.map +1 -1
- package/lib/module/internal/adapter/event/BaseEvent.js.map +1 -1
- package/lib/module/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/module/internal/cache/MediaCache.js.map +1 -1
- package/lib/module/internal/cache/NativeCachingTaskAdapter.js +1 -1
- package/lib/module/internal/cache/NativeCachingTaskParametersAdapter.js.map +1 -1
- package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/module/internal/utils/Dimensions.js.map +1 -1
- package/lib/typescript/api/source/ads/Ads.d.ts +7 -3
- package/lib/typescript/api/source/ads/Ads.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/DefaultNativePlayerState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/DefaultTextTrackState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/NativePlayerState.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/broadcast/EventBroadcastAdapter.web.d.ts +5 -5
- package/lib/typescript/internal/adapter/broadcast/EventBroadcastAdapter.web.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/broadcast/web/DefaultWebEventDispatcher.d.ts +1 -1
- package/lib/typescript/internal/adapter/broadcast/web/DefaultWebEventDispatcher.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/cast/THEOplayerNativeCastAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/BaseEvent.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts.map +1 -1
- package/lib/typescript/internal/cache/NativeCachingTaskAdapter.d.ts +1 -1
- package/lib/typescript/internal/cache/NativeCachingTaskParametersAdapter.d.ts +1 -1
- package/lib/typescript/internal/cache/NativeCachingTaskParametersAdapter.d.ts.map +1 -1
- package/lib/typescript/internal/utils/Dimensions.d.ts.map +1 -1
- package/package.json +18 -13
- package/react-native-theoplayer.json +4 -8
- package/react-native-theoplayer.podspec +7 -8
- package/src/api/source/ads/Ads.ts +7 -3
- package/src/internal/THEOplayerView.tsx +2 -2
- package/src/internal/adapter/DefaultNativePlayerState.ts +1 -1
- package/src/internal/adapter/DefaultTextTrackState.ts +2 -2
- package/src/internal/adapter/NativePlayerState.ts +1 -2
- package/src/internal/adapter/broadcast/EventBroadcastAdapter.web.ts +12 -12
- package/src/internal/adapter/broadcast/web/DefaultWebEventDispatcher.ts +47 -47
- package/src/internal/adapter/cast/THEOplayerNativeCastAdapter.ts +4 -1
- package/src/internal/adapter/event/BaseEvent.ts +4 -1
- package/src/internal/adapter/event/PlayerEvents.ts +39 -9
- package/src/internal/adapter/web/FullscreenAPI.ts +4 -4
- package/src/internal/cache/NativeCachingTaskAdapter.ts +1 -1
- package/src/internal/cache/NativeCachingTaskParametersAdapter.ts +7 -9
- package/src/internal/utils/Dimensions.ts +5 -3
- package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/7.6.1/ads-wrapper-7.6.1.aar +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ 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
|
+
## [8.0.0] - 24-09-11
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added support for THEOplayer 8.0.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Deprecated Jitpack.io in favor of the THEOplayer Maven repository on Android.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fixed an issue on iOS where the initial `duration` property of the player would be `0` instead of `NaN`.
|
|
21
|
+
|
|
8
22
|
## [7.9.0] - 24-09-06
|
|
9
23
|
|
|
10
24
|
### Added
|
package/README.md
CHANGED
|
@@ -13,7 +13,9 @@ This projects falls under the license as defined in https://github.com/THEOplaye
|
|
|
13
13
|
3. [How to use these guides](#how-to-use-these-guides)
|
|
14
14
|
4. [Features](#features)
|
|
15
15
|
5. [Available connectors](#available-connectors)
|
|
16
|
-
6. [
|
|
16
|
+
6. [Creating your first app](#creating-your-first-app)
|
|
17
|
+
7. [Knowledge Base](#knowledge-base)
|
|
18
|
+
8. [API Reference](#api-reference)
|
|
17
19
|
|
|
18
20
|
## Overview
|
|
19
21
|
|
|
@@ -89,6 +91,11 @@ please reach out to us for support.
|
|
|
89
91
|
<td colspan="3">Adobe, Agama, Comscore, Conviva, Mux, Nielsen, Youbora</td>
|
|
90
92
|
</tr>
|
|
91
93
|
<tr>
|
|
94
|
+
<td><strong>Other Connectors</strong></td>
|
|
95
|
+
<td colspan="1">Yospace SSAI</td>
|
|
96
|
+
<td colspan="2"></td>
|
|
97
|
+
</tr>
|
|
98
|
+
<tr>
|
|
92
99
|
<td><strong>Subtitles & Closed Captions</strong></td>
|
|
93
100
|
<td colspan="3">CEA-608/708, SRT, TTML, WebVTT</td>
|
|
94
101
|
</tr>
|
|
@@ -141,6 +148,7 @@ functionality. Currently, the following connectors are available:
|
|
|
141
148
|
| Mux analytics | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-analytics-mux) | [`Mux`](https://github.com/THEOplayer/react-native-connectors/tree/main/mux) |
|
|
142
149
|
| Nielsen analytics | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-analytics-nielsen) | [`Nielsen`](https://github.com/THEOplayer/react-native-connectors/tree/main/nielsen) |
|
|
143
150
|
| Youbora analytics | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-analytics-youbora) | [`Youbora`](https://github.com/THEOplayer/react-native-connectors/tree/main/youbora) |
|
|
151
|
+
| Yospace SSAI | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-yospace) | [`Yospace`](https://github.com/THEOplayer/react-native-connectors/tree/main/yospace) |
|
|
144
152
|
| Content protection (DRM) | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-drm) | [`DRM`](https://github.com/THEOplayer/react-native-theoplayer-drm) |
|
|
145
153
|
| React Native Open UI | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-ui) | [`Open UI`](https://github.com/THEOplayer/react-native-theoplayer-ui) |
|
|
146
154
|
| A template for<br/>`react-native-theoplayer` connectors. | [](https://www.npmjs.com/package/%40theoplayer%2Freact-native-connector-template) | [`Connector template`](https://github.com/THEOplayer/react-native-theoplayer-connector-template) |
|
package/android/build.gradle
CHANGED
|
@@ -102,7 +102,7 @@ repositories {
|
|
|
102
102
|
google()
|
|
103
103
|
mavenCentral()
|
|
104
104
|
maven { url("local") }
|
|
105
|
-
maven { url
|
|
105
|
+
maven { url "https://maven.theoplayer.com/releases" }
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
dependencies {
|
|
@@ -118,7 +118,7 @@ dependencies {
|
|
|
118
118
|
|
|
119
119
|
println("Using THEOplayer (${versionString(theoplayer_sdk_version)})")
|
|
120
120
|
implementation "com.theoplayer.theoplayer-sdk-android:core:${theoplayer_sdk_version}"
|
|
121
|
-
implementation "com.theoplayer.theoplayer-sdk-android:ads-wrapper:
|
|
121
|
+
implementation "com.theoplayer.theoplayer-sdk-android:ads-wrapper:8.0.0"
|
|
122
122
|
implementation "com.theoplayer.android-connector:mediasession:${theoplayer_mediasession_version}"
|
|
123
123
|
|
|
124
124
|
if (enabledGoogleIMA) {
|
package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/8.0.0/ads-wrapper-8.0.0.aar
ADDED
|
Binary file
|
|
@@ -1,9 +1,9 @@
|
|
|
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>8.0.0</modelVersion>
|
|
5
5
|
<groupId>com.theoplayer.theoplayer-sdk-android</groupId>
|
|
6
6
|
<artifactId>ads-wrapper</artifactId>
|
|
7
|
-
<version>
|
|
7
|
+
<version>8.0.0</version>
|
|
8
8
|
<packaging>aar</packaging>
|
|
9
9
|
</project>
|
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>8.0.0</latest>
|
|
7
|
+
<release>8.0.0</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>
|
|
9
|
+
<version>8.0.0</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20240909163212</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package com.theoplayer
|
|
2
2
|
|
|
3
|
-
import android.text.TextUtils
|
|
4
3
|
import com.facebook.react.bridge.ReadableMap
|
|
5
4
|
import com.google.ads.interactivemedia.v3.api.AdsRenderingSettings
|
|
6
5
|
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory
|
|
@@ -11,14 +10,12 @@ import com.theoplayer.android.api.cast.CastStrategy
|
|
|
11
10
|
import com.theoplayer.android.api.cast.CastConfiguration
|
|
12
11
|
import com.theoplayer.android.api.pip.PipConfiguration
|
|
13
12
|
import com.theoplayer.android.api.player.NetworkConfiguration
|
|
14
|
-
import com.theoplayer.android.api.ui.UIConfiguration
|
|
15
13
|
import com.theoplayer.media.MediaSessionConfig
|
|
16
14
|
import com.theoplayer.media.MediaSessionConfigAdapter
|
|
17
15
|
|
|
18
16
|
private const val PROP_LICENSE = "license"
|
|
19
17
|
private const val PROP_LICENSE_URL = "licenseUrl"
|
|
20
18
|
private const val PROP_PRELOAD = "preload"
|
|
21
|
-
private const val PROP_LANGUAGE = "language"
|
|
22
19
|
private const val PROP_LIVE_OFFSET = "liveOffset"
|
|
23
20
|
private const val PROP_UI_ENABLED = "uiEnabled"
|
|
24
21
|
private const val PROP_CAST_STRATEGY = "strategy"
|
|
@@ -30,7 +27,6 @@ private const val PROP_RETRY_MAX_BACKOFF = "maximumBackoff"
|
|
|
30
27
|
private const val PROP_CAST_CONFIGURATION = "cast"
|
|
31
28
|
private const val PROP_ADS_CONFIGURATION = "ads"
|
|
32
29
|
private const val PROP_IMA_CONFIGURATION = "ima"
|
|
33
|
-
private const val PROP_UI_CONFIGURATION = "ui"
|
|
34
30
|
private const val PROP_MEDIA_CONTROL = "mediaControl"
|
|
35
31
|
private const val PROP_PPID = "ppid"
|
|
36
32
|
private const val PROP_MAX_REDIRECTS = "maxRedirects"
|
|
@@ -62,9 +58,6 @@ class PlayerConfigAdapter(private val configProps: ReadableMap?) {
|
|
|
62
58
|
if (hasKey(PROP_LIVE_OFFSET)) {
|
|
63
59
|
liveOffset(getDouble(PROP_LIVE_OFFSET))
|
|
64
60
|
}
|
|
65
|
-
if (hasKey(PROP_UI_CONFIGURATION)) {
|
|
66
|
-
ui(uiConfig())
|
|
67
|
-
}
|
|
68
61
|
if (hasKey(PROP_HLS_DATE_RANGE)) {
|
|
69
62
|
hlsDateRange(getBoolean(PROP_HLS_DATE_RANGE))
|
|
70
63
|
}
|
|
@@ -115,10 +108,6 @@ class PlayerConfigAdapter(private val configProps: ReadableMap?) {
|
|
|
115
108
|
}
|
|
116
109
|
featureFlags = convertedMap
|
|
117
110
|
}
|
|
118
|
-
// The current ISO 639-1 language code, get it from the UI config.
|
|
119
|
-
uiConfig().language?.let {
|
|
120
|
-
language = it
|
|
121
|
-
}
|
|
122
111
|
// The maximum number of VAST redirects.
|
|
123
112
|
if (hasKey(PROP_MAX_REDIRECTS)) {
|
|
124
113
|
maxRedirects = getInt(PROP_MAX_REDIRECTS)
|
|
@@ -164,21 +153,6 @@ class PlayerConfigAdapter(private val configProps: ReadableMap?) {
|
|
|
164
153
|
}
|
|
165
154
|
}
|
|
166
155
|
|
|
167
|
-
/**
|
|
168
|
-
* Get UIConfiguration object; these properties apply:
|
|
169
|
-
* - language: The language used to localize the ui elements.
|
|
170
|
-
*/
|
|
171
|
-
private fun uiConfig(): UIConfiguration {
|
|
172
|
-
return UIConfiguration.Builder().apply {
|
|
173
|
-
configProps?.getMap(PROP_UI_CONFIGURATION)?.run {
|
|
174
|
-
val languageString = getString(PROP_LANGUAGE)
|
|
175
|
-
if (languageString != null && !TextUtils.isEmpty(languageString)) {
|
|
176
|
-
language(languageString)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}.build()
|
|
180
|
-
}
|
|
181
|
-
|
|
182
156
|
/**
|
|
183
157
|
* Get CastConfiguration object; these properties apply:
|
|
184
158
|
* - strategy: The join strategy of the player.
|
|
@@ -88,7 +88,7 @@ private const val EVENT_PROP_SUITE_VERSION = "playerSuiteVersion"
|
|
|
88
88
|
@Suppress("UNCHECKED_CAST")
|
|
89
89
|
class PlayerEventEmitter internal constructor(
|
|
90
90
|
private val reactContext: ReactApplicationContext,
|
|
91
|
-
playerView: ReactTHEOplayerView
|
|
91
|
+
private val playerView: ReactTHEOplayerView
|
|
92
92
|
) {
|
|
93
93
|
@Retention(AnnotationRetention.SOURCE)
|
|
94
94
|
@StringDef(
|
|
@@ -163,7 +163,6 @@ class PlayerEventEmitter internal constructor(
|
|
|
163
163
|
private val textTrackListeners = HashMap<EventType<*>, EventListener<*>>()
|
|
164
164
|
private val audioTrackListeners = HashMap<EventType<*>, EventListener<*>>()
|
|
165
165
|
private val videoTrackListeners = HashMap<EventType<*>, EventListener<*>>()
|
|
166
|
-
private val playerView: ReactTHEOplayerView
|
|
167
166
|
private var adEventAdapter: AdEventAdapter? = null
|
|
168
167
|
private var castEventAdapter: CastEventAdapter? = null
|
|
169
168
|
private var lastTimeUpdate: Long = 0
|
|
@@ -175,7 +174,6 @@ class PlayerEventEmitter internal constructor(
|
|
|
175
174
|
}
|
|
176
175
|
|
|
177
176
|
init {
|
|
178
|
-
this.playerView = playerView
|
|
179
177
|
|
|
180
178
|
// Create listeners
|
|
181
179
|
playerListeners[PlayerEventTypes.SOURCECHANGE] = EventListener<PlayerEvent<*>> {
|
|
@@ -75,10 +75,7 @@ object AdAdapter {
|
|
|
75
75
|
*/
|
|
76
76
|
private fun fromAd(ad: Ad, includeAdBreak: Boolean): WritableMap {
|
|
77
77
|
val adPayload = Arguments.createMap()
|
|
78
|
-
adPayload.putString(
|
|
79
|
-
PROP_AD_INTEGRATION, if (ad.integration != null) ad.integration!!
|
|
80
|
-
.type else ""
|
|
81
|
-
)
|
|
78
|
+
adPayload.putString(PROP_AD_INTEGRATION, ad.integration.type)
|
|
82
79
|
adPayload.putString(PROP_AD_TYPE, ad.type)
|
|
83
80
|
adPayload.putString(PROP_AD_ID, ad.id)
|
|
84
81
|
val adBreak = ad.adBreak
|
|
@@ -206,13 +203,18 @@ object AdAdapter {
|
|
|
206
203
|
}
|
|
207
204
|
|
|
208
205
|
override fun getIntegration(): AdIntegrationKind {
|
|
209
|
-
return AdIntegrationKind.from(ad.getString(PROP_AD_INTEGRATION))
|
|
206
|
+
return AdIntegrationKind.from(ad.getString(PROP_AD_INTEGRATION)) ?: AdIntegrationKind.CUSTOM
|
|
210
207
|
}
|
|
211
208
|
|
|
212
209
|
override fun getCustomIntegration(): String? {
|
|
213
210
|
return ad.getString(PROP_AD_CUSTOM_INTEGRATION)
|
|
214
211
|
}
|
|
215
212
|
|
|
213
|
+
override fun getCustomData(): Any? {
|
|
214
|
+
// Not supported yet
|
|
215
|
+
return null
|
|
216
|
+
}
|
|
217
|
+
|
|
216
218
|
override fun getImaAd(): com.google.ads.interactivemedia.v3.api.Ad {
|
|
217
219
|
return parseImaAd(ad)
|
|
218
220
|
}
|
|
@@ -282,12 +284,17 @@ object AdAdapter {
|
|
|
282
284
|
}
|
|
283
285
|
|
|
284
286
|
override fun getIntegration(): AdIntegrationKind {
|
|
285
|
-
return AdIntegrationKind.from(adBreak.getString(PROP_ADBREAK_INTEGRATION))
|
|
287
|
+
return AdIntegrationKind.from(adBreak.getString(PROP_ADBREAK_INTEGRATION)) ?: AdIntegrationKind.CUSTOM
|
|
286
288
|
}
|
|
287
289
|
|
|
288
290
|
override fun getCustomIntegration(): String? {
|
|
289
291
|
return adBreak.getString(PROP_AD_CUSTOM_INTEGRATION)
|
|
290
292
|
}
|
|
293
|
+
|
|
294
|
+
override fun getCustomData(): Any? {
|
|
295
|
+
// Not supported yet
|
|
296
|
+
return null
|
|
297
|
+
}
|
|
291
298
|
}
|
|
292
299
|
}
|
|
293
300
|
|
|
@@ -21,36 +21,35 @@ private const val EVENT_PROP_TYPE = "type"
|
|
|
21
21
|
private const val EVENT_PROP_SUBTYPE = "subType"
|
|
22
22
|
|
|
23
23
|
class AdEventAdapter(private val adsApi: AdsApiWrapper, eventEmitter: AdEventEmitter) {
|
|
24
|
-
private val eventListener: AdEventListener
|
|
24
|
+
private val eventListener: AdEventListener = object : AdEventListener {
|
|
25
|
+
override fun <E : AdEvent<*>?> onAdEvent(type: EventType<E>?, ad: Ad?, adData: Map<String, String>?, adError: AdError?) {
|
|
26
|
+
val payload = Arguments.createMap()
|
|
27
|
+
if (type != null) {
|
|
28
|
+
payload.putString(EVENT_PROP_TYPE, mapAdType(type))
|
|
29
|
+
}
|
|
30
|
+
if (ad != null) {
|
|
31
|
+
payload.putMap(EVENT_PROP_AD, AdAdapter.fromAd(ad))
|
|
32
|
+
}
|
|
33
|
+
eventEmitter.emit(payload)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun <E : AdEvent<*>?> onAdBreakEvent(type: EventType<E>?, adBreak: AdBreak?, adData: Map<String, String>?, adError: AdError?) {
|
|
37
|
+
val payload = Arguments.createMap()
|
|
38
|
+
if (type != null) {
|
|
39
|
+
payload.putString(EVENT_PROP_TYPE, mapAdType(type))
|
|
40
|
+
}
|
|
41
|
+
if (adBreak != null) {
|
|
42
|
+
payload.putMap(EVENT_PROP_AD, AdAdapter.fromAdBreak(adBreak))
|
|
43
|
+
}
|
|
44
|
+
eventEmitter.emit(payload)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
25
47
|
|
|
26
48
|
interface AdEventEmitter {
|
|
27
49
|
fun emit(payload: WritableMap?)
|
|
28
50
|
}
|
|
29
51
|
|
|
30
52
|
init {
|
|
31
|
-
eventListener = object : AdEventListener {
|
|
32
|
-
override fun <E : AdEvent<*>?> onAdEvent(type: EventType<E>?, ad: Ad?, adData: Map<String, String>?, adError: AdError?) {
|
|
33
|
-
val payload = Arguments.createMap()
|
|
34
|
-
if (type != null) {
|
|
35
|
-
payload.putString(EVENT_PROP_TYPE, mapAdType(type))
|
|
36
|
-
}
|
|
37
|
-
if (ad != null) {
|
|
38
|
-
payload.putMap(EVENT_PROP_AD, AdAdapter.fromAd(ad))
|
|
39
|
-
}
|
|
40
|
-
eventEmitter.emit(payload)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
override fun <E : AdEvent<*>?> onAdBreakEvent(type: EventType<E>?, adBreak: AdBreak?, adData: Map<String, String>?, adError: AdError?) {
|
|
44
|
-
val payload = Arguments.createMap()
|
|
45
|
-
if (type != null) {
|
|
46
|
-
payload.putString(EVENT_PROP_TYPE, mapAdType(type))
|
|
47
|
-
}
|
|
48
|
-
if (adBreak != null) {
|
|
49
|
-
payload.putMap(EVENT_PROP_AD, AdAdapter.fromAdBreak(adBreak))
|
|
50
|
-
}
|
|
51
|
-
eventEmitter.emit(payload)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
53
|
adsApi.addAllEventsListener(eventListener)
|
|
55
54
|
}
|
|
56
55
|
|
|
@@ -13,11 +13,7 @@ private const val TAG = "THEORCTAdsModule"
|
|
|
13
13
|
|
|
14
14
|
class AdsModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
15
15
|
private val sourceHelper = SourceAdapter()
|
|
16
|
-
private val viewResolver: ViewResolver
|
|
17
|
-
|
|
18
|
-
init {
|
|
19
|
-
viewResolver = ViewResolver(context)
|
|
20
|
-
}
|
|
16
|
+
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
21
17
|
|
|
22
18
|
override fun getName(): String {
|
|
23
19
|
return TAG
|
|
@@ -14,11 +14,7 @@ private const val TAG = "THEORCTEventBroadcastModule"
|
|
|
14
14
|
@ReactModule(name = TAG)
|
|
15
15
|
class EventBroadcastModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
16
16
|
|
|
17
|
-
private val viewResolver: ViewResolver
|
|
18
|
-
|
|
19
|
-
init {
|
|
20
|
-
viewResolver = ViewResolver(context)
|
|
21
|
-
}
|
|
17
|
+
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
22
18
|
|
|
23
19
|
override fun getName(): String {
|
|
24
20
|
return TAG
|
|
@@ -46,14 +46,14 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
46
46
|
private val onTaskError = mutableMapOf<String, EventListener<CachingTaskErrorEvent>>()
|
|
47
47
|
private val onTaskStateChange = mutableMapOf<String, EventListener<CachingTaskStateChangeEvent>>()
|
|
48
48
|
private val sourceAdapter = SourceAdapter()
|
|
49
|
-
private val cache: Cache
|
|
49
|
+
private val cache: Cache
|
|
50
50
|
get() = THEOplayerGlobal.getSharedInstance(context.applicationContext).cache
|
|
51
51
|
private val handler = Handler(Looper.getMainLooper())
|
|
52
52
|
|
|
53
53
|
init {
|
|
54
54
|
// Add cache event listeners
|
|
55
55
|
handler.post {
|
|
56
|
-
cache
|
|
56
|
+
cache.apply {
|
|
57
57
|
// Listen for cache state changes
|
|
58
58
|
addEventListener(CacheEventTypes.CACHE_STATE_CHANGE) { event ->
|
|
59
59
|
emit("onCacheStatusChange", Arguments.createMap().apply {
|
|
@@ -155,7 +155,7 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
155
155
|
@ReactMethod
|
|
156
156
|
fun getInitialState(promise: Promise) {
|
|
157
157
|
handler.post {
|
|
158
|
-
cache
|
|
158
|
+
cache.apply {
|
|
159
159
|
|
|
160
160
|
// Add listeners to existing tasks
|
|
161
161
|
tasks.forEach { task ->
|
|
@@ -175,7 +175,7 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
175
175
|
val sourceDescription = sourceAdapter.parseSourceFromJS(source)
|
|
176
176
|
if (sourceDescription != null) {
|
|
177
177
|
handler.post {
|
|
178
|
-
cache
|
|
178
|
+
cache.createTask(
|
|
179
179
|
sourceDescription,
|
|
180
180
|
CacheAdapter.parseCachingParameters(parameters)
|
|
181
181
|
)
|
|
@@ -186,21 +186,21 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
186
186
|
@ReactMethod
|
|
187
187
|
fun pauseCachingTask(id: String) {
|
|
188
188
|
handler.post {
|
|
189
|
-
cache
|
|
189
|
+
cache.tasks.getTaskById(id)?.pause()
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
@ReactMethod
|
|
194
194
|
fun removeCachingTask(id: String) {
|
|
195
195
|
handler.post {
|
|
196
|
-
cache
|
|
196
|
+
cache.tasks.getTaskById(id)?.remove()
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
@ReactMethod
|
|
201
201
|
fun startCachingTask(id: String) {
|
|
202
202
|
handler.post {
|
|
203
|
-
cache
|
|
203
|
+
cache.tasks.getTaskById(id)?.start()
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -232,7 +232,7 @@ class CacheModule(private val context: ReactApplicationContext) :
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
private fun taskById(id: String): CachingTask? {
|
|
235
|
-
return cache
|
|
235
|
+
return cache.tasks.getTaskById(id) ?: run {
|
|
236
236
|
Log.w(TAG, "CachingTask with id $id not found")
|
|
237
237
|
return null
|
|
238
238
|
}
|
|
@@ -19,7 +19,7 @@ data class BridgeRequest(
|
|
|
19
19
|
val onTimeout: Runnable
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
private const val TAG = "
|
|
22
|
+
private const val TAG = "ContentProtectionModule"
|
|
23
23
|
|
|
24
24
|
private const val EVENT_CERTIFICATE_REQUEST = "onCertificateRequest"
|
|
25
25
|
private const val EVENT_CERTIFICATE_REQUEST_PROCESSED_AS_REQUEST = "onCertificateRequestProcessedAsRequest"
|
|
@@ -34,6 +34,7 @@ private const val EVENT_LICENSE_REQUEST_PROCESSED_AS_LICENSE = "onLicenseRequest
|
|
|
34
34
|
private const val EVENT_LICENSE_RESPONSE = "onLicenseResponse"
|
|
35
35
|
private const val EVENT_LICENSE_RESPONSE_PROCESSED = "onLicenseResponseProcessed"
|
|
36
36
|
|
|
37
|
+
@Suppress("unused")
|
|
37
38
|
class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
38
39
|
ReactContextBaseJavaModule(context) {
|
|
39
40
|
|
|
@@ -19,11 +19,7 @@ private const val TAG = "THEORCTPlayerModule"
|
|
|
19
19
|
|
|
20
20
|
@Suppress("unused")
|
|
21
21
|
class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) {
|
|
22
|
-
private val viewResolver: ViewResolver
|
|
23
|
-
|
|
24
|
-
init {
|
|
25
|
-
viewResolver = ViewResolver(context)
|
|
26
|
-
}
|
|
22
|
+
private val viewResolver: ViewResolver = ViewResolver(context)
|
|
27
23
|
|
|
28
24
|
override fun getName(): String {
|
|
29
25
|
return TAG
|
|
@@ -14,6 +14,7 @@ private const val PROP_AVAILABILITY_TYPE = "availabilityType"
|
|
|
14
14
|
private const val AVAILABILITY_TYPE_VOD = "vod"
|
|
15
15
|
private const val ERROR_DAI_NOT_ENABLED = "Google DAI support not enabled."
|
|
16
16
|
|
|
17
|
+
@Suppress("UNUSED_PARAMETER")
|
|
17
18
|
@Throws(THEOplayerException::class)
|
|
18
19
|
fun googleDaiBuilderFromJson(builder: TypedSource.Builder, json: JSONObject): TypedSource.Builder {
|
|
19
20
|
// Check whether the integration was enabled
|
|
@@ -4,26 +4,13 @@ import com.theoplayer.android.api.player.track.mediatrack.quality.Quality
|
|
|
4
4
|
import com.theoplayer.android.api.player.track.mediatrack.quality.QualityList
|
|
5
5
|
import java.util.*
|
|
6
6
|
|
|
7
|
-
fun <Q: Quality> emptyQualityList(): QualityList<Q> {
|
|
8
|
-
return QualityListAdapter()
|
|
9
|
-
}
|
|
10
|
-
|
|
11
7
|
/**
|
|
12
8
|
* Adapts an Android List to a QualityList.
|
|
13
9
|
*/
|
|
14
|
-
class QualityListAdapter<Q : Quality> : QualityList<Q> {
|
|
15
|
-
private var qualities: MutableList<Q>
|
|
16
|
-
|
|
17
|
-
constructor() {
|
|
18
|
-
this.qualities = arrayListOf()
|
|
19
|
-
}
|
|
10
|
+
class QualityListAdapter<Q : Quality>(qualities: QualityList<Q>) : QualityList<Q> {
|
|
11
|
+
private var qualities: MutableList<Q> = ArrayList()
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
this.qualities = qualities
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
constructor(qualities: QualityList<Q>) {
|
|
26
|
-
this.qualities = ArrayList()
|
|
13
|
+
init {
|
|
27
14
|
for (quality in qualities) {
|
|
28
15
|
this.qualities.add(quality)
|
|
29
16
|
}
|
|
@@ -41,10 +28,6 @@ class QualityListAdapter<Q : Quality> : QualityList<Q> {
|
|
|
41
28
|
return qualities.iterator()
|
|
42
29
|
}
|
|
43
30
|
|
|
44
|
-
fun asList(): List<Q> {
|
|
45
|
-
return qualities
|
|
46
|
-
}
|
|
47
|
-
|
|
48
31
|
fun sort(comparator: Comparator<Q>) {
|
|
49
32
|
Collections.sort(qualities, comparator)
|
|
50
33
|
}
|
|
@@ -4,18 +4,18 @@ import android.graphics.Color
|
|
|
4
4
|
import com.facebook.react.bridge.ReadableMap
|
|
5
5
|
import com.theoplayer.android.api.player.track.texttrack.TextTrackStyle
|
|
6
6
|
|
|
7
|
-
private val PROP_BACKGROUND_COLOR = "backgroundColor"
|
|
8
|
-
private val PROP_EDGE_STYLE = "edgeStyle"
|
|
9
|
-
private val PROP_FONT_COLOR = "fontColor"
|
|
10
|
-
private val PROP_FONT_FAMILY = "fontFamily"
|
|
11
|
-
private val PROP_FONT_SIZE = "fontSize"
|
|
12
|
-
private val PROP_WINDOW_COLOR = "windowColor"
|
|
13
|
-
private val PROP_MARGIN_LEFT = "marginLeft"
|
|
14
|
-
private val PROP_MARGIN_TOP = "marginTop"
|
|
15
|
-
private val PROP_COLOR_R = "r"
|
|
16
|
-
private val PROP_COLOR_G = "g"
|
|
17
|
-
private val PROP_COLOR_B = "b"
|
|
18
|
-
private val PROP_COLOR_A = "a"
|
|
7
|
+
private const val PROP_BACKGROUND_COLOR = "backgroundColor"
|
|
8
|
+
private const val PROP_EDGE_STYLE = "edgeStyle"
|
|
9
|
+
private const val PROP_FONT_COLOR = "fontColor"
|
|
10
|
+
private const val PROP_FONT_FAMILY = "fontFamily"
|
|
11
|
+
private const val PROP_FONT_SIZE = "fontSize"
|
|
12
|
+
private const val PROP_WINDOW_COLOR = "windowColor"
|
|
13
|
+
private const val PROP_MARGIN_LEFT = "marginLeft"
|
|
14
|
+
private const val PROP_MARGIN_TOP = "marginTop"
|
|
15
|
+
private const val PROP_COLOR_R = "r"
|
|
16
|
+
private const val PROP_COLOR_G = "g"
|
|
17
|
+
private const val PROP_COLOR_B = "b"
|
|
18
|
+
private const val PROP_COLOR_A = "a"
|
|
19
19
|
|
|
20
20
|
object TextTrackStyleAdapter {
|
|
21
21
|
|
|
@@ -37,7 +37,7 @@ object BridgeUtils {
|
|
|
37
37
|
/**
|
|
38
38
|
* Convert a JSONArray to bridge data.
|
|
39
39
|
*/
|
|
40
|
-
fun fromJSONArrayToBridge(jsonArray: JSONArray): WritableArray {
|
|
40
|
+
private fun fromJSONArrayToBridge(jsonArray: JSONArray): WritableArray {
|
|
41
41
|
return Arguments.createArray().apply {
|
|
42
42
|
try {
|
|
43
43
|
for (i in 0 until jsonArray.length()) {
|
package/app.plugin.js
CHANGED
|
@@ -8,50 +8,47 @@
|
|
|
8
8
|
* }]
|
|
9
9
|
* ]
|
|
10
10
|
*/
|
|
11
|
-
const {withProjectBuildGradle, withGradleProperties} = require('@expo/config-plugins');
|
|
11
|
+
const { withProjectBuildGradle, withGradleProperties } = require('@expo/config-plugins');
|
|
12
12
|
|
|
13
13
|
function mapAndroidExtensionKey(ext) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
switch (ext) {
|
|
15
|
+
case 'ima':
|
|
16
|
+
return 'THEOplayer_extensionGoogleIMA';
|
|
17
|
+
case 'dai':
|
|
18
|
+
return 'THEOplayer_extensionGoogleDAI';
|
|
19
|
+
case 'cast':
|
|
20
|
+
return 'THEOplayer_extensionCast';
|
|
21
|
+
default:
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const applyAndroidExtensions = (config, extensions) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
return config;
|
|
27
|
+
return withGradleProperties(config, (config) => {
|
|
28
|
+
extensions?.forEach((ext) => {
|
|
29
|
+
const key = mapAndroidExtensionKey(ext);
|
|
30
|
+
if (key) {
|
|
31
|
+
config.modResults.push({ type: 'property', key, value: true });
|
|
32
|
+
}
|
|
35
33
|
});
|
|
36
|
-
|
|
34
|
+
return config;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
37
|
|
|
38
38
|
const withAndroidTHEOplayer = (config, props) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
// Apply Android extensions
|
|
40
|
+
const { extensions } = props | {};
|
|
41
|
+
config = applyAndroidExtensions(config, extensions);
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
50
|
-
return config;
|
|
51
|
-
});
|
|
43
|
+
// Add the localMaven repo to the project's repositories
|
|
44
|
+
return withProjectBuildGradle(config, (config) => {
|
|
45
|
+
const localMaven = 'maven { url("$rootDir/../node_modules/react-native-theoplayer/android/local") }';
|
|
46
|
+
config.modResults.contents = config.modResults.contents.replace(/allprojects\s*\{\s*repositories\s*\{/, `$&\n\t\t${localMaven}`);
|
|
47
|
+
return config;
|
|
48
|
+
});
|
|
52
49
|
};
|
|
53
50
|
|
|
54
51
|
module.exports = (config, props) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
52
|
+
// Apply Android modifications
|
|
53
|
+
return withAndroidTHEOplayer(config, props);
|
|
54
|
+
};
|