react-native-theoplayer 2.5.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 +24 -0
- package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +9 -15
- package/android/src/main/java/com/theoplayer/util/PayloadBuilder.kt +2 -1
- 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 +63 -37
- 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/api/abr/ABRConfiguration.js +25 -0
- package/lib/commonjs/api/abr/ABRConfiguration.js.map +1 -1
- package/lib/commonjs/api/track/Track.js +5 -1
- package/lib/commonjs/api/track/Track.js.map +1 -1
- package/lib/commonjs/internal/THEOplayerView.web.js +2 -6
- package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +41 -10
- package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +105 -52
- package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/module/api/abr/ABRConfiguration.js +19 -0
- package/lib/module/api/abr/ABRConfiguration.js.map +1 -1
- package/lib/module/api/track/Track.js +4 -1
- package/lib/module/api/track/Track.js.map +1 -1
- package/lib/module/internal/THEOplayerView.web.js +2 -6
- package/lib/module/internal/THEOplayerView.web.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/module/internal/adapter/THEOplayerWebAdapter.js +106 -53
- package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
- package/lib/typescript/api/abr/ABRConfiguration.d.ts +5 -1
- package/lib/typescript/api/track/Track.d.ts +1 -0
- package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +2 -0
- package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +3 -3
- package/package.json +1 -1
- package/react-native-theoplayer.podspec +1 -1
- package/src/api/abr/ABRConfiguration.ts +5 -1
- package/src/api/track/Track.ts +5 -1
- package/src/internal/THEOplayerView.web.tsx +2 -6
- package/src/internal/adapter/THEOplayerAdapter.ts +44 -10
- package/src/internal/adapter/THEOplayerWebAdapter.ts +97 -50
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// THEOplayerRCTNowPlayingManager.swift
|
|
2
2
|
|
|
3
3
|
import Foundation
|
|
4
4
|
import THEOplayerSDK
|
|
@@ -34,39 +34,54 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
34
34
|
func updateNowPlaying() {
|
|
35
35
|
// Reset any existing playing info
|
|
36
36
|
self.nowPlayingInfo = [:]
|
|
37
|
-
|
|
37
|
+
self.clearNowPlayingOnInfoCenter()
|
|
38
38
|
|
|
39
39
|
// Gather new playing info
|
|
40
40
|
if let player = self.player,
|
|
41
41
|
let sourceDescription = player.source,
|
|
42
42
|
let metadata = sourceDescription.metadata {
|
|
43
43
|
let artWorkUrlString = self.getArtWorkUrlStringFromSourceDescription(sourceDescription)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
self
|
|
55
|
-
|
|
56
|
-
if let welf = self {
|
|
57
|
-
MPNowPlayingInfoCenter.default().nowPlayingInfo = welf.nowPlayingInfo
|
|
58
|
-
if DEBUG_NOWINFO { print("[NATIVE] NowPlayingInfoCenter Updated.") }
|
|
59
|
-
}
|
|
44
|
+
self.updatePlaybackState()
|
|
45
|
+
self.nowPlayingInfo = [String : Any]()
|
|
46
|
+
self.updateTitle(metadata.title)
|
|
47
|
+
self.updateSubtitle(metadata.metadataKeys?["subtitle"] as? String)
|
|
48
|
+
self.updateDuration(player.duration)
|
|
49
|
+
self.updateMediaType() // video
|
|
50
|
+
self.updatePlaybackRate(player.playbackRate)
|
|
51
|
+
self.updateServiceIdentifier(metadata.metadataKeys?["nowPlayingServiceIdentifier"] as? String)
|
|
52
|
+
self.updateContentIdentifier(metadata.metadataKeys?["nowPlayingContentIdentifier"] as? String)
|
|
53
|
+
self.updateArtWork(artWorkUrlString) { [weak self] in
|
|
54
|
+
self?.updateCurrentTime { [weak self] in
|
|
55
|
+
self?.processNowPlayingToInfoCenter()
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
|
|
61
|
+
private func processNowPlayingToInfoCenter() {
|
|
62
|
+
DispatchQueue.main.async {
|
|
63
|
+
MPNowPlayingInfoCenter.default().nowPlayingInfo = self.nowPlayingInfo
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private func clearNowPlayingOnInfoCenter() {
|
|
68
|
+
DispatchQueue.main.async {
|
|
69
|
+
MPNowPlayingInfoCenter.default().nowPlayingInfo = nil
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private func processPlaybackStateToInfoCenter(paused: Bool) {
|
|
74
|
+
if #available(iOS 13.0, tvOS 13.0, *) {
|
|
75
|
+
DispatchQueue.main.async {
|
|
76
|
+
MPNowPlayingInfoCenter.default().playbackState = paused ? MPNowPlayingPlaybackState.paused : MPNowPlayingPlaybackState.playing
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
65
81
|
private func getArtWorkUrlStringFromSourceDescription(_ sourceDescription: SourceDescription) -> String? {
|
|
66
82
|
if let posterUrlString = sourceDescription.poster?.absoluteString {
|
|
67
83
|
return posterUrlString
|
|
68
84
|
}
|
|
69
|
-
|
|
70
85
|
if let metadata = sourceDescription.metadata,
|
|
71
86
|
let displayIconUrlString = metadata.metadataKeys?["displayIconUri"] as? String {
|
|
72
87
|
return displayIconUrlString
|
|
@@ -115,19 +130,29 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
115
130
|
private func updatePlaybackState() {
|
|
116
131
|
if #available(iOS 13.0, tvOS 13.0, *) {
|
|
117
132
|
if let player = self.player {
|
|
118
|
-
|
|
133
|
+
self.processPlaybackStateToInfoCenter(paused: player.paused)
|
|
119
134
|
}
|
|
120
135
|
}
|
|
121
136
|
}
|
|
122
137
|
|
|
123
|
-
private func updateArtWork(_ urlString: String?) {
|
|
138
|
+
private func updateArtWork(_ urlString: String?, completion: (() -> Void)?) {
|
|
124
139
|
if let artUrlString = urlString,
|
|
125
|
-
let artUrl = URL(string: artUrlString)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
let artUrl = URL(string: artUrlString) {
|
|
141
|
+
let dataTask = URLSession.shared.dataTask(with: artUrl) { [weak self] (data, _, _) in
|
|
142
|
+
if let displayIconData = data,
|
|
143
|
+
let displayIcon = UIImage(data: displayIconData) {
|
|
144
|
+
self?.nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: displayIcon.size) { size in
|
|
145
|
+
return displayIcon
|
|
146
|
+
}
|
|
147
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] Artwork updated in nowPlayingInfo.") }
|
|
148
|
+
} else {
|
|
149
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] Failed to update artwork in nowPlayingInfo.") }
|
|
150
|
+
}
|
|
151
|
+
completion?()
|
|
130
152
|
}
|
|
153
|
+
dataTask.resume()
|
|
154
|
+
} else {
|
|
155
|
+
completion?()
|
|
131
156
|
}
|
|
132
157
|
}
|
|
133
158
|
|
|
@@ -141,6 +166,7 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
141
166
|
if let welf = self,
|
|
142
167
|
let currentTime = time {
|
|
143
168
|
welf.nowPlayingInfo[MPNowPlayingInfoPropertyElapsedPlaybackTime] = NSNumber(value: currentTime)
|
|
169
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] CurrentTime updated in nowPlayingInfo.") }
|
|
144
170
|
DispatchQueue.main.async {
|
|
145
171
|
completion?()
|
|
146
172
|
}
|
|
@@ -162,8 +188,8 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
162
188
|
welf.nowPlayingInfo[MPNowPlayingInfoPropertyIsLiveStream] = duration.isInfinite
|
|
163
189
|
if (!duration.isInfinite) {
|
|
164
190
|
welf.nowPlayingInfo[MPMediaItemPropertyPlaybackDuration] = duration
|
|
165
|
-
|
|
166
|
-
|
|
191
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] DURATION_CHANGE: Updating duration on NowPlayingInfoCenter...") }
|
|
192
|
+
welf.processNowPlayingToInfoCenter()
|
|
167
193
|
}
|
|
168
194
|
}
|
|
169
195
|
}
|
|
@@ -173,8 +199,8 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
173
199
|
self?.updatePlaybackState()
|
|
174
200
|
self?.updateCurrentTime { [weak self] in
|
|
175
201
|
if let welf = self {
|
|
176
|
-
|
|
177
|
-
|
|
202
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] PLAYING: Updating playbackState and time on NowPlayingInfoCenter...") }
|
|
203
|
+
welf.processNowPlayingToInfoCenter()
|
|
178
204
|
}
|
|
179
205
|
}
|
|
180
206
|
}
|
|
@@ -184,8 +210,8 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
184
210
|
self?.updatePlaybackState()
|
|
185
211
|
self?.updateCurrentTime { [weak self] in
|
|
186
212
|
if let welf = self {
|
|
187
|
-
|
|
188
|
-
|
|
213
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] PAUSED: Updating PlaybackState and time on NowPlayingInfoCenter...") }
|
|
214
|
+
welf.processNowPlayingToInfoCenter()
|
|
189
215
|
}
|
|
190
216
|
}
|
|
191
217
|
}
|
|
@@ -196,8 +222,8 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
196
222
|
if let welf = self,
|
|
197
223
|
let wplayer = player {
|
|
198
224
|
welf.nowPlayingInfo[MPNowPlayingInfoPropertyPlaybackRate] = NSNumber(value: wplayer.playbackRate)
|
|
199
|
-
|
|
200
|
-
|
|
225
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] RATE_CHANGE: Updating playbackRate on NowPlayingInfoCenter...") }
|
|
226
|
+
welf.processNowPlayingToInfoCenter()
|
|
201
227
|
}
|
|
202
228
|
}
|
|
203
229
|
|
|
@@ -205,16 +231,16 @@ class THEOplayerRCTNowPlayingManager {
|
|
|
205
231
|
self.seekedListener = player.addEventListener(type: PlayerEventTypes.SEEKED) { [weak self] event in
|
|
206
232
|
self?.updateCurrentTime { [weak self] in
|
|
207
233
|
if let welf = self {
|
|
208
|
-
|
|
209
|
-
|
|
234
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] SEEKED: Time updated on NowPlayingInfoCenter.") }
|
|
235
|
+
welf.processNowPlayingToInfoCenter()
|
|
210
236
|
}
|
|
211
237
|
}
|
|
212
238
|
}
|
|
213
239
|
|
|
214
240
|
// SOURCE_CHANGE
|
|
215
241
|
self.sourceChangeListener = player.addEventListener(type: PlayerEventTypes.SOURCE_CHANGE) { [weak self] event in
|
|
242
|
+
if DEBUG_NOWINFO { PrintUtils.printLog(logText: "[NATIVE] SOURCE_CHANGE: Full update on NowPlayingInfoCenter.") }
|
|
216
243
|
self?.updateNowPlaying()
|
|
217
|
-
if DEBUG_NOWINFO { print("[NATIVE] SOURCE_CHANGE: Full update on NowPlayingInfoCenter.") }
|
|
218
244
|
}
|
|
219
245
|
}
|
|
220
246
|
|
|
@@ -67,7 +67,7 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
67
67
|
commandCenter.skipBackwardCommand.preferredIntervals = [NSNumber(value: DEFAULT_SKIP_INTERVAL)]
|
|
68
68
|
commandCenter.skipBackwardCommand.addTarget(self, action: #selector(onSkipBackwardCommand(_:)))
|
|
69
69
|
|
|
70
|
-
if DEBUG_REMOTECOMMANDS {
|
|
70
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Remote commands initialised.") }
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
func updateRemoteCommands() {
|
|
@@ -79,17 +79,17 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
79
79
|
commandCenter.changePlaybackPositionCommand.isEnabled = !isLive && !self.inAd && self.backgroundaudioConfig.enabled
|
|
80
80
|
commandCenter.skipForwardCommand.isEnabled = !isLive && !self.inAd && self.backgroundaudioConfig.enabled
|
|
81
81
|
commandCenter.skipBackwardCommand.isEnabled = !isLive && !self.inAd && self.backgroundaudioConfig.enabled
|
|
82
|
-
if DEBUG_REMOTECOMMANDS {
|
|
82
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Remote commands updated for \(self.isLive ? "LIVE" : "VOD") (\(self.inAd ? "AD IS PLAYING" : "NO AD PLAYING"), \(self.backgroundaudioConfig.enabled ? "BGAUDIO ENABLED" : "BGAUDIO DISABLED") ).") }
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
@objc private func onPlayCommand(_ event: MPRemoteCommandEvent) -> MPRemoteCommandHandlerStatus {
|
|
86
86
|
if let player = self.player,
|
|
87
87
|
player.paused {
|
|
88
88
|
player.play()
|
|
89
|
-
if DEBUG_REMOTECOMMANDS {
|
|
89
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Play command triggered.") }
|
|
90
90
|
return .success
|
|
91
91
|
}
|
|
92
|
-
if DEBUG_REMOTECOMMANDS {
|
|
92
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Play command Failed.") }
|
|
93
93
|
return .commandFailed
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -97,10 +97,10 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
97
97
|
if let player = self.player,
|
|
98
98
|
!player.paused {
|
|
99
99
|
player.pause()
|
|
100
|
-
if DEBUG_REMOTECOMMANDS {
|
|
100
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Pause command triggered.") }
|
|
101
101
|
return .success
|
|
102
102
|
}
|
|
103
|
-
if DEBUG_REMOTECOMMANDS {
|
|
103
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Pause command Failed.") }
|
|
104
104
|
return .commandFailed
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -111,10 +111,10 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
111
111
|
} else {
|
|
112
112
|
player.pause()
|
|
113
113
|
}
|
|
114
|
-
if DEBUG_REMOTECOMMANDS {
|
|
114
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Toggle play/pause command triggered.") }
|
|
115
115
|
return .success
|
|
116
116
|
}
|
|
117
|
-
if DEBUG_REMOTECOMMANDS {
|
|
117
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Toggle play/pause command Failed.") }
|
|
118
118
|
return .commandFailed
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -123,20 +123,20 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
123
123
|
if !player.paused {
|
|
124
124
|
player.pause()
|
|
125
125
|
}
|
|
126
|
-
if DEBUG_REMOTECOMMANDS {
|
|
126
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Stop command triggered.") }
|
|
127
127
|
return .success
|
|
128
128
|
}
|
|
129
|
-
if DEBUG_REMOTECOMMANDS {
|
|
129
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Stop command Failed.") }
|
|
130
130
|
return .commandFailed
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
@objc private func onScrubCommand(_ event: MPChangePlaybackPositionCommandEvent) -> MPRemoteCommandHandlerStatus {
|
|
134
134
|
if let player = self.player {
|
|
135
135
|
player.setCurrentTime(event.positionTime)
|
|
136
|
-
if DEBUG_REMOTECOMMANDS {
|
|
136
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Scrub command triggered.") }
|
|
137
137
|
return .success
|
|
138
138
|
}
|
|
139
|
-
if DEBUG_REMOTECOMMANDS {
|
|
139
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Scrub command Failed.") }
|
|
140
140
|
return .commandFailed
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -147,10 +147,10 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
147
147
|
player.setCurrentTime(currentTime + event.interval)
|
|
148
148
|
}
|
|
149
149
|
})
|
|
150
|
-
if DEBUG_REMOTECOMMANDS {
|
|
150
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Skip forward command triggered.") }
|
|
151
151
|
return .success
|
|
152
152
|
}
|
|
153
|
-
if DEBUG_REMOTECOMMANDS {
|
|
153
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Skip forward command Failed.") }
|
|
154
154
|
return .commandFailed
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -161,10 +161,10 @@ class THEOplayerRCTRemoteCommandsManager: NSObject {
|
|
|
161
161
|
player.setCurrentTime(currentTime - event.interval)
|
|
162
162
|
}
|
|
163
163
|
})
|
|
164
|
-
if DEBUG_REMOTECOMMANDS {
|
|
164
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Skip backward command triggered.") }
|
|
165
165
|
return .success
|
|
166
166
|
}
|
|
167
|
-
if DEBUG_REMOTECOMMANDS {
|
|
167
|
+
if DEBUG_REMOTECOMMANDS { PrintUtils.printLog(logText: "[NATIVE] Skip backward command Failed.") }
|
|
168
168
|
return .commandFailed
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -19,7 +19,7 @@ extension THEOplayerRCTCastAPI {
|
|
|
19
19
|
resolve(airplay.casting)
|
|
20
20
|
} else {
|
|
21
21
|
reject(ERROR_CODE_AIRPLAY_ACCESS_FAILURE, ERROR_MESSAGE_AIRPLAY_ACCESS_FAILURE, nil)
|
|
22
|
-
if DEBUG_CAST_API {
|
|
22
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not retrieve current airplay casting status.") }
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -33,7 +33,7 @@ extension THEOplayerRCTCastAPI {
|
|
|
33
33
|
resolve(airplay.state._rawValue)
|
|
34
34
|
} else {
|
|
35
35
|
reject(ERROR_CODE_AIRPLAY_ACCESS_FAILURE, ERROR_MESSAGE_AIRPLAY_ACCESS_FAILURE, nil)
|
|
36
|
-
if DEBUG_CAST_API {
|
|
36
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not retrieve current airplay state.") }
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -44,10 +44,10 @@ extension THEOplayerRCTCastAPI {
|
|
|
44
44
|
let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView
|
|
45
45
|
if let cast = theView.cast(),
|
|
46
46
|
let airplay = cast.airPlay {
|
|
47
|
-
if DEBUG_CAST_API {
|
|
47
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Starting airplay session.") }
|
|
48
48
|
airplay.start()
|
|
49
49
|
} else {
|
|
50
|
-
if DEBUG_CAST_API {
|
|
50
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not start airplay session.") }
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -58,10 +58,10 @@ extension THEOplayerRCTCastAPI {
|
|
|
58
58
|
let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView
|
|
59
59
|
if let cast = theView.cast(),
|
|
60
60
|
let airplay = cast.airPlay {
|
|
61
|
-
if DEBUG_CAST_API {
|
|
61
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Stopping airplay session.") }
|
|
62
62
|
airplay.stop()
|
|
63
63
|
} else {
|
|
64
|
-
if DEBUG_CAST_API {
|
|
64
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not stop airplay session.") }
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -19,7 +19,7 @@ extension THEOplayerRCTCastAPI {
|
|
|
19
19
|
resolve(chromecast.casting)
|
|
20
20
|
} else {
|
|
21
21
|
reject(ERROR_CODE_CHROMECAST_ACCESS_FAILURE, ERROR_MESSAGE_CHROMECAST_ACCESS_FAILURE, nil)
|
|
22
|
-
if DEBUG_CAST_API {
|
|
22
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not retrieve current chromecast casting status.") }
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -33,7 +33,7 @@ extension THEOplayerRCTCastAPI {
|
|
|
33
33
|
resolve(chromecast.state?._rawValue)
|
|
34
34
|
} else {
|
|
35
35
|
reject(ERROR_CODE_CHROMECAST_ACCESS_FAILURE, ERROR_MESSAGE_CHROMECAST_ACCESS_FAILURE, nil)
|
|
36
|
-
if DEBUG_CAST_API {
|
|
36
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not retrieve current chromecast state.") }
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -44,10 +44,10 @@ extension THEOplayerRCTCastAPI {
|
|
|
44
44
|
let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView
|
|
45
45
|
if let cast = theView.cast(),
|
|
46
46
|
let chromecast = cast.chromecast {
|
|
47
|
-
if DEBUG_CAST_API {
|
|
47
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Starting chromecast session.") }
|
|
48
48
|
chromecast.start()
|
|
49
49
|
} else {
|
|
50
|
-
if DEBUG_CAST_API {
|
|
50
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not start chromecast session.") }
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -58,10 +58,10 @@ extension THEOplayerRCTCastAPI {
|
|
|
58
58
|
let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView
|
|
59
59
|
if let cast = theView.cast(),
|
|
60
60
|
let chromecast = cast.chromecast {
|
|
61
|
-
if DEBUG_CAST_API {
|
|
61
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Stopping chromecast session.") }
|
|
62
62
|
chromecast.stop()
|
|
63
63
|
} else {
|
|
64
|
-
if DEBUG_CAST_API {
|
|
64
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not stop chromecast session.") }
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -72,10 +72,10 @@ extension THEOplayerRCTCastAPI {
|
|
|
72
72
|
let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView
|
|
73
73
|
if let cast = theView.cast(),
|
|
74
74
|
let chromecast = cast.chromecast {
|
|
75
|
-
if DEBUG_CAST_API {
|
|
75
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Joining chromecast session.") }
|
|
76
76
|
chromecast.join()
|
|
77
77
|
} else {
|
|
78
|
-
if DEBUG_CAST_API {
|
|
78
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not join chromecast session.") }
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -86,10 +86,10 @@ extension THEOplayerRCTCastAPI {
|
|
|
86
86
|
let theView = self.bridge.uiManager.view(forReactTag: node) as! THEOplayerRCTView
|
|
87
87
|
if let cast = theView.cast(),
|
|
88
88
|
let chromecast = cast.chromecast {
|
|
89
|
-
if DEBUG_CAST_API {
|
|
89
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Leaving chromecast session.") }
|
|
90
90
|
chromecast.leave()
|
|
91
91
|
} else {
|
|
92
|
-
if DEBUG_CAST_API {
|
|
92
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not leave chromecast session.") }
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -35,7 +35,7 @@ class THEOplayerRCTCastAPI: NSObject, RCTBridgeModule {
|
|
|
35
35
|
resolve(cast.casting)
|
|
36
36
|
} else {
|
|
37
37
|
reject(ERROR_CODE_CAST_ACCESS_FAILURE, ERROR_MESSAGE_CAST_ACCESS_FAILURE, nil)
|
|
38
|
-
if DEBUG_CAST_API {
|
|
38
|
+
if DEBUG_CAST_API { PrintUtils.printLog(logText: "[NATIVE] Could not retrieve current casting status (cast module unavailable).") }
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -49,21 +49,21 @@ class THEOplayerRCTCastEventHandler {
|
|
|
49
49
|
#if os(iOS) && (CHROMECAST || canImport(THEOplayerGoogleCastIntegration))
|
|
50
50
|
// CHROMECAST STATE_CHANGE
|
|
51
51
|
self.chromecastStateChangeListener = player.cast?.chromecast?.addEventListener(type: ChromecastEventTypes.STATE_CHANGE) { [weak self] event in
|
|
52
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
52
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received Chromecast STATE_CHANGE event from THEOplayer cast.chromecast") }
|
|
53
53
|
if let forwardedCastEvent = self?.onNativeCastEvent {
|
|
54
54
|
let newCastState = event.state._rawValue
|
|
55
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
55
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] New Chromecast state: \(newCastState)") }
|
|
56
56
|
forwardedCastEvent([
|
|
57
57
|
CAST_EVENT_PROP_TYPE: EVENT_TYPE_CHROMECAST_STATE_CHANGE,
|
|
58
58
|
CAST_EVENT_PROP_STATE: newCastState
|
|
59
59
|
])
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
if DEBUG_EVENTHANDLER {
|
|
62
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] Chromecast StateChange listener attached to THEOplayer cast.chromecast") }
|
|
63
63
|
|
|
64
64
|
// CHROMECAST ERROR
|
|
65
65
|
self.chromecastErrorListener = player.cast?.chromecast?.addEventListener(type: ChromecastEventTypes.ERROR) { [weak self] event in
|
|
66
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
66
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received Chromecast ERROR event from THEOplayer cast.chromecast") }
|
|
67
67
|
if let forwardedCastEvent = self?.onNativeCastEvent {
|
|
68
68
|
let error = event.error
|
|
69
69
|
forwardedCastEvent([
|
|
@@ -75,23 +75,23 @@ class THEOplayerRCTCastEventHandler {
|
|
|
75
75
|
])
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
if DEBUG_EVENTHANDLER {
|
|
78
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] Chromecast Error listener attached to THEOplayer cast.chromecast") }
|
|
79
79
|
#endif
|
|
80
80
|
|
|
81
81
|
#if os(iOS)
|
|
82
82
|
// AIRPLAY STATE_CHANGE
|
|
83
83
|
self.airplayStateChangeListener = player.cast?.airPlay?.addEventListener(type: AirPlayEventTypes.STATE_CHANGE) { [weak self] event in
|
|
84
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
84
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received Airplay STATE_CHANGE event from THEOplayer cast.airplay") }
|
|
85
85
|
if let forwardedCastEvent = self?.onNativeCastEvent,
|
|
86
86
|
let castState = event.state {
|
|
87
|
-
if DEBUG_THEOPLAYER_EVENTS {
|
|
87
|
+
if DEBUG_THEOPLAYER_EVENTS { PrintUtils.printLog(logText: "[NATIVE] New Airplay state: \(castState)") }
|
|
88
88
|
forwardedCastEvent([
|
|
89
89
|
CAST_EVENT_PROP_TYPE: EVENT_TYPE_AIRPLAY_STATE_CHANGE,
|
|
90
90
|
CAST_EVENT_PROP_STATE: castState._rawValue
|
|
91
91
|
])
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
if DEBUG_EVENTHANDLER {
|
|
94
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] Airplay StateChange listener attached to THEOplayer cast.airplay") }
|
|
95
95
|
#endif
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -105,11 +105,11 @@ class THEOplayerRCTCastEventHandler {
|
|
|
105
105
|
// CHROMECAST STATE_CHANGE
|
|
106
106
|
if let chromecastStateChangeListener = self.chromecastStateChangeListener {
|
|
107
107
|
player.cast?.chromecast?.removeEventListener(type: ChromecastEventTypes.STATE_CHANGE, listener: chromecastStateChangeListener)
|
|
108
|
-
if DEBUG_EVENTHANDLER {
|
|
108
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] Chromecast StateChange listener dettached from THEOplayer cast.chromecast") }
|
|
109
109
|
}
|
|
110
110
|
if let chromecastErrorListener = self.chromecastErrorListener {
|
|
111
111
|
player.cast?.chromecast?.removeEventListener(type: ChromecastEventTypes.ERROR, listener: chromecastErrorListener)
|
|
112
|
-
if DEBUG_EVENTHANDLER {
|
|
112
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] Chromecast Error listener dettached from THEOplayer cast.chromecast") }
|
|
113
113
|
}
|
|
114
114
|
#endif
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ class THEOplayerRCTCastEventHandler {
|
|
|
117
117
|
// AIRPLAY STATE_CHANGE
|
|
118
118
|
if let airplayStateChangeListener = self.airplayStateChangeListener {
|
|
119
119
|
player.cast?.airPlay?.removeEventListener(type: AirPlayEventTypes.STATE_CHANGE, listener: airplayStateChangeListener)
|
|
120
|
-
if DEBUG_EVENTHANDLER {
|
|
120
|
+
if DEBUG_EVENTHANDLER { PrintUtils.printLog(logText: "[NATIVE] Airplay StateChange listener dettached from THEOplayer cast.airplay") }
|
|
121
121
|
}
|
|
122
122
|
#endif
|
|
123
123
|
}
|
|
@@ -216,7 +216,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
216
216
|
if let responseError = error {
|
|
217
217
|
print(CPI_TAG, "Certificate request failure: error = \(responseError.localizedDescription)")
|
|
218
218
|
} else if statusCode >= 400 {
|
|
219
|
-
|
|
219
|
+
PrintUtils.printLog(logText: "Certificate request failure: statusCode = \(statusCode)")
|
|
220
220
|
} else {
|
|
221
221
|
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "Certificate request success: statusCode = \(statusCode)") }
|
|
222
222
|
let certificateRequest = CertificateRequest(url: urlString, method: method, headers: headers, body: bodyData)
|
|
@@ -58,7 +58,7 @@ class THEOplayerRCTPipControlsManager: NSObject {
|
|
|
58
58
|
if let player = self.player,
|
|
59
59
|
let pip = player.pip {
|
|
60
60
|
pip.configure(configuration: self.newPipConfiguration())
|
|
61
|
-
if DEBUG_PIPCONTROLS {
|
|
61
|
+
if DEBUG_PIPCONTROLS { PrintUtils.printLog(logText: "[NATIVE] Pip controls updated for \(self.isLive ? "LIVE" : "VOD") (\(self.inAd ? "AD IS PLAYING" : "NO AD PLAYING")). (requiresLinearPlayback = \(self.isLive || self.inAd), canStartPictureInPictureAutomaticallyFromInline = \(self.pipConfig.canStartPictureInPictureAutomaticallyFromInline))") }
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -1,2 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ABRStrategyType = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* The adaptive bitrate strategy of the first segment, represented by a value from the following list:
|
|
9
|
+
* <br/> - `'performance'`: The player will optimize ABR behavior to focus on the performance of the player. This strategy initiates playback with the lowest quality suitable for the device which means faster start-up time.
|
|
10
|
+
* <br/> - `'quality'`: The player will optimize ABR behavior to focus displaying the best visual quality to the end-user. This strategy initiates playback with the highest bit rate suitable for the device.
|
|
11
|
+
* <br/> - `'bandwidth'`: The player will optimize the ABR behavior to focus on displaying the most optimal quality based on historic data of available bandwidth and knowledge of the network conditions.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
let ABRStrategyType;
|
|
16
|
+
/**
|
|
17
|
+
* Describes the metadata of the adaptive bitrate strategy.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
exports.ABRStrategyType = ABRStrategyType;
|
|
22
|
+
(function (ABRStrategyType) {
|
|
23
|
+
ABRStrategyType["performance"] = "performance";
|
|
24
|
+
ABRStrategyType["quality"] = "quality";
|
|
25
|
+
ABRStrategyType["bandwidth"] = "bandwidth";
|
|
26
|
+
})(ABRStrategyType || (exports.ABRStrategyType = ABRStrategyType = {}));
|
|
2
27
|
//# sourceMappingURL=ABRConfiguration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ABRConfiguration.ts"],"sourcesContent":["/**\n * The adaptive bitrate strategy of the first segment, represented by a value from the following list:\n * <br/> - `'performance'`: The player will optimize ABR behavior to focus on the performance of the player. This strategy initiates playback with the lowest quality suitable for the device which means faster start-up time.\n * <br/> - `'quality'`: The player will optimize ABR behavior to focus displaying the best visual quality to the end-user. This strategy initiates playback with the highest bit rate suitable for the device.\n * <br/> - `'bandwidth'`: The player will optimize the ABR behavior to focus on displaying the most optimal quality based on historic data of available bandwidth and knowledge of the network conditions.\n *\n * @public\n */\nexport
|
|
1
|
+
{"version":3,"names":["ABRStrategyType","exports"],"sources":["ABRConfiguration.ts"],"sourcesContent":["/**\n * The adaptive bitrate strategy of the first segment, represented by a value from the following list:\n * <br/> - `'performance'`: The player will optimize ABR behavior to focus on the performance of the player. This strategy initiates playback with the lowest quality suitable for the device which means faster start-up time.\n * <br/> - `'quality'`: The player will optimize ABR behavior to focus displaying the best visual quality to the end-user. This strategy initiates playback with the highest bit rate suitable for the device.\n * <br/> - `'bandwidth'`: The player will optimize the ABR behavior to focus on displaying the most optimal quality based on historic data of available bandwidth and knowledge of the network conditions.\n *\n * @public\n */\nexport enum ABRStrategyType {\n performance = 'performance',\n quality = 'quality',\n bandwidth = 'bandwidth',\n}\n\n/**\n * Describes the metadata of the adaptive bitrate strategy.\n *\n * @public\n */\nexport interface ABRMetadata {\n /**\n * The initial bitrate, in bits per second.\n *\n * @defaultValue Bitrate available to the browser.\n */\n bitrate?: number;\n}\n\n/**\n * Describes the configuration of the adaptive bitrate strategy.\n *\n * @public\n */\nexport interface ABRStrategyConfiguration {\n /**\n * The strategy for initial playback.\n */\n type: ABRStrategyType;\n\n /**\n * The metadata for the initial playback strategy.\n *\n * @defaultValue A {@link ABRMetadata} object with default values.\n */\n metadata?: ABRMetadata;\n}\n\n/**\n * The adaptive bitrate stratey.\n *\n * @public\n */\nexport type ABRStrategy = ABRStrategyConfiguration | ABRStrategyType;\n\n/**\n * Describes the adaptive bitrate configuration.\n *\n * @public\n */\nexport interface ABRConfiguration {\n /**\n * The adaptive bitrate strategy.\n *\n * @defaultValue `'bandwidth'`\n */\n strategy?: ABRStrategy;\n\n /**\n * The amount which the player should buffer ahead of the current playback position, in seconds.\n *\n * @remarks\n * <br/> - Before v4.3.0: This duration has a maximum of 60 seconds.\n * <br/> - After v4.3.0: This duration has no maximum.\n * <br/> - The player might reduce or ignore the configured amount because of device or performance constraints.\n *\n * @defaultValue `20`\n */\n targetBuffer?: number;\n\n /**\n * The amount of data which the player should keep in its buffer before the current playback position, in seconds.\n * This configuration option can be used to reduce the memory footprint on memory restricted devices or on devices\n * which don't automatically prune decoder buffers.\n *\n * Note that the player can decide to keep less data in the decoder buffer in case memory is running low.\n * A value of 0 or lower is not accepted and will be treated as default.\n *\n * @defaultValue `30`\n *\n * @remarks\n * <br/> - This property is currently supported on Web platforms only.\n */\n bufferLookbackWindow?: number;\n\n /**\n * The maximum length of the player's buffer, in seconds.\n *\n * The player will initially buffer up to {@link ABRConfiguration.targetBuffer} seconds of media data.\n * If the player detects that the decoder is unable to hold so much data,\n * it will reduce `maxBufferLength` and restrict `targetBuffer` to be less than\n * this maximum.\n *\n * @remarks\n * <br/> - This property is currently supported on Web platforms only.\n */\n readonly maxBufferLength?: number;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAQYA,eAAe;AAM3B;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAD,eAAA,GAAAA,eAAA;AAAA,WANYA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;AAAA,GAAfA,eAAe,KAAAC,OAAA,CAAAD,eAAA,GAAfA,eAAe"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addTrack = addTrack;
|
|
7
7
|
exports.hasTrack = hasTrack;
|
|
8
8
|
exports.removeTrack = removeTrack;
|
|
9
|
+
exports.sortTracks = sortTracks;
|
|
9
10
|
/**
|
|
10
11
|
* Represents a track of a media resource.
|
|
11
12
|
*
|
|
@@ -22,6 +23,9 @@ function removeTrack(trackList, track) {
|
|
|
22
23
|
return trackList && track ? trackList.filter(t => t.uid !== track.uid) : trackList;
|
|
23
24
|
}
|
|
24
25
|
function addTrack(trackList, track) {
|
|
25
|
-
return trackList && track && !hasTrack(trackList, track) ? [...trackList, track] : trackList;
|
|
26
|
+
return trackList && track && !hasTrack(trackList, track) ? sortTracks([...trackList, track]) : trackList;
|
|
27
|
+
}
|
|
28
|
+
function sortTracks(trackList) {
|
|
29
|
+
return (trackList === null || trackList === void 0 ? void 0 : trackList.sort((t1, t2) => t1.uid - t2.uid)) || [];
|
|
26
30
|
}
|
|
27
31
|
//# sourceMappingURL=Track.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hasTrack","trackList","track","find","t","uid","removeTrack","filter","addTrack"],"sources":["Track.ts"],"sourcesContent":["/**\n * Represents a track of a media resource.\n *\n * @remarks\n * <br/> - A specific track type (e.g. {@link TextTrack}) will always be used.\n *\n * @public\n */\nexport interface Track {\n /**\n * The kind of the track.\n *\n * @remarks\n * <br/> - The values for this property depend on the specific type of the track.\n */\n readonly kind: string;\n\n /**\n * The label of the track.\n */\n label: string;\n\n /**\n * The identifier of the track.\n *\n * @remarks\n * <br/> - This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.\n *\n * @privateRemarks\n * <br/> - This identifier is a randomly generated string.\n */\n readonly id: string;\n\n /**\n * A unique identifier of the track.\n *\n * @remarks\n * <br/> - This identifier is unique across tracks of a THEOplayer instance and can be used to distinguish between tracks.\n * <br/> - This identifier is a randomly generated number.\n */\n readonly uid: number;\n\n /**\n * The language of the track.\n */\n readonly language: string;\n}\n\nexport function hasTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): boolean {\n return !!(trackList && track && trackList.find((t) => t.uid === track.uid));\n}\n\nexport function removeTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track ? trackList.filter((t) => t.uid !== track.uid) : trackList;\n}\n\nexport function addTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track && !hasTrack(trackList, track) ? [...trackList, track] : trackList;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["hasTrack","trackList","track","find","t","uid","removeTrack","filter","addTrack","sortTracks","sort","t1","t2"],"sources":["Track.ts"],"sourcesContent":["/**\n * Represents a track of a media resource.\n *\n * @remarks\n * <br/> - A specific track type (e.g. {@link TextTrack}) will always be used.\n *\n * @public\n */\nexport interface Track {\n /**\n * The kind of the track.\n *\n * @remarks\n * <br/> - The values for this property depend on the specific type of the track.\n */\n readonly kind: string;\n\n /**\n * The label of the track.\n */\n label: string;\n\n /**\n * The identifier of the track.\n *\n * @remarks\n * <br/> - This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.\n *\n * @privateRemarks\n * <br/> - This identifier is a randomly generated string.\n */\n readonly id: string;\n\n /**\n * A unique identifier of the track.\n *\n * @remarks\n * <br/> - This identifier is unique across tracks of a THEOplayer instance and can be used to distinguish between tracks.\n * <br/> - This identifier is a randomly generated number.\n */\n readonly uid: number;\n\n /**\n * The language of the track.\n */\n readonly language: string;\n}\n\nexport function hasTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): boolean {\n return !!(trackList && track && trackList.find((t) => t.uid === track.uid));\n}\n\nexport function removeTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track ? trackList.filter((t) => t.uid !== track.uid) : trackList;\n}\n\nexport function addTrack<TTrack extends Track>(trackList: TTrack[], track: TTrack): TTrack[] {\n return trackList && track && !hasTrack(trackList, track) ? sortTracks([...trackList, track]) : trackList;\n}\n\nexport function sortTracks<TTrack extends Track>(trackList?: TTrack[]): TTrack[] {\n return trackList?.sort((t1: TTrack, t2: TTrack) => t1.uid - t2.uid) || [];\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAyCO,SAASA,QAAQA,CAAuBC,SAAmB,EAAEC,KAAa,EAAW;EAC1F,OAAO,CAAC,EAAED,SAAS,IAAIC,KAAK,IAAID,SAAS,CAACE,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKH,KAAK,CAACG,GAAG,CAAC,CAAC;AAC7E;AAEO,SAASC,WAAWA,CAAuBL,SAAmB,EAAEC,KAAa,EAAY;EAC9F,OAAOD,SAAS,IAAIC,KAAK,GAAGD,SAAS,CAACM,MAAM,CAAEH,CAAC,IAAKA,CAAC,CAACC,GAAG,KAAKH,KAAK,CAACG,GAAG,CAAC,GAAGJ,SAAS;AACtF;AAEO,SAASO,QAAQA,CAAuBP,SAAmB,EAAEC,KAAa,EAAY;EAC3F,OAAOD,SAAS,IAAIC,KAAK,IAAI,CAACF,QAAQ,CAACC,SAAS,EAAEC,KAAK,CAAC,GAAGO,UAAU,CAAC,CAAC,GAAGR,SAAS,EAAEC,KAAK,CAAC,CAAC,GAAGD,SAAS;AAC1G;AAEO,SAASQ,UAAUA,CAAuBR,SAAoB,EAAY;EAC/E,OAAO,CAAAA,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAES,IAAI,CAAC,CAACC,EAAU,EAAEC,EAAU,KAAKD,EAAE,CAACN,GAAG,GAAGO,EAAE,CAACP,GAAG,CAAC,KAAI,EAAE;AAC3E"}
|
|
@@ -7,8 +7,6 @@ exports.THEOplayerView = THEOplayerView;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var THEOplayer = _interopRequireWildcard(require("theoplayer"));
|
|
9
9
|
var _THEOplayerWebAdapter = require("./adapter/THEOplayerWebAdapter");
|
|
10
|
-
var _BaseEvent = require("./adapter/event/BaseEvent");
|
|
11
|
-
var _reactNativeTheoplayer = require("react-native-theoplayer");
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
12
|
function THEOplayerView(props) {
|
|
@@ -55,7 +53,7 @@ function THEOplayerView(props) {
|
|
|
55
53
|
|
|
56
54
|
// Clean-up
|
|
57
55
|
return () => {
|
|
58
|
-
var _adapter$current
|
|
56
|
+
var _adapter$current;
|
|
59
57
|
// Notify the player will be destroyed.
|
|
60
58
|
const {
|
|
61
59
|
onPlayerDestroy
|
|
@@ -63,9 +61,7 @@ function THEOplayerView(props) {
|
|
|
63
61
|
if (adapter !== null && adapter !== void 0 && adapter.current && onPlayerDestroy) {
|
|
64
62
|
onPlayerDestroy(adapter === null || adapter === void 0 ? void 0 : adapter.current);
|
|
65
63
|
}
|
|
66
|
-
adapter === null || adapter === void 0 ? void 0 : (_adapter$current = adapter.current) === null || _adapter$current === void 0 ? void 0 : _adapter$current.
|
|
67
|
-
adapter === null || adapter === void 0 ? void 0 : (_adapter$current2 = adapter.current) === null || _adapter$current2 === void 0 ? void 0 : _adapter$current2.destroy();
|
|
68
|
-
player === null || player === void 0 ? void 0 : (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.destroy();
|
|
64
|
+
adapter === null || adapter === void 0 ? void 0 : (_adapter$current = adapter.current) === null || _adapter$current === void 0 ? void 0 : _adapter$current.destroy();
|
|
69
65
|
};
|
|
70
66
|
}, [container]);
|
|
71
67
|
const chromeless = (config === null || config === void 0 ? void 0 : config.chromeless) === undefined || (config === null || config === void 0 ? void 0 : config.chromeless) === true;
|