@100mslive/react-native-hms 0.9.8 → 0.9.9

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.
@@ -110,8 +110,8 @@ export class HMSSDK {
110
110
  * @param {HMSLogger} hmsLogger
111
111
  * @memberof HMSSDK
112
112
  */
113
- setLogger = (hmsLogger: HMSLogger) => {
114
- setLogger(hmsLogger, this.id);
113
+ setLogger = (hmsLogger?: HMSLogger) => {
114
+ setLogger(this.id, hmsLogger);
115
115
  };
116
116
 
117
117
  /**
@@ -510,9 +510,9 @@ export class HMSSDK {
510
510
  * @param {string}
511
511
  * @memberof HMSSDK
512
512
  */
513
- changeMetadata = (metadata: string) => {
513
+ changeMetadata = async (metadata: string) => {
514
514
  logger?.verbose('#Function changeMetadata', { metadata, id: this.id });
515
- HMSManager.changeMetadata({ metadata, id: this.id });
515
+ return await HMSManager.changeMetadata({ metadata, id: this.id });
516
516
  };
517
517
 
518
518
  /**
@@ -754,9 +754,9 @@ export class HMSSDK {
754
754
  *
755
755
  * @memberof HMSSDK
756
756
  */
757
- remoteMuteAllAudio = () => {
757
+ remoteMuteAllAudio = async () => {
758
758
  logger?.verbose('#Function remoteMuteAllAudio', { id: this.id });
759
- HMSManager.remoteMuteAllAudio({ id: this.id });
759
+ return await HMSManager.remoteMuteAllAudio({ id: this.id });
760
760
  };
761
761
 
762
762
  /**
@@ -1093,7 +1093,6 @@ export class HMSSDK {
1093
1093
  if (data.id !== this.id) {
1094
1094
  return;
1095
1095
  }
1096
- logger?.verbose('#Listener ON_PREVIEW', data);
1097
1096
  const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
1098
1097
  const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
1099
1098
  data.localPeer,
@@ -1112,6 +1111,8 @@ export class HMSSDK {
1112
1111
  previewTracks,
1113
1112
  });
1114
1113
  this.onPreviewDelegate({ ...data, room, localPeer, previewTracks });
1114
+ } else {
1115
+ logger?.verbose('#Listener ON_PREVIEW', data);
1115
1116
  }
1116
1117
  };
1117
1118
 
@@ -1119,7 +1120,6 @@ export class HMSSDK {
1119
1120
  if (data.id !== this.id) {
1120
1121
  return;
1121
1122
  }
1122
- logger?.verbose('#LISTENER ON_JOIN', data);
1123
1123
  // Preprocessing
1124
1124
  const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
1125
1125
  const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
@@ -1143,6 +1143,8 @@ export class HMSSDK {
1143
1143
  remotePeers,
1144
1144
  });
1145
1145
  this.onJoinDelegate({ ...data, room, localPeer, remotePeers });
1146
+ } else {
1147
+ logger?.verbose('#LISTENER ON_JOIN', data);
1146
1148
  }
1147
1149
  };
1148
1150
 
@@ -1150,7 +1152,6 @@ export class HMSSDK {
1150
1152
  if (data.id !== this.id) {
1151
1153
  return;
1152
1154
  }
1153
- logger?.verbose('#Listener ON_ROOM', data);
1154
1155
  const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
1155
1156
  const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
1156
1157
  data.localPeer,
@@ -1171,6 +1172,8 @@ export class HMSSDK {
1171
1172
  remotePeers,
1172
1173
  });
1173
1174
  this.onRoomDelegate({ ...data, room, localPeer, remotePeers });
1175
+ } else {
1176
+ logger?.verbose('#Listener ON_ROOM', data);
1174
1177
  }
1175
1178
  };
1176
1179
 
@@ -1178,7 +1181,6 @@ export class HMSSDK {
1178
1181
  if (data.id !== this.id) {
1179
1182
  return;
1180
1183
  }
1181
- logger?.verbose('#Listener ON_PEER', data);
1182
1184
  const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1183
1185
  const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
1184
1186
  const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
@@ -1194,8 +1196,16 @@ export class HMSSDK {
1194
1196
  this.remotePeers = remotePeers;
1195
1197
  this.room = room;
1196
1198
  if (this.onPeerDelegate) {
1197
- logger?.verbose('#Listener ON_PEER_LISTENER_CALL', data);
1199
+ logger?.verbose('#Listener ON_PEER_LISTENER_CALL', {
1200
+ ...data,
1201
+ localPeer,
1202
+ remotePeers,
1203
+ room,
1204
+ peer,
1205
+ });
1198
1206
  this.onPeerDelegate({ ...data, localPeer, remotePeers, room, peer });
1207
+ } else {
1208
+ logger?.verbose('#Listener ON_PEER', data);
1199
1209
  }
1200
1210
  };
1201
1211
 
@@ -1203,7 +1213,6 @@ export class HMSSDK {
1203
1213
  if (data.id !== this.id) {
1204
1214
  return;
1205
1215
  }
1206
- logger?.verbose('#Listener ON_TRACK', data);
1207
1216
  const track: HMSTrack = HMSEncoder.encodeHmsTrack(data.track, this.id);
1208
1217
  const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1209
1218
  const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
@@ -1226,7 +1235,14 @@ export class HMSSDK {
1226
1235
  this.localPeer = localPeer;
1227
1236
  this.remotePeers = remotePeers;
1228
1237
  if (this.onTrackDelegate) {
1229
- logger?.verbose('#Listener ON_TRACK_LISTENER_CALL', data);
1238
+ logger?.verbose('#Listener ON_TRACK_LISTENER_CALL', {
1239
+ ...data,
1240
+ localPeer,
1241
+ remotePeers,
1242
+ room,
1243
+ peer,
1244
+ track,
1245
+ });
1230
1246
  this.onTrackDelegate({
1231
1247
  ...data,
1232
1248
  localPeer,
@@ -1235,6 +1251,8 @@ export class HMSSDK {
1235
1251
  peer,
1236
1252
  track,
1237
1253
  });
1254
+ } else {
1255
+ logger?.verbose('#Listener ON_TRACK', data);
1238
1256
  }
1239
1257
  };
1240
1258
 
@@ -1242,11 +1260,12 @@ export class HMSSDK {
1242
1260
  if (data.id !== this.id) {
1243
1261
  return;
1244
1262
  }
1245
- logger?.verbose('#Listener ON_MESSAGE', data);
1246
1263
  const message = HMSEncoder.encodeHMSMessage(data, this.id);
1247
1264
  if (this.onMessageDelegate) {
1248
1265
  logger?.verbose('#Listener ON_MESSAGE_LISTENER_CALL', message);
1249
1266
  this.onMessageDelegate(message);
1267
+ } else {
1268
+ logger?.verbose('#Listener ON_MESSAGE', data);
1250
1269
  }
1251
1270
  };
1252
1271
 
@@ -1254,12 +1273,13 @@ export class HMSSDK {
1254
1273
  if (data.id !== this.id) {
1255
1274
  return;
1256
1275
  }
1257
- logger?.verbose('#Listener ON_SPEAKER', data?.speakers);
1258
1276
  if (this.onSpeakerDelegate) {
1259
1277
  logger?.verbose('#Listener ON_SPEAKER_LISTENER_CALL', data?.speakers);
1260
1278
  this.onSpeakerDelegate(
1261
1279
  HMSEncoder.encodeHmsSpeakers(data?.speakers, this.id)
1262
1280
  );
1281
+ } else {
1282
+ logger?.verbose('#Listener ON_SPEAKER', data?.speakers);
1263
1283
  }
1264
1284
  };
1265
1285
 
@@ -1267,12 +1287,13 @@ export class HMSSDK {
1267
1287
  if (data.id !== this.id) {
1268
1288
  return;
1269
1289
  }
1270
- logger?.warn('#Listener ON_ERROR', data);
1271
- logger?.verbose('#Listener ON_ERROR', data);
1272
1290
  if (this.onErrorDelegate) {
1273
1291
  logger?.verbose('#Listener ON_ERROR_LISTENER_CALL', data);
1274
1292
  logger?.warn('#Listener ON_ERROR_LISTENER_CALL', data);
1275
1293
  this.onErrorDelegate(data);
1294
+ } else {
1295
+ logger?.warn('#Listener ON_ERROR', data);
1296
+ logger?.verbose('#Listener ON_ERROR', data);
1276
1297
  }
1277
1298
  };
1278
1299
 
@@ -1280,7 +1301,6 @@ export class HMSSDK {
1280
1301
  if (data.id !== this.id) {
1281
1302
  return;
1282
1303
  }
1283
- logger?.verbose('#Listener ON_ROLE_CHANGE_REQUEST', data);
1284
1304
  if (this.onRoleChangeRequestDelegate) {
1285
1305
  const encodedRoleChangeRequest = HMSEncoder.encodeHmsRoleChangeRequest(
1286
1306
  data,
@@ -1291,6 +1311,8 @@ export class HMSSDK {
1291
1311
  encodedRoleChangeRequest
1292
1312
  );
1293
1313
  this.onRoleChangeRequestDelegate(encodedRoleChangeRequest);
1314
+ } else {
1315
+ logger?.verbose('#Listener ON_ROLE_CHANGE_REQUEST', data);
1294
1316
  }
1295
1317
  };
1296
1318
 
@@ -1298,7 +1320,6 @@ export class HMSSDK {
1298
1320
  if (data.id !== this.id) {
1299
1321
  return;
1300
1322
  }
1301
- logger?.verbose('#Listener ON_CHANGE_TRACK_STATE_REQUEST', data);
1302
1323
  if (this.onChangeTrackStateRequestDelegate) {
1303
1324
  const encodedRoleChangeRequest =
1304
1325
  HMSEncoder.encodeHmsChangeTrackStateRequest(data, this.id);
@@ -1307,6 +1328,8 @@ export class HMSSDK {
1307
1328
  encodedRoleChangeRequest
1308
1329
  );
1309
1330
  this.onChangeTrackStateRequestDelegate(encodedRoleChangeRequest);
1331
+ } else {
1332
+ logger?.verbose('#Listener ON_CHANGE_TRACK_STATE_REQUEST', data);
1310
1333
  }
1311
1334
  };
1312
1335
 
@@ -1314,7 +1337,6 @@ export class HMSSDK {
1314
1337
  if (data.id !== this.id) {
1315
1338
  return;
1316
1339
  }
1317
- logger?.verbose('#Listener ON_REMOVED_FROM_ROOM', data);
1318
1340
  if (this.onRemovedFromRoomDelegate) {
1319
1341
  let requestedBy = null;
1320
1342
  if (data.requestedBy) {
@@ -1330,6 +1352,8 @@ export class HMSSDK {
1330
1352
  id: this.id,
1331
1353
  });
1332
1354
  this.onRemovedFromRoomDelegate({ requestedBy, reason, roomEnded });
1355
+ } else {
1356
+ logger?.verbose('#Listener ON_REMOVED_FROM_ROOM', data);
1333
1357
  }
1334
1358
  };
1335
1359
 
@@ -1337,9 +1361,11 @@ export class HMSSDK {
1337
1361
  if (data.id !== this.id) {
1338
1362
  return;
1339
1363
  }
1340
- logger?.verbose('#Listener ON_RECONNECTING', data);
1341
1364
  if (this.onReconnectingDelegate) {
1365
+ logger?.verbose('#Listener ON_RECONNECTING_CALL', data);
1342
1366
  this.onReconnectingDelegate(data);
1367
+ } else {
1368
+ logger?.verbose('#Listener ON_RECONNECTING', data);
1343
1369
  }
1344
1370
  };
1345
1371
 
@@ -1349,7 +1375,10 @@ export class HMSSDK {
1349
1375
  }
1350
1376
  logger?.verbose('#Listener ON_RECONNECTED', data);
1351
1377
  if (this.onReconnectedDelegate) {
1378
+ logger?.verbose('#Listener ON_RECONNECTED_CALL', data);
1352
1379
  this.onReconnectedDelegate(data);
1380
+ } else {
1381
+ logger?.verbose('#Listener ON_RECONNECTED', data);
1353
1382
  }
1354
1383
  };
1355
1384
 
@@ -1358,12 +1387,13 @@ export class HMSSDK {
1358
1387
  return;
1359
1388
  }
1360
1389
 
1361
- logger?.verbose('#Listener RTCStatsListener', data);
1362
-
1363
1390
  let rtcStats = HMSEncoder.encodeRTCStats(data);
1364
1391
 
1365
1392
  if (this.onRtcStatsDelegate) {
1393
+ logger?.verbose('#Listener RTCStatsListener_CALL', { rtcStats });
1366
1394
  this.onRtcStatsDelegate({ rtcStats });
1395
+ } else {
1396
+ logger?.verbose('#Listener RTCStatsListener', data);
1367
1397
  }
1368
1398
  };
1369
1399
 
@@ -1372,14 +1402,20 @@ export class HMSSDK {
1372
1402
  return;
1373
1403
  }
1374
1404
 
1375
- logger?.verbose('#Listener onLocalAudioStatsListener', data);
1376
-
1377
1405
  let localAudioStats = new HMSLocalAudioStats(data.localAudioStats);
1378
1406
  let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1379
1407
  let track = HMSEncoder.encodeHmsLocalAudioTrack(data.track, this.id);
1380
1408
 
1381
1409
  if (this.onLocalAudioStatsDelegate) {
1410
+ logger?.verbose('#Listener onLocalAudioStatsListener_CALL', {
1411
+ ...data,
1412
+ localAudioStats,
1413
+ peer,
1414
+ track,
1415
+ });
1382
1416
  this.onLocalAudioStatsDelegate({ ...data, localAudioStats, peer, track });
1417
+ } else {
1418
+ logger?.verbose('#Listener onLocalAudioStatsListener', data);
1383
1419
  }
1384
1420
  };
1385
1421
 
@@ -1388,14 +1424,20 @@ export class HMSSDK {
1388
1424
  return;
1389
1425
  }
1390
1426
 
1391
- logger?.verbose('#Listener onLocalVideoStatsListener', data);
1392
-
1393
1427
  let localVideoStats = new HMSLocalVideoStats(data.localVideoStats);
1394
1428
  let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1395
1429
  let track = HMSEncoder.encodeHmsLocalVideoTrack(data.track, this.id);
1396
1430
 
1397
1431
  if (this.onLocalVideoStatsDelegate) {
1432
+ logger?.verbose('#Listener onLocalVideoStatsListener_CALL', {
1433
+ ...data,
1434
+ localVideoStats,
1435
+ peer,
1436
+ track,
1437
+ });
1398
1438
  this.onLocalVideoStatsDelegate({ ...data, localVideoStats, peer, track });
1439
+ } else {
1440
+ logger?.verbose('#Listener onLocalVideoStatsListener', data);
1399
1441
  }
1400
1442
  };
1401
1443
 
@@ -1404,19 +1446,25 @@ export class HMSSDK {
1404
1446
  return;
1405
1447
  }
1406
1448
 
1407
- logger?.verbose('#Listener onRemoteAudioStatsListener', data);
1408
-
1409
1449
  let remoteAudioStats = new HMSRemoteAudioStats(data.remoteAudioStats);
1410
1450
  let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1411
1451
  let track = HMSEncoder.encodeHmsRemoteAudioTrack(data.track, this.id);
1412
1452
 
1413
1453
  if (this.onRemoteAudioStatsDelegate) {
1454
+ logger?.verbose('#Listener onRemoteAudioStatsListener_CALL', {
1455
+ ...data,
1456
+ remoteAudioStats,
1457
+ peer,
1458
+ track,
1459
+ });
1414
1460
  this.onRemoteAudioStatsDelegate({
1415
1461
  ...data,
1416
1462
  remoteAudioStats,
1417
1463
  peer,
1418
1464
  track,
1419
1465
  });
1466
+ } else {
1467
+ logger?.verbose('#Listener onRemoteAudioStatsListener', data);
1420
1468
  }
1421
1469
  };
1422
1470
 
@@ -1425,19 +1473,25 @@ export class HMSSDK {
1425
1473
  return;
1426
1474
  }
1427
1475
 
1428
- logger?.verbose('#Listener onRemoteVideoStatsListener', data);
1429
-
1430
1476
  let remoteVideoStats = new HMSRemoteVideoStats(data.remoteVideoStats);
1431
1477
  let peer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
1432
1478
  let track = HMSEncoder.encodeHmsRemoteVideoTrack(data.track, this.id);
1433
1479
 
1434
1480
  if (this.onRemoteVideoStatsDelegate) {
1481
+ logger?.verbose('#Listener onRemoteVideoStatsListener_CALL', {
1482
+ ...data,
1483
+ remoteVideoStats,
1484
+ peer,
1485
+ track,
1486
+ });
1435
1487
  this.onRemoteVideoStatsDelegate({
1436
1488
  ...data,
1437
1489
  remoteVideoStats,
1438
1490
  peer,
1439
1491
  track,
1440
1492
  });
1493
+ } else {
1494
+ logger?.verbose('#Listener onRemoteVideoStatsListener', data);
1441
1495
  }
1442
1496
  };
1443
1497
  }