mediasoup-client 3.6.92 → 3.6.93

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/lib/Device.js CHANGED
@@ -44,7 +44,6 @@ const ReactNativeUnifiedPlan_1 = require("./handlers/ReactNativeUnifiedPlan");
44
44
  const ReactNative_1 = require("./handlers/ReactNative");
45
45
  const logger = new Logger_1.Logger('Device');
46
46
  function detectDevice() {
47
- var _a, _b, _c, _d, _e, _f, _g, _h;
48
47
  // React-Native.
49
48
  // NOTE: react-native-webrtc >= 1.75.0 is required.
50
49
  // NOTE: react-native-webrtc with Unified Plan requires version >= 106.0.0.
@@ -69,13 +68,13 @@ function detectDevice() {
69
68
  const uaParser = new ua_parser_js_1.UAParser(ua);
70
69
  logger.debug('detectDevice() | browser detected [ua:%s, parsed:%o]', ua, uaParser.getResult());
71
70
  const browser = uaParser.getBrowser();
72
- const browserName = (_b = (_a = browser.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '';
73
- const browserVersion = parseInt((_c = browser.major) !== null && _c !== void 0 ? _c : '0');
71
+ const browserName = browser.name?.toLowerCase() ?? '';
72
+ const browserVersion = parseInt(browser.major ?? '0');
74
73
  const engine = uaParser.getEngine();
75
- const engineName = (_e = (_d = engine.name) === null || _d === void 0 ? void 0 : _d.toLowerCase()) !== null && _e !== void 0 ? _e : '';
74
+ const engineName = engine.name?.toLowerCase() ?? '';
76
75
  const os = uaParser.getOS();
77
- const osName = (_g = (_f = os.name) === null || _f === void 0 ? void 0 : _f.toLowerCase()) !== null && _g !== void 0 ? _g : '';
78
- const osVersion = parseFloat((_h = os.version) !== null && _h !== void 0 ? _h : '0');
76
+ const osName = os.name?.toLowerCase() ?? '';
77
+ const osVersion = parseFloat(os.version ?? '0');
79
78
  const isIOS = osName === 'ios';
80
79
  const isChrome = [
81
80
  'chrome',
@@ -202,7 +202,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
202
202
  return this._pc.getStats();
203
203
  }
204
204
  async send({ track, encodings, codecOptions, codec }) {
205
- var _a;
206
205
  this.assertSendDirection();
207
206
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
208
207
  if (encodings && encodings.length > 1) {
@@ -247,7 +246,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
247
246
  let localSdpObject = sdpTransform.parse(offer.sdp);
248
247
  if (!this._transportReady) {
249
248
  await this.setupTransport({
250
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
249
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
251
250
  localSdpObject
252
251
  });
253
252
  }
@@ -421,7 +420,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
421
420
  return transceiver.sender.getStats();
422
421
  }
423
422
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
424
- var _a;
425
423
  this.assertSendDirection();
426
424
  const options = {
427
425
  negotiated: true,
@@ -445,7 +443,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
445
443
  .find((m) => m.type === 'application');
446
444
  if (!this._transportReady) {
447
445
  await this.setupTransport({
448
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
446
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
449
447
  localSdpObject
450
448
  });
451
449
  }
@@ -466,7 +464,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
466
464
  return { dataChannel, sctpStreamParameters };
467
465
  }
468
466
  async receive(optionsList) {
469
- var _a;
470
467
  this.assertRecvDirection();
471
468
  const results = [];
472
469
  const mapLocalId = new Map();
@@ -503,7 +500,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
503
500
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
504
501
  if (!this._transportReady) {
505
502
  await this.setupTransport({
506
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
503
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
507
504
  localSdpObject
508
505
  });
509
506
  }
@@ -594,7 +591,6 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
594
591
  return transceiver.receiver.getStats();
595
592
  }
596
593
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
597
- var _a;
598
594
  this.assertRecvDirection();
599
595
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
600
596
  const options = {
@@ -618,7 +614,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
618
614
  if (!this._transportReady) {
619
615
  const localSdpObject = sdpTransform.parse(answer.sdp);
620
616
  await this.setupTransport({
621
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
617
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
622
618
  localSdpObject
623
619
  });
624
620
  }
@@ -206,7 +206,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
206
206
  return this._pc.getStats();
207
207
  }
208
208
  async send({ track, encodings, codecOptions, codec }) {
209
- var _a;
210
209
  this.assertSendDirection();
211
210
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
212
211
  if (codec) {
@@ -225,7 +224,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
225
224
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
226
225
  if (!this._transportReady) {
227
226
  await this.setupTransport({
228
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
227
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
229
228
  localSdpObject
230
229
  });
231
230
  }
@@ -342,7 +341,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
342
341
  throw new errors_1.UnsupportedError('not implemented');
343
342
  }
344
343
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
345
- var _a;
346
344
  this.assertSendDirection();
347
345
  const options = {
348
346
  negotiated: true,
@@ -367,7 +365,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
367
365
  .find((m) => m.type === 'application');
368
366
  if (!this._transportReady) {
369
367
  await this.setupTransport({
370
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
368
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
371
369
  localSdpObject
372
370
  });
373
371
  }
@@ -388,7 +386,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
388
386
  return { dataChannel, sctpStreamParameters };
389
387
  }
390
388
  async receive(optionsList) {
391
- var _a;
392
389
  this.assertRecvDirection();
393
390
  const results = [];
394
391
  for (const options of optionsList) {
@@ -423,7 +420,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
423
420
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
424
421
  if (!this._transportReady) {
425
422
  await this.setupTransport({
426
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
423
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
427
424
  localSdpObject
428
425
  });
429
426
  }
@@ -477,7 +474,6 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
477
474
  throw new errors_1.UnsupportedError('not implemented');
478
475
  }
479
476
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
480
- var _a;
481
477
  this.assertRecvDirection();
482
478
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
483
479
  const options = {
@@ -502,7 +498,7 @@ class Chrome55 extends HandlerInterface_1.HandlerInterface {
502
498
  if (!this._transportReady) {
503
499
  const localSdpObject = sdpTransform.parse(answer.sdp);
504
500
  await this.setupTransport({
505
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
501
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
506
502
  localSdpObject
507
503
  });
508
504
  }
@@ -205,7 +205,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
205
205
  return this._pc.getStats();
206
206
  }
207
207
  async send({ track, encodings, codecOptions, codec }) {
208
- var _a;
209
208
  this.assertSendDirection();
210
209
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
211
210
  if (codec) {
@@ -224,7 +223,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
224
223
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
225
224
  if (!this._transportReady) {
226
225
  await this.setupTransport({
227
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
226
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
228
227
  localSdpObject
229
228
  });
230
229
  }
@@ -392,7 +391,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
392
391
  return rtpSender.getStats();
393
392
  }
394
393
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
395
- var _a;
396
394
  this.assertSendDirection();
397
395
  const options = {
398
396
  negotiated: true,
@@ -417,7 +415,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
417
415
  .find((m) => m.type === 'application');
418
416
  if (!this._transportReady) {
419
417
  await this.setupTransport({
420
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
418
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
421
419
  localSdpObject
422
420
  });
423
421
  }
@@ -438,7 +436,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
438
436
  return { dataChannel, sctpStreamParameters };
439
437
  }
440
438
  async receive(optionsList) {
441
- var _a;
442
439
  this.assertRecvDirection();
443
440
  const results = [];
444
441
  for (const options of optionsList) {
@@ -473,7 +470,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
473
470
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
474
471
  if (!this._transportReady) {
475
472
  await this.setupTransport({
476
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
473
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
477
474
  localSdpObject
478
475
  });
479
476
  }
@@ -533,7 +530,6 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
533
530
  return rtpReceiver.getStats();
534
531
  }
535
532
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
536
- var _a;
537
533
  this.assertRecvDirection();
538
534
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
539
535
  const options = {
@@ -558,7 +554,7 @@ class Chrome67 extends HandlerInterface_1.HandlerInterface {
558
554
  if (!this._transportReady) {
559
555
  const localSdpObject = sdpTransform.parse(answer.sdp);
560
556
  await this.setupTransport({
561
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
557
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
562
558
  localSdpObject
563
559
  });
564
560
  }
@@ -199,7 +199,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
199
199
  return this._pc.getStats();
200
200
  }
201
201
  async send({ track, encodings, codecOptions, codec }) {
202
- var _a;
203
202
  this.assertSendDirection();
204
203
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
205
204
  const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
@@ -217,7 +216,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
217
216
  let offerMediaObject;
218
217
  if (!this._transportReady) {
219
218
  await this.setupTransport({
220
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
219
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
221
220
  localSdpObject
222
221
  });
223
222
  }
@@ -416,7 +415,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
416
415
  return transceiver.sender.getStats();
417
416
  }
418
417
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
419
- var _a;
420
418
  this.assertSendDirection();
421
419
  const options = {
422
420
  negotiated: true,
@@ -441,7 +439,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
441
439
  .find((m) => m.type === 'application');
442
440
  if (!this._transportReady) {
443
441
  await this.setupTransport({
444
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
442
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
445
443
  localSdpObject
446
444
  });
447
445
  }
@@ -462,7 +460,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
462
460
  return { dataChannel, sctpStreamParameters };
463
461
  }
464
462
  async receive(optionsList) {
465
- var _a;
466
463
  this.assertRecvDirection();
467
464
  const results = [];
468
465
  const mapLocalId = new Map();
@@ -499,7 +496,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
499
496
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
500
497
  if (!this._transportReady) {
501
498
  await this.setupTransport({
502
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
499
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
503
500
  localSdpObject
504
501
  });
505
502
  }
@@ -562,7 +559,6 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
562
559
  return transceiver.receiver.getStats();
563
560
  }
564
561
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
565
- var _a;
566
562
  this.assertRecvDirection();
567
563
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
568
564
  const options = {
@@ -587,7 +583,7 @@ class Chrome70 extends HandlerInterface_1.HandlerInterface {
587
583
  if (!this._transportReady) {
588
584
  const localSdpObject = sdpTransform.parse(answer.sdp);
589
585
  await this.setupTransport({
590
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
586
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
591
587
  localSdpObject
592
588
  });
593
589
  }
@@ -202,7 +202,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
202
202
  return this._pc.getStats();
203
203
  }
204
204
  async send({ track, encodings, codecOptions, codec }) {
205
- var _a;
206
205
  this.assertSendDirection();
207
206
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
208
207
  if (encodings && encodings.length > 1) {
@@ -229,7 +228,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
229
228
  let offerMediaObject;
230
229
  if (!this._transportReady) {
231
230
  await this.setupTransport({
232
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
231
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
233
232
  localSdpObject
234
233
  });
235
234
  }
@@ -438,7 +437,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
438
437
  return transceiver.sender.getStats();
439
438
  }
440
439
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
441
- var _a;
442
440
  this.assertSendDirection();
443
441
  const options = {
444
442
  negotiated: true,
@@ -462,7 +460,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
462
460
  .find((m) => m.type === 'application');
463
461
  if (!this._transportReady) {
464
462
  await this.setupTransport({
465
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
463
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
466
464
  localSdpObject
467
465
  });
468
466
  }
@@ -483,7 +481,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
483
481
  return { dataChannel, sctpStreamParameters };
484
482
  }
485
483
  async receive(optionsList) {
486
- var _a;
487
484
  this.assertRecvDirection();
488
485
  const results = [];
489
486
  const mapLocalId = new Map();
@@ -520,7 +517,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
520
517
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
521
518
  if (!this._transportReady) {
522
519
  await this.setupTransport({
523
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
520
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
524
521
  localSdpObject
525
522
  });
526
523
  }
@@ -611,7 +608,6 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
611
608
  return transceiver.receiver.getStats();
612
609
  }
613
610
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
614
- var _a;
615
611
  this.assertRecvDirection();
616
612
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
617
613
  const options = {
@@ -635,7 +631,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
635
631
  if (!this._transportReady) {
636
632
  const localSdpObject = sdpTransform.parse(answer.sdp);
637
633
  await this.setupTransport({
638
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
634
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
639
635
  localSdpObject
640
636
  });
641
637
  }
@@ -210,7 +210,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
210
210
  return this._pc.getStats();
211
211
  }
212
212
  async send({ track, encodings, codecOptions, codec }) {
213
- var _a;
214
213
  this.assertSendDirection();
215
214
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
216
215
  if (codec) {
@@ -229,7 +228,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
229
228
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
230
229
  if (!this._transportReady) {
231
230
  await this.setupTransport({
232
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
231
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
233
232
  localSdpObject
234
233
  });
235
234
  }
@@ -348,7 +347,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
348
347
  throw new errors_1.UnsupportedError('not implemented');
349
348
  }
350
349
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
351
- var _a;
352
350
  this.assertSendDirection();
353
351
  const options = {
354
352
  negotiated: true,
@@ -373,7 +371,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
373
371
  .find((m) => m.type === 'application');
374
372
  if (!this._transportReady) {
375
373
  await this.setupTransport({
376
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
374
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
377
375
  localSdpObject
378
376
  });
379
377
  }
@@ -394,7 +392,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
394
392
  return { dataChannel, sctpStreamParameters };
395
393
  }
396
394
  async receive(optionsList) {
397
- var _a;
398
395
  this.assertRecvDirection();
399
396
  const results = [];
400
397
  const mapStreamId = new Map();
@@ -439,7 +436,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
439
436
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
440
437
  if (!this._transportReady) {
441
438
  await this.setupTransport({
442
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
439
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
443
440
  localSdpObject
444
441
  });
445
442
  }
@@ -493,7 +490,6 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
493
490
  throw new errors_1.UnsupportedError('not implemented');
494
491
  }
495
492
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
496
- var _a;
497
493
  this.assertRecvDirection();
498
494
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
499
495
  const options = {
@@ -518,7 +514,7 @@ class ReactNative extends HandlerInterface_1.HandlerInterface {
518
514
  if (!this._transportReady) {
519
515
  const localSdpObject = sdpTransform.parse(answer.sdp);
520
516
  await this.setupTransport({
521
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
517
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
522
518
  localSdpObject
523
519
  });
524
520
  }
@@ -206,7 +206,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
206
206
  return this._pc.getStats();
207
207
  }
208
208
  async send({ track, encodings, codecOptions, codec }) {
209
- var _a, _b;
210
209
  this.assertSendDirection();
211
210
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
212
211
  if (encodings && encodings.length > 1) {
@@ -233,7 +232,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
233
232
  let offerMediaObject;
234
233
  if (!this._transportReady) {
235
234
  await this.setupTransport({
236
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
235
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
237
236
  localSdpObject
238
237
  });
239
238
  }
@@ -263,7 +262,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
263
262
  // Issue: https://github.com/react-native-webrtc/react-native-webrtc/issues/1404
264
263
  // NOTE: So let's fill MID in sendingRtpParameters later.
265
264
  // NOTE: This is fixed in react-native-webrtc 111.0.3.
266
- let localId = (_b = transceiver.mid) !== null && _b !== void 0 ? _b : undefined;
265
+ let localId = transceiver.mid ?? undefined;
267
266
  if (!localId) {
268
267
  logger.warn('send() | missing transceiver.mid (bug in react-native-webrtc, using a workaround');
269
268
  }
@@ -460,7 +459,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
460
459
  return transceiver.sender.getStats();
461
460
  }
462
461
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
463
- var _a;
464
462
  this.assertSendDirection();
465
463
  const options = {
466
464
  negotiated: true,
@@ -484,7 +482,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
484
482
  .find((m) => m.type === 'application');
485
483
  if (!this._transportReady) {
486
484
  await this.setupTransport({
487
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
485
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
488
486
  localSdpObject
489
487
  });
490
488
  }
@@ -505,7 +503,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
505
503
  return { dataChannel, sctpStreamParameters };
506
504
  }
507
505
  async receive(optionsList) {
508
- var _a;
509
506
  this.assertRecvDirection();
510
507
  const results = [];
511
508
  const mapLocalId = new Map();
@@ -542,7 +539,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
542
539
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
543
540
  if (!this._transportReady) {
544
541
  await this.setupTransport({
545
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
542
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
546
543
  localSdpObject
547
544
  });
548
545
  }
@@ -633,7 +630,6 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
633
630
  return transceiver.receiver.getStats();
634
631
  }
635
632
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
636
- var _a;
637
633
  this.assertRecvDirection();
638
634
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
639
635
  const options = {
@@ -657,7 +653,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
657
653
  if (!this._transportReady) {
658
654
  const localSdpObject = sdpTransform.parse(answer.sdp);
659
655
  await this.setupTransport({
660
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
656
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
661
657
  localSdpObject
662
658
  });
663
659
  }
@@ -204,7 +204,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
204
204
  return this._pc.getStats();
205
205
  }
206
206
  async send({ track, encodings, codecOptions, codec }) {
207
- var _a;
208
207
  this.assertSendDirection();
209
208
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
210
209
  if (codec) {
@@ -223,7 +222,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
223
222
  ortc.reduceCodecs(sendingRemoteRtpParameters.codecs);
224
223
  if (!this._transportReady) {
225
224
  await this.setupTransport({
226
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
225
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
227
226
  localSdpObject
228
227
  });
229
228
  }
@@ -388,7 +387,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
388
387
  return rtpSender.getStats();
389
388
  }
390
389
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
391
- var _a;
392
390
  this.assertSendDirection();
393
391
  const options = {
394
392
  negotiated: true,
@@ -412,7 +410,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
412
410
  .find((m) => m.type === 'application');
413
411
  if (!this._transportReady) {
414
412
  await this.setupTransport({
415
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
413
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
416
414
  localSdpObject
417
415
  });
418
416
  }
@@ -433,7 +431,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
433
431
  return { dataChannel, sctpStreamParameters };
434
432
  }
435
433
  async receive(optionsList) {
436
- var _a;
437
434
  this.assertRecvDirection();
438
435
  const results = [];
439
436
  for (const options of optionsList) {
@@ -468,7 +465,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
468
465
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
469
466
  if (!this._transportReady) {
470
467
  await this.setupTransport({
471
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
468
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
472
469
  localSdpObject
473
470
  });
474
471
  }
@@ -528,7 +525,6 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
528
525
  // Unimplemented.
529
526
  }
530
527
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
531
- var _a;
532
528
  this.assertRecvDirection();
533
529
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
534
530
  const options = {
@@ -552,7 +548,7 @@ class Safari11 extends HandlerInterface_1.HandlerInterface {
552
548
  if (!this._transportReady) {
553
549
  const localSdpObject = sdpTransform.parse(answer.sdp);
554
550
  await this.setupTransport({
555
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
551
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
556
552
  localSdpObject
557
553
  });
558
554
  }
@@ -200,7 +200,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
200
200
  return this._pc.getStats();
201
201
  }
202
202
  async send({ track, encodings, codecOptions, codec }) {
203
- var _a;
204
203
  this.assertSendDirection();
205
204
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
206
205
  const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
@@ -218,7 +217,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
218
217
  let offerMediaObject;
219
218
  if (!this._transportReady) {
220
219
  await this.setupTransport({
221
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
220
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
222
221
  localSdpObject
223
222
  });
224
223
  }
@@ -413,7 +412,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
413
412
  return transceiver.sender.getStats();
414
413
  }
415
414
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
416
- var _a;
417
415
  this.assertSendDirection();
418
416
  const options = {
419
417
  negotiated: true,
@@ -437,7 +435,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
437
435
  .find((m) => m.type === 'application');
438
436
  if (!this._transportReady) {
439
437
  await this.setupTransport({
440
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
438
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
441
439
  localSdpObject
442
440
  });
443
441
  }
@@ -458,7 +456,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
458
456
  return { dataChannel, sctpStreamParameters };
459
457
  }
460
458
  async receive(optionsList) {
461
- var _a;
462
459
  this.assertRecvDirection();
463
460
  const results = [];
464
461
  const mapLocalId = new Map();
@@ -495,7 +492,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
495
492
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
496
493
  if (!this._transportReady) {
497
494
  await this.setupTransport({
498
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
495
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
499
496
  localSdpObject
500
497
  });
501
498
  }
@@ -584,7 +581,6 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
584
581
  return transceiver.receiver.getStats();
585
582
  }
586
583
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
587
- var _a;
588
584
  this.assertRecvDirection();
589
585
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
590
586
  const options = {
@@ -608,7 +604,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
608
604
  if (!this._transportReady) {
609
605
  const localSdpObject = sdpTransform.parse(answer.sdp);
610
606
  await this.setupTransport({
611
- localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
607
+ localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
612
608
  localSdpObject
613
609
  });
614
610
  }
@@ -5,11 +5,10 @@ exports.addNackSuppportForOpus = void 0;
5
5
  * This function adds RTCP NACK support for OPUS codec in given capabilities.
6
6
  */
7
7
  function addNackSuppportForOpus(rtpCapabilities) {
8
- var _a;
9
8
  for (const codec of (rtpCapabilities.codecs || [])) {
10
9
  if ((codec.mimeType.toLowerCase() === 'audio/opus' ||
11
10
  codec.mimeType.toLowerCase() === 'audio/multiopus') &&
12
- !((_a = codec.rtcpFeedback) === null || _a === void 0 ? void 0 : _a.some((fb) => fb.type === 'nack' && !fb.parameter))) {
11
+ !codec.rtcpFeedback?.some((fb) => fb.type === 'nack' && !fb.parameter)) {
13
12
  if (!codec.rtcpFeedback) {
14
13
  codec.rtcpFeedback = [];
15
14
  }
@@ -312,7 +312,6 @@ class AnswerMediaSection extends MediaSection {
312
312
  this._mediaObject.direction = 'recvonly';
313
313
  }
314
314
  muxSimulcastStreams(encodings) {
315
- var _a;
316
315
  if (!this._mediaObject.simulcast || !this._mediaObject.simulcast.list1) {
317
316
  return;
318
317
  }
@@ -326,7 +325,7 @@ class AnswerMediaSection extends MediaSection {
326
325
  const simulcastStreams = sdpTransform.parseSimulcastStreamList(raw);
327
326
  for (const simulcastStream of simulcastStreams) {
328
327
  for (const simulcastFormat of simulcastStream) {
329
- simulcastFormat.paused = !((_a = layers[simulcastFormat.scid]) === null || _a === void 0 ? void 0 : _a.active);
328
+ simulcastFormat.paused = !layers[simulcastFormat.scid]?.active;
330
329
  }
331
330
  }
332
331
  this._mediaObject.simulcast.list1 = simulcastStreams.map((simulcastFormats) => simulcastFormats.map((f) => `${f.paused ? '~' : ''}${f.scid}`).join(',')).join(';');
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { types };
8
8
  /**
9
9
  * Expose mediasoup-client version.
10
10
  */
11
- export declare const version = "3.6.92";
11
+ export declare const version = "3.6.93";
12
12
  /**
13
13
  * Expose Device class and detectDevice() helper.
14
14
  */
package/lib/index.js CHANGED
@@ -37,7 +37,7 @@ exports.types = types;
37
37
  /**
38
38
  * Expose mediasoup-client version.
39
39
  */
40
- exports.version = '3.6.92';
40
+ exports.version = '3.6.93';
41
41
  /**
42
42
  * Expose parseScalabilityMode() function.
43
43
  */
package/lib/tests/test.js CHANGED
@@ -212,7 +212,6 @@ test('transport.produce() without "connect" listener rejects', async () => {
212
212
  .toThrow(Error);
213
213
  }, 500);
214
214
  test('transport.produce() succeeds', async () => {
215
- var _a, _b;
216
215
  const audioTrack = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'audio' });
217
216
  const videoTrack = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'video' });
218
217
  let audioProducerId;
@@ -307,12 +306,12 @@ test('transport.produce() succeeds', async () => {
307
306
  encodings = audioProducer.rtpParameters.encodings;
308
307
  expect(Array.isArray(encodings)).toBe(true);
309
308
  expect(encodings.length).toBe(1);
310
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0])).toBe('object');
309
+ expect(typeof encodings?.[0]).toBe('object');
311
310
  expect(Object.keys(encodings[0])).toEqual(['ssrc', 'dtx']);
312
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0].ssrc)).toBe('number');
311
+ expect(typeof encodings?.[0].ssrc).toBe('number');
313
312
  rtcp = audioProducer.rtpParameters.rtcp;
314
313
  expect(typeof rtcp).toBe('object');
315
- expect(typeof (rtcp === null || rtcp === void 0 ? void 0 : rtcp.cname)).toBe('string');
314
+ expect(typeof rtcp?.cname).toBe('string');
316
315
  expect(audioProducer.paused).toBe(true);
317
316
  expect(audioProducer.maxSpatialLayer).toBe(undefined);
318
317
  expect(audioProducer.appData).toEqual({ foo: 'FOO' });
@@ -401,19 +400,19 @@ test('transport.produce() succeeds', async () => {
401
400
  encodings = videoProducer.rtpParameters.encodings;
402
401
  expect(Array.isArray(encodings)).toBe(true);
403
402
  expect(encodings.length).toBe(2);
404
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0])).toBe('object');
405
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0].ssrc)).toBe('number');
406
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0].rtx)).toBe('object');
403
+ expect(typeof encodings?.[0]).toBe('object');
404
+ expect(typeof encodings?.[0].ssrc).toBe('number');
405
+ expect(typeof encodings?.[0].rtx).toBe('object');
407
406
  expect(Object.keys(encodings[0].rtx)).toEqual(['ssrc']);
408
- expect(typeof ((_a = encodings === null || encodings === void 0 ? void 0 : encodings[0].rtx) === null || _a === void 0 ? void 0 : _a.ssrc)).toBe('number');
409
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[1])).toBe('object');
410
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[1].ssrc)).toBe('number');
411
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[1].rtx)).toBe('object');
407
+ expect(typeof encodings?.[0].rtx?.ssrc).toBe('number');
408
+ expect(typeof encodings?.[1]).toBe('object');
409
+ expect(typeof encodings?.[1].ssrc).toBe('number');
410
+ expect(typeof encodings?.[1].rtx).toBe('object');
412
411
  expect(Object.keys(encodings[1].rtx)).toEqual(['ssrc']);
413
- expect(typeof ((_b = encodings === null || encodings === void 0 ? void 0 : encodings[1].rtx) === null || _b === void 0 ? void 0 : _b.ssrc)).toBe('number');
412
+ expect(typeof encodings?.[1].rtx?.ssrc).toBe('number');
414
413
  rtcp = videoProducer.rtpParameters.rtcp;
415
414
  expect(typeof rtcp).toBe('object');
416
- expect(typeof (rtcp === null || rtcp === void 0 ? void 0 : rtcp.cname)).toBe('string');
415
+ expect(typeof rtcp?.cname).toBe('string');
417
416
  expect(videoProducer.paused).toBe(false);
418
417
  expect(videoProducer.maxSpatialLayer).toBe(undefined);
419
418
  expect(videoProducer.appData).toEqual({});
@@ -446,7 +445,6 @@ test('transport.produce() with a non object appData rejects with TypeError', asy
446
445
  .toThrow(TypeError);
447
446
  }, 500);
448
447
  test('transport.consume() succeeds', async () => {
449
- var _a;
450
448
  const audioConsumerRemoteParameters = fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'audio/opus' });
451
449
  const videoConsumerRemoteParameters = fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'video/VP8' });
452
450
  let connectEventNumTimesCalled = 0;
@@ -517,12 +515,12 @@ test('transport.consume() succeeds', async () => {
517
515
  encodings = audioConsumer.rtpParameters.encodings;
518
516
  expect(Array.isArray(encodings)).toBe(true);
519
517
  expect(encodings.length).toBe(1);
520
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0])).toBe('object');
518
+ expect(typeof encodings?.[0]).toBe('object');
521
519
  expect(Object.keys(encodings[0])).toEqual(['ssrc', 'dtx']);
522
520
  expect(typeof encodings[0].ssrc).toBe('number');
523
521
  rtcp = audioProducer.rtpParameters.rtcp;
524
522
  expect(typeof rtcp).toBe('object');
525
- expect(typeof (rtcp === null || rtcp === void 0 ? void 0 : rtcp.cname)).toBe('string');
523
+ expect(typeof rtcp?.cname).toBe('string');
526
524
  expect(audioConsumer.paused).toBe(false);
527
525
  expect(audioConsumer.appData).toEqual({ bar: 'BAR' });
528
526
  videoConsumer = await recvTransport.consume({
@@ -602,15 +600,15 @@ test('transport.consume() succeeds', async () => {
602
600
  encodings = videoConsumer.rtpParameters.encodings;
603
601
  expect(Array.isArray(encodings)).toBe(true);
604
602
  expect(encodings.length).toBe(1);
605
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0])).toBe('object');
603
+ expect(typeof encodings?.[0]).toBe('object');
606
604
  expect(Object.keys(encodings[0])).toEqual(['ssrc', 'rtx', 'dtx']);
607
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0].ssrc)).toBe('number');
608
- expect(typeof (encodings === null || encodings === void 0 ? void 0 : encodings[0].rtx)).toBe('object');
605
+ expect(typeof encodings?.[0].ssrc).toBe('number');
606
+ expect(typeof encodings?.[0].rtx).toBe('object');
609
607
  expect(Object.keys(encodings[0].rtx)).toEqual(['ssrc']);
610
- expect(typeof ((_a = encodings === null || encodings === void 0 ? void 0 : encodings[0].rtx) === null || _a === void 0 ? void 0 : _a.ssrc)).toBe('number');
608
+ expect(typeof encodings?.[0].rtx?.ssrc).toBe('number');
611
609
  rtcp = videoConsumer.rtpParameters.rtcp;
612
610
  expect(typeof rtcp).toBe('object');
613
- expect(typeof (rtcp === null || rtcp === void 0 ? void 0 : rtcp.cname)).toBe('string');
611
+ expect(typeof rtcp?.cname).toBe('string');
614
612
  expect(videoConsumer.paused).toBe(false);
615
613
  expect(videoConsumer.appData).toEqual({});
616
614
  recvTransport.removeAllListeners('connect');
@@ -854,20 +852,17 @@ test('connection state change fires "connectionstatechange" in live Transport',
854
852
  sendTransport.removeAllListeners('connectionstatechange');
855
853
  });
856
854
  test('producer.pause() succeeds', () => {
857
- var _a;
858
855
  videoProducer.pause();
859
856
  expect(videoProducer.paused).toBe(true);
860
857
  // Track will be still enabled due to disableTrackOnPause: false.
861
- expect((_a = videoProducer.track) === null || _a === void 0 ? void 0 : _a.enabled).toBe(true);
858
+ expect(videoProducer.track?.enabled).toBe(true);
862
859
  });
863
860
  test('producer.resume() succeeds', () => {
864
- var _a;
865
861
  videoProducer.resume();
866
862
  expect(videoProducer.paused).toBe(false);
867
- expect((_a = videoProducer.track) === null || _a === void 0 ? void 0 : _a.enabled).toBe(true);
863
+ expect(videoProducer.track?.enabled).toBe(true);
868
864
  });
869
865
  test('producer.replaceTrack() with a new track succeeds', async () => {
870
- var _a;
871
866
  // Have the audio Producer paused.
872
867
  audioProducer.pause();
873
868
  const audioProducerPreviousTrack = audioProducer.track;
@@ -876,8 +871,8 @@ test('producer.replaceTrack() with a new track succeeds', async () => {
876
871
  .resolves
877
872
  .toBe(undefined);
878
873
  // Previous track must be 'live' due to stopTracks: false.
879
- expect(audioProducerPreviousTrack === null || audioProducerPreviousTrack === void 0 ? void 0 : audioProducerPreviousTrack.readyState).toBe('live');
880
- expect((_a = audioProducer.track) === null || _a === void 0 ? void 0 : _a.readyState).toBe('live');
874
+ expect(audioProducerPreviousTrack?.readyState).toBe('live');
875
+ expect(audioProducer.track?.readyState).toBe('live');
881
876
  expect(audioProducer.track).not.toBe(audioProducerPreviousTrack);
882
877
  expect(audioProducer.track).toBe(newAudioTrack);
883
878
  // Producer was already paused.
@@ -890,7 +885,7 @@ test('producer.replaceTrack() with a new track succeeds', async () => {
890
885
  .resolves
891
886
  .toBe(undefined);
892
887
  // Previous track must be 'ended' due to stopTracks: true.
893
- expect(videoProducerPreviousTrack === null || videoProducerPreviousTrack === void 0 ? void 0 : videoProducerPreviousTrack.readyState).toBe('ended');
888
+ expect(videoProducerPreviousTrack?.readyState).toBe('ended');
894
889
  expect(videoProducer.track).not.toBe(videoProducerPreviousTrack);
895
890
  expect(videoProducer.track).toBe(newVideoTrack);
896
891
  expect(videoProducer.paused).toBe(false);
@@ -903,7 +898,7 @@ test('producer.replaceTrack() with null succeeds', async () => {
903
898
  .resolves
904
899
  .toBe(undefined);
905
900
  // Previous track must be 'live' due to stopTracks: false.
906
- expect(audioProducerPreviousTrack === null || audioProducerPreviousTrack === void 0 ? void 0 : audioProducerPreviousTrack.readyState).toBe('live');
901
+ expect(audioProducerPreviousTrack?.readyState).toBe('live');
907
902
  expect(audioProducer.track).toBeNull();
908
903
  // Producer was already paused.
909
904
  expect(audioProducer.paused).toBe(true);
@@ -919,26 +914,24 @@ test('producer.replaceTrack() with null succeeds', async () => {
919
914
  // The given audio track was muted but the Producer was not, so the track
920
915
  // must not be muted now.
921
916
  expect(audioProducer.paused).toBe(false);
922
- expect(audioProducerPreviousTrack === null || audioProducerPreviousTrack === void 0 ? void 0 : audioProducerPreviousTrack.enabled).toBe(true);
917
+ expect(audioProducerPreviousTrack?.enabled).toBe(true);
923
918
  // Reset the audio paused state.
924
919
  audioProducer.resume();
925
920
  }, 500);
926
921
  test('producer.replaceTrack() with an ended track rejects with InvalidStateError', async () => {
927
- var _a;
928
922
  const track = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'audio' });
929
923
  track.stop();
930
924
  await expect(videoProducer.replaceTrack({ track }))
931
925
  .rejects
932
926
  .toThrow(errors_1.InvalidStateError);
933
927
  expect(track.readyState).toBe('ended');
934
- expect((_a = videoProducer.track) === null || _a === void 0 ? void 0 : _a.readyState).toBe('live');
928
+ expect(videoProducer.track?.readyState).toBe('live');
935
929
  }, 500);
936
930
  test('producer.replaceTrack() with the same track succeeds', async () => {
937
- var _a;
938
931
  await expect(audioProducer.replaceTrack({ track: audioProducer.track }))
939
932
  .resolves
940
933
  .toBe(undefined);
941
- expect((_a = audioProducer.track) === null || _a === void 0 ? void 0 : _a.readyState).toBe('live');
934
+ expect(audioProducer.track?.readyState).toBe('live');
942
935
  }, 500);
943
936
  test('producer.setMaxSpatialLayer() succeeds', async () => {
944
937
  await expect(videoProducer.setMaxSpatialLayer(0))
@@ -987,11 +980,10 @@ test('consumer.getStats() succeeds', async () => {
987
980
  expect(typeof stats).toBe('object');
988
981
  }, 500);
989
982
  test('producer.close() succeed', () => {
990
- var _a;
991
983
  audioProducer.close();
992
984
  expect(audioProducer.closed).toBe(true);
993
985
  // Track will be still 'live' due to stopTracks: false.
994
- expect((_a = audioProducer.track) === null || _a === void 0 ? void 0 : _a.readyState).toBe('live');
986
+ expect(audioProducer.track?.readyState).toBe('live');
995
987
  });
996
988
  test('producer.replaceTrack() rejects with InvalidStateError if closed', async () => {
997
989
  const audioTrack = new fake_mediastreamtrack_1.FakeMediaStreamTrack({ kind: 'audio' });
@@ -1160,7 +1152,6 @@ test('connection state change does not fire "connectionstatechange" in closed Tr
1160
1152
  sendTransport.removeAllListeners('connectionstatechange');
1161
1153
  });
1162
1154
  test('RemoteSdp properly handles multiple streams of the same type in planB', async () => {
1163
- var _a, _b, _c;
1164
1155
  let sdp = undefined;
1165
1156
  let sdpObject = undefined;
1166
1157
  const remoteSdp = new RemoteSdp_1.RemoteSdp({ planB: true });
@@ -1180,7 +1171,7 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as
1180
1171
  expect(sdpObject.media[0].rtp[0].codec).toBe('VP8');
1181
1172
  expect(sdpObject.media[0].rtp[1].payload).toBe(102);
1182
1173
  expect(sdpObject.media[0].rtp[1].codec).toBe('rtx');
1183
- expect((_a = sdpObject.media[0].ssrcs) === null || _a === void 0 ? void 0 : _a.length).toBe(4);
1174
+ expect(sdpObject.media[0].ssrcs?.length).toBe(4);
1184
1175
  await remoteSdp.receive({
1185
1176
  mid: 'video',
1186
1177
  kind: 'video',
@@ -1201,7 +1192,7 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as
1201
1192
  expect(sdpObject.media[0].rtp[2].codec).toBe('H264');
1202
1193
  expect(sdpObject.media[0].rtp[3].payload).toBe(104);
1203
1194
  expect(sdpObject.media[0].rtp[3].codec).toBe('rtx');
1204
- expect((_b = sdpObject.media[0].ssrcs) === null || _b === void 0 ? void 0 : _b.length).toBe(8);
1195
+ expect(sdpObject.media[0].ssrcs?.length).toBe(8);
1205
1196
  await remoteSdp.planBStopReceiving({
1206
1197
  mid: 'video',
1207
1198
  offerRtpParameters: fakeParameters.generateConsumerRemoteParameters({ codecMimeType: 'video/H264' }).rtpParameters
@@ -1219,10 +1210,9 @@ test('RemoteSdp properly handles multiple streams of the same type in planB', as
1219
1210
  expect(sdpObject.media[0].rtp[2].codec).toBe('H264');
1220
1211
  expect(sdpObject.media[0].rtp[3].payload).toBe(104);
1221
1212
  expect(sdpObject.media[0].rtp[3].codec).toBe('rtx');
1222
- expect((_c = sdpObject.media[0].ssrcs) === null || _c === void 0 ? void 0 : _c.length).toBe(4);
1213
+ expect(sdpObject.media[0].ssrcs?.length).toBe(4);
1223
1214
  }, 500);
1224
1215
  test('RemoteSdp does not duplicate codec descriptions', async () => {
1225
- var _a, _b;
1226
1216
  let sdp = undefined;
1227
1217
  let sdpObject = undefined;
1228
1218
  const remoteSdp = new RemoteSdp_1.RemoteSdp({ planB: true });
@@ -1242,7 +1232,7 @@ test('RemoteSdp does not duplicate codec descriptions', async () => {
1242
1232
  expect(sdpObject.media[0].rtp[0].codec).toBe('VP8');
1243
1233
  expect(sdpObject.media[0].rtp[1].payload).toBe(102);
1244
1234
  expect(sdpObject.media[0].rtp[1].codec).toBe('rtx');
1245
- expect((_a = sdpObject.media[0].ssrcs) === null || _a === void 0 ? void 0 : _a.length).toBe(4);
1235
+ expect(sdpObject.media[0].ssrcs?.length).toBe(4);
1246
1236
  await remoteSdp.receive({
1247
1237
  mid: 'video',
1248
1238
  kind: 'video',
@@ -1259,7 +1249,7 @@ test('RemoteSdp does not duplicate codec descriptions', async () => {
1259
1249
  expect(sdpObject.media[0].rtp[0].codec).toBe('VP8');
1260
1250
  expect(sdpObject.media[0].rtp[1].payload).toBe(102);
1261
1251
  expect(sdpObject.media[0].rtp[1].codec).toBe('rtx');
1262
- expect((_b = sdpObject.media[0].ssrcs) === null || _b === void 0 ? void 0 : _b.length).toBe(8);
1252
+ expect(sdpObject.media[0].ssrcs?.length).toBe(8);
1263
1253
  }, 500);
1264
1254
  test('parseScalabilityMode() works', () => {
1265
1255
  expect(parseScalabilityMode('L1T3')).toEqual({ spatialLayers: 1, temporalLayers: 3 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup-client",
3
- "version": "3.6.92",
3
+ "version": "3.6.93",
4
4
  "description": "mediasoup client side JavaScript library",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",