mediasoup-client 3.6.95 → 3.6.96

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