bitmovin-player-react-native 0.14.0 → 0.14.2
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/RNBitmovinPlayer.podspec +1 -1
- package/android/src/main/java/com/bitmovin/player/reactnative/RNPlayerView.kt +25 -8
- package/ios/DefaultJsonConvertibleEvent.swift +9 -0
- package/ios/Event+JSON.swift +252 -215
- package/ios/JsonConvertible.swift +5 -0
- package/ios/OfflineContentManagerBridge.swift +1 -1
- package/ios/RNPlayerView+PlayerListener.swift +2 -1
- package/package.json +1 -1
package/RNBitmovinPlayer.podspec
CHANGED
|
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
20
20
|
|
|
21
21
|
s.dependency "React-Core"
|
|
22
|
-
s.dependency "BitmovinPlayer", "3.
|
|
22
|
+
s.dependency "BitmovinPlayer", "3.49.0"
|
|
23
23
|
s.ios.dependency "GoogleAds-IMA-iOS-SDK", "3.18.4"
|
|
24
24
|
s.tvos.dependency "GoogleAds-IMA-tvOS-SDK", "4.8.2"
|
|
25
25
|
end
|
|
@@ -25,7 +25,6 @@ import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
|
25
25
|
import kotlin.reflect.KClass
|
|
26
26
|
|
|
27
27
|
private val EVENT_CLASS_TO_REACT_NATIVE_NAME_MAPPING = mapOf(
|
|
28
|
-
PlayerEvent::class to "event",
|
|
29
28
|
PlayerEvent.Error::class to "playerError",
|
|
30
29
|
PlayerEvent.Warning::class to "playerWarning",
|
|
31
30
|
PlayerEvent.Destroy::class to "destroy",
|
|
@@ -139,7 +138,10 @@ class RNPlayerView(
|
|
|
139
138
|
* Relays the provided set of events, emitted by the player, together with the associated name
|
|
140
139
|
* to the `eventOutput` callback.
|
|
141
140
|
*/
|
|
142
|
-
private val playerEventRelay = EventRelay<Player, Event>(
|
|
141
|
+
private val playerEventRelay = EventRelay<Player, Event>(
|
|
142
|
+
EVENT_CLASS_TO_REACT_NATIVE_NAME_MAPPING,
|
|
143
|
+
::emitEventFromPlayer,
|
|
144
|
+
)
|
|
143
145
|
|
|
144
146
|
/**
|
|
145
147
|
* Relays the provided set of events, emitted by the player view, together with the associated name
|
|
@@ -149,6 +151,7 @@ class RNPlayerView(
|
|
|
149
151
|
|
|
150
152
|
private var _playerView: PlayerView? = null
|
|
151
153
|
set(value) {
|
|
154
|
+
field?.removeOnLayoutChangeListener(this)
|
|
152
155
|
field = value
|
|
153
156
|
viewEventRelay.eventEmitter = field
|
|
154
157
|
playerEventRelay.eventEmitter = field?.player
|
|
@@ -157,8 +160,7 @@ class RNPlayerView(
|
|
|
157
160
|
/**
|
|
158
161
|
* Associated Bitmovin's `PlayerView`.
|
|
159
162
|
*/
|
|
160
|
-
val playerView: PlayerView?
|
|
161
|
-
get() = _playerView
|
|
163
|
+
val playerView: PlayerView? get() = _playerView
|
|
162
164
|
|
|
163
165
|
private var subtitleView: SubtitleView? = null
|
|
164
166
|
|
|
@@ -186,11 +188,15 @@ class RNPlayerView(
|
|
|
186
188
|
* Cleans up the resources and listeners produced by this view.
|
|
187
189
|
*/
|
|
188
190
|
fun dispose() {
|
|
189
|
-
viewEventRelay.eventEmitter = null
|
|
190
|
-
playerEventRelay.eventEmitter = null
|
|
191
|
-
playerView?.removeOnLayoutChangeListener(this)
|
|
192
|
-
playerView?.onDestroy()
|
|
193
191
|
activityLifecycle.removeObserver(activityLifecycleObserver)
|
|
192
|
+
|
|
193
|
+
val playerView = _playerView ?: return
|
|
194
|
+
_playerView = null
|
|
195
|
+
// The `RNPlayerView` should not take care of the player lifecycle.
|
|
196
|
+
// As a different component is creating the player instance, the other component
|
|
197
|
+
// is responsible for destroying the player in the end.
|
|
198
|
+
playerView.player = null
|
|
199
|
+
playerView.onDestroy()
|
|
194
200
|
}
|
|
195
201
|
|
|
196
202
|
/**
|
|
@@ -314,6 +320,17 @@ class RNPlayerView(
|
|
|
314
320
|
.getJSModule(RCTEventEmitter::class.java)
|
|
315
321
|
.receiveEvent(id, name, payload)
|
|
316
322
|
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Emits a bubbling event from the player with payload to js
|
|
326
|
+
* and emits it for "event" to support `onEvent` prop.
|
|
327
|
+
* @param name Native event name.
|
|
328
|
+
* @param event Optional js object to be sent as payload.
|
|
329
|
+
*/
|
|
330
|
+
private inline fun <reified E : Event> emitEventFromPlayer(name: String, event: E) {
|
|
331
|
+
emitEvent(name, event)
|
|
332
|
+
emitEvent("event", event)
|
|
333
|
+
}
|
|
317
334
|
}
|
|
318
335
|
|
|
319
336
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import BitmovinPlayer
|
|
2
|
+
|
|
3
|
+
/// Used when the event has no additional data
|
|
4
|
+
internal protocol DefaultJsonConvertibleEvent: JsonConvertible {}
|
|
5
|
+
internal extension DefaultJsonConvertibleEvent where Self: Event {
|
|
6
|
+
func toJSON() -> [AnyHashable: Any] {
|
|
7
|
+
toEventJSON { [:] }
|
|
8
|
+
}
|
|
9
|
+
}
|
package/ios/Event+JSON.swift
CHANGED
|
@@ -15,68 +15,75 @@ extension Source {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
extension
|
|
18
|
+
extension NSError: JsonConvertible {
|
|
19
19
|
func toJSON() -> [AnyHashable: Any] {
|
|
20
20
|
[
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"source": from.source.toJSON()
|
|
26
|
-
],
|
|
27
|
-
"to": [
|
|
28
|
-
"time": to.time,
|
|
29
|
-
"source": to.source.toJSON()
|
|
30
|
-
]
|
|
21
|
+
"code": code,
|
|
22
|
+
"domain": domain,
|
|
23
|
+
"description": description,
|
|
24
|
+
"localizedDescription": localizedDescription
|
|
31
25
|
]
|
|
32
26
|
}
|
|
33
27
|
}
|
|
34
28
|
|
|
35
|
-
extension
|
|
29
|
+
extension DeficiencyData: JsonConvertible {
|
|
36
30
|
func toJSON() -> [AnyHashable: Any] {
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
]
|
|
31
|
+
var json: [AnyHashable: Any] = ["code": code, "message": message]
|
|
32
|
+
if let underlyingError {
|
|
33
|
+
json["underlyingError"] = underlyingError.toJSON()
|
|
34
|
+
}
|
|
35
|
+
return json
|
|
43
36
|
}
|
|
44
37
|
}
|
|
45
38
|
|
|
46
|
-
extension
|
|
47
|
-
func
|
|
48
|
-
|
|
39
|
+
extension Event where Self: JsonConvertible {
|
|
40
|
+
func toEventJSON(_ eventPayloadBuilder: () -> [AnyHashable: Any]) -> [AnyHashable: Any] {
|
|
41
|
+
var json: [AnyHashable: Any] = [
|
|
42
|
+
"name": name,
|
|
43
|
+
"timestamp": timestamp,
|
|
44
|
+
]
|
|
45
|
+
json.merge(eventPayloadBuilder()) { _, new in new }
|
|
46
|
+
return json
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
extension
|
|
50
|
+
extension SeekEvent: JsonConvertible {
|
|
53
51
|
func toJSON() -> [AnyHashable: Any] {
|
|
54
|
-
|
|
52
|
+
toEventJSON {
|
|
53
|
+
[
|
|
54
|
+
"from": [
|
|
55
|
+
"time": from.time,
|
|
56
|
+
"source": from.source.toJSON()
|
|
57
|
+
],
|
|
58
|
+
"to": [
|
|
59
|
+
"time": to.time,
|
|
60
|
+
"source": to.source.toJSON()
|
|
61
|
+
]
|
|
62
|
+
]
|
|
63
|
+
}
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
extension
|
|
67
|
+
extension TimeShiftEvent: JsonConvertible {
|
|
59
68
|
func toJSON() -> [AnyHashable: Any] {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
toEventJSON {
|
|
70
|
+
[
|
|
71
|
+
"position": position,
|
|
72
|
+
"targetPosition": target
|
|
73
|
+
]
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
extension
|
|
78
|
+
extension TimeChangedEvent: JsonConvertible {
|
|
70
79
|
func toJSON() -> [AnyHashable: Any] {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
json["underlyingError"] = underlyingError.toJSON()
|
|
80
|
+
toEventJSON {
|
|
81
|
+
["currentTime": currentTime]
|
|
74
82
|
}
|
|
75
|
-
return json
|
|
76
83
|
}
|
|
77
84
|
}
|
|
78
85
|
|
|
79
|
-
private protocol ErrorEventType: Event {
|
|
86
|
+
private protocol ErrorEventType: Event, JsonConvertible {
|
|
80
87
|
associatedtype Code
|
|
81
88
|
var code: Code { get }
|
|
82
89
|
var data: DeficiencyData? { get }
|
|
@@ -85,16 +92,16 @@ private protocol ErrorEventType: Event {
|
|
|
85
92
|
|
|
86
93
|
extension ErrorEventType {
|
|
87
94
|
func toJSON() -> [AnyHashable: Any] {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
toEventJSON {
|
|
96
|
+
var json: [AnyHashable: Any] = [
|
|
97
|
+
"code": code,
|
|
98
|
+
"message": message
|
|
99
|
+
]
|
|
100
|
+
if let data {
|
|
101
|
+
json["data"] = data.toJSON()
|
|
102
|
+
}
|
|
103
|
+
return json
|
|
96
104
|
}
|
|
97
|
-
return json
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
|
|
@@ -114,13 +121,15 @@ extension SourceWarningEvent: ErrorEventType {
|
|
|
114
121
|
typealias Code = SourceWarning.Code
|
|
115
122
|
}
|
|
116
123
|
|
|
117
|
-
private protocol SourceEventType: Event {
|
|
124
|
+
private protocol SourceEventType: Event, JsonConvertible {
|
|
118
125
|
var source: Source { get }
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
extension SourceEventType {
|
|
122
129
|
func toJSON() -> [AnyHashable: Any] {
|
|
123
|
-
|
|
130
|
+
toEventJSON {
|
|
131
|
+
["source": source.toJSON()]
|
|
132
|
+
}
|
|
124
133
|
}
|
|
125
134
|
}
|
|
126
135
|
|
|
@@ -128,13 +137,15 @@ extension SourceLoadEvent: SourceEventType {}
|
|
|
128
137
|
extension SourceLoadedEvent: SourceEventType {}
|
|
129
138
|
extension SourceUnloadedEvent: SourceEventType {}
|
|
130
139
|
|
|
131
|
-
private protocol TimedEventType: Event {
|
|
140
|
+
private protocol TimedEventType: Event, JsonConvertible {
|
|
132
141
|
var time: TimeInterval { get }
|
|
133
142
|
}
|
|
134
143
|
|
|
135
144
|
extension TimedEventType {
|
|
136
145
|
func toJSON() -> [AnyHashable: Any] {
|
|
137
|
-
|
|
146
|
+
toEventJSON {
|
|
147
|
+
["time": time]
|
|
148
|
+
}
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
|
|
@@ -142,263 +153,289 @@ extension PlayEvent: TimedEventType {}
|
|
|
142
153
|
extension PausedEvent: TimedEventType {}
|
|
143
154
|
extension PlayingEvent: TimedEventType {}
|
|
144
155
|
|
|
145
|
-
extension AudioAddedEvent {
|
|
156
|
+
extension AudioAddedEvent: JsonConvertible {
|
|
146
157
|
func toJSON() -> [AnyHashable: Any] {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
158
|
+
toEventJSON {
|
|
159
|
+
[
|
|
160
|
+
"audioTrack": RCTConvert.audioTrackJson(audioTrack),
|
|
161
|
+
"time": time
|
|
162
|
+
]
|
|
163
|
+
}
|
|
153
164
|
}
|
|
154
165
|
}
|
|
155
166
|
|
|
156
|
-
extension AudioRemovedEvent {
|
|
167
|
+
extension AudioRemovedEvent: JsonConvertible {
|
|
157
168
|
func toJSON() -> [AnyHashable: Any] {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
toEventJSON {
|
|
170
|
+
[
|
|
171
|
+
"audioTrack": RCTConvert.audioTrackJson(audioTrack),
|
|
172
|
+
"time": time
|
|
173
|
+
]
|
|
174
|
+
}
|
|
164
175
|
}
|
|
165
176
|
}
|
|
166
177
|
|
|
167
|
-
extension AudioChangedEvent {
|
|
178
|
+
extension AudioChangedEvent: JsonConvertible {
|
|
168
179
|
func toJSON() -> [AnyHashable: Any] {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
180
|
+
toEventJSON {
|
|
181
|
+
[
|
|
182
|
+
"oldAudioTrack": RCTConvert.audioTrackJson(audioTrackOld),
|
|
183
|
+
"newAudioTrack": RCTConvert.audioTrackJson(audioTrackNew)
|
|
184
|
+
]
|
|
185
|
+
}
|
|
175
186
|
}
|
|
176
187
|
}
|
|
177
188
|
|
|
178
|
-
extension SubtitleAddedEvent {
|
|
189
|
+
extension SubtitleAddedEvent: JsonConvertible {
|
|
179
190
|
func toJSON() -> [AnyHashable: Any] {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
191
|
+
toEventJSON {
|
|
192
|
+
[
|
|
193
|
+
"subtitleTrack": RCTConvert.subtitleTrackJson(subtitleTrack)
|
|
194
|
+
]
|
|
195
|
+
}
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
198
|
|
|
188
|
-
extension SubtitleRemovedEvent {
|
|
199
|
+
extension SubtitleRemovedEvent: JsonConvertible {
|
|
189
200
|
func toJSON() -> [AnyHashable: Any] {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
201
|
+
toEventJSON {
|
|
202
|
+
[
|
|
203
|
+
"subtitleTrack": RCTConvert.subtitleTrackJson(subtitleTrack)
|
|
204
|
+
]
|
|
205
|
+
}
|
|
195
206
|
}
|
|
196
207
|
}
|
|
197
208
|
|
|
198
|
-
extension SubtitleChangedEvent {
|
|
209
|
+
extension SubtitleChangedEvent: JsonConvertible {
|
|
199
210
|
func toJSON() -> [AnyHashable: Any] {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
toEventJSON {
|
|
212
|
+
[
|
|
213
|
+
"oldSubtitleTrack": RCTConvert.subtitleTrackJson(subtitleTrackOld),
|
|
214
|
+
"newSubtitleTrack": RCTConvert.subtitleTrackJson(subtitleTrackNew)
|
|
215
|
+
]
|
|
216
|
+
}
|
|
206
217
|
}
|
|
207
218
|
}
|
|
208
219
|
|
|
209
|
-
extension AdBreakFinishedEvent {
|
|
220
|
+
extension AdBreakFinishedEvent: JsonConvertible {
|
|
210
221
|
func toJSON() -> [AnyHashable: Any] {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
222
|
+
toEventJSON {
|
|
223
|
+
[
|
|
224
|
+
"adBreak": RCTConvert.toJson(adBreak: adBreak)
|
|
225
|
+
]
|
|
226
|
+
}
|
|
216
227
|
}
|
|
217
228
|
}
|
|
218
229
|
|
|
219
|
-
extension AdBreakStartedEvent {
|
|
230
|
+
extension AdBreakStartedEvent: JsonConvertible {
|
|
220
231
|
func toJSON() -> [AnyHashable: Any] {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
232
|
+
toEventJSON {
|
|
233
|
+
[
|
|
234
|
+
"adBreak": RCTConvert.toJson(adBreak: adBreak)
|
|
235
|
+
]
|
|
236
|
+
}
|
|
226
237
|
}
|
|
227
238
|
}
|
|
228
239
|
|
|
229
|
-
extension AdClickedEvent {
|
|
240
|
+
extension AdClickedEvent: JsonConvertible {
|
|
230
241
|
func toJSON() -> [AnyHashable: Any] {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
242
|
+
toEventJSON {
|
|
243
|
+
[
|
|
244
|
+
"clickThroughUrl": clickThroughUrl
|
|
245
|
+
]
|
|
246
|
+
}
|
|
236
247
|
}
|
|
237
248
|
}
|
|
238
249
|
|
|
239
|
-
extension AdErrorEvent {
|
|
250
|
+
extension AdErrorEvent: JsonConvertible {
|
|
240
251
|
func toJSON() -> [AnyHashable: Any] {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
toEventJSON {
|
|
253
|
+
[
|
|
254
|
+
"adConfig": RCTConvert.toJson(adConfig: adConfig),
|
|
255
|
+
"adItem": RCTConvert.toJson(adItem: adItem),
|
|
256
|
+
"code": code,
|
|
257
|
+
"message": message
|
|
258
|
+
]
|
|
259
|
+
}
|
|
249
260
|
}
|
|
250
261
|
}
|
|
251
262
|
|
|
252
|
-
extension AdFinishedEvent {
|
|
263
|
+
extension AdFinishedEvent: JsonConvertible {
|
|
253
264
|
func toJSON() -> [AnyHashable: Any] {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
265
|
+
toEventJSON {
|
|
266
|
+
[
|
|
267
|
+
"ad": RCTConvert.toJson(ad: ad)
|
|
268
|
+
]
|
|
269
|
+
}
|
|
259
270
|
}
|
|
260
271
|
}
|
|
261
272
|
|
|
262
|
-
extension AdManifestLoadEvent {
|
|
273
|
+
extension AdManifestLoadEvent: JsonConvertible {
|
|
263
274
|
func toJSON() -> [AnyHashable: Any] {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
toEventJSON {
|
|
276
|
+
[
|
|
277
|
+
"adBreak": RCTConvert.toJson(adBreak: adBreak),
|
|
278
|
+
"adConfig": RCTConvert.toJson(adConfig: adConfig)
|
|
279
|
+
]
|
|
280
|
+
}
|
|
270
281
|
}
|
|
271
282
|
}
|
|
272
283
|
|
|
273
|
-
extension AdManifestLoadedEvent {
|
|
284
|
+
extension AdManifestLoadedEvent: JsonConvertible {
|
|
274
285
|
func toJSON() -> [AnyHashable: Any] {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
286
|
+
toEventJSON {
|
|
287
|
+
[
|
|
288
|
+
"adBreak": RCTConvert.toJson(adBreak: adBreak),
|
|
289
|
+
"adConfig": RCTConvert.toJson(adConfig: adConfig),
|
|
290
|
+
"downloadTime": downloadTime
|
|
291
|
+
]
|
|
292
|
+
}
|
|
282
293
|
}
|
|
283
294
|
}
|
|
284
295
|
|
|
285
|
-
extension AdQuartileEvent {
|
|
296
|
+
extension AdQuartileEvent: JsonConvertible {
|
|
286
297
|
func toJSON() -> [AnyHashable: Any] {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
298
|
+
toEventJSON {
|
|
299
|
+
[
|
|
300
|
+
"quartile": RCTConvert.toJson(adQuartile: adQuartile)
|
|
301
|
+
]
|
|
302
|
+
}
|
|
292
303
|
}
|
|
293
304
|
}
|
|
294
305
|
|
|
295
|
-
extension AdScheduledEvent {
|
|
306
|
+
extension AdScheduledEvent: JsonConvertible {
|
|
296
307
|
func toJSON() -> [AnyHashable: Any] {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
308
|
+
toEventJSON {
|
|
309
|
+
[
|
|
310
|
+
"numberOfAds": numberOfAds
|
|
311
|
+
]
|
|
312
|
+
}
|
|
302
313
|
}
|
|
303
314
|
}
|
|
304
315
|
|
|
305
|
-
extension AdSkippedEvent {
|
|
316
|
+
extension AdSkippedEvent: JsonConvertible {
|
|
306
317
|
func toJSON() -> [AnyHashable: Any] {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
318
|
+
toEventJSON {
|
|
319
|
+
[
|
|
320
|
+
"ad": RCTConvert.toJson(ad: ad)
|
|
321
|
+
]
|
|
322
|
+
}
|
|
312
323
|
}
|
|
313
324
|
}
|
|
314
325
|
|
|
315
|
-
extension AdStartedEvent {
|
|
326
|
+
extension AdStartedEvent: JsonConvertible {
|
|
316
327
|
func toJSON() -> [AnyHashable: Any] {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
328
|
+
toEventJSON {
|
|
329
|
+
[
|
|
330
|
+
"ad": RCTConvert.toJson(ad: ad),
|
|
331
|
+
"clickThroughUrl": clickThroughUrl?.absoluteString,
|
|
332
|
+
"clientType": RCTConvert.toJson(adSourceType: clientType),
|
|
333
|
+
"duration": duration,
|
|
334
|
+
"indexInQueue": indexInQueue,
|
|
335
|
+
"position": position,
|
|
336
|
+
"skipOffset": skipOffset,
|
|
337
|
+
"timeOffset": timeOffset
|
|
338
|
+
]
|
|
339
|
+
}
|
|
329
340
|
}
|
|
330
341
|
}
|
|
331
342
|
|
|
332
|
-
extension VideoDownloadQualityChangedEvent {
|
|
343
|
+
extension VideoDownloadQualityChangedEvent: JsonConvertible {
|
|
333
344
|
func toJSON() -> [AnyHashable: Any] {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
345
|
+
toEventJSON {
|
|
346
|
+
[
|
|
347
|
+
"newVideoQuality": RCTConvert.toJson(videoQuality: videoQualityNew),
|
|
348
|
+
"oldVideoQuality": RCTConvert.toJson(videoQuality: videoQualityOld),
|
|
349
|
+
]
|
|
350
|
+
}
|
|
340
351
|
}
|
|
341
352
|
}
|
|
342
353
|
|
|
343
|
-
extension VideoPlaybackQualityChangedEvent {
|
|
354
|
+
extension VideoPlaybackQualityChangedEvent: JsonConvertible {
|
|
344
355
|
func toJSON() -> [AnyHashable: Any] {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
356
|
+
toEventJSON {
|
|
357
|
+
[
|
|
358
|
+
"newVideoQuality": RCTConvert.toJson(videoQuality: videoQualityNew),
|
|
359
|
+
"oldVideoQuality": RCTConvert.toJson(videoQuality: videoQualityOld),
|
|
360
|
+
]
|
|
361
|
+
}
|
|
351
362
|
}
|
|
352
363
|
}
|
|
353
364
|
|
|
354
|
-
extension CastStartedEvent {
|
|
365
|
+
extension CastStartedEvent: JsonConvertible {
|
|
355
366
|
func toJSON() -> [AnyHashable: Any] {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
367
|
+
toEventJSON {
|
|
368
|
+
[
|
|
369
|
+
"deviceName": deviceName
|
|
370
|
+
]
|
|
371
|
+
}
|
|
361
372
|
}
|
|
362
373
|
}
|
|
363
374
|
|
|
364
375
|
#if os(iOS)
|
|
365
|
-
extension CastWaitingForDeviceEvent {
|
|
376
|
+
extension CastWaitingForDeviceEvent: JsonConvertible {
|
|
366
377
|
func toJSON() -> [AnyHashable: Any] {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
378
|
+
toEventJSON {
|
|
379
|
+
[
|
|
380
|
+
"castPayload": RCTConvert.toJson(castPayload: castPayload)
|
|
381
|
+
]
|
|
382
|
+
}
|
|
372
383
|
}
|
|
373
384
|
}
|
|
374
385
|
#endif
|
|
375
386
|
|
|
376
|
-
extension DownloadFinishedEvent {
|
|
387
|
+
extension DownloadFinishedEvent: JsonConvertible {
|
|
377
388
|
func toJSON() -> [AnyHashable: Any] {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
389
|
+
toEventJSON {
|
|
390
|
+
var json: [AnyHashable: Any] = [
|
|
391
|
+
"downloadTime": downloadTime,
|
|
392
|
+
"requestType": requestType.rawValue,
|
|
393
|
+
"httpStatus": httpStatus,
|
|
394
|
+
"isSuccess": successful,
|
|
395
|
+
"size": size,
|
|
396
|
+
"url": url.absoluteString
|
|
397
|
+
]
|
|
398
|
+
if let lastRedirectLocation {
|
|
399
|
+
json["lastRedirectLocation"] = lastRedirectLocation.absoluteString
|
|
400
|
+
}
|
|
401
|
+
return json
|
|
390
402
|
}
|
|
391
|
-
return json
|
|
392
403
|
}
|
|
393
404
|
}
|
|
394
405
|
|
|
395
|
-
extension PlaybackSpeedChangedEvent {
|
|
406
|
+
extension PlaybackSpeedChangedEvent: JsonConvertible {
|
|
396
407
|
func toJSON() -> [AnyHashable: Any] {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
408
|
+
toEventJSON {
|
|
409
|
+
[
|
|
410
|
+
"from": from,
|
|
411
|
+
"to": to,
|
|
412
|
+
]
|
|
413
|
+
}
|
|
403
414
|
}
|
|
404
415
|
}
|
|
416
|
+
|
|
417
|
+
extension PlayerActiveEvent: DefaultJsonConvertibleEvent {}
|
|
418
|
+
extension DestroyEvent: DefaultJsonConvertibleEvent {}
|
|
419
|
+
extension MutedEvent: DefaultJsonConvertibleEvent {}
|
|
420
|
+
extension UnmutedEvent: DefaultJsonConvertibleEvent {}
|
|
421
|
+
extension ReadyEvent: DefaultJsonConvertibleEvent {}
|
|
422
|
+
extension PlaybackFinishedEvent: DefaultJsonConvertibleEvent {}
|
|
423
|
+
extension SeekedEvent: DefaultJsonConvertibleEvent {}
|
|
424
|
+
extension TimeShiftedEvent: DefaultJsonConvertibleEvent {}
|
|
425
|
+
extension StallStartedEvent: DefaultJsonConvertibleEvent {}
|
|
426
|
+
extension StallEndedEvent: DefaultJsonConvertibleEvent {}
|
|
427
|
+
extension CastAvailableEvent: DefaultJsonConvertibleEvent {}
|
|
428
|
+
extension CastPausedEvent: DefaultJsonConvertibleEvent {}
|
|
429
|
+
extension CastPlaybackFinishedEvent: DefaultJsonConvertibleEvent {}
|
|
430
|
+
extension CastPlayingEvent: DefaultJsonConvertibleEvent {}
|
|
431
|
+
extension CastStartEvent: DefaultJsonConvertibleEvent {}
|
|
432
|
+
extension CastStoppedEvent: DefaultJsonConvertibleEvent {}
|
|
433
|
+
extension CastTimeUpdatedEvent: DefaultJsonConvertibleEvent {}
|
|
434
|
+
extension PictureInPictureEnterEvent: DefaultJsonConvertibleEvent {}
|
|
435
|
+
extension PictureInPictureEnteredEvent: DefaultJsonConvertibleEvent {}
|
|
436
|
+
extension PictureInPictureExitEvent: DefaultJsonConvertibleEvent {}
|
|
437
|
+
extension PictureInPictureExitedEvent: DefaultJsonConvertibleEvent {}
|
|
438
|
+
extension FullscreenEnterEvent: DefaultJsonConvertibleEvent {}
|
|
439
|
+
extension FullscreenExitEvent: DefaultJsonConvertibleEvent {}
|
|
440
|
+
extension FullscreenEnabledEvent: DefaultJsonConvertibleEvent {}
|
|
441
|
+
extension FullscreenDisabledEvent: DefaultJsonConvertibleEvent {}
|
|
@@ -158,7 +158,7 @@ internal class OfflineContentManagerBridge: NSObject, OfflineContentManagerListe
|
|
|
158
158
|
"state": RCTConvert.toJson(offlineState: offlineContentManager.offlineState)
|
|
159
159
|
]
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
let eventBody = baseEvent.merging(body) { current, _ in current }
|
|
162
162
|
|
|
163
163
|
do {
|
|
164
164
|
try eventEmitter?.sendEvent(withName: "BitmovinOfflineEvent", body: eventBody)
|
|
@@ -2,7 +2,8 @@ import BitmovinPlayer
|
|
|
2
2
|
|
|
3
3
|
extension RNPlayerView: PlayerListener {
|
|
4
4
|
public func onEvent(_ event: Event, player: Player) {
|
|
5
|
-
|
|
5
|
+
guard let jsonConvertibleEvent = event as? JsonConvertible else { return }
|
|
6
|
+
onEvent?(jsonConvertibleEvent.toJSON())
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
public func onPlayerActive(_ event: PlayerActiveEvent, player: Player) {
|