react-native-theoplayer 2.6.0 → 2.7.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 +10 -0
- package/android/src/main/java/com/theoplayer/util/ViewResolver.kt +9 -1
- package/ios/THEOplayerRCTDebug.swift +3 -3
- package/ios/THEOplayerRCTMainEventHandler.swift +59 -59
- package/ios/THEOplayerRCTMediaTrackEventHandler.swift +18 -18
- package/ios/THEOplayerRCTNetworkUtils.swift +1 -1
- package/ios/THEOplayerRCTPlayerAPI.swift +14 -14
- package/ios/THEOplayerRCTPrintUtils.swift +16 -0
- package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +6 -6
- package/ios/THEOplayerRCTTextTrackEventHandler.swift +21 -21
- package/ios/THEOplayerRCTView.swift +29 -29
- package/ios/ads/THEOplayerRCTAdsAPI+DAI.swift +6 -6
- package/ios/ads/THEOplayerRCTAdsAPI.swift +13 -13
- package/ios/ads/THEOplayerRCTAdsEventHandler.swift +27 -27
- package/ios/ads/THEOplayerRCTSourceDescriptionBuilder+Ads.swift +5 -5
- package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +16 -15
- package/ios/backgroundAudio/THEOplayerRCTRemoteCommandsManager.swift +16 -16
- package/ios/casting/THEOplayerRCTCastAPI+Airplay.swift +6 -6
- package/ios/casting/THEOplayerRCTCastAPI+Chromecast.swift +10 -10
- package/ios/casting/THEOplayerRCTCastAPI.swift +1 -1
- package/ios/casting/THEOplayerRCTCastEventHandler.swift +11 -11
- package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +1 -1
- package/ios/pip/THEOplayerRCTPipControlsManager.swift +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +41 -10
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/module/internal/adapter/THEOplayerAdapter.js +41 -10
- package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +2 -0
- package/package.json +1 -1
- package/src/internal/adapter/THEOplayerAdapter.ts +44 -10
|
@@ -28,10 +28,10 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
28
28
|
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
29
29
|
let player = theView.player {
|
|
30
30
|
if paused && !player.paused {
|
|
31
|
-
if DEBUG_PLAYER_API {
|
|
31
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Triggering pause on TheoPlayer") }
|
|
32
32
|
player.pause()
|
|
33
33
|
} else if !paused && player.paused {
|
|
34
|
-
if DEBUG_PLAYER_API {
|
|
34
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Triggering play on TheoPlayer") }
|
|
35
35
|
player.play()
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -44,11 +44,11 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
44
44
|
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
45
45
|
let srcDescription = THEOplayerRCTSourceDescriptionBuilder.buildSourceDescription(src) {
|
|
46
46
|
if let player = theView.player {
|
|
47
|
-
if DEBUG_PLAYER_API {
|
|
47
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting new source on TheoPlayer") }
|
|
48
48
|
player.source = srcDescription
|
|
49
49
|
}
|
|
50
50
|
} else {
|
|
51
|
-
if DEBUG_PLAYER_API {
|
|
51
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Failed to update THEOplayer source.") }
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -65,7 +65,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
65
65
|
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
66
66
|
let player = theView.player {
|
|
67
67
|
let timeValue = time.doubleValue * 0.001
|
|
68
|
-
if DEBUG_PLAYER_API {
|
|
68
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Seeking to \(timeValue) on TheoPlayer") }
|
|
69
69
|
player.setCurrentTime(timeValue)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -77,7 +77,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
77
77
|
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
78
78
|
let player = theView.player {
|
|
79
79
|
if player.muted != muted {
|
|
80
|
-
if DEBUG_PLAYER_API {
|
|
80
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Changing TheoPlayer to \(muted ? "muted" : "not muted")") }
|
|
81
81
|
player.muted = muted
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -86,7 +86,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
86
86
|
|
|
87
87
|
@objc(setVolume:volume:)
|
|
88
88
|
func setVolume(_ node: NSNumber, volume: NSNumber) -> Void {
|
|
89
|
-
if DEBUG_PLAYER_API {
|
|
89
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting volume: TheoPlayer does not handle volume changes for iOS. This is handled by the device.") }
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
@objc(setPlaybackRate:playbackRate:)
|
|
@@ -96,7 +96,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
96
96
|
let player = theView.player {
|
|
97
97
|
let playbackRateValue = playbackRate.doubleValue
|
|
98
98
|
if player.playbackRate != playbackRateValue {
|
|
99
|
-
if DEBUG_PLAYER_API {
|
|
99
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting playbackRate on TheoPlayer to \(playbackRateValue)") }
|
|
100
100
|
player.setPlaybackRate(playbackRateValue)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -113,7 +113,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
113
113
|
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
114
114
|
let player = theView.player {
|
|
115
115
|
if player.presentationMode != newPresentationMode {
|
|
116
|
-
if DEBUG_PLAYER_API {
|
|
116
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Changing TheoPlayer to \(presentationMode)") }
|
|
117
117
|
player.presentationMode = newPresentationMode
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -128,7 +128,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
128
128
|
if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
|
|
129
129
|
let player = theView.player {
|
|
130
130
|
if player.fullscreen.aspectRatio != newAspectRatio {
|
|
131
|
-
if DEBUG_PLAYER_API {
|
|
131
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Changing TheoPlayer's aspectRatio to \(ratio)") }
|
|
132
132
|
player.fullscreen.setAspectRatio(aspectRatio: newAspectRatio)
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -180,7 +180,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
180
180
|
guard textTracks.count > 0 else {
|
|
181
181
|
return
|
|
182
182
|
}
|
|
183
|
-
if DEBUG_PLAYER_API {
|
|
183
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Showing textTrack \(uidValue) on TheoPlayer") }
|
|
184
184
|
for i in 0...textTracks.count-1 {
|
|
185
185
|
var textTrack: TextTrack = textTracks.get(i)
|
|
186
186
|
if textTrack.uid == uidValue {
|
|
@@ -203,7 +203,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
203
203
|
guard audioTracks.count > 0 else {
|
|
204
204
|
return
|
|
205
205
|
}
|
|
206
|
-
if DEBUG_PLAYER_API {
|
|
206
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Enabling audioTrack \(uidValue) on TheoPlayer") }
|
|
207
207
|
for i in 0...audioTracks.count-1 {
|
|
208
208
|
var audioTrack: MediaTrack = audioTracks.get(i)
|
|
209
209
|
audioTrack.enabled = (audioTrack.uid == uidValue)
|
|
@@ -222,7 +222,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
222
222
|
guard videoTracks.count > 0 else {
|
|
223
223
|
return
|
|
224
224
|
}
|
|
225
|
-
if DEBUG_PLAYER_API {
|
|
225
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Enabling videoTrack \(uidValue) on TheoPlayer") }
|
|
226
226
|
for i in 0...videoTracks.count-1 {
|
|
227
227
|
var videoTrack: MediaTrack = videoTracks.get(i)
|
|
228
228
|
videoTrack.enabled = (videoTrack.uid == uidValue)
|
|
@@ -244,7 +244,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
|
|
|
244
244
|
let player = theView.player {
|
|
245
245
|
let preloadType = THEOplayerRCTTypeUtils.preloadTypeFromString(type)
|
|
246
246
|
if player.preload != preloadType {
|
|
247
|
-
if DEBUG_PLAYER_API {
|
|
247
|
+
if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Changing TheoPlayer preload type to \(type)") }
|
|
248
248
|
player.setPreload(preloadType)
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Printing.swift
|
|
3
|
+
// THEOliveSDK
|
|
4
|
+
//
|
|
5
|
+
// Created by William van Haevre on 21/06/2021.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
class PrintUtils {
|
|
11
|
+
static func printLog(logText: String) {
|
|
12
|
+
let formatter = DateFormatter()
|
|
13
|
+
formatter.dateFormat = "HH:mm:ss.SSS"
|
|
14
|
+
print(formatter.string(from: Date()), logText)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -75,7 +75,7 @@ class THEOplayerRCTSourceDescriptionBuilder {
|
|
|
75
75
|
typedSources.append(typedSource)
|
|
76
76
|
} else {
|
|
77
77
|
if DEBUG_SOURCE_DESCRIPTION_BUIDER {
|
|
78
|
-
|
|
78
|
+
PrintUtils.printLog(logText: "[NATIVE] Could not create THEOplayer TypedSource from sourceData array")
|
|
79
79
|
}
|
|
80
80
|
return nil
|
|
81
81
|
}
|
|
@@ -87,7 +87,7 @@ class THEOplayerRCTSourceDescriptionBuilder {
|
|
|
87
87
|
typedSources.append(typedSource)
|
|
88
88
|
} else {
|
|
89
89
|
if DEBUG_SOURCE_DESCRIPTION_BUIDER {
|
|
90
|
-
|
|
90
|
+
PrintUtils.printLog(logText: "[NATIVE] Could not create THEOplayer TypedSource from sourceData")
|
|
91
91
|
}
|
|
92
92
|
return nil
|
|
93
93
|
}
|
|
@@ -105,7 +105,7 @@ class THEOplayerRCTSourceDescriptionBuilder {
|
|
|
105
105
|
textTrackDescriptions?.append(textTrackDescription)
|
|
106
106
|
} else {
|
|
107
107
|
if DEBUG_SOURCE_DESCRIPTION_BUIDER {
|
|
108
|
-
|
|
108
|
+
PrintUtils.printLog(logText: "[NATIVE] Could not create THEOplayer TextTrackDescription from textTrackData array")
|
|
109
109
|
}
|
|
110
110
|
return nil
|
|
111
111
|
}
|
|
@@ -152,7 +152,7 @@ class THEOplayerRCTSourceDescriptionBuilder {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
if DEBUG_SOURCE_DESCRIPTION_BUIDER {
|
|
155
|
-
|
|
155
|
+
PrintUtils.printLog(logText: "[NATIVE] THEOplayer TypedSource requires 'src' property in 'sources' description")
|
|
156
156
|
}
|
|
157
157
|
return nil
|
|
158
158
|
}
|
|
@@ -329,11 +329,11 @@ class THEOplayerRCTSourceDescriptionBuilder {
|
|
|
329
329
|
default: return try JSONDecoder().decode(MultiplatformDRMConfiguration.self, from: data)
|
|
330
330
|
}
|
|
331
331
|
} else {
|
|
332
|
-
|
|
332
|
+
PrintUtils.printLog(logText: "[NATIVE] integration type not specified... trying default drm integration")
|
|
333
333
|
return try JSONDecoder().decode(MultiplatformDRMConfiguration.self, from: data)
|
|
334
334
|
}
|
|
335
335
|
} catch {
|
|
336
|
-
|
|
336
|
+
PrintUtils.printLog(logText: "[NATIVE] unsupported contentProtection data format")
|
|
337
337
|
}
|
|
338
338
|
return nil
|
|
339
339
|
}
|
|
@@ -48,7 +48,7 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
48
48
|
guard let welf = self else { return }
|
|
49
49
|
if let forwardedTextTrackListEvent = welf.onNativeTextTrackListEvent,
|
|
50
50
|
let textTrack = event.track as? TextTrack {
|
|
51
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
51
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received ADD_TRACK event from THEOplayer textTrack list: trackUid = \(textTrack.uid)") }
|
|
52
52
|
// trigger tracklist event
|
|
53
53
|
forwardedTextTrackListEvent([
|
|
54
54
|
"track" : THEOplayerRCTTrackMetadataAggregator.aggregatedTextTrackInfo(textTrack: textTrack),
|
|
@@ -56,23 +56,23 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
56
56
|
])
|
|
57
57
|
// start listening for cue events on this track and keep listener for later removal
|
|
58
58
|
welf.addCueListeners[textTrack.uid] = textTrack.addEventListener(type: TextTrackEventTypes.ADD_CUE, listener: welf.addCueListener(_:))
|
|
59
|
-
if DEBUG_EVENTHANDLER {
|
|
59
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] AddCue listener attached to THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
60
60
|
welf.removeCueListeners[textTrack.uid] = textTrack.addEventListener(type: TextTrackEventTypes.REMOVE_CUE, listener: welf.removeCueListener(_:))
|
|
61
|
-
if DEBUG_EVENTHANDLER {
|
|
61
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] RemoveCue listener attached to THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
62
62
|
welf.enterCueListeners[textTrack.uid] = textTrack.addEventListener(type: TextTrackEventTypes.ENTER_CUE, listener: welf.enterCueListener(_:))
|
|
63
|
-
if DEBUG_EVENTHANDLER {
|
|
63
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] EnterCue listener attached to THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
64
64
|
welf.exitCueListeners[textTrack.uid] = textTrack.addEventListener(type: TextTrackEventTypes.EXIT_CUE, listener: welf.exitCueListener(_:))
|
|
65
|
-
if DEBUG_EVENTHANDLER {
|
|
65
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] ExitCue listener attached to THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
if DEBUG_EVENTHANDLER {
|
|
68
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] AddTrack listener attached to THEOplayer textTrack list") }
|
|
69
69
|
|
|
70
70
|
// REMOVE_TRACK
|
|
71
71
|
self.removeTrackListener = player.textTracks.addEventListener(type: TextTrackListEventTypes.REMOVE_TRACK) { [weak self] event in
|
|
72
72
|
guard let welf = self else { return }
|
|
73
73
|
if let forwardedTextTrackListEvent = welf.onNativeTextTrackListEvent,
|
|
74
74
|
let textTrack = event.track as? TextTrack {
|
|
75
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
75
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received REMOVE_TRACK event from THEOplayer textTrack list: trackUid = \(textTrack.uid)") }
|
|
76
76
|
// trigger tracklist event
|
|
77
77
|
forwardedTextTrackListEvent([
|
|
78
78
|
"track" : THEOplayerRCTTrackMetadataAggregator.aggregatedTextTrackInfo(textTrack: textTrack),
|
|
@@ -84,24 +84,24 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
84
84
|
let enterCueListener = welf.enterCueListeners[textTrack.uid],
|
|
85
85
|
let exitCueListener = welf.exitCueListeners[textTrack.uid] {
|
|
86
86
|
textTrack.removeEventListener(type: TextTrackEventTypes.ADD_CUE, listener: addCueListener)
|
|
87
|
-
if DEBUG_EVENTHANDLER {
|
|
87
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] AddCue listener removed from THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
88
88
|
textTrack.removeEventListener(type: TextTrackEventTypes.REMOVE_CUE, listener: removeCueListener)
|
|
89
|
-
if DEBUG_EVENTHANDLER {
|
|
89
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] RemoveCue listener removed from THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
90
90
|
textTrack.removeEventListener(type: TextTrackEventTypes.ENTER_CUE, listener: enterCueListener)
|
|
91
|
-
if DEBUG_EVENTHANDLER {
|
|
91
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] EnterCue listener removed from THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
92
92
|
textTrack.removeEventListener(type: TextTrackEventTypes.EXIT_CUE, listener: exitCueListener)
|
|
93
|
-
if DEBUG_EVENTHANDLER {
|
|
93
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] ExitCue listener removed from THEOplayer textTrack with uid \(textTrack.uid)") }
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
if DEBUG_EVENTHANDLER {
|
|
97
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] RemoveTrack listener attached to THEOplayer textTrack list") }
|
|
98
98
|
|
|
99
99
|
// CHANGE
|
|
100
100
|
self.changeTrackListener = player.textTracks.addEventListener(type: TextTrackListEventTypes.CHANGE) { [weak self] event in
|
|
101
101
|
guard let welf = self else { return }
|
|
102
102
|
if let forwardedTextTrackListEvent = welf.onNativeTextTrackListEvent,
|
|
103
103
|
let textTrack = event.track as? TextTrack {
|
|
104
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
104
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received CHANGE event from THEOplayer textTrack list: trackUid = \(textTrack.uid)") }
|
|
105
105
|
// trigger tracklist event
|
|
106
106
|
forwardedTextTrackListEvent([
|
|
107
107
|
"track" : THEOplayerRCTTrackMetadataAggregator.aggregatedTextTrackInfo(textTrack: textTrack),
|
|
@@ -109,7 +109,7 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
109
109
|
])
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
if DEBUG_EVENTHANDLER {
|
|
112
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] ChangeTrack listener attached to THEOplayer textTrack list") }
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
private func dettachListeners() {
|
|
@@ -120,19 +120,19 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
120
120
|
// ADD_TRACK
|
|
121
121
|
if let addTrackListener = self.addTrackListener {
|
|
122
122
|
player.textTracks.removeEventListener(type: TextTrackListEventTypes.ADD_TRACK, listener: addTrackListener)
|
|
123
|
-
if DEBUG_EVENTHANDLER {
|
|
123
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] AddTrack listener dettached from THEOplayer textTrack list") }
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// REMOVE_TRACK
|
|
127
127
|
if let removeTrackListener = self.removeTrackListener {
|
|
128
128
|
player.textTracks.removeEventListener(type: TextTrackListEventTypes.REMOVE_TRACK, listener: removeTrackListener)
|
|
129
|
-
if DEBUG_EVENTHANDLER {
|
|
129
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] RemoveTrack listener dettached from THEOplayer textTrack list") }
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// CHANGE
|
|
133
133
|
if let changeTrackListener = self.changeTrackListener {
|
|
134
134
|
player.textTracks.removeEventListener(type: TextTrackListEventTypes.CHANGE, listener: changeTrackListener)
|
|
135
|
-
if DEBUG_EVENTHANDLER {
|
|
135
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] ChangeTrack listener dettached from THEOplayer textTrack list") }
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -140,7 +140,7 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
140
140
|
private func addCueListener(_ event: AddCueEvent) {
|
|
141
141
|
if let forwardedTextTrackEvent = self.onNativeTextTrackEvent,
|
|
142
142
|
let textTrack = event.cue.track {
|
|
143
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
143
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received ADD_CUE event from textTrack: trackUid = \(textTrack.uid), cueUid = \(event.cue.uid)") }
|
|
144
144
|
forwardedTextTrackEvent([
|
|
145
145
|
"trackUid" : textTrack.uid,
|
|
146
146
|
"type": TrackCueEventType.ADD_CUE.rawValue,
|
|
@@ -152,7 +152,7 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
152
152
|
private func removeCueListener(_ event: RemoveCueEvent) {
|
|
153
153
|
if let forwardedTextTrackEvent = self.onNativeTextTrackEvent,
|
|
154
154
|
let textTrack = event.cue.track {
|
|
155
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
155
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received REMOVE_CUE event from textTrack: trackUid = \(textTrack.uid), cueUid = \(event.cue.uid)") }
|
|
156
156
|
forwardedTextTrackEvent([
|
|
157
157
|
"trackUid" : textTrack.uid,
|
|
158
158
|
"type": TrackCueEventType.REMOVE_CUE.rawValue,
|
|
@@ -164,7 +164,7 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
164
164
|
private func enterCueListener(_ event: EnterCueEvent) {
|
|
165
165
|
if let forwardedTextTrackEvent = self.onNativeTextTrackEvent,
|
|
166
166
|
let textTrack = event.cue.track {
|
|
167
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
167
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received ENTER_CUE event from textTrack: trackUid = \(textTrack.uid), cueUid = \(event.cue.uid)") }
|
|
168
168
|
forwardedTextTrackEvent([
|
|
169
169
|
"trackUid" : textTrack.uid,
|
|
170
170
|
"type": TrackCueEventType.ENTER_CUE.rawValue,
|
|
@@ -176,7 +176,7 @@ class THEOplayerRCTTextTrackEventHandler {
|
|
|
176
176
|
private func exitCueListener(_ event: ExitCueEvent) {
|
|
177
177
|
if let forwardedTextTrackEvent = self.onNativeTextTrackEvent,
|
|
178
178
|
let textTrack = event.cue.track {
|
|
179
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
179
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received EXIT_CUE event from textTrack: trackUid = \(textTrack.uid), cueUid = \(event.cue.uid)") }
|
|
180
180
|
forwardedTextTrackEvent([
|
|
181
181
|
"trackUid" : textTrack.uid,
|
|
182
182
|
"type": TrackCueEventType.EXIT_CUE.rawValue,
|
|
@@ -140,7 +140,7 @@ public class THEOplayerRCTView: UIView {
|
|
|
140
140
|
self.player?.removeAllIntegrations()
|
|
141
141
|
self.player?.destroy()
|
|
142
142
|
self.player = nil
|
|
143
|
-
if DEBUG_THEOPLAYER_INTERACTION {
|
|
143
|
+
if DEBUG_THEOPLAYER_INTERACTION { PrintUtils.printLog(logText: "[NATIVE] THEOplayer instance destroyed.") }
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
// MARK: - Property bridging (config)
|
|
@@ -153,7 +153,7 @@ public class THEOplayerRCTView: UIView {
|
|
|
153
153
|
self.chromeless = configDict["chromeless"] as? Bool ?? true
|
|
154
154
|
self.parseAdsConfig(configDict: configDict)
|
|
155
155
|
self.parseCastConfig(configDict: configDict)
|
|
156
|
-
if DEBUG_VIEW {
|
|
156
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] config prop updated.") }
|
|
157
157
|
|
|
158
158
|
// Given the bridged config, create the initial THEOplayer instance
|
|
159
159
|
self.createPlayer()
|
|
@@ -167,7 +167,7 @@ public class THEOplayerRCTView: UIView {
|
|
|
167
167
|
@objc(setOnNativePlayerReady:)
|
|
168
168
|
func setOnNativePlayerReady(nativePlayerReady: @escaping RCTDirectEventBlock) {
|
|
169
169
|
self.onNativePlayerReady = nativePlayerReady
|
|
170
|
-
if DEBUG_VIEW {
|
|
170
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativePlayerReady prop set.") }
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
// MARK: - Listener based MAIN event bridging
|
|
@@ -175,121 +175,121 @@ public class THEOplayerRCTView: UIView {
|
|
|
175
175
|
@objc(setOnNativePlay:)
|
|
176
176
|
func setOnNativePlay(nativePlay: @escaping RCTDirectEventBlock) {
|
|
177
177
|
self.mainEventHandler.onNativePlay = nativePlay
|
|
178
|
-
if DEBUG_VIEW {
|
|
178
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativePlay prop set.") }
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
@objc(setOnNativePause:)
|
|
182
182
|
func setOnNativePause(nativePause: @escaping RCTDirectEventBlock) {
|
|
183
183
|
self.mainEventHandler.onNativePause = nativePause
|
|
184
|
-
if DEBUG_VIEW {
|
|
184
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativePause prop set.") }
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
@objc(setOnNativeSourceChange:)
|
|
188
188
|
func setOnNativeSourceChange(nativeSourceChange: @escaping RCTDirectEventBlock) {
|
|
189
189
|
self.mainEventHandler.onNativeSourceChange = nativeSourceChange
|
|
190
|
-
if DEBUG_VIEW {
|
|
190
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeSourceChange prop set.") }
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
@objc(setOnNativeLoadStart:)
|
|
194
194
|
func setOnNativeLoadStart(nativeLoadStart: @escaping RCTDirectEventBlock) {
|
|
195
195
|
self.mainEventHandler.onNativeLoadStart = nativeLoadStart
|
|
196
|
-
if DEBUG_VIEW {
|
|
196
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeLoadStart prop set.") }
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
@objc(setOnNativeReadyStateChange:)
|
|
200
200
|
func setOnNativeReadyStateChange(nativeReadyStateChange: @escaping RCTDirectEventBlock) {
|
|
201
201
|
self.mainEventHandler.onNativeReadyStateChange = nativeReadyStateChange
|
|
202
|
-
if DEBUG_VIEW {
|
|
202
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeReadyStateChange prop set.") }
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
@objc(setOnNativeDurationChange:)
|
|
206
206
|
func setOnNativeDurationChange(nativeDurationChange: @escaping RCTDirectEventBlock) {
|
|
207
207
|
self.mainEventHandler.onNativeDurationChange = nativeDurationChange
|
|
208
|
-
if DEBUG_VIEW {
|
|
208
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeDurationChange prop set.") }
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
@objc(setOnNativeVolumeChange:)
|
|
212
212
|
func setOnNativeVolumeChange(nativeVolumeChange: @escaping RCTDirectEventBlock) {
|
|
213
213
|
self.mainEventHandler.onNativeVolumeChange = nativeVolumeChange
|
|
214
|
-
if DEBUG_VIEW {
|
|
214
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeVolumeChange prop set.") }
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
@objc(setOnNativeProgress:)
|
|
218
218
|
func setOnNativeProgress(nativeProgress: @escaping RCTBubblingEventBlock) {
|
|
219
219
|
self.mainEventHandler.onNativeProgress = nativeProgress
|
|
220
|
-
if DEBUG_VIEW {
|
|
220
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeProgress prop set.") }
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
@objc(setOnNativeTimeUpdate:)
|
|
224
224
|
func setOnNativeTimeUpdate(nativeTimeUpdate: @escaping RCTBubblingEventBlock) {
|
|
225
225
|
self.mainEventHandler.onNativeTimeUpdate = nativeTimeUpdate
|
|
226
|
-
if DEBUG_VIEW {
|
|
226
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeTimeUpdate prop set.") }
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
@objc(setOnNativePlaying:)
|
|
230
230
|
func setOnNativePlaying(nativePlaying: @escaping RCTDirectEventBlock) {
|
|
231
231
|
self.mainEventHandler.onNativePlaying = nativePlaying
|
|
232
|
-
if DEBUG_VIEW {
|
|
232
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativePlaying prop set.") }
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
@objc(setOnNativeSeeking:)
|
|
236
236
|
func setOnNativeSeeking(nativeSeeking: @escaping RCTDirectEventBlock) {
|
|
237
237
|
self.mainEventHandler.onNativeSeeking = nativeSeeking
|
|
238
|
-
if DEBUG_VIEW {
|
|
238
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeSeeking prop set.") }
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
@objc(setOnNativeSeeked:)
|
|
242
242
|
func setOnNativeSeeked(nativeSeeked: @escaping RCTDirectEventBlock) {
|
|
243
243
|
self.mainEventHandler.onNativeSeeked = nativeSeeked
|
|
244
|
-
if DEBUG_VIEW {
|
|
244
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeSeeked prop set.") }
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
@objc(setOnNativeEnded:)
|
|
248
248
|
func setOnNativeEnded(nativeEnded: @escaping RCTDirectEventBlock) {
|
|
249
249
|
self.mainEventHandler.onNativeEnded = nativeEnded
|
|
250
|
-
if DEBUG_VIEW {
|
|
250
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeEnded prop set.") }
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
@objc(setOnNativeError:)
|
|
254
254
|
func setOnNativeError(nativeError: @escaping RCTDirectEventBlock) {
|
|
255
255
|
self.mainEventHandler.onNativeError = nativeError
|
|
256
|
-
if DEBUG_VIEW {
|
|
256
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeError prop set.") }
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
@objc(setOnNativeLoadedData:)
|
|
260
260
|
func setOnNativeLoadedData(nativeLoadedData: @escaping RCTDirectEventBlock) {
|
|
261
261
|
self.mainEventHandler.onNativeLoadedData = nativeLoadedData
|
|
262
|
-
if DEBUG_VIEW {
|
|
262
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeLoadedData prop set.") }
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
@objc(setOnNativeRateChange:)
|
|
266
266
|
func setOnNativeRateChange(nativeRateChange: @escaping RCTDirectEventBlock) {
|
|
267
267
|
self.mainEventHandler.onNativeRateChange = nativeRateChange
|
|
268
|
-
if DEBUG_VIEW {
|
|
268
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeRateChange prop set.") }
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
@objc(setOnNativeLoadedMetadata:)
|
|
272
272
|
func setOnNativeLoadedMetadata(nativeLoadedMetadata: @escaping RCTDirectEventBlock) {
|
|
273
273
|
self.mainEventHandler.onNativeLoadedMetadata = nativeLoadedMetadata
|
|
274
|
-
if DEBUG_VIEW {
|
|
274
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeLoadedMetadata prop set.") }
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
@objc(setOnNativeWaiting:)
|
|
278
278
|
func setOnNativeWaiting(nativeWaiting: @escaping RCTDirectEventBlock) {
|
|
279
279
|
self.mainEventHandler.onNativeWaiting = nativeWaiting
|
|
280
|
-
if DEBUG_VIEW {
|
|
280
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeWaiting prop set.") }
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
@objc(setOnNativeCanPlay:)
|
|
284
284
|
func setOnNativeCanPlay(nativeCanPlay: @escaping RCTDirectEventBlock) {
|
|
285
285
|
self.mainEventHandler.onNativeCanPlay = nativeCanPlay
|
|
286
|
-
if DEBUG_VIEW {
|
|
286
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeCanPlay prop set.") }
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
@objc(setOnNativePresentationModeChange:)
|
|
290
290
|
func setOnNativePresentationModeChange(nativePresentationMode: @escaping RCTDirectEventBlock) {
|
|
291
291
|
self.mainEventHandler.onNativePresentationModeChange = nativePresentationMode
|
|
292
|
-
if DEBUG_VIEW {
|
|
292
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativePresentationMode prop set.") }
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
// MARK: - Listener based TEXTTRACK event bridging
|
|
@@ -297,13 +297,13 @@ public class THEOplayerRCTView: UIView {
|
|
|
297
297
|
@objc(setOnNativeTextTrackListEvent:)
|
|
298
298
|
func setOnNativeTextTrackListEvent(nativeTextTrackListEvent: @escaping RCTDirectEventBlock) {
|
|
299
299
|
self.textTrackEventHandler.onNativeTextTrackListEvent = nativeTextTrackListEvent
|
|
300
|
-
if DEBUG_VIEW {
|
|
300
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeTextTrackListEvent prop set.") }
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
@objc(setOnNativeTextTrackEvent:)
|
|
304
304
|
func setOnNativeTextTrackEvent(nativeTextTrackEvent: @escaping RCTDirectEventBlock) {
|
|
305
305
|
self.textTrackEventHandler.onNativeTextTrackEvent = nativeTextTrackEvent
|
|
306
|
-
if DEBUG_VIEW {
|
|
306
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeTextTrackEvent prop set.") }
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// MARK: - Listener based MEDIATRACK event bridging
|
|
@@ -311,13 +311,13 @@ public class THEOplayerRCTView: UIView {
|
|
|
311
311
|
@objc(setOnNativeMediaTrackListEvent:)
|
|
312
312
|
func setOnNativeMediaTrackListEvent(nativeMediaTrackListEvent: @escaping RCTDirectEventBlock) {
|
|
313
313
|
self.mediaTrackEventHandler.onNativeMediaTrackListEvent = nativeMediaTrackListEvent
|
|
314
|
-
if DEBUG_VIEW {
|
|
314
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeMediaTrackListEvent prop set.") }
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
@objc(setOnNativeMediaTrackEvent:)
|
|
318
318
|
func setOnNativeMediaTrackEvent(nativeMediaTrackEvent: @escaping RCTDirectEventBlock) {
|
|
319
319
|
self.mediaTrackEventHandler.onNativeMediaTrackEvent = nativeMediaTrackEvent
|
|
320
|
-
if DEBUG_VIEW {
|
|
320
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeMediaTrackEvent prop set.") }
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// MARK: - Listener based CAST event bridging
|
|
@@ -325,7 +325,7 @@ public class THEOplayerRCTView: UIView {
|
|
|
325
325
|
@objc(setOnNativeCastEvent:)
|
|
326
326
|
func setOnNativeCastEvent(nativeCastEvent: @escaping RCTDirectEventBlock) {
|
|
327
327
|
self.castEventHandler.onNativeCastEvent = nativeCastEvent
|
|
328
|
-
if DEBUG_VIEW {
|
|
328
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeCastEvent prop set.") }
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
// MARK: - Listener based AD event bridging
|
|
@@ -333,6 +333,6 @@ public class THEOplayerRCTView: UIView {
|
|
|
333
333
|
@objc(setOnNativeAdEvent:)
|
|
334
334
|
func setOnNativeAdEvent(nativeAdEvent: @escaping RCTDirectEventBlock) {
|
|
335
335
|
self.adEventHandler.onNativeAdEvent = nativeAdEvent
|
|
336
|
-
if DEBUG_VIEW {
|
|
336
|
+
if DEBUG_VIEW { PrintUtils.printLog(logText: "[NATIVE] nativeAdEvent prop set.") }
|
|
337
337
|
}
|
|
338
338
|
}
|
|
@@ -21,17 +21,17 @@ extension THEOplayerRCTAdsAPI {
|
|
|
21
21
|
dai.requestSnapBack { enabled, error in
|
|
22
22
|
if let err = error {
|
|
23
23
|
reject(ERROR_CODE_DAI_GET_SNAPBACK_FAILED, err.localizedDescription, error)
|
|
24
|
-
if DEBUG_ADS_API {
|
|
24
|
+
if DEBUG_ADS_API { PrintUtils.printLog(logText: "[NATIVE] Retrieving dai snapback status failed: \(err.localizedDescription)") }
|
|
25
25
|
} else if let snapBack = enabled {
|
|
26
26
|
resolve(snapBack)
|
|
27
27
|
} else {
|
|
28
28
|
reject(ERROR_CODE_DAI_GET_SNAPBACK_UNDEFINED, ERROR_MESSAGE_DAI_GET_SNAPBACK_UNDEFINED, nil)
|
|
29
|
-
if DEBUG_ADS_API {
|
|
29
|
+
if DEBUG_ADS_API { PrintUtils.printLog(logText: "[NATIVE] Retrieving dai snapback status failed.") }
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
} else {
|
|
33
33
|
reject(ERROR_CODE_DAI_ACCESS_FAILURE, ERROR_MESSAGE_DAI_ACCESS_FAILURE, nil)
|
|
34
|
-
if DEBUG_ADS_API {
|
|
34
|
+
if DEBUG_ADS_API { PrintUtils.printLog(logText: "[NATIVE] Could not retrieve dai snapback status (ads DAI module unavailable).") }
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -44,7 +44,7 @@ extension THEOplayerRCTAdsAPI {
|
|
|
44
44
|
let dai = ads.dai {
|
|
45
45
|
dai.setSnapBack(enabled, completionHandler: nil)
|
|
46
46
|
} else {
|
|
47
|
-
if DEBUG_ADS_API {
|
|
47
|
+
if DEBUG_ADS_API { PrintUtils.printLog(logText: "[NATIVE] Could not update dai snapback status (ads DAI module unavailable).") }
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -60,7 +60,7 @@ extension THEOplayerRCTAdsAPI {
|
|
|
60
60
|
resolve(contentTime)
|
|
61
61
|
} else {
|
|
62
62
|
reject(ERROR_CODE_DAI_ACCESS_FAILURE, ERROR_MESSAGE_DAI_ACCESS_FAILURE, nil)
|
|
63
|
-
if DEBUG_ADS_API {
|
|
63
|
+
if DEBUG_ADS_API { PrintUtils.printLog(logText: "[NATIVE] Could not convert stream time to content time (ads DAI module unavailable).") }
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -76,7 +76,7 @@ extension THEOplayerRCTAdsAPI {
|
|
|
76
76
|
resolve(streamTime)
|
|
77
77
|
} else {
|
|
78
78
|
reject(ERROR_CODE_DAI_ACCESS_FAILURE, ERROR_MESSAGE_DAI_ACCESS_FAILURE, nil)
|
|
79
|
-
if DEBUG_ADS_API {
|
|
79
|
+
if DEBUG_ADS_API { PrintUtils.printLog(logText: "[NATIVE] Could not convert content time to stream time (ads DAI module unavailable).") }
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|