@100mslive/react-native-hms 1.1.1 → 1.2.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.
Files changed (101) hide show
  1. package/README.md +145 -340
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +205 -75
  4. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +127 -127
  5. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +153 -115
  6. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +147 -17
  7. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +7 -7
  8. package/ios/HMSDecoder.swift +205 -129
  9. package/ios/HMSHelper.swift +3 -3
  10. package/ios/HMSManager.m +3 -0
  11. package/ios/HMSManager.swift +22 -1
  12. package/ios/HMSRNSDK.swift +228 -79
  13. package/ios/HMSView.m +2 -0
  14. package/ios/HMSView.swift +35 -3
  15. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  16. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  17. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
  18. package/lib/commonjs/classes/HMSEncoder.js +133 -84
  19. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  20. package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
  21. package/lib/commonjs/classes/HMSLocalVideoTrack.js +0 -2
  22. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  23. package/lib/commonjs/classes/HMSMessageRecipient.js +1 -1
  24. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
  25. package/lib/commonjs/classes/HMSNativeEventEmitter.js +106 -0
  26. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -0
  27. package/lib/commonjs/classes/HMSPeer.js +4 -0
  28. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  29. package/lib/commonjs/classes/HMSPublishSettings.js +0 -6
  30. package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
  31. package/lib/commonjs/classes/HMSRole.js +0 -6
  32. package/lib/commonjs/classes/HMSRole.js.map +1 -1
  33. package/lib/commonjs/classes/HMSRoleChangeRequest.js +3 -1
  34. package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
  35. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  36. package/lib/commonjs/classes/HMSSDK.js +465 -137
  37. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  38. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  39. package/lib/commonjs/classes/HMSSubscribeSettings.js +0 -2
  40. package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
  41. package/lib/commonjs/index.js.map +1 -1
  42. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  43. package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
  44. package/lib/module/classes/HMSEncoder.js +133 -84
  45. package/lib/module/classes/HMSEncoder.js.map +1 -1
  46. package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
  47. package/lib/module/classes/HMSLocalVideoTrack.js +0 -2
  48. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  49. package/lib/module/classes/HMSMessageRecipient.js +1 -1
  50. package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
  51. package/lib/module/classes/HMSNativeEventEmitter.js +99 -0
  52. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -0
  53. package/lib/module/classes/HMSPeer.js +4 -0
  54. package/lib/module/classes/HMSPeer.js.map +1 -1
  55. package/lib/module/classes/HMSPublishSettings.js +0 -6
  56. package/lib/module/classes/HMSPublishSettings.js.map +1 -1
  57. package/lib/module/classes/HMSRole.js +0 -6
  58. package/lib/module/classes/HMSRole.js.map +1 -1
  59. package/lib/module/classes/HMSRoleChangeRequest.js +3 -1
  60. package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
  61. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  62. package/lib/module/classes/HMSSDK.js +466 -138
  63. package/lib/module/classes/HMSSDK.js.map +1 -1
  64. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  65. package/lib/module/classes/HMSSubscribeSettings.js +0 -2
  66. package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
  67. package/lib/module/index.js.map +1 -1
  68. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -4
  69. package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -2
  70. package/lib/typescript/classes/HMSEncoder.d.ts +3 -0
  71. package/lib/typescript/classes/HMSHLSStreamingState.d.ts +2 -2
  72. package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +0 -2
  73. package/lib/typescript/classes/HMSMessageRecipient.d.ts +2 -2
  74. package/lib/typescript/classes/HMSNativeEventEmitter.d.ts +13 -0
  75. package/lib/typescript/classes/HMSPublishSettings.d.ts +8 -15
  76. package/lib/typescript/classes/HMSRole.d.ts +0 -6
  77. package/lib/typescript/classes/HMSRoleChangeRequest.d.ts +2 -2
  78. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -4
  79. package/lib/typescript/classes/HMSSDK.d.ts +2 -12
  80. package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -2
  81. package/lib/typescript/classes/HMSSubscribeSettings.d.ts +0 -2
  82. package/lib/typescript/index.d.ts +1 -0
  83. package/package.json +5 -4
  84. package/react-native-hms.podspec +1 -1
  85. package/sdk-versions.json +3 -2
  86. package/src/classes/HMSBrowserRecordingState.ts +4 -4
  87. package/src/classes/HMSChangeTrackStateRequest.ts +2 -2
  88. package/src/classes/HMSEncoder.ts +186 -99
  89. package/src/classes/HMSHLSStreamingState.ts +2 -2
  90. package/src/classes/HMSLocalVideoTrack.ts +0 -2
  91. package/src/classes/HMSMessageRecipient.ts +3 -3
  92. package/src/classes/HMSNativeEventEmitter.ts +86 -0
  93. package/src/classes/HMSPeer.ts +4 -0
  94. package/src/classes/HMSPublishSettings.ts +8 -18
  95. package/src/classes/HMSRole.ts +0 -9
  96. package/src/classes/HMSRoleChangeRequest.ts +5 -3
  97. package/src/classes/HMSRtmpStreamingState.ts +4 -4
  98. package/src/classes/HMSSDK.tsx +629 -269
  99. package/src/classes/HMSServerRecordingState.ts +2 -2
  100. package/src/classes/HMSSubscribeSettings.ts +1 -7
  101. package/src/index.ts +1 -0
@@ -13,6 +13,15 @@ import live.hms.video.sdk.models.role.*
13
13
  import live.hms.video.sdk.models.trackchangerequest.HMSChangeTrackStateRequest
14
14
 
15
15
  object HMSDecoder {
16
+ private var restrictRoleData = mutableMapOf<String, Boolean>()
17
+
18
+ fun setRestrictRoleData(roleName: String, value: Boolean) {
19
+ this.restrictRoleData[roleName] = value
20
+ }
21
+
22
+ fun clearRestrictDataStates() {
23
+ this.restrictRoleData.clear()
24
+ }
16
25
 
17
26
  fun getHmsRoom(hmsRoom: HMSRoom?): WritableMap {
18
27
  val room: WritableMap = Arguments.createMap()
@@ -21,21 +30,39 @@ object HMSDecoder {
21
30
  room.putString("sessionId", hmsRoom.sessionId)
22
31
  room.putString("name", hmsRoom.name)
23
32
  room.putString("metaData", null)
24
- room.putString("startedAt", hmsRoom.startedAt.toString())
25
- room.putMap(
26
- "browserRecordingState",
27
- this.getHMSBrowserRecordingState(hmsRoom.browserRecordingState)
28
- )
29
- room.putMap(
30
- "rtmpHMSRtmpStreamingState",
31
- this.getHMSRtmpStreamingState(hmsRoom.rtmpHMSRtmpStreamingState)
32
- )
33
- room.putMap(
34
- "serverRecordingState",
35
- this.getHMSServerRecordingState(hmsRoom.serverRecordingState)
36
- )
37
- room.putMap("hlsStreamingState", this.getHMSHlsStreamingState(hmsRoom.hlsStreamingState))
38
- room.putMap("hlsRecordingState", this.getHMSHlsRecordingState(hmsRoom.hlsRecordingState))
33
+ hmsRoom.startedAt?.let {
34
+ room.putString("startedAt", it.toString())
35
+ }
36
+
37
+ hmsRoom.browserRecordingState?.let {
38
+ room.putMap(
39
+ "browserRecordingState",
40
+ this.getHMSBrowserRecordingState(it)
41
+ )
42
+ }
43
+
44
+ hmsRoom.rtmpHMSRtmpStreamingState?.let {
45
+ room.putMap(
46
+ "rtmpHMSRtmpStreamingState",
47
+ this.getHMSRtmpStreamingState(it)
48
+ )
49
+ }
50
+
51
+ hmsRoom.serverRecordingState?.let {
52
+ room.putMap(
53
+ "serverRecordingState",
54
+ this.getHMSServerRecordingState(it)
55
+ )
56
+ }
57
+
58
+ hmsRoom.hlsStreamingState?.let {
59
+ room.putMap("hlsStreamingState", this.getHMSHlsStreamingState(hmsRoom.hlsStreamingState))
60
+ }
61
+
62
+ hmsRoom.hlsRecordingState?.let {
63
+ room.putMap("hlsRecordingState", this.getHMSHlsRecordingState(hmsRoom.hlsRecordingState))
64
+ }
65
+
39
66
  room.putMap("localPeer", this.getHmsLocalPeer(hmsRoom.localPeer))
40
67
  room.putArray("peers", this.getAllPeers(hmsRoom.peerList))
41
68
  room.putInt("peerCount", hmsRoom.peerCount)
@@ -49,13 +76,32 @@ object HMSDecoder {
49
76
  peer.putString("peerID", hmsPeer.peerID)
50
77
  peer.putString("name", hmsPeer.name)
51
78
  peer.putBoolean("isLocal", hmsPeer.isLocal)
52
- peer.putString("customerUserID", hmsPeer.customerUserID)
79
+
80
+ hmsPeer.customerUserID?.let {
81
+ peer.putString("customerUserID", it)
82
+ }
83
+
84
+ peer.putString("joinedAt", hmsPeer.joinedAt.toString())
85
+
53
86
  peer.putString("metadata", hmsPeer.metadata)
54
- peer.putMap("networkQuality", this.getHmsNetworkQuality(hmsPeer.networkQuality))
55
- peer.putMap("audioTrack", this.getHmsAudioTrack(hmsPeer.audioTrack))
56
- peer.putMap("videoTrack", this.getHmsVideoTrack(hmsPeer.videoTrack))
87
+
57
88
  peer.putMap("role", this.getHmsRole(hmsPeer.hmsRole))
58
- peer.putArray("auxiliaryTracks", this.getAllTracks(hmsPeer.auxiliaryTracks))
89
+
90
+ hmsPeer.networkQuality?.let {
91
+ peer.putMap("networkQuality", this.getHmsNetworkQuality(it))
92
+ }
93
+
94
+ hmsPeer.audioTrack?.let {
95
+ peer.putMap("audioTrack", this.getHmsAudioTrack(it))
96
+ }
97
+
98
+ hmsPeer.videoTrack?.let {
99
+ peer.putMap("videoTrack", this.getHmsVideoTrack(it))
100
+ }
101
+
102
+ hmsPeer.auxiliaryTracks.let {
103
+ peer.putArray("auxiliaryTracks", this.getAllTracks(it))
104
+ }
59
105
  }
60
106
  return peer
61
107
  }
@@ -112,10 +158,17 @@ object HMSDecoder {
112
158
  val role: WritableMap = Arguments.createMap()
113
159
  if (hmsRole != null) {
114
160
  role.putString("name", hmsRole.name)
115
- role.putMap("permissions", this.getHmsPermissions(hmsRole.permission))
116
- role.putMap("publishSettings", this.getHmsPublishSettings(hmsRole.publishParams))
117
- role.putMap("subscribeSettings", this.getHmsSubscribeSettings(hmsRole.subscribeParams))
118
- role.putInt("priority", hmsRole.priority)
161
+ if (this.restrictRoleData[hmsRole.name] != true) {
162
+ role.putMap("permissions", this.getHmsPermissions(hmsRole.permission))
163
+ hmsRole.publishParams?.let {
164
+ role.putMap("publishSettings", this.getHmsPublishSettings(it))
165
+ }
166
+ hmsRole.subscribeParams?.let {
167
+ role.putMap("subscribeSettings", this.getHmsSubscribeSettings(it))
168
+ }
169
+
170
+ role.putInt("priority", hmsRole.priority)
171
+ }
119
172
  }
120
173
  return role
121
174
  }
@@ -138,11 +191,18 @@ object HMSDecoder {
138
191
  private fun getHmsPublishSettings(hmsPublishSettings: PublishParams?): WritableMap {
139
192
  val publishSettings: WritableMap = Arguments.createMap()
140
193
  if (hmsPublishSettings != null) {
141
- publishSettings.putMap("audio", this.getHmsAudioSettings(hmsPublishSettings.audio))
142
- publishSettings.putMap("video", this.getHmsVideoSettings(hmsPublishSettings.video))
143
- publishSettings.putMap("screen", this.getHmsVideoSettings(hmsPublishSettings.screen))
144
- publishSettings.putMap("videoSimulcastLayers", null)
145
- publishSettings.putMap("screenSimulcastLayers", null)
194
+ hmsPublishSettings.audio?.let {
195
+ publishSettings.putMap("audio", this.getHmsAudioSettings(it))
196
+ }
197
+
198
+ hmsPublishSettings.video?.let {
199
+ publishSettings.putMap("video", this.getHmsVideoSettings(it))
200
+ }
201
+
202
+ hmsPublishSettings.screen?.let {
203
+ publishSettings.putMap("screen", this.getHmsVideoSettings(it))
204
+ }
205
+
146
206
  publishSettings.putArray("allowed", this.getWriteableArray(hmsPublishSettings.allowed))
147
207
  }
148
208
  return publishSettings
@@ -160,7 +220,7 @@ object HMSDecoder {
160
220
 
161
221
  private fun getHmsAudioSettings(hmsAudioSettings: AudioParams?): WritableMap {
162
222
  val audioSettings: WritableMap = Arguments.createMap()
163
- if (hmsAudioSettings != null && hmsAudioSettings.codec != null) {
223
+ if (hmsAudioSettings != null) {
164
224
  audioSettings.putInt("bitRate", hmsAudioSettings.bitRate)
165
225
  audioSettings.putString("codec", hmsAudioSettings.codec.name)
166
226
  }
@@ -169,7 +229,7 @@ object HMSDecoder {
169
229
 
170
230
  private fun getHmsVideoSettings(hmsVideoSettings: VideoParams?): WritableMap {
171
231
  val videoSettings: WritableMap = Arguments.createMap()
172
- if (hmsVideoSettings != null && hmsVideoSettings.codec != null) {
232
+ if (hmsVideoSettings != null) {
173
233
  videoSettings.putInt("bitRate", hmsVideoSettings.bitRate)
174
234
  videoSettings.putInt("frameRate", hmsVideoSettings.frameRate)
175
235
  videoSettings.putInt("width", hmsVideoSettings.width)
@@ -185,15 +245,32 @@ object HMSDecoder {
185
245
  peer.putString("peerID", hmsLocalPeer.peerID)
186
246
  peer.putString("name", hmsLocalPeer.name)
187
247
  peer.putBoolean("isLocal", hmsLocalPeer.isLocal)
188
- peer.putString("customerUserID", hmsLocalPeer.customerUserID)
189
- peer.putString("metadata", hmsLocalPeer.metadata)
190
- peer.putMap("networkQuality", this.getHmsNetworkQuality(hmsLocalPeer.networkQuality))
191
- peer.putMap("audioTrack", this.getHmsAudioTrack(hmsLocalPeer.audioTrack))
192
- peer.putMap("videoTrack", this.getHmsVideoTrack(hmsLocalPeer.videoTrack))
248
+
193
249
  peer.putMap("role", this.getHmsRole(hmsLocalPeer.hmsRole))
194
- peer.putArray("auxiliaryTracks", this.getAllTracks(hmsLocalPeer.auxiliaryTracks))
195
- peer.putMap("localAudioTrackData", this.getHmsLocalAudioTrack(hmsLocalPeer.audioTrack))
196
- peer.putMap("localVideoTrackData", this.getHmsLocalVideoTrack(hmsLocalPeer.videoTrack))
250
+
251
+ peer.putString("metadata", hmsLocalPeer.metadata)
252
+
253
+ hmsLocalPeer.customerUserID?.let {
254
+ peer.putString("customerUserID", it)
255
+ }
256
+
257
+ hmsLocalPeer.networkQuality?.let {
258
+ peer.putMap("networkQuality", this.getHmsNetworkQuality(it))
259
+ }
260
+
261
+ hmsLocalPeer.audioTrack?.let {
262
+ peer.putMap("audioTrack", this.getHmsAudioTrack(it))
263
+ peer.putMap("localAudioTrackData", this.getHmsLocalAudioTrack(it))
264
+ }
265
+
266
+ hmsLocalPeer.videoTrack?.let {
267
+ peer.putMap("videoTrack", this.getHmsVideoTrack(it))
268
+ peer.putMap("localVideoTrackData", this.getHmsLocalVideoTrack(it))
269
+ }
270
+
271
+ hmsLocalPeer.auxiliaryTracks.let {
272
+ peer.putArray("auxiliaryTracks", this.getAllTracks(it))
273
+ }
197
274
  }
198
275
  return peer
199
276
  }
@@ -272,15 +349,30 @@ object HMSDecoder {
272
349
  peer.putString("peerID", hmsRemotePeer.peerID)
273
350
  peer.putString("name", hmsRemotePeer.name)
274
351
  peer.putBoolean("isLocal", hmsRemotePeer.isLocal)
275
- peer.putString("customerUserID", hmsRemotePeer.customerUserID)
276
352
  peer.putString("metadata", hmsRemotePeer.metadata)
277
- peer.putMap("networkQuality", this.getHmsNetworkQuality(hmsRemotePeer.networkQuality))
278
- peer.putMap("audioTrack", this.getHmsAudioTrack(hmsRemotePeer.audioTrack))
279
- peer.putMap("videoTrack", this.getHmsVideoTrack(hmsRemotePeer.videoTrack))
280
353
  peer.putMap("role", this.getHmsRole(hmsRemotePeer.hmsRole))
281
- peer.putArray("auxiliaryTracks", this.getAllTracks(hmsRemotePeer.auxiliaryTracks))
282
- peer.putMap("remoteAudioTrackData", this.getHmsRemoteAudioTrack(hmsRemotePeer.audioTrack))
283
- peer.putMap("remoteVideoTrackData", this.getHmsRemoteVideoTrack(hmsRemotePeer.videoTrack))
354
+
355
+ hmsRemotePeer.customerUserID?.let {
356
+ peer.putString("customerUserID", it)
357
+ }
358
+
359
+ hmsRemotePeer.networkQuality?.let {
360
+ peer.putMap("networkQuality", this.getHmsNetworkQuality(it))
361
+ }
362
+
363
+ hmsRemotePeer.audioTrack?.let {
364
+ peer.putMap("audioTrack", this.getHmsAudioTrack(it))
365
+ peer.putMap("remoteAudioTrackData", this.getHmsRemoteAudioTrack(it))
366
+ }
367
+
368
+ hmsRemotePeer.videoTrack?.let {
369
+ peer.putMap("videoTrack", this.getHmsVideoTrack(hmsRemotePeer.videoTrack))
370
+ peer.putMap("remoteVideoTrackData", this.getHmsRemoteVideoTrack(hmsRemotePeer.videoTrack))
371
+ }
372
+
373
+ hmsRemotePeer.auxiliaryTracks.let {
374
+ peer.putArray("auxiliaryTracks", this.getAllTracks(it))
375
+ }
284
376
  }
285
377
  return peer
286
378
  }
@@ -330,7 +422,9 @@ object HMSDecoder {
330
422
  fun getHmsRoleChangeRequest(request: HMSRoleChangeRequest, id: String?): WritableMap {
331
423
  val roleChangeRequest: WritableMap = Arguments.createMap()
332
424
  if (id != null) {
333
- roleChangeRequest.putMap("requestedBy", this.getHmsPeer(request.requestedBy))
425
+ request.requestedBy?.let {
426
+ roleChangeRequest.putMap("requestedBy", this.getHmsPeer(it))
427
+ }
334
428
  roleChangeRequest.putMap("suggestedRole", this.getHmsRole(request.suggestedRole))
335
429
  roleChangeRequest.putString("id", id)
336
430
  return roleChangeRequest
@@ -341,7 +435,9 @@ object HMSDecoder {
341
435
  fun getHmsChangeTrackStateRequest(request: HMSChangeTrackStateRequest, id: String): WritableMap {
342
436
  val changeTrackStateRequest: WritableMap = Arguments.createMap()
343
437
 
344
- changeTrackStateRequest.putMap("requestedBy", this.getHmsPeer(request.requestedBy))
438
+ request.requestedBy?.let {
439
+ changeTrackStateRequest.putMap("requestedBy", this.getHmsPeer(it))
440
+ }
345
441
  changeTrackStateRequest.putString("trackType", request.track.type.name)
346
442
  changeTrackStateRequest.putBoolean("mute", request.mute)
347
443
  changeTrackStateRequest.putString("id", id)
@@ -367,10 +463,18 @@ object HMSDecoder {
367
463
  val input = Arguments.createMap()
368
464
  if (data !== null) {
369
465
  input.putBoolean("running", data.running)
370
- input.putString("startedAt", data.startedAt.toString())
371
- input.putString("stoppedAt", data.stoppedAt.toString())
372
- input.putBoolean("running", data.running)
373
- input.putMap("error", this.getError(data.error))
466
+
467
+ data.startedAt?.let {
468
+ input.putString("startedAt", it.toString())
469
+ }
470
+
471
+ data.stoppedAt?.let {
472
+ input.putString("stoppedAt", it.toString())
473
+ }
474
+
475
+ data.error?.let {
476
+ input.putMap("error", this.getError(it))
477
+ }
374
478
  }
375
479
  return input
376
480
  }
@@ -379,9 +483,18 @@ object HMSDecoder {
379
483
  val input = Arguments.createMap()
380
484
  if (data !== null) {
381
485
  input.putBoolean("running", data.running)
382
- input.putString("startedAt", data.startedAt.toString())
383
- input.putString("stoppedAt", data.stoppedAt.toString())
384
- input.putMap("error", this.getError(data.error))
486
+
487
+ data.startedAt?.let {
488
+ input.putString("startedAt", it.toString())
489
+ }
490
+
491
+ data.stoppedAt?.let {
492
+ input.putString("stoppedAt", it.toString())
493
+ }
494
+
495
+ data.error?.let {
496
+ input.putMap("error", this.getError(it))
497
+ }
385
498
  }
386
499
  return input
387
500
  }
@@ -390,8 +503,14 @@ object HMSDecoder {
390
503
  val input = Arguments.createMap()
391
504
  if (data !== null) {
392
505
  input.putBoolean("running", data.running)
393
- input.putString("startedAt", data.startedAt.toString())
394
- input.putMap("error", this.getError(data.error))
506
+
507
+ data.startedAt?.let {
508
+ input.putString("startedAt", it.toString())
509
+ }
510
+
511
+ data.error?.let {
512
+ input.putMap("error", this.getError(it))
513
+ }
395
514
  }
396
515
  return input
397
516
  }
@@ -400,7 +519,9 @@ object HMSDecoder {
400
519
  val input = Arguments.createMap()
401
520
  if (data !== null) {
402
521
  input.putBoolean("running", data.running)
403
- input.putArray("variants", this.getHMSHLSVariant(data.variants))
522
+ data.variants?.let {
523
+ input.putArray("variants", this.getHMSHLSVariant(it))
524
+ }
404
525
  }
405
526
  return input
406
527
  }
@@ -409,8 +530,11 @@ object HMSDecoder {
409
530
  val input = Arguments.createMap()
410
531
  if (data !== null) {
411
532
  data.running?.let { input.putBoolean("running", it) }
412
- input.putString("startedAt", data.startedAt.toString())
413
- // input.putMap("hlsRecordingConfig", this.getHMSHlsRecordingConfig(data.hlsRecordingConfig))
533
+
534
+ data.startedAt?.let {
535
+ input.putString("startedAt", it.toString())
536
+ }
537
+
414
538
  data.hlsRecordingConfig?.let { input.putBoolean("singleFilePerLayer", it.singleFilePerLayer) }
415
539
  data.hlsRecordingConfig?.let { input.putBoolean("videoOnDemand", it.videoOnDemand) }
416
540
  }
@@ -425,7 +549,9 @@ object HMSDecoder {
425
549
  input.putString("hlsStreamUrl", variant.hlsStreamUrl)
426
550
  input.putString("meetingUrl", variant.meetingUrl)
427
551
  input.putString("metadata", variant.metadata)
428
- input.putString("startedAt", variant.startedAt.toString())
552
+ variant.startedAt?.let {
553
+ input.putString("startedAt", it.toString())
554
+ }
429
555
  variants.pushMap(input)
430
556
  }
431
557
  }
@@ -436,10 +562,6 @@ object HMSDecoder {
436
562
  val subscribeSettings: WritableMap = Arguments.createMap()
437
563
  if (hmsSubscribeSettings != null) {
438
564
  subscribeSettings.putInt("maxSubsBitRate", hmsSubscribeSettings.maxSubsBitRate)
439
- subscribeSettings.putMap(
440
- "subscribeDegradationParam",
441
- this.getHmsSubscribeDegradationSettings(hmsSubscribeSettings.subscribeDegradationParam)
442
- )
443
565
  subscribeSettings.putArray(
444
566
  "subscribeTo",
445
567
  this.getWriteableArray(hmsSubscribeSettings.subscribeTo)
@@ -494,7 +616,10 @@ object HMSDecoder {
494
616
  fun getHmsMessageRecipient(recipient: HMSMessageRecipient?): WritableMap {
495
617
  val hmsRecipient: WritableMap = Arguments.createMap()
496
618
  if (recipient != null) {
497
- hmsRecipient.putMap("recipientPeer", this.getHmsPeer(recipient.recipientPeer))
619
+ recipient.recipientPeer?.let {
620
+ hmsRecipient.putMap("recipientPeer", this.getHmsPeer(it))
621
+ }
622
+
498
623
  hmsRecipient.putArray("recipientRoles", this.getAllRoles(recipient.recipientRoles))
499
624
  hmsRecipient.putString("recipientType", recipient.recipientType.name)
500
625
  }
@@ -533,19 +658,24 @@ object HMSDecoder {
533
658
  return localAudioStats
534
659
  }
535
660
 
536
- fun getLocalVideoStats(hmsLocalVideoStats: HMSLocalVideoStats?): WritableMap {
537
- val localVideoStats: WritableMap = Arguments.createMap()
538
- if (hmsLocalVideoStats != null) {
539
- localVideoStats.putString("bytesSent", hmsLocalVideoStats.bytesSent.toString())
661
+ fun getLocalVideoStats(hmsLocalVideoStats: List<HMSLocalVideoStats>): WritableArray {
662
+ val stats: WritableArray = Arguments.createArray()
663
+
664
+ for (stat in hmsLocalVideoStats) {
665
+ val localVideoStats: WritableMap = Arguments.createMap()
666
+
667
+ localVideoStats.putString("bytesSent", stat.bytesSent.toString())
540
668
  localVideoStats.putMap(
541
669
  "resolution",
542
- hmsLocalVideoStats.resolution?.let { this.getHmsVideoTrackResolution(it) }
670
+ stat.resolution?.let { this.getHmsVideoTrackResolution(it) }
543
671
  )
544
- hmsLocalVideoStats.bitrate?.let { localVideoStats.putDouble("bitrate", it) }
545
- hmsLocalVideoStats.roundTripTime?.let { localVideoStats.putDouble("roundTripTime", it) }
546
- hmsLocalVideoStats.frameRate?.let { localVideoStats.putDouble("frameRate", it) }
672
+ stat.bitrate?.let { localVideoStats.putDouble("bitrate", it) }
673
+ stat.roundTripTime?.let { localVideoStats.putDouble("roundTripTime", it) }
674
+ stat.frameRate?.let { localVideoStats.putDouble("frameRate", it) }
675
+ stats.pushMap(localVideoStats)
547
676
  }
548
- return localVideoStats
677
+
678
+ return stats
549
679
  }
550
680
 
551
681
  fun getRemoteAudioStats(hmsRemoteAudioStats: HMSRemoteAudioStats?): WritableMap {