react-native-theoplayer 10.11.0 → 10.12.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 +13 -0
- package/android/build.gradle +2 -4
- package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +13 -3
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +15 -0
- package/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +6 -0
- package/android/src/main/java/com/theoplayer/ads/AdAdapter.kt +6 -0
- package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +4 -0
- package/ios/THEOplayerRCTBridge.m +1 -0
- package/ios/THEOplayerRCTMainEventHandler.swift +25 -2
- package/ios/THEOplayerRCTSourceDescriptionAggregator.swift +14 -0
- package/ios/THEOplayerRCTView.swift +7 -1
- package/ios/ads/THEOplayerRCTAdAdapter.swift +4 -1
- package/ios/ads/THEOplayerRCTAdsNative.swift +10 -10
- package/lib/commonjs/api/event/PlayerEvent.js +7 -0
- package/lib/commonjs/api/event/PlayerEvent.js.map +1 -1
- package/lib/commonjs/api/player/PlayerEventMap.js +1 -0
- package/lib/commonjs/api/player/PlayerEventMap.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.js +54 -45
- package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +2 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +5 -0
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/adapter/ads/THEOplayerWebAdsAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js +8 -1
- package/lib/commonjs/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/commonjs/manifest.json +1 -1
- package/lib/module/api/event/PlayerEvent.js +8 -0
- package/lib/module/api/event/PlayerEvent.js.map +1 -1
- package/lib/module/api/player/PlayerEventMap.js +1 -0
- package/lib/module/api/player/PlayerEventMap.js.map +1 -1
- package/lib/module/internal/THEOplayerView.js +55 -46
- package/lib/module/internal/THEOplayerView.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +2 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +6 -1
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/adapter/ads/THEOplayerWebAdsAdapter.js.map +1 -1
- package/lib/module/internal/adapter/event/PlayerEvents.js +6 -0
- package/lib/module/internal/adapter/event/PlayerEvents.js.map +1 -1
- package/lib/module/manifest.json +1 -1
- package/lib/typescript/api/ads/AdBreak.d.ts +9 -0
- package/lib/typescript/api/ads/AdBreak.d.ts.map +1 -1
- package/lib/typescript/api/config/PlayerConfiguration.d.ts +11 -0
- package/lib/typescript/api/config/PlayerConfiguration.d.ts.map +1 -1
- package/lib/typescript/api/event/PlayerEvent.d.ts +14 -1
- package/lib/typescript/api/event/PlayerEvent.d.ts.map +1 -1
- package/lib/typescript/api/player/PlayerEventMap.d.ts +6 -1
- package/lib/typescript/api/player/PlayerEventMap.d.ts.map +1 -1
- package/lib/typescript/internal/THEOplayerView.d.ts +2 -1
- package/lib/typescript/internal/THEOplayerView.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +1 -1
- package/lib/typescript/internal/adapter/THEOplayerAdapter.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 +5 -1
- package/lib/typescript/internal/adapter/event/PlayerEvents.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts +9 -0
- package/lib/typescript/internal/adapter/event/native/NativePlayerEvent.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-theoplayer.podspec +6 -6
- package/src/api/ads/AdBreak.ts +10 -0
- package/src/api/config/PlayerConfiguration.ts +12 -0
- package/src/api/event/PlayerEvent.ts +15 -1
- package/src/api/player/PlayerEventMap.ts +7 -0
- package/src/internal/THEOplayerView.tsx +59 -46
- package/src/internal/adapter/THEOplayerAdapter.ts +2 -1
- package/src/internal/adapter/WebEventForwarder.ts +12 -2
- package/src/internal/adapter/ads/THEOplayerWebAdsAdapter.ts +3 -3
- package/src/internal/adapter/event/PlayerEvents.ts +8 -0
- package/src/internal/adapter/event/native/NativePlayerEvent.ts +10 -0
- package/src/manifest.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ 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.12.0] - 26-03-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added `currentsourcechange` event to the player API, which is dispatched when the current source, chosen from the source description's sources, changes.
|
|
13
|
+
- Added `debugLogsEnabled` flag to `PlayerConfiguration` to allow enabling all debug logs from the underlying Android SDK.
|
|
14
|
+
- Added the `id` property to `AdBreak`, representing the identifier of the ad break.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Fixed an issue on Android where the build process would pick up version from the snapshot repository instead of the release repository, causing build failures.
|
|
19
|
+
- Fixed an issue on iOS & Android where, when using `<StrictMode>`, the player's list of text tracks would be empty.
|
|
20
|
+
|
|
8
21
|
## [10.11.0] - 26-03-10
|
|
9
22
|
|
|
10
23
|
### Fixed
|
package/android/build.gradle
CHANGED
|
@@ -109,7 +109,6 @@ android {
|
|
|
109
109
|
rootProject.allprojects {
|
|
110
110
|
repositories {
|
|
111
111
|
maven { url "https://maven.theoplayer.com/releases" }
|
|
112
|
-
maven { url "https://maven.theoplayer.com/snapshots" }
|
|
113
112
|
maven { url("$rootDir/../node_modules/react-native-theoplayer/android/local") }
|
|
114
113
|
mavenLocal()
|
|
115
114
|
}
|
|
@@ -119,13 +118,12 @@ repositories {
|
|
|
119
118
|
google()
|
|
120
119
|
mavenCentral()
|
|
121
120
|
maven { url "https://maven.theoplayer.com/releases" }
|
|
122
|
-
maven { url "https://maven.theoplayer.com/snapshots" }
|
|
123
121
|
maven { url("$rootDir/../node_modules/react-native-theoplayer/android/local") }
|
|
124
122
|
mavenLocal()
|
|
125
123
|
}
|
|
126
124
|
|
|
127
|
-
// The minimum supported THEOplayer version is 10.
|
|
128
|
-
def theoVersion = safeExtGet('THEOplayer_sdk', '[10.
|
|
125
|
+
// The minimum supported THEOplayer version is 10.12.0
|
|
126
|
+
def theoVersion = safeExtGet('THEOplayer_sdk', '[10.12.0, 11.0.0)')
|
|
129
127
|
def theoMediaSessionVersion = safeExtGet('THEOplayer_mediasession', '[8.0.0, 11.0.0)')
|
|
130
128
|
def theoAdsWrapperVersion = "10.0.0"
|
|
131
129
|
def coroutinesVersion = safeExtGet('coroutinesVersion', '1.10.2')
|
|
@@ -43,9 +43,19 @@ private const val PROP_THEOLIVE_EXTERNAL_SESSION_ID = "externalSessionId"
|
|
|
43
43
|
private const val PROP_THEOLIVE_ANALYTICS_DISABLED = "analyticsDisabled"
|
|
44
44
|
private const val PROP_THEOLIVE_DISCOVERY_URL = "discoveryUrl"
|
|
45
45
|
private const val PROP_MULTIMEDIA_TUNNELING_ENABLED = "tunnelingEnabled"
|
|
46
|
+
private const val PROP_DEBUG_LOGS_ENABLED = "debugLogsEnabled"
|
|
46
47
|
|
|
47
48
|
class PlayerConfigAdapter(private val configProps: ReadableMap?) {
|
|
48
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Whether debug logs from the native SDK should be enabled.
|
|
52
|
+
*/
|
|
53
|
+
fun debugLogsEnabled(): Boolean {
|
|
54
|
+
return configProps?.let {
|
|
55
|
+
if (it.hasKey(PROP_DEBUG_LOGS_ENABLED)) it.getBoolean(PROP_DEBUG_LOGS_ENABLED) else false
|
|
56
|
+
} ?: false
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
/**
|
|
50
60
|
* Get general THEOplayerConfig object; these properties apply:
|
|
51
61
|
* - license: The license for the player.
|
|
@@ -62,12 +72,12 @@ class PlayerConfigAdapter(private val configProps: ReadableMap?) {
|
|
|
62
72
|
licenseUrl(licenseUrl)
|
|
63
73
|
}
|
|
64
74
|
if (hasKey(PROP_RETRY_CONFIG) || hasKey(PROP_USE_HTTPENGINE)) {
|
|
65
|
-
|
|
75
|
+
network(networkConfig())
|
|
66
76
|
}
|
|
67
77
|
if (hasKey(PROP_THEOLIVE_CONFIG)) {
|
|
68
|
-
|
|
78
|
+
theoLive(theoLiveConfig())
|
|
69
79
|
}
|
|
70
|
-
|
|
80
|
+
pip(PipConfiguration.Builder().build())
|
|
71
81
|
// Opt-out for auto-integrations for now
|
|
72
82
|
autoIntegrations(false)
|
|
73
83
|
if (hasKey(PROP_MULTIMEDIA_TUNNELING_ENABLED)) {
|
|
@@ -44,6 +44,7 @@ import com.theoplayer.android.api.player.track.texttrack.TextTrackKind
|
|
|
44
44
|
import com.theoplayer.android.api.player.track.texttrack.TextTrackMode
|
|
45
45
|
import com.theoplayer.cast.CastEventAdapter
|
|
46
46
|
import com.theoplayer.presentation.PresentationModeChangeContext
|
|
47
|
+
import com.theoplayer.source.SourceAdapter
|
|
47
48
|
import com.theoplayer.theoads.THEOadsEventAdapter
|
|
48
49
|
import com.theoplayer.theolive.THEOliveEventAdapter
|
|
49
50
|
import com.theoplayer.track.*
|
|
@@ -55,6 +56,7 @@ private val TAG = PlayerEventEmitter::class.java.name
|
|
|
55
56
|
private const val EVENT_PLAYER_READY = "onNativePlayerReady"
|
|
56
57
|
private const val EVENT_PLAYER_STATE_SYNC = "onNativePlayerStateSync"
|
|
57
58
|
private const val EVENT_SOURCECHANGE = "onNativeSourceChange"
|
|
59
|
+
private const val EVENT_CURRENTSOURCECHANGE = "onNativeCurrentSourceChange"
|
|
58
60
|
private const val EVENT_LOADSTART = "onNativeLoadStart"
|
|
59
61
|
private const val EVENT_LOADEDMETADATA = "onNativeLoadedMetadata"
|
|
60
62
|
private const val EVENT_LOADEDDATA = "onNativeLoadedData"
|
|
@@ -101,6 +103,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
101
103
|
EVENT_PLAYER_READY,
|
|
102
104
|
EVENT_PLAYER_STATE_SYNC,
|
|
103
105
|
EVENT_SOURCECHANGE,
|
|
106
|
+
EVENT_CURRENTSOURCECHANGE,
|
|
104
107
|
EVENT_LOADSTART,
|
|
105
108
|
EVENT_LOADEDMETADATA,
|
|
106
109
|
EVENT_LOADEDDATA,
|
|
@@ -139,6 +142,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
139
142
|
EVENT_PLAYER_READY,
|
|
140
143
|
EVENT_PLAYER_STATE_SYNC,
|
|
141
144
|
EVENT_SOURCECHANGE,
|
|
145
|
+
EVENT_CURRENTSOURCECHANGE,
|
|
142
146
|
EVENT_LOADSTART,
|
|
143
147
|
EVENT_LOADEDMETADATA,
|
|
144
148
|
EVENT_LOADEDDATA,
|
|
@@ -181,6 +185,7 @@ class PlayerEventEmitter internal constructor(
|
|
|
181
185
|
private var castEventAdapter: CastEventAdapter? = null
|
|
182
186
|
private var theoLiveEventAdapter: THEOliveEventAdapter? = null
|
|
183
187
|
private var theoAdsEventAdapter: THEOadsEventAdapter? = null
|
|
188
|
+
private val sourceAdapter: SourceAdapter = SourceAdapter()
|
|
184
189
|
private var lastTimeUpdate: Long = 0
|
|
185
190
|
private var lastCurrentTime = 0.0
|
|
186
191
|
private var dimensionChangeListener = View.OnLayoutChangeListener { v, _, _, _, _, oldLeft, oldTop, oldRight, oldBottom ->
|
|
@@ -195,6 +200,8 @@ class PlayerEventEmitter internal constructor(
|
|
|
195
200
|
playerListeners[PlayerEventTypes.SOURCECHANGE] = EventListener<PlayerEvent<*>> {
|
|
196
201
|
receiveEvent(EVENT_SOURCECHANGE, null)
|
|
197
202
|
}
|
|
203
|
+
playerListeners[PlayerEventTypes.CURRENTSOURCECHANGE] =
|
|
204
|
+
EventListener { event: CurrentSourceChangeEvent -> onCurrentSourceChange(event) }
|
|
198
205
|
playerListeners[PlayerEventTypes.LOADSTART] = EventListener<PlayerEvent<*>> {
|
|
199
206
|
receiveEvent(EVENT_LOADSTART, null)
|
|
200
207
|
}
|
|
@@ -340,6 +347,14 @@ class PlayerEventEmitter internal constructor(
|
|
|
340
347
|
receiveEvent(EVENT_ERROR, PayloadBuilder().error(code, message).build())
|
|
341
348
|
}
|
|
342
349
|
|
|
350
|
+
private fun onCurrentSourceChange(event: CurrentSourceChangeEvent) {
|
|
351
|
+
event.currentSource?.let { currentSource ->
|
|
352
|
+
receiveEvent(EVENT_CURRENTSOURCECHANGE, Arguments.createMap().apply {
|
|
353
|
+
putMap("currentSource", sourceAdapter.fromTypedSource(currentSource))
|
|
354
|
+
})
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
343
358
|
private fun onLoadedMetadata() {
|
|
344
359
|
playerView.player?.let {
|
|
345
360
|
receiveEvent(
|
|
@@ -14,6 +14,7 @@ import android.support.v4.media.session.MediaSessionCompat
|
|
|
14
14
|
import android.support.v4.media.session.PlaybackStateCompat
|
|
15
15
|
import android.util.Log
|
|
16
16
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
17
|
+
import com.theoplayer.android.api.THEOplayerGlobal
|
|
17
18
|
import com.theoplayer.android.api.THEOplayerView
|
|
18
19
|
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration
|
|
19
20
|
import com.theoplayer.android.api.ads.dai.GoogleDaiIntegrationFactory
|
|
@@ -229,6 +230,11 @@ class ReactTHEOplayerContext private constructor(
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
private fun initializePlayerView() {
|
|
233
|
+
// Enable all debug logs from the underlying Android SDK if configured.
|
|
234
|
+
if (configAdapter.debugLogsEnabled()) {
|
|
235
|
+
THEOplayerGlobal.getSharedInstance(reactContext).logger.enableAllTags()
|
|
236
|
+
}
|
|
237
|
+
|
|
232
238
|
playerView = object : THEOplayerView(reactContext, configAdapter.playerConfig()) {
|
|
233
239
|
private fun measureAndLayout() {
|
|
234
240
|
measure(
|
|
@@ -39,6 +39,7 @@ private const val PROP_ADBREAK_INTEGRATION = "integration"
|
|
|
39
39
|
private const val PROP_ADBREAK_MAXDURATION = "maxDuration"
|
|
40
40
|
private const val PROP_ADBREAK_TIMEOFFSET = "timeOffset"
|
|
41
41
|
private const val PROP_ADBREAK_MAXREMAININGDURATION = "maxRemainingDuration"
|
|
42
|
+
private const val PROP_ADBREAK_ID = "id"
|
|
42
43
|
private const val PROP_ADBREAK_ADS = "ads"
|
|
43
44
|
private const val PROP_COMPANION_ADSLOTID = "adSlotId"
|
|
44
45
|
private const val PROP_COMPANION_ALTTEXT = "altText"
|
|
@@ -141,6 +142,7 @@ object AdAdapter {
|
|
|
141
142
|
return adbreakPayload
|
|
142
143
|
}
|
|
143
144
|
adbreakPayload.putString(PROP_ADBREAK_INTEGRATION, adbreak.integration.type)
|
|
145
|
+
adbreakPayload.putString(PROP_ADBREAK_ID, adbreak.idAsString)
|
|
144
146
|
adbreakPayload.putInt(PROP_ADBREAK_MAXDURATION,adbreak.maxDuration)
|
|
145
147
|
adbreakPayload.putInt(PROP_ADBREAK_TIMEOFFSET, adbreak.timeOffset)
|
|
146
148
|
adbreakPayload.putDouble(PROP_ADBREAK_MAXREMAININGDURATION, adbreak.maxRemainingDuration)
|
|
@@ -286,6 +288,10 @@ object AdAdapter {
|
|
|
286
288
|
return adBreak.getString(PROP_AD_CUSTOM_INTEGRATION)
|
|
287
289
|
}
|
|
288
290
|
|
|
291
|
+
override fun getIdAsString(): String? {
|
|
292
|
+
return if (adBreak.hasKey(PROP_ADBREAK_ID)) adBreak.getString(PROP_ADBREAK_ID) else null
|
|
293
|
+
}
|
|
294
|
+
|
|
289
295
|
override fun getCustomData(): Any? {
|
|
290
296
|
// Not supported yet
|
|
291
297
|
return null
|
|
@@ -456,6 +456,10 @@ class SourceAdapter {
|
|
|
456
456
|
return BridgeUtils.fromJSONObjectToBridge(json)
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
fun fromTypedSource(typedSource: TypedSource): WritableMap {
|
|
460
|
+
return BridgeUtils.fromJSONObjectToBridge(JSONObject(gson.toJson(typedSource)))
|
|
461
|
+
}
|
|
462
|
+
|
|
459
463
|
private fun parseCmcdTransmissionMode(cmcdConfiguration : JSONObject) : CMCDTransmissionMode {
|
|
460
464
|
try {
|
|
461
465
|
val transmissionMode = cmcdConfiguration.optInt(CMCD_TRANSMISSION_MODE)
|
|
@@ -19,6 +19,7 @@ RCT_EXPORT_VIEW_PROPERTY(config, NSDictionary);
|
|
|
19
19
|
RCT_EXPORT_VIEW_PROPERTY(onNativePause, RCTDirectEventBlock);
|
|
20
20
|
RCT_EXPORT_VIEW_PROPERTY(onNativePlay, RCTDirectEventBlock);
|
|
21
21
|
RCT_EXPORT_VIEW_PROPERTY(onNativeSourceChange, RCTDirectEventBlock);
|
|
22
|
+
RCT_EXPORT_VIEW_PROPERTY(onNativeCurrentSourceChange, RCTDirectEventBlock);
|
|
22
23
|
RCT_EXPORT_VIEW_PROPERTY(onNativeLoadStart, RCTDirectEventBlock);
|
|
23
24
|
RCT_EXPORT_VIEW_PROPERTY(onNativeReadyStateChange, RCTDirectEventBlock);
|
|
24
25
|
RCT_EXPORT_VIEW_PROPERTY(onNativeDurationChange, RCTDirectEventBlock);
|
|
@@ -13,6 +13,7 @@ public class THEOplayerRCTMainEventHandler {
|
|
|
13
13
|
var onNativePlay: RCTDirectEventBlock?
|
|
14
14
|
var onNativePause: RCTDirectEventBlock?
|
|
15
15
|
var onNativeSourceChange: RCTDirectEventBlock?
|
|
16
|
+
var onNativeCurrentSourceChange: RCTDirectEventBlock?
|
|
16
17
|
var onNativeLoadStart: RCTDirectEventBlock?
|
|
17
18
|
var onNativeReadyStateChange: RCTDirectEventBlock?
|
|
18
19
|
var onNativeDurationChange: RCTDirectEventBlock?
|
|
@@ -36,6 +37,7 @@ public class THEOplayerRCTMainEventHandler {
|
|
|
36
37
|
private var playListener: EventListener?
|
|
37
38
|
private var pauseListener: EventListener?
|
|
38
39
|
private var sourceChangeListener: EventListener?
|
|
40
|
+
private var currentSourceChangeListener: EventListener?
|
|
39
41
|
private var loadStartListener: EventListener?
|
|
40
42
|
private var readyStateChangeListener: EventListener?
|
|
41
43
|
private var durationChangeListener: EventListener?
|
|
@@ -107,7 +109,22 @@ public class THEOplayerRCTMainEventHandler {
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] SourceChange listener attached to THEOplayer") }
|
|
110
|
-
|
|
112
|
+
|
|
113
|
+
// CURRENT_SOURCE_CHANGE
|
|
114
|
+
self.currentSourceChangeListener = player.addEventListener(type: PlayerEventTypes.CURRENT_SOURCE_CHANGE) { [weak self] event in
|
|
115
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received CURRENT_SOURCE_CHANGE event from THEOplayer") }
|
|
116
|
+
if let forwardedCurrentSourceChangeEvent = self?.onNativeCurrentSourceChange {
|
|
117
|
+
var typedSource: [String:Any]? = nil
|
|
118
|
+
if let currentSource = event.currentSource {
|
|
119
|
+
typedSource = THEOplayerRCTSourceDescriptionAggregator.aggregateTypedSource(typedSource: currentSource)
|
|
120
|
+
}
|
|
121
|
+
forwardedCurrentSourceChangeEvent(
|
|
122
|
+
["currentSource": typedSource ?? [:]]
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] CurrentSourceChange listener attached to THEOplayer") }
|
|
127
|
+
|
|
111
128
|
// LOAD_START
|
|
112
129
|
self.loadStartListener = player.addEventListener(type: PlayerEventTypes.LOAD_START) { [weak self] event in
|
|
113
130
|
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received LOAD_START event from THEOplayer") }
|
|
@@ -361,7 +378,13 @@ public class THEOplayerRCTMainEventHandler {
|
|
|
361
378
|
player.removeEventListener(type: PlayerEventTypes.SOURCE_CHANGE, listener: sourceChangeListener)
|
|
362
379
|
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] SourceChange listener dettached from THEOplayer") }
|
|
363
380
|
}
|
|
364
|
-
|
|
381
|
+
|
|
382
|
+
// CURRENT_SOURCE_CHANGE
|
|
383
|
+
if let currentSourceChangeListener = self.currentSourceChangeListener {
|
|
384
|
+
player.removeEventListener(type: PlayerEventTypes.CURRENT_SOURCE_CHANGE, listener: currentSourceChangeListener)
|
|
385
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] CurrentSourceChange listener dettached from THEOplayer") }
|
|
386
|
+
}
|
|
387
|
+
|
|
365
388
|
// LOAD_START
|
|
366
389
|
if let loadStartListener = self.loadStartListener {
|
|
367
390
|
player.removeEventListener(type: PlayerEventTypes.LOAD_START, listener: loadStartListener)
|
|
@@ -19,6 +19,20 @@ class THEOplayerRCTSourceDescriptionAggregator {
|
|
|
19
19
|
return nil
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
class func aggregateTypedSource(typedSource: TypedSource) -> [String:Any]? {
|
|
23
|
+
do {
|
|
24
|
+
let jsonEncoder = JSONEncoder()
|
|
25
|
+
let data = try jsonEncoder.encode(typedSource)
|
|
26
|
+
if let result = try? JSONSerialization.jsonObject(with: data, options: []) as? [String:Any] {
|
|
27
|
+
return result
|
|
28
|
+
}
|
|
29
|
+
} catch {
|
|
30
|
+
if DEBUG { PrintUtils.printLog(logText: "[NATIVE] Could not aggregate typedSource: \(error.localizedDescription)")}
|
|
31
|
+
return nil
|
|
32
|
+
}
|
|
33
|
+
return nil
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
class func aggregateCacheTaskSourceDescription(sourceDescription: SourceDescription, cachingTaskId: String) -> [String:Any]? {
|
|
23
37
|
if let result = THEOplayerRCTSourceDescriptionAggregator.aggregateSourceDescription(sourceDescription: sourceDescription) {
|
|
24
38
|
let srcDescription = THEOplayerRCTSourceDescriptionAggregator.sanitiseSourceDescriptionMetadata(input: result)
|
|
@@ -364,7 +364,13 @@ public class THEOplayerRCTView: UIView {
|
|
|
364
364
|
self.mainEventHandler.onNativeSourceChange = nativeSourceChange
|
|
365
365
|
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeSourceChange prop set.") }
|
|
366
366
|
}
|
|
367
|
-
|
|
367
|
+
|
|
368
|
+
@objc(setOnNativeCurrentSourceChange:)
|
|
369
|
+
func setOnNativeCurrentSourceChange(nativeCurrentSourceChange: @escaping RCTDirectEventBlock) {
|
|
370
|
+
self.mainEventHandler.onNativeCurrentSourceChange = nativeCurrentSourceChange
|
|
371
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeCurrentSourceChange prop set.") }
|
|
372
|
+
}
|
|
373
|
+
|
|
368
374
|
@objc(setOnNativeLoadStart:)
|
|
369
375
|
func setOnNativeLoadStart(nativeLoadStart: @escaping RCTDirectEventBlock) {
|
|
370
376
|
self.mainEventHandler.onNativeLoadStart = nativeLoadStart
|
|
@@ -27,6 +27,7 @@ let PROP_GOOGLE_AD_ID_VALUE: String = "adIdValue"
|
|
|
27
27
|
let PROP_GOOGLE_AD_WRAPPER_AD_IDS: String = "wrapperAdIds"
|
|
28
28
|
let PROP_GOOGLE_AD_WRAPPER_AD_SYSTEMS: String = "wrapperAdSystems"
|
|
29
29
|
let PROP_GOOGLE_AD_WRAPPER_CREATIVE_IDS: String = "wrapperCreativeIds"
|
|
30
|
+
let PROP_ADBREAK_ID: String = "id"
|
|
30
31
|
let PROP_ADBREAK_MAX_DURATION: String = "maxDuration"
|
|
31
32
|
let PROP_ADBREAK_TIME_OFFSET: String = "timeOffset"
|
|
32
33
|
let PROP_ADBREAK_MAX_REMAINING_DURATION: String = "maxRemainingDuration"
|
|
@@ -173,6 +174,7 @@ class THEOplayerRCTAdAdapter {
|
|
|
173
174
|
|
|
174
175
|
class func fromAdBreak(adBreak: AdBreak) -> [String:Any] {
|
|
175
176
|
var adBreakData: [String:Any] = [:]
|
|
177
|
+
adBreakData[PROP_ADBREAK_ID] = adBreak.id
|
|
176
178
|
adBreakData[PROP_ADBREAK_MAX_DURATION] = adBreak.maxDuration
|
|
177
179
|
adBreakData[PROP_ADBREAK_TIME_OFFSET] = adBreak.timeOffset
|
|
178
180
|
adBreakData[PROP_ADBREAK_MAX_REMAINING_DURATION] = adBreak.maxRemainingDuration
|
|
@@ -204,6 +206,7 @@ class THEOplayerRCTAdAdapter {
|
|
|
204
206
|
}
|
|
205
207
|
|
|
206
208
|
return NativeAdBreak(ads: ads,
|
|
209
|
+
id: adBreakData[PROP_ADBREAK_ID] as? String,
|
|
207
210
|
maxDuration: lround((adBreakData[PROP_ADBREAK_MAX_DURATION] as? Double) ?? 0),
|
|
208
211
|
maxRemainingDuration: (adBreakData[PROP_ADBREAK_MAX_REMAINING_DURATION] as? Double) ?? 0,
|
|
209
212
|
timeOffset: lround((adBreakData[PROP_ADBREAK_TIME_OFFSET] as? Double) ?? 0),
|
|
@@ -212,7 +215,7 @@ class THEOplayerRCTAdAdapter {
|
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
class func defaultAdBreak() -> NativeAdBreak {
|
|
215
|
-
return NativeAdBreak(ads: [], maxDuration: 0, maxRemainingDuration: 0, timeOffset: 0, integration: .custom)
|
|
218
|
+
return NativeAdBreak(ads: [], id: nil, maxDuration: 0, maxRemainingDuration: 0, timeOffset: 0, integration: .custom)
|
|
216
219
|
}
|
|
217
220
|
|
|
218
221
|
class private func fromCompanionAds(companionAds: [CompanionAd]) -> [[String:Any]] {
|
|
@@ -30,7 +30,7 @@ class NativeAd: THEOplayerSDK.Ad {
|
|
|
30
30
|
var clickThrough: String? = nil
|
|
31
31
|
/**The type of custom ad integration.*/
|
|
32
32
|
var customIntegration: String? = nil
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
init(adBreak: AdBreak, companions: [THEOplayerSDK.CompanionAd], type: String, id: String? = nil, skipOffset: Int? = nil, resourceURI: String? = nil, width: Int? = nil, height: Int? = nil, isSlate: Bool = false, integration: THEOplayerSDK.AdIntegrationKind, duration: Int? = 0, clickThrough: String?, customIntegration: String?) {
|
|
35
35
|
self.adBreak = adBreak
|
|
36
36
|
self.companions = companions
|
|
@@ -51,11 +51,11 @@ class NativeAd: THEOplayerSDK.Ad {
|
|
|
51
51
|
class NativeLinearAd: NativeAd, THEOplayerSDK.LinearAd {
|
|
52
52
|
/** An array of mediafiles, which provides some meta data retrieved from the VAST file.*/
|
|
53
53
|
var mediaFiles: [THEOplayerSDK.MediaFile] = []
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
init(adBreak: AdBreak, companions: [THEOplayerSDK.CompanionAd], type: String, id: String? = nil, skipOffset: Int? = nil, resourceURI: String? = nil, width: Int? = nil, height: Int? = nil, integration: THEOplayerSDK.AdIntegrationKind, duration: Int? = 0, clickThrough: String? = nil, customIntegration: String? = nil, mediaFiles: [THEOplayerSDK.MediaFile] = []) {
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
self.mediaFiles = mediaFiles
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
super.init(adBreak:adBreak,
|
|
60
60
|
companions: companions,
|
|
61
61
|
type: type,
|
|
@@ -88,7 +88,7 @@ class NativeLinearGoogleImaAd: NativeLinearAd, THEOplayerSDK.GoogleImaAd {
|
|
|
88
88
|
var universalAdIds: [UniversalAdId] = []
|
|
89
89
|
/** The String representing custom trafficking parameters from the VAST response.*/
|
|
90
90
|
var traffickingParameters: String = ""
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
init(adBreak: AdBreak, companions: [THEOplayerSDK.CompanionAd], type: String, id: String? = nil, skipOffset: Int? = nil, resourceURI: String? = nil, width: Int? = nil, height: Int? = nil, integration: THEOplayerSDK.AdIntegrationKind, duration: Int? = 0, clickThrough: String? = nil, customIntegration: String? = nil, mediaFiles: [THEOplayerSDK.MediaFile] = [], adSystem: String? = nil, creativeId: String? = nil, wrapperAdIds: [String], wrapperAdSystems: [String], wrapperCreativeIds: [String], vastMediaBitrate: Int, universalAdIds: [UniversalAdId], traffickingParameters: String) {
|
|
93
93
|
self.adSystem = adSystem
|
|
94
94
|
self.creativeId = creativeId
|
|
@@ -98,7 +98,7 @@ class NativeLinearGoogleImaAd: NativeLinearAd, THEOplayerSDK.GoogleImaAd {
|
|
|
98
98
|
self.vastMediaBitrate = vastMediaBitrate
|
|
99
99
|
self.universalAdIds = universalAdIds
|
|
100
100
|
self.traffickingParameters = traffickingParameters
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
super.init(adBreak: adBreak,
|
|
103
103
|
companions: companions,
|
|
104
104
|
type: type,
|
|
@@ -134,8 +134,8 @@ class NativeAdBreak: THEOplayerSDK.AdBreak {
|
|
|
134
134
|
- For other integrations, this may be `nil`.
|
|
135
135
|
*/
|
|
136
136
|
var id: String? = nil
|
|
137
|
-
|
|
138
|
-
init(ads: [Ad], maxDuration: Int, maxRemainingDuration: Double, timeOffset: Int, integration: THEOplayerSDK.AdIntegrationKind, customIntegration: String? = nil
|
|
137
|
+
|
|
138
|
+
init(ads: [Ad], id: String? = nil, maxDuration: Int, maxRemainingDuration: Double, timeOffset: Int, integration: THEOplayerSDK.AdIntegrationKind, customIntegration: String? = nil) {
|
|
139
139
|
self.ads = ads
|
|
140
140
|
self.maxDuration = maxDuration
|
|
141
141
|
self.maxRemainingDuration = maxRemainingDuration
|
|
@@ -161,7 +161,7 @@ class NativeCompanionAd: THEOplayerSDK.CompanionAd {
|
|
|
161
161
|
var width: Int
|
|
162
162
|
/** The type of the companion ad.*/
|
|
163
163
|
var type: String = ""
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
init(adSlotId: String? = nil, altText: String? = nil, clickThrough: String? = nil, height: Int, resourceURI: String? = nil, width: Int, type: String) {
|
|
166
166
|
self.adSlotId = adSlotId
|
|
167
167
|
self.altText = altText
|
|
@@ -178,7 +178,7 @@ class NativeUniversalAdId: THEOplayerSDK.UniversalAdId {
|
|
|
178
178
|
var adIdValue: String = ""
|
|
179
179
|
/** The registry associated with cataloging the UniversalAdId of the selected creative for the ad.*/
|
|
180
180
|
var adIdRegistry: String = ""
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
init(adIdValue: String, adIdRegistry: String) {
|
|
183
183
|
self.adIdValue = adIdValue
|
|
184
184
|
self.adIdRegistry = adIdRegistry
|
|
@@ -125,6 +125,13 @@ let PresentationModeChangePipContext = exports.PresentationModeChangePipContext
|
|
|
125
125
|
* @category Player
|
|
126
126
|
* @public
|
|
127
127
|
*/
|
|
128
|
+
/**
|
|
129
|
+
* Dispatched when the current source, which is chosen from the source description's sources, changes.
|
|
130
|
+
*
|
|
131
|
+
* @category Events
|
|
132
|
+
* @category Player
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
128
135
|
/**
|
|
129
136
|
* Dispatched when the player has finished seeking to a new position.
|
|
130
137
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PresentationModeChangePipContext","exports"],"sourceRoot":"../../../../src","sources":["api/event/PlayerEvent.ts"],"mappings":";;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOYA,gCAAgC,GAAAC,OAAA,CAAAD,gCAAA,0BAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAA,OAAhCA,gCAAgC;AAAA;AAmB5C;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["PresentationModeChangePipContext","exports"],"sourceRoot":"../../../../src","sources":["api/event/PlayerEvent.ts"],"mappings":";;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOYA,gCAAgC,GAAAC,OAAA,CAAAD,gCAAA,0BAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAhCA,gCAAgC;EAAA,OAAhCA,gCAAgC;AAAA;AAmB5C;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ let PlayerEventType = exports.PlayerEventType = /*#__PURE__*/function (PlayerEve
|
|
|
16
16
|
PlayerEventType["CANPLAY"] = "canplay";
|
|
17
17
|
PlayerEventType["PLAYING"] = "playing";
|
|
18
18
|
PlayerEventType["SOURCE_CHANGE"] = "sourcechange";
|
|
19
|
+
PlayerEventType["CURRENT_SOURCE_CHANGE"] = "currentsourcechange";
|
|
19
20
|
PlayerEventType["LOAD_START"] = "loadstart";
|
|
20
21
|
PlayerEventType["LOADED_METADATA"] = "loadedmetadata";
|
|
21
22
|
PlayerEventType["LOADED_DATA"] = "loadeddata";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PlayerEventType","exports"],"sourceRoot":"../../../../src","sources":["api/player/PlayerEventMap.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["PlayerEventType","exports"],"sourceRoot":"../../../../src","sources":["api/player/PlayerEventMap.ts"],"mappings":";;;;;;AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOYA,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAwC3B;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|