react-native-altibbi 0.1.9 → 0.3.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/README.md +8 -8
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/altibbi/OTPublisherLayout.java +2 -1
- package/android/src/main/java/com/altibbi/OTPublisherViewManager.java +2 -1
- package/android/src/main/java/com/altibbi/OTRN.java +2 -1
- package/android/src/main/java/com/altibbi/OTScreenCapturer.java +1 -0
- package/android/src/main/java/com/altibbi/OTSessionManager.java +91 -33
- package/android/src/main/java/com/altibbi/OTSubscriberLayout.java +0 -1
- package/android/src/main/java/com/altibbi/OTSubscriberViewManager.java +2 -1
- package/android/src/main/java/com/altibbi/utils/EventUtils.java +1 -1
- package/android/src/main/java/com/altibbi/utils/Utils.java +8 -11
- package/ios/OTSessionManager.m +7 -4
- package/ios/OTSessionManager.swift +156 -80
- package/ios/Utils/EventUtils.swift +51 -12
- package/ios/Utils/Utils.swift +21 -12
- package/lib/commonjs/connection.js +101 -6
- package/lib/commonjs/connection.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/scoket.js.map +1 -1
- package/lib/commonjs/video/OT.d.js +3 -0
- package/lib/commonjs/video/OT.d.js.map +1 -1
- package/lib/commonjs/video/OT.js +3 -2
- package/lib/commonjs/video/OT.js.map +1 -1
- package/lib/commonjs/video/OTError.js.map +1 -1
- package/lib/commonjs/video/OTPublisher.d.js +2 -2
- package/lib/commonjs/video/OTPublisher.d.js.map +1 -1
- package/lib/commonjs/video/OTPublisher.js +27 -7
- package/lib/commonjs/video/OTPublisher.js.map +1 -1
- package/lib/commonjs/video/OTSession.d.js +2 -1
- package/lib/commonjs/video/OTSession.d.js.map +1 -1
- package/lib/commonjs/video/OTSession.js +25 -5
- package/lib/commonjs/video/OTSession.js.map +1 -1
- package/lib/commonjs/video/OTSubscriber.d.js +2 -2
- package/lib/commonjs/video/OTSubscriber.d.js.map +1 -1
- package/lib/commonjs/video/OTSubscriber.js +20 -4
- package/lib/commonjs/video/OTSubscriber.js.map +1 -1
- package/lib/commonjs/video/contexts/OTContext.js +1 -1
- package/lib/commonjs/video/contexts/OTContext.js.map +1 -1
- package/lib/commonjs/video/helpers/OTHelper.js +2 -2
- package/lib/commonjs/video/helpers/OTHelper.js.map +1 -1
- package/lib/commonjs/video/helpers/OTPublisherHelper.js +47 -8
- package/lib/commonjs/video/helpers/OTPublisherHelper.js.map +1 -1
- package/lib/commonjs/video/helpers/OTSessionHelper.js +7 -1
- package/lib/commonjs/video/helpers/OTSessionHelper.js.map +1 -1
- package/lib/commonjs/video/helpers/OTSubscriberHelper.js +1 -1
- package/lib/commonjs/video/index.d.js +1 -1
- package/lib/commonjs/video/index.d.js.map +1 -1
- package/lib/commonjs/video/index.js +1 -1
- package/lib/commonjs/video/index.js.map +1 -1
- package/lib/module/connection.js +92 -4
- package/lib/module/connection.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/scoket.js.map +1 -1
- package/lib/module/video/OT.d.js +2 -1
- package/lib/module/video/OT.d.js.map +1 -1
- package/lib/module/video/OT.js +3 -2
- package/lib/module/video/OT.js.map +1 -1
- package/lib/module/video/OTError.js.map +1 -1
- package/lib/module/video/OTPublisher.d.js +1 -1
- package/lib/module/video/OTPublisher.d.js.map +1 -1
- package/lib/module/video/OTPublisher.js +26 -6
- package/lib/module/video/OTPublisher.js.map +1 -1
- package/lib/module/video/OTSession.d.js +1 -1
- package/lib/module/video/OTSession.d.js.map +1 -1
- package/lib/module/video/OTSession.js +25 -5
- package/lib/module/video/OTSession.js.map +1 -1
- package/lib/module/video/OTSubscriber.d.js +1 -1
- package/lib/module/video/OTSubscriber.d.js.map +1 -1
- package/lib/module/video/OTSubscriber.js +19 -3
- package/lib/module/video/OTSubscriber.js.map +1 -1
- package/lib/module/video/helpers/OTHelper.js +1 -1
- package/lib/module/video/helpers/OTHelper.js.map +1 -1
- package/lib/module/video/helpers/OTPublisherHelper.js +47 -8
- package/lib/module/video/helpers/OTPublisherHelper.js.map +1 -1
- package/lib/module/video/helpers/OTSessionHelper.js +6 -1
- package/lib/module/video/helpers/OTSessionHelper.js.map +1 -1
- package/lib/module/video/helpers/OTSubscriberHelper.js +1 -1
- package/lib/typescript/src/connection.d.ts +11 -3
- package/lib/typescript/src/connection.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +73 -13
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/video/OT.d.ts +1 -1
- package/lib/typescript/src/video/OT.d.ts.map +1 -1
- package/lib/typescript/src/video/OTPublisher.d.ts +7 -1
- package/lib/typescript/src/video/OTPublisher.d.ts.map +1 -1
- package/lib/typescript/src/video/OTSession.d.ts +3 -1
- package/lib/typescript/src/video/OTSession.d.ts.map +1 -1
- package/lib/typescript/src/video/OTSubscriber.d.ts +7 -1
- package/lib/typescript/src/video/OTSubscriber.d.ts.map +1 -1
- package/lib/typescript/src/video/helpers/OTPublisherHelper.d.ts +2 -1
- package/lib/typescript/src/video/helpers/OTPublisherHelper.d.ts.map +1 -1
- package/lib/typescript/src/video/helpers/OTSessionHelper.d.ts +1 -0
- package/lib/typescript/src/video/helpers/OTSessionHelper.d.ts.map +1 -1
- package/lib/typescript/src/video/views/OTPublisherView.d.ts.map +1 -1
- package/lib/typescript/src/video/views/OTSubscriberView.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-altibbi.podspec +2 -2
- package/src/connection.ts +123 -6
- package/src/index.tsx +2 -0
- package/src/types.ts +77 -11
- package/src/video/OT.d.ts +5 -14
- package/src/video/OT.js +6 -4
- package/src/video/OTPublisher.d.ts +16 -10
- package/src/video/OTPublisher.js +37 -5
- package/src/video/OTSession.d.ts +42 -41
- package/src/video/OTSession.js +23 -4
- package/src/video/OTSubscriber.d.ts +12 -6
- package/src/video/OTSubscriber.js +25 -3
- package/src/video/helpers/OTHelper.js +1 -1
- package/src/video/helpers/OTPublisherHelper.js +56 -6
- package/src/video/helpers/OTSessionHelper.js +7 -0
- package/src/video/helpers/OTSubscriberHelper.js +1 -1
- package/android/src/main/java/com/altibbi/OTCustomAudioDevice.java +0 -1146
|
@@ -10,11 +10,11 @@ import Foundation
|
|
|
10
10
|
|
|
11
11
|
@objc(OTSessionManager)
|
|
12
12
|
class OTSessionManager: RCTEventEmitter {
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
var jsEvents: [String] = [];
|
|
15
15
|
var componentEvents: [String] = [];
|
|
16
16
|
var logLevel: Bool = false;
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
deinit {
|
|
19
19
|
OTRN.sharedState.subscriberStreams.removeAll();
|
|
20
20
|
OTRN.sharedState.sessions.removeAll();
|
|
@@ -28,16 +28,16 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
28
28
|
OTRN.sharedState.streamObservers.removeAll();
|
|
29
29
|
OTRN.sharedState.connections.removeAll();
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
override static func requiresMainQueueSetup() -> Bool {
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
@objc override func supportedEvents() -> [String] {
|
|
37
37
|
let allEvents = EventUtils.getSupportedEvents();
|
|
38
38
|
return allEvents + jsEvents
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
@objc func initSession(_ apiKey: String, sessionId: String, sessionOptions: Dictionary<String, Any>) -> Void {
|
|
42
42
|
let enableStereoOutput: Bool = Utils.sanitizeBooleanProperty(sessionOptions["enableStereoOutput"] as Any);
|
|
43
43
|
if enableStereoOutput == true {
|
|
@@ -54,7 +54,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
54
54
|
settings.iceConfig = Utils.sanitizeIceServer(sessionOptions["customServers"] as Any, sessionOptions["transportPolicy"] as Any, sessionOptions["includeServers"] as Any);
|
|
55
55
|
OTRN.sharedState.sessions.updateValue(OTSession(apiKey: apiKey, sessionId: sessionId, delegate: self, settings: settings)!, forKey: sessionId);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
@objc func connect(_ sessionId: String, token: String, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
59
59
|
var error: OTError?
|
|
60
60
|
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
@@ -69,7 +69,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
69
69
|
OTRN.sharedState.sessionConnectCallbacks[sessionId] = callback;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
@objc func initPublisher(_ publisherId: String, properties: Dictionary<String, Any>, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
74
74
|
DispatchQueue.main.async {
|
|
75
75
|
let publisherProperties = OTPublisherSettings()
|
|
@@ -82,6 +82,8 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
82
82
|
publisherProperties.cameraResolution = Utils.sanitizeCameraResolution(properties["resolution"] as Any);
|
|
83
83
|
publisherProperties.enableOpusDtx = Utils.sanitizeBooleanProperty(properties["enableDtx"] as Any);
|
|
84
84
|
publisherProperties.name = properties["name"] as? String;
|
|
85
|
+
publisherProperties.publisherAudioFallbackEnabled = Utils.sanitizeBooleanProperty(properties["publisherAudioFallback"] as Any);
|
|
86
|
+
publisherProperties.subscriberAudioFallbackEnabled = Utils.sanitizeBooleanProperty(properties["subscriberAudioFallback"] as Any);
|
|
85
87
|
publisherProperties.videoCapture?.videoContentHint = Utils.convertVideoContentHint(properties["videoContentHint"] as Any)
|
|
86
88
|
OTRN.sharedState.publishers.updateValue(OTPublisher(delegate: self, settings: publisherProperties)!, forKey: publisherId);
|
|
87
89
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else {
|
|
@@ -108,11 +110,12 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
108
110
|
publisher.publishVideo = Utils.sanitizeBooleanProperty(properties["publishVideo"] as Any);
|
|
109
111
|
publisher.publishCaptions = Utils.sanitizeBooleanProperty(properties["publishCaptions"] as Any);
|
|
110
112
|
publisher.audioLevelDelegate = self;
|
|
113
|
+
publisher.networkStatsDelegate = self;
|
|
111
114
|
publisher.rtcStatsReportDelegate = self;
|
|
112
115
|
callback([NSNull()]);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
|
-
|
|
118
|
+
|
|
116
119
|
@objc func publish(_ sessionId: String, publisherId: String, callback: RCTResponseSenderBlock) -> Void {
|
|
117
120
|
var error: OTError?
|
|
118
121
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else {
|
|
@@ -132,7 +135,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
132
135
|
callback([NSNull()])
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
|
-
|
|
138
|
+
|
|
136
139
|
@objc func subscribeToStream(_ streamId: String, sessionId: String, properties: Dictionary<String, Any>, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
137
140
|
var error: OTError?
|
|
138
141
|
DispatchQueue.main.async {
|
|
@@ -165,6 +168,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
165
168
|
subscriber.audioVolume = audioVolume;
|
|
166
169
|
}
|
|
167
170
|
subscriber.rtcStatsReportDelegate = self;
|
|
171
|
+
subscriber.captionsDelegate = self;
|
|
168
172
|
if let err = error {
|
|
169
173
|
self.dispatchErrorViaCallback(callback, error: err)
|
|
170
174
|
} else {
|
|
@@ -172,7 +176,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
}
|
|
175
|
-
|
|
179
|
+
|
|
176
180
|
@objc func removeSubscriber(_ streamId: String, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
177
181
|
DispatchQueue.main.async {
|
|
178
182
|
OTRN.sharedState.streamObservers.removeValue(forKey: streamId);
|
|
@@ -186,9 +190,9 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
186
190
|
self.removeStream(streamId)
|
|
187
191
|
callback([NSNull()])
|
|
188
192
|
}
|
|
189
|
-
|
|
193
|
+
|
|
190
194
|
}
|
|
191
|
-
|
|
195
|
+
|
|
192
196
|
@objc func disconnectSession(_ sessionId: String, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
193
197
|
var error: OTError?
|
|
194
198
|
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
@@ -203,67 +207,73 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
203
207
|
OTRN.sharedState.sessionDisconnectCallbacks[sessionId] = callback;
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
|
-
|
|
210
|
+
|
|
207
211
|
@objc func publishAudio(_ publisherId: String, pubAudio: Bool) -> Void {
|
|
208
212
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else { return }
|
|
209
213
|
publisher.publishAudio = pubAudio;
|
|
210
214
|
}
|
|
211
|
-
|
|
215
|
+
|
|
212
216
|
@objc func publishVideo(_ publisherId: String, pubVideo: Bool) -> Void {
|
|
213
217
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else { return }
|
|
214
218
|
publisher.publishVideo = pubVideo;
|
|
215
219
|
}
|
|
216
220
|
|
|
221
|
+
@objc func publishCaptions(_ publisherId: String, pubCaptions: Bool) -> Void {
|
|
222
|
+
guard let publisher = OTRN.sharedState.publishers[publisherId] else { return }
|
|
223
|
+
publisher.publishCaptions = pubCaptions;
|
|
224
|
+
}
|
|
225
|
+
|
|
217
226
|
@objc func getRtcStatsReport(_ publisherId: String) -> Void {
|
|
218
227
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else { return }
|
|
219
228
|
publisher.getRtcStatsReport()
|
|
220
229
|
}
|
|
221
|
-
|
|
230
|
+
|
|
222
231
|
@objc func subscribeToAudio(_ streamId: String, subAudio: Bool) -> Void {
|
|
223
232
|
guard let subscriber = OTRN.sharedState.subscribers[streamId] else { return }
|
|
224
233
|
subscriber.subscribeToAudio = subAudio;
|
|
225
234
|
}
|
|
226
|
-
|
|
235
|
+
|
|
227
236
|
@objc func subscribeToVideo(_ streamId: String, subVideo: Bool) -> Void {
|
|
228
237
|
guard let subscriber = OTRN.sharedState.subscribers[streamId] else { return }
|
|
229
238
|
subscriber.subscribeToVideo = subVideo;
|
|
230
239
|
}
|
|
231
|
-
|
|
240
|
+
|
|
232
241
|
@objc func subscribeToCaptions(_ streamId: String, subCaptions: Bool) -> Void {
|
|
233
242
|
guard let subscriber = OTRN.sharedState.subscribers[streamId] else { return }
|
|
234
243
|
subscriber.subscribeToCaptions = subCaptions;
|
|
235
244
|
}
|
|
236
|
-
|
|
245
|
+
|
|
237
246
|
@objc func setPreferredResolution(_ streamId: String, resolution: NSDictionary) -> Void {
|
|
238
247
|
guard let subscriber = OTRN.sharedState.subscribers[streamId] else { return }
|
|
239
248
|
subscriber.preferredResolution = Utils.sanitizePreferredResolution(resolution);
|
|
240
249
|
}
|
|
241
|
-
|
|
250
|
+
|
|
242
251
|
@objc func setPreferredFrameRate(_ streamId: String, frameRate: Float) -> Void {
|
|
243
252
|
guard let subscriber = OTRN.sharedState.subscribers[streamId] else { return }
|
|
244
253
|
subscriber.preferredFrameRate = Utils.sanitizePreferredFrameRate(frameRate);
|
|
245
254
|
}
|
|
246
|
-
|
|
255
|
+
|
|
247
256
|
@objc func setAudioVolume(_ streamId: String, audioVolume: Double) -> Void {
|
|
248
257
|
guard let subscriber = OTRN.sharedState.subscribers[streamId] else { return }
|
|
249
258
|
subscriber.audioVolume = audioVolume;
|
|
250
259
|
}
|
|
251
|
-
|
|
252
|
-
@objc func getSubscriberRtcStatsReport(
|
|
253
|
-
|
|
254
|
-
|
|
260
|
+
|
|
261
|
+
@objc func getSubscriberRtcStatsReport() -> Void {
|
|
262
|
+
for subscriber in OTRN.sharedState.subscribers {
|
|
263
|
+
subscriber.value.getRtcStatsReport()
|
|
264
|
+
}
|
|
255
265
|
}
|
|
256
|
-
|
|
266
|
+
|
|
257
267
|
@objc func changeCameraPosition(_ publisherId: String, cameraPosition: String) -> Void {
|
|
258
268
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else { return }
|
|
259
269
|
publisher.cameraPosition = cameraPosition == "front" ? .front : .back;
|
|
260
270
|
}
|
|
261
|
-
|
|
271
|
+
|
|
262
272
|
@objc func changeVideoContentHint(_ publisherId: String, videoContentHint: String) -> Void {
|
|
263
273
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else { return }
|
|
264
274
|
publisher.videoCapture?.videoContentHint = Utils.convertVideoContentHint(videoContentHint);
|
|
265
275
|
}
|
|
266
|
-
|
|
276
|
+
|
|
267
277
|
@objc func setNativeEvents(_ events: Array<String>) -> Void {
|
|
268
278
|
for event in events {
|
|
269
279
|
if (!self.jsEvents.contains(event)) {
|
|
@@ -271,13 +281,13 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
271
281
|
}
|
|
272
282
|
}
|
|
273
283
|
}
|
|
274
|
-
|
|
284
|
+
|
|
275
285
|
@objc func setJSComponentEvents(_ events: Array<String>) -> Void {
|
|
276
286
|
for event in events {
|
|
277
287
|
self.componentEvents.append(event);
|
|
278
288
|
}
|
|
279
289
|
}
|
|
280
|
-
|
|
290
|
+
|
|
281
291
|
@objc func removeJSComponentEvents(_ events: Array<String>) -> Void {
|
|
282
292
|
for event in events {
|
|
283
293
|
if let i = self.componentEvents.index(of: event) {
|
|
@@ -285,7 +295,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
285
295
|
}
|
|
286
296
|
}
|
|
287
297
|
}
|
|
288
|
-
|
|
298
|
+
|
|
289
299
|
@objc func sendSignal(_ sessionId: String, signal: Dictionary<String, String>, callback: RCTResponseSenderBlock ) -> Void {
|
|
290
300
|
var error: OTError?
|
|
291
301
|
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
@@ -306,7 +316,22 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
306
316
|
callback([NSNull()])
|
|
307
317
|
}
|
|
308
318
|
}
|
|
309
|
-
|
|
319
|
+
|
|
320
|
+
@objc func setEncryptionSecret(_ sessionId: String, secret: String, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
321
|
+
var error: OTError?
|
|
322
|
+
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
323
|
+
let errorInfo = EventUtils.createErrorMessage("Error setting encryption secret. Could not find native session instance.")
|
|
324
|
+
callback([errorInfo])
|
|
325
|
+
return
|
|
326
|
+
}
|
|
327
|
+
session.setEncryptionSecret(secret, error: &error)
|
|
328
|
+
if let err = error {
|
|
329
|
+
dispatchErrorViaCallback(callback, error: err)
|
|
330
|
+
} else {
|
|
331
|
+
callback([NSNull()])
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
310
335
|
@objc func destroyPublisher(_ publisherId: String, callback: @escaping RCTResponseSenderBlock) -> Void {
|
|
311
336
|
DispatchQueue.main.async {
|
|
312
337
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else { callback([NSNull()]); return }
|
|
@@ -332,7 +357,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
332
357
|
self.dispatchErrorViaCallback(callback, error: err)
|
|
333
358
|
}
|
|
334
359
|
}
|
|
335
|
-
|
|
360
|
+
|
|
336
361
|
@objc func setVideoTransformers(_ publisherId: String, videoTransformers: Array<Any>) -> Void {
|
|
337
362
|
guard let publisher = OTRN.sharedState.publishers[publisherId] else {
|
|
338
363
|
return // To do -- handle error
|
|
@@ -356,7 +381,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
356
381
|
}
|
|
357
382
|
publisher.videoTransformers = nativeTransformers
|
|
358
383
|
}
|
|
359
|
-
|
|
384
|
+
|
|
360
385
|
@objc func removeNativeEvents(_ events: Array<String>) -> Void {
|
|
361
386
|
for event in events {
|
|
362
387
|
if let i = self.jsEvents.index(of: event) {
|
|
@@ -364,14 +389,14 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
364
389
|
}
|
|
365
390
|
}
|
|
366
391
|
}
|
|
367
|
-
|
|
392
|
+
|
|
368
393
|
@objc func getSessionInfo(_ sessionId: String, callback: RCTResponseSenderBlock) -> Void {
|
|
369
394
|
guard let session = OTRN.sharedState.sessions[sessionId] else { callback([NSNull()]); return }
|
|
370
395
|
var sessionInfo: Dictionary<String, Any> = EventUtils.prepareJSSessionEventData(session);
|
|
371
396
|
sessionInfo["connectionStatus"] = session.sessionConnectionStatus.rawValue;
|
|
372
397
|
callback([sessionInfo]);
|
|
373
398
|
}
|
|
374
|
-
|
|
399
|
+
|
|
375
400
|
@objc func getSessionCapabilities(_ sessionId: String, callback: RCTResponseSenderBlock) -> Void{
|
|
376
401
|
guard let session = OTRN.sharedState.sessions[sessionId] else { callback([NSNull()]); return }
|
|
377
402
|
var sessionCapabilities: Dictionary<String, Any> = [:];
|
|
@@ -381,14 +406,14 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
381
406
|
sessionCapabilities["canForceMute"] = session.capabilities?.canForceMute;
|
|
382
407
|
callback([sessionCapabilities]);
|
|
383
408
|
}
|
|
384
|
-
|
|
409
|
+
|
|
385
410
|
@objc func reportIssue(_ sessionId: String, callback: RCTResponseSenderBlock) -> Void{
|
|
386
411
|
guard let session = OTRN.sharedState.sessions[sessionId] else { callback([NSNull()]); return }
|
|
387
412
|
var issueId:NSString? = ""
|
|
388
413
|
session.reportIssue(&issueId)
|
|
389
414
|
callback([issueId! as NSString])
|
|
390
415
|
}
|
|
391
|
-
|
|
416
|
+
|
|
392
417
|
// The OpenTok iOS SDK does not implement a getVideoCodecs method, because iOS
|
|
393
418
|
// supported all supported codecs. But we will implement it here so that the
|
|
394
419
|
// OT.getVideoCodecs() method can be called cross-platform.
|
|
@@ -398,17 +423,30 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
398
423
|
supportedCodecs["videoEncoderCodecs"] = ["H.264", "VP8"];
|
|
399
424
|
resolve(supportedCodecs)
|
|
400
425
|
}
|
|
401
|
-
|
|
402
|
-
@objc func forceMuteAll(_ sessionId: String, excludedStreamIds:
|
|
426
|
+
|
|
427
|
+
@objc func forceMuteAll(_ sessionId: String, excludedStreamIds: Array<String>, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void{
|
|
403
428
|
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
404
429
|
reject("event_failure", "Session ID not found", nil)
|
|
405
430
|
return
|
|
406
431
|
}
|
|
407
|
-
|
|
432
|
+
var excludedStreams:[OTStream] = []
|
|
433
|
+
for streamId in excludedStreamIds {
|
|
434
|
+
guard let stream = OTRN.sharedState.subscriberStreams[streamId] ?? OTRN.sharedState.publisherStreams[streamId] else {
|
|
435
|
+
continue // Ignore bogus stream IDs
|
|
436
|
+
}
|
|
437
|
+
excludedStreams.append(stream)
|
|
438
|
+
}
|
|
439
|
+
var error: OTError?
|
|
440
|
+
session.forceMuteAll(excludedStreams, error: &error)
|
|
441
|
+
if let error = error {
|
|
442
|
+
reject("event_failure", error.localizedDescription, nil)
|
|
443
|
+
return
|
|
444
|
+
}
|
|
445
|
+
return resolve(true)
|
|
408
446
|
}
|
|
409
447
|
|
|
410
448
|
@objc func forceMuteStream(_ sessionId: String, streamId: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void{
|
|
411
|
-
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
449
|
+
guard let session = OTRN.sharedState.sessions[sessionId] else {
|
|
412
450
|
reject("event_failure", "Session ID not found", nil);
|
|
413
451
|
return
|
|
414
452
|
}
|
|
@@ -438,39 +476,39 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
438
476
|
}
|
|
439
477
|
resolve(true);
|
|
440
478
|
}
|
|
441
|
-
|
|
479
|
+
|
|
442
480
|
@objc func enableLogs(_ logLevel: Bool) -> Void {
|
|
443
481
|
self.logLevel = logLevel;
|
|
444
482
|
}
|
|
445
|
-
|
|
483
|
+
|
|
446
484
|
func resetPublisher(_ publisherId: String, publisher: OTPublisher) -> Void {
|
|
447
485
|
publisher.view?.removeFromSuperview()
|
|
448
486
|
OTRN.sharedState.isPublishing[publisherId] = false;
|
|
449
487
|
}
|
|
450
|
-
|
|
488
|
+
|
|
451
489
|
func removeStream(_ streamId: String) -> Void {
|
|
452
490
|
OTRN.sharedState.subscribers.removeValue(forKey: streamId)
|
|
453
491
|
OTRN.sharedState.subscriberStreams.removeValue(forKey: streamId)
|
|
454
492
|
}
|
|
455
|
-
|
|
493
|
+
|
|
456
494
|
func emitEvent(_ event: String, data: Any) -> Void {
|
|
457
495
|
if (self.bridge != nil && (self.jsEvents.contains(event) || self.componentEvents.contains(event))) {
|
|
458
496
|
self.sendEvent(withName: event, body: data);
|
|
459
497
|
}
|
|
460
498
|
}
|
|
461
|
-
|
|
499
|
+
|
|
462
500
|
func checkAndEmitStreamPropertyChangeEvent(_ streamId: String, changedProperty: String, oldValue: Any, newValue: Any, isPublisherStream: Bool) {
|
|
463
501
|
guard let stream = isPublisherStream ? OTRN.sharedState.publisherStreams[streamId] : OTRN.sharedState.subscriberStreams[streamId] else { return }
|
|
464
502
|
let streamInfo: Dictionary<String, Any> = EventUtils.prepareJSStreamEventData(stream);
|
|
465
503
|
let eventData: Dictionary<String, Any> = EventUtils.prepareStreamPropertyChangedEventData(changedProperty, oldValue: oldValue, newValue: newValue, stream: streamInfo);
|
|
466
504
|
self.emitEvent("\(stream.session.sessionId):\(EventUtils.sessionPreface)streamPropertyChanged", data: eventData)
|
|
467
505
|
}
|
|
468
|
-
|
|
506
|
+
|
|
469
507
|
func dispatchErrorViaCallback(_ callback: RCTResponseSenderBlock, error: OTError) {
|
|
470
508
|
let errorInfo = EventUtils.prepareJSErrorEventData(error);
|
|
471
509
|
callback([errorInfo]);
|
|
472
510
|
}
|
|
473
|
-
|
|
511
|
+
|
|
474
512
|
func setStreamObservers(stream: OTStream, isPublisherStream: Bool) {
|
|
475
513
|
let hasVideoObservation: NSKeyValueObservation = stream.observe(\.hasVideo, options: [.old, .new]) { object, change in
|
|
476
514
|
guard let oldValue = change.oldValue else { return }
|
|
@@ -494,7 +532,7 @@ class OTSessionManager: RCTEventEmitter {
|
|
|
494
532
|
}
|
|
495
533
|
OTRN.sharedState.streamObservers.updateValue([hasAudioObservation, hasVideoObservation, videoDimensionsObservation, videoTypeObservation], forKey: stream.streamId)
|
|
496
534
|
}
|
|
497
|
-
|
|
535
|
+
|
|
498
536
|
func printLogs(_ message: String) {
|
|
499
537
|
if (logLevel) {
|
|
500
538
|
print(message)
|
|
@@ -510,7 +548,7 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
510
548
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)sessionDidConnect", data: sessionInfo);
|
|
511
549
|
printLogs("OTRN: Session connected")
|
|
512
550
|
}
|
|
513
|
-
|
|
551
|
+
|
|
514
552
|
func sessionDidDisconnect(_ session: OTSession) {
|
|
515
553
|
let sessionInfo = EventUtils.prepareJSSessionEventData(session);
|
|
516
554
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)sessionDidDisconnect", data: sessionInfo);
|
|
@@ -522,7 +560,7 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
522
560
|
OTRN.sharedState.sessionConnectCallbacks.removeValue(forKey: session.sessionId);
|
|
523
561
|
printLogs("OTRN: Session disconnected")
|
|
524
562
|
}
|
|
525
|
-
|
|
563
|
+
|
|
526
564
|
func session(_ session: OTSession, connectionCreated connection: OTConnection) {
|
|
527
565
|
OTRN.sharedState.connections.updateValue(connection, forKey: connection.connectionId)
|
|
528
566
|
var connectionInfo = EventUtils.prepareJSConnectionEventData(connection);
|
|
@@ -537,7 +575,7 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
537
575
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)connectionDestroyed", data: connectionInfo)
|
|
538
576
|
printLogs("OTRN Session: A connection was destroyed")
|
|
539
577
|
}
|
|
540
|
-
|
|
578
|
+
|
|
541
579
|
func session(_ session: OTSession, archiveStartedWithId archiveId: String, name: String?) {
|
|
542
580
|
var archiveInfo: Dictionary<String, String> = [:];
|
|
543
581
|
archiveInfo["archiveId"] = archiveId;
|
|
@@ -546,7 +584,7 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
546
584
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)archiveStartedWithId", data: archiveInfo)
|
|
547
585
|
printLogs("OTRN Session: Archive started with \(archiveId)")
|
|
548
586
|
}
|
|
549
|
-
|
|
587
|
+
|
|
550
588
|
func session(_ session: OTSession, archiveStoppedWithId archiveId: String) {
|
|
551
589
|
var archiveInfo: Dictionary<String, String> = [:];
|
|
552
590
|
archiveInfo["archiveId"] = archiveId;
|
|
@@ -555,19 +593,19 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
555
593
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)archiveStoppedWithId", data: archiveInfo);
|
|
556
594
|
printLogs("OTRN Session: Archive stopped with \(archiveId)")
|
|
557
595
|
}
|
|
558
|
-
|
|
596
|
+
|
|
559
597
|
func sessionDidBeginReconnecting(_ session: OTSession) {
|
|
560
598
|
let sessionInfo = EventUtils.prepareJSSessionEventData(session);
|
|
561
599
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)sessionDidBeginReconnecting", data: sessionInfo)
|
|
562
600
|
printLogs("OTRN Session: Session did begin reconnecting")
|
|
563
601
|
}
|
|
564
|
-
|
|
602
|
+
|
|
565
603
|
func sessionDidReconnect(_ session: OTSession) {
|
|
566
604
|
let sessionInfo = EventUtils.prepareJSSessionEventData(session);
|
|
567
605
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)sessionDidReconnect", data: sessionInfo)
|
|
568
606
|
printLogs("OTRN Session: Session reconnected")
|
|
569
607
|
}
|
|
570
|
-
|
|
608
|
+
|
|
571
609
|
func session(_ session: OTSession, streamCreated stream: OTStream) {
|
|
572
610
|
OTRN.sharedState.subscriberStreams.updateValue(stream, forKey: stream.streamId)
|
|
573
611
|
let streamInfo: Dictionary<String, Any> = EventUtils.prepareJSStreamEventData(stream)
|
|
@@ -575,19 +613,19 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
575
613
|
setStreamObservers(stream: stream, isPublisherStream: false)
|
|
576
614
|
printLogs("OTRN: Session streamCreated \(stream.streamId)")
|
|
577
615
|
}
|
|
578
|
-
|
|
616
|
+
|
|
579
617
|
func session(_ session: OTSession, streamDestroyed stream: OTStream) {
|
|
580
618
|
let streamInfo: Dictionary<String, Any> = EventUtils.prepareJSStreamEventData(stream);
|
|
581
619
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)streamDestroyed", data: streamInfo)
|
|
582
620
|
printLogs("OTRN: Session streamDestroyed: \(stream.streamId)")
|
|
583
621
|
}
|
|
584
|
-
|
|
622
|
+
|
|
585
623
|
func session(_ session: OTSession, didFailWithError error: OTError) {
|
|
586
624
|
let errorInfo: Dictionary<String, Any> = EventUtils.prepareJSErrorEventData(error);
|
|
587
625
|
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)didFailWithError", data: errorInfo)
|
|
588
626
|
printLogs("OTRN: Session Failed to connect: \(error.localizedDescription)")
|
|
589
627
|
}
|
|
590
|
-
|
|
628
|
+
|
|
591
629
|
func session(_ session: OTSession, receivedSignalType type: String?, from connection: OTConnection?, with string: String?) {
|
|
592
630
|
var signalData: Dictionary<String, Any> = [:];
|
|
593
631
|
signalData["type"] = type;
|
|
@@ -601,7 +639,7 @@ extension OTSessionManager: OTSessionDelegate {
|
|
|
601
639
|
func session(_ session: OTSession, info muteForced: OTMuteForcedInfo) {
|
|
602
640
|
var muteForcedInfo: Dictionary<String, Any> = [:];
|
|
603
641
|
muteForcedInfo["active"] = muteForced.active;
|
|
604
|
-
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)
|
|
642
|
+
self.emitEvent("\(session.sessionId):\(EventUtils.sessionPreface)muteForced", data: muteForcedInfo)
|
|
605
643
|
printLogs("OTRN Session: Session muteForced - active: \(muteForced.active)")
|
|
606
644
|
}
|
|
607
645
|
}
|
|
@@ -613,13 +651,14 @@ extension OTSessionManager: OTPublisherDelegate {
|
|
|
613
651
|
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
|
|
614
652
|
if (publisherId.count > 0) {
|
|
615
653
|
OTRN.sharedState.isPublishing[publisherId] = true;
|
|
616
|
-
|
|
617
|
-
|
|
654
|
+
var streamInfo: Dictionary<String, Any> = EventUtils.prepareJSStreamEventData(stream);
|
|
655
|
+
streamInfo["publisherId"] = publisherId;
|
|
656
|
+
self.emitEvent("publisherStreamCreated", data: streamInfo);
|
|
618
657
|
setStreamObservers(stream: stream, isPublisherStream: true)
|
|
619
658
|
}
|
|
620
659
|
printLogs("OTRN: Publisher Stream created")
|
|
621
660
|
}
|
|
622
|
-
|
|
661
|
+
|
|
623
662
|
func publisher(_ publisher: OTPublisherKit, streamDestroyed stream: OTStream) {
|
|
624
663
|
OTRN.sharedState.streamObservers.removeValue(forKey: stream.streamId)
|
|
625
664
|
OTRN.sharedState.publisherStreams.removeValue(forKey: stream.streamId)
|
|
@@ -628,8 +667,9 @@ extension OTSessionManager: OTPublisherDelegate {
|
|
|
628
667
|
OTRN.sharedState.isPublishing[publisherId] = false;
|
|
629
668
|
if (publisherId.count > 0) {
|
|
630
669
|
OTRN.sharedState.isPublishing[publisherId] = false;
|
|
631
|
-
|
|
632
|
-
|
|
670
|
+
var streamInfo: Dictionary<String, Any> = EventUtils.prepareJSStreamEventData(stream);
|
|
671
|
+
streamInfo["publisherId"] = publisherId;
|
|
672
|
+
self.emitEvent("publisherStreamDestroyed", data: streamInfo);
|
|
633
673
|
}
|
|
634
674
|
OTRN.sharedState.publishers[publisherId] = nil;
|
|
635
675
|
OTRN.sharedState.isPublishing[publisherId] = nil;
|
|
@@ -640,7 +680,7 @@ extension OTSessionManager: OTPublisherDelegate {
|
|
|
640
680
|
callback([NSNull()]);
|
|
641
681
|
printLogs("OTRN: Publisher Stream destroyed")
|
|
642
682
|
}
|
|
643
|
-
|
|
683
|
+
|
|
644
684
|
func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) {
|
|
645
685
|
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
|
|
646
686
|
if (publisherId.count > 0) {
|
|
@@ -657,6 +697,42 @@ extension OTSessionManager: OTPublisherDelegate {
|
|
|
657
697
|
}
|
|
658
698
|
printLogs("OTRN: Publisher mute forced")
|
|
659
699
|
}
|
|
700
|
+
|
|
701
|
+
func videoDisableWarning(_ publisher: OTPublisherKit) {
|
|
702
|
+
let publisherId = Utils.getPublisherId(publisher as! OTPublisher)
|
|
703
|
+
if (publisherId.count > 0) {
|
|
704
|
+
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)videoDisableWarning", data: [NSNull()])
|
|
705
|
+
}
|
|
706
|
+
printLogs("OTRN: Publisher videoDisableWarning")
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
func videoDisableWarningLifted(_ publisher: OTPublisherKit) {
|
|
710
|
+
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
|
|
711
|
+
if (publisherId.count > 0) {
|
|
712
|
+
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)videoDisableWarningLifted", data: [NSNull()])
|
|
713
|
+
}
|
|
714
|
+
printLogs("OTRN: Publisher videoDisableWarningLifted")
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
func videoDisabled(_ publisher: OTPublisherKit, reason: OTPublisherVideoEventReason) {
|
|
718
|
+
var publisherInfo: Dictionary<String, Any> = [:]
|
|
719
|
+
publisherInfo["reason"] = Utils.convertOTPublisherVideoEventReasonToString(reason)
|
|
720
|
+
let publisherId = Utils.getPublisherId(publisher as! OTPublisher)
|
|
721
|
+
if (publisherId.count > 0) {
|
|
722
|
+
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)videoDisabled", data: publisherInfo)
|
|
723
|
+
}
|
|
724
|
+
printLogs("OTRN: Publisher videoDisabled")
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
func videoEnabled(_ publisher: OTPublisherKit, reason: OTPublisherVideoEventReason) {
|
|
728
|
+
var publisherInfo: Dictionary<String, Any> = [:]
|
|
729
|
+
publisherInfo["reason"] = Utils.convertOTPublisherVideoEventReasonToString(reason)
|
|
730
|
+
let publisherId = Utils.getPublisherId(publisher as! OTPublisher)
|
|
731
|
+
if (publisherId.count > 0) {
|
|
732
|
+
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)videoEnabled", data: publisherInfo)
|
|
733
|
+
}
|
|
734
|
+
printLogs("OTRN: Publisher videoEnabled")
|
|
735
|
+
}
|
|
660
736
|
}
|
|
661
737
|
|
|
662
738
|
extension OTSessionManager: OTPublisherKitAudioLevelDelegate {
|
|
@@ -683,7 +759,7 @@ extension OTSessionManager: OTPublisherKitNetworkStatsDelegate {
|
|
|
683
759
|
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
|
|
684
760
|
if (publisherId.count > 0) {
|
|
685
761
|
let statsArray: [Dictionary<String, Any>] = EventUtils.preparePublisherAudioNetworkStats(stats);
|
|
686
|
-
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)
|
|
762
|
+
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)audioNetworkStatsUpdated", data: statsArray)
|
|
687
763
|
}
|
|
688
764
|
}
|
|
689
765
|
|
|
@@ -691,7 +767,7 @@ extension OTSessionManager: OTPublisherKitNetworkStatsDelegate {
|
|
|
691
767
|
let publisherId = Utils.getPublisherId(publisher as! OTPublisher);
|
|
692
768
|
if (publisherId.count > 0) {
|
|
693
769
|
let statsArray: [Dictionary<String, Any>] = EventUtils.preparePublisherVideoNetworkStats(stats);
|
|
694
|
-
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)
|
|
770
|
+
self.emitEvent("\(publisherId):\(EventUtils.publisherPreface)videoNetworkStatsUpdated", data: statsArray)
|
|
695
771
|
}
|
|
696
772
|
}
|
|
697
773
|
}
|
|
@@ -706,7 +782,7 @@ extension OTSessionManager: OTSubscriberDelegate {
|
|
|
706
782
|
}
|
|
707
783
|
printLogs("OTRN: Subscriber connected")
|
|
708
784
|
}
|
|
709
|
-
|
|
785
|
+
|
|
710
786
|
func subscriber(_ subscriber: OTSubscriberKit, didFailWithError error: OTError) {
|
|
711
787
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
712
788
|
subscriberInfo["error"] = EventUtils.prepareJSErrorEventData(error);
|
|
@@ -731,7 +807,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
731
807
|
subscriberInfo["stream"] = EventUtils.prepareJSStreamEventData(stream);
|
|
732
808
|
self.emitEvent("\(EventUtils.subscriberPreface)videoNetworkStatsUpdated", data: subscriberInfo);
|
|
733
809
|
}
|
|
734
|
-
|
|
810
|
+
|
|
735
811
|
func subscriber(_ subscriber: OTSubscriberKit, audioNetworkStatsUpdated stats: OTSubscriberKitAudioNetworkStats) {
|
|
736
812
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
737
813
|
subscriberInfo["audioStats"] = EventUtils.prepareSubscriberAudioNetworkStatsEventData(stats);
|
|
@@ -742,7 +818,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
742
818
|
subscriberInfo["stream"] = EventUtils.prepareJSStreamEventData(stream);
|
|
743
819
|
self.emitEvent("\(EventUtils.subscriberPreface)audioNetworkStatsUpdated", data: subscriberInfo);
|
|
744
820
|
}
|
|
745
|
-
|
|
821
|
+
|
|
746
822
|
func subscriberVideoEnabled(_ subscriber: OTSubscriberKit, reason: OTSubscriberVideoEventReason) {
|
|
747
823
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
748
824
|
subscriberInfo["reason"] = Utils.convertOTSubscriberVideoEventReasonToString(reason);
|
|
@@ -754,7 +830,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
754
830
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberVideoEnabled", data: subscriberInfo);
|
|
755
831
|
printLogs("OTRN: subscriberVideoEnabled")
|
|
756
832
|
}
|
|
757
|
-
|
|
833
|
+
|
|
758
834
|
func subscriberVideoDisabled(_ subscriber: OTSubscriberKit, reason: OTSubscriberVideoEventReason) {
|
|
759
835
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
760
836
|
subscriberInfo["reason"] = Utils.convertOTSubscriberVideoEventReasonToString(reason);
|
|
@@ -766,7 +842,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
766
842
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberVideoDisabled", data: subscriberInfo);
|
|
767
843
|
printLogs("OTRN: subscriberVideoDisabled")
|
|
768
844
|
}
|
|
769
|
-
|
|
845
|
+
|
|
770
846
|
func subscriberVideoDisableWarning(_ subscriber: OTSubscriberKit) {
|
|
771
847
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
772
848
|
guard let stream = subscriber.stream else {
|
|
@@ -777,7 +853,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
777
853
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberVideoDisableWarning", data: subscriberInfo);
|
|
778
854
|
printLogs("OTRN: subscriberVideoDisableWarning")
|
|
779
855
|
}
|
|
780
|
-
|
|
856
|
+
|
|
781
857
|
func subscriberVideoDisableWarningLifted(_ subscriber: OTSubscriberKit) {
|
|
782
858
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
783
859
|
guard let stream = subscriber.stream else {
|
|
@@ -788,7 +864,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
788
864
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberVideoDisableWarningLifted", data: subscriberInfo);
|
|
789
865
|
printLogs("OTRN: subscriberVideoDisableWarningLifted")
|
|
790
866
|
}
|
|
791
|
-
|
|
867
|
+
|
|
792
868
|
func subscriberVideoDataReceived(_ subscriber: OTSubscriber) {
|
|
793
869
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
794
870
|
guard let stream = subscriber.stream else {
|
|
@@ -798,7 +874,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
798
874
|
subscriberInfo["stream"] = EventUtils.prepareJSStreamEventData(stream);
|
|
799
875
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberVideoDataReceived", data: subscriberInfo);
|
|
800
876
|
}
|
|
801
|
-
|
|
877
|
+
|
|
802
878
|
func subscriberDidReconnect(toStream subscriber: OTSubscriberKit) {
|
|
803
879
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
804
880
|
guard let stream = subscriber.stream else {
|
|
@@ -810,7 +886,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
810
886
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberDidReconnect", data: subscriberInfo);
|
|
811
887
|
printLogs("OTRN: subscriberDidReconnect")
|
|
812
888
|
}
|
|
813
|
-
|
|
889
|
+
|
|
814
890
|
func subscriberDidDisconnect(fromStream subscriberKit: OTSubscriberKit) {
|
|
815
891
|
var subscriberInfo: Dictionary<String, Any> = [:];
|
|
816
892
|
guard let stream = subscriberKit.stream else {
|
|
@@ -822,7 +898,7 @@ extension OTSessionManager: OTSubscriberKitNetworkStatsDelegate {
|
|
|
822
898
|
self.emitEvent("\(EventUtils.subscriberPreface)subscriberDidDisconnect", data: subscriberInfo);
|
|
823
899
|
printLogs("OTRN: Subscriber disconnected")
|
|
824
900
|
}
|
|
825
|
-
|
|
901
|
+
|
|
826
902
|
}
|
|
827
903
|
|
|
828
904
|
extension OTSessionManager: OTSubscriberKitAudioLevelDelegate {
|
|
@@ -857,10 +933,10 @@ extension OTSessionManager: OTSubscriberKitCaptionsDelegate {
|
|
|
857
933
|
subscriberInfo["text"] = text;
|
|
858
934
|
subscriberInfo["isFinal"] = isFinal;
|
|
859
935
|
guard let stream = subscriber.stream else {
|
|
860
|
-
self.emitEvent("\(EventUtils.subscriberPreface)
|
|
936
|
+
self.emitEvent("\(EventUtils.subscriberPreface)subscriberCaptionReceived", data: subscriberInfo);
|
|
861
937
|
return;
|
|
862
938
|
}
|
|
863
939
|
subscriberInfo["stream"] = EventUtils.prepareJSStreamEventData(stream);
|
|
864
|
-
self.emitEvent("\(EventUtils.subscriberPreface)
|
|
940
|
+
self.emitEvent("\(EventUtils.subscriberPreface)subscriberCaptionReceived", data: subscriberInfo);
|
|
865
941
|
}
|
|
866
942
|
}
|