mediasoup-client 3.6.91 → 3.6.92

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',
@@ -202,6 +202,7 @@ 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;
205
206
  this.assertSendDirection();
206
207
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
207
208
  if (encodings && encodings.length > 1) {
@@ -246,7 +247,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
246
247
  let localSdpObject = sdpTransform.parse(offer.sdp);
247
248
  if (!this._transportReady) {
248
249
  await this.setupTransport({
249
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
250
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
250
251
  localSdpObject
251
252
  });
252
253
  }
@@ -420,6 +421,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
420
421
  return transceiver.sender.getStats();
421
422
  }
422
423
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
424
+ var _a;
423
425
  this.assertSendDirection();
424
426
  const options = {
425
427
  negotiated: true,
@@ -443,7 +445,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
443
445
  .find((m) => m.type === 'application');
444
446
  if (!this._transportReady) {
445
447
  await this.setupTransport({
446
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
448
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
447
449
  localSdpObject
448
450
  });
449
451
  }
@@ -464,6 +466,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
464
466
  return { dataChannel, sctpStreamParameters };
465
467
  }
466
468
  async receive(optionsList) {
469
+ var _a;
467
470
  this.assertRecvDirection();
468
471
  const results = [];
469
472
  const mapLocalId = new Map();
@@ -500,7 +503,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
500
503
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
501
504
  if (!this._transportReady) {
502
505
  await this.setupTransport({
503
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
506
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
504
507
  localSdpObject
505
508
  });
506
509
  }
@@ -591,6 +594,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
591
594
  return transceiver.receiver.getStats();
592
595
  }
593
596
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
597
+ var _a;
594
598
  this.assertRecvDirection();
595
599
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
596
600
  const options = {
@@ -614,7 +618,7 @@ class Chrome111 extends HandlerInterface_1.HandlerInterface {
614
618
  if (!this._transportReady) {
615
619
  const localSdpObject = sdpTransform.parse(answer.sdp);
616
620
  await this.setupTransport({
617
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
621
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
618
622
  localSdpObject
619
623
  });
620
624
  }
@@ -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
  }
@@ -202,6 +202,7 @@ 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;
205
206
  this.assertSendDirection();
206
207
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
207
208
  if (encodings && encodings.length > 1) {
@@ -228,7 +229,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
228
229
  let offerMediaObject;
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
  }
@@ -437,6 +438,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
437
438
  return transceiver.sender.getStats();
438
439
  }
439
440
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
441
+ var _a;
440
442
  this.assertSendDirection();
441
443
  const options = {
442
444
  negotiated: true,
@@ -460,7 +462,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
460
462
  .find((m) => m.type === 'application');
461
463
  if (!this._transportReady) {
462
464
  await this.setupTransport({
463
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
465
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
464
466
  localSdpObject
465
467
  });
466
468
  }
@@ -481,6 +483,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
481
483
  return { dataChannel, sctpStreamParameters };
482
484
  }
483
485
  async receive(optionsList) {
486
+ var _a;
484
487
  this.assertRecvDirection();
485
488
  const results = [];
486
489
  const mapLocalId = new Map();
@@ -517,7 +520,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
517
520
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
518
521
  if (!this._transportReady) {
519
522
  await this.setupTransport({
520
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
523
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
521
524
  localSdpObject
522
525
  });
523
526
  }
@@ -608,6 +611,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
608
611
  return transceiver.receiver.getStats();
609
612
  }
610
613
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
614
+ var _a;
611
615
  this.assertRecvDirection();
612
616
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
613
617
  const options = {
@@ -631,7 +635,7 @@ class Chrome74 extends HandlerInterface_1.HandlerInterface {
631
635
  if (!this._transportReady) {
632
636
  const localSdpObject = sdpTransform.parse(answer.sdp);
633
637
  await this.setupTransport({
634
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
638
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
635
639
  localSdpObject
636
640
  });
637
641
  }
@@ -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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNativeUnifiedPlan.d.ts","sourceRoot":"","sources":["../../src/handlers/ReactNativeUnifiedPlan.ts"],"names":[],"mappings":"AAOA,OAAO,EACN,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,gCAAgC,EAChC,+BAA+B,EAC/B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,aAAa,EAAY,MAAM,cAAc,CAAC;AACvD,OAAO,EACN,eAAe,EAGf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAM3E,qBAAa,sBAAuB,SAAQ,gBAAgB;IAG3D,OAAO,CAAC,UAAU,CAAC,CAAkB;IAErC,OAAO,CAAC,UAAU,CAAC,CAAY;IAE/B,OAAO,CAAC,2BAA2B,CAAC,CAAmC;IAGvE,OAAO,CAAC,iCAAiC,CAAC,CAAmC;IAG7E,OAAO,CAAC,oBAAoB,CAAC,CAAW;IAExC,OAAO,CAAC,GAAG,CAAM;IAEjB,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CACxB;IAEX,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAEjD,OAAO,CAAC,2BAA2B,CAAS;IAE5C,OAAO,CAAC,qBAAqB,CAAK;IAElC,OAAO,CAAC,eAAe,CAAS;IAEhC;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,cAAc;;IAUtC,IAAI,IAAI,IAAI,MAAM,CAGjB;IAED,KAAK,IAAI,IAAI;IAmBP,wBAAwB,IAAI,OAAO,CAAC,eAAe,CAAC;IAyCpD,yBAAyB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAS5D,GAAG,CACF,EACC,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,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C;IAkDxE,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CrE,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAcxD,eAAe,CACpB,EACC,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,QAAQ,EACR,EAAE,6BAA6B,GAC9B,OAAO,CAAC,4BAA4B,CAAC;IAsElC,OAAO,CACZ,WAAW,EAAE,qBAAqB,EAAE,GACjC,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAkG7B,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwChD,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCjD,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoClD,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAc1D,kBAAkB,CACvB,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gCAAgC,GACzE,OAAO,CAAC,+BAA+B,CAAC;YAgE7B,cAAc;IAyC5B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,mBAAmB;CAQ3B"}
@@ -206,6 +206,7 @@ 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;
209
210
  this.assertSendDirection();
210
211
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
211
212
  if (encodings && encodings.length > 1) {
@@ -232,7 +233,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
232
233
  let offerMediaObject;
233
234
  if (!this._transportReady) {
234
235
  await this.setupTransport({
235
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
236
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
236
237
  localSdpObject
237
238
  });
238
239
  }
@@ -261,7 +262,8 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
261
262
  // is called, so this is best effort.
262
263
  // Issue: https://github.com/react-native-webrtc/react-native-webrtc/issues/1404
263
264
  // NOTE: So let's fill MID in sendingRtpParameters later.
264
- let localId = transceiver.mid ?? undefined;
265
+ // NOTE: This is fixed in react-native-webrtc 111.0.3.
266
+ let localId = (_b = transceiver.mid) !== null && _b !== void 0 ? _b : undefined;
265
267
  if (!localId) {
266
268
  logger.warn('send() | missing transceiver.mid (bug in react-native-webrtc, using a workaround');
267
269
  }
@@ -320,6 +322,8 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
320
322
  await this._pc.setRemoteDescription(answer);
321
323
  // Follow up of iOS react-native-webrtc 111.0.0 issue told above. Now yes,
322
324
  // we can read generated MID (if not done above) and fill sendingRtpParameters.
325
+ // NOTE: This is fixed in react-native-webrtc 111.0.3 so this block isn't
326
+ // needed starting from that version.
323
327
  if (!localId) {
324
328
  localId = transceiver.mid;
325
329
  sendingRtpParameters.mid = localId;
@@ -456,6 +460,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
456
460
  return transceiver.sender.getStats();
457
461
  }
458
462
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
463
+ var _a;
459
464
  this.assertSendDirection();
460
465
  const options = {
461
466
  negotiated: true,
@@ -479,7 +484,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
479
484
  .find((m) => m.type === 'application');
480
485
  if (!this._transportReady) {
481
486
  await this.setupTransport({
482
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
487
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
483
488
  localSdpObject
484
489
  });
485
490
  }
@@ -500,6 +505,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
500
505
  return { dataChannel, sctpStreamParameters };
501
506
  }
502
507
  async receive(optionsList) {
508
+ var _a;
503
509
  this.assertRecvDirection();
504
510
  const results = [];
505
511
  const mapLocalId = new Map();
@@ -536,7 +542,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
536
542
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
537
543
  if (!this._transportReady) {
538
544
  await this.setupTransport({
539
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
545
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
540
546
  localSdpObject
541
547
  });
542
548
  }
@@ -627,6 +633,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
627
633
  return transceiver.receiver.getStats();
628
634
  }
629
635
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
636
+ var _a;
630
637
  this.assertRecvDirection();
631
638
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
632
639
  const options = {
@@ -650,7 +657,7 @@ class ReactNativeUnifiedPlan extends HandlerInterface_1.HandlerInterface {
650
657
  if (!this._transportReady) {
651
658
  const localSdpObject = sdpTransform.parse(answer.sdp);
652
659
  await this.setupTransport({
653
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
660
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
654
661
  localSdpObject
655
662
  });
656
663
  }
@@ -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
  }
@@ -200,6 +200,7 @@ 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;
203
204
  this.assertSendDirection();
204
205
  logger.debug('send() [kind:%s, track.id:%s]', track.kind, track.id);
205
206
  const sendingRtpParameters = utils.clone(this._sendingRtpParametersByKind[track.kind], {});
@@ -217,7 +218,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
217
218
  let offerMediaObject;
218
219
  if (!this._transportReady) {
219
220
  await this.setupTransport({
220
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
221
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
221
222
  localSdpObject
222
223
  });
223
224
  }
@@ -412,6 +413,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
412
413
  return transceiver.sender.getStats();
413
414
  }
414
415
  async sendDataChannel({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol }) {
416
+ var _a;
415
417
  this.assertSendDirection();
416
418
  const options = {
417
419
  negotiated: true,
@@ -435,7 +437,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
435
437
  .find((m) => m.type === 'application');
436
438
  if (!this._transportReady) {
437
439
  await this.setupTransport({
438
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
440
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
439
441
  localSdpObject
440
442
  });
441
443
  }
@@ -456,6 +458,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
456
458
  return { dataChannel, sctpStreamParameters };
457
459
  }
458
460
  async receive(optionsList) {
461
+ var _a;
459
462
  this.assertRecvDirection();
460
463
  const results = [];
461
464
  const mapLocalId = new Map();
@@ -492,7 +495,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
492
495
  answer = { type: 'answer', sdp: sdpTransform.write(localSdpObject) };
493
496
  if (!this._transportReady) {
494
497
  await this.setupTransport({
495
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
498
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
496
499
  localSdpObject
497
500
  });
498
501
  }
@@ -581,6 +584,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
581
584
  return transceiver.receiver.getStats();
582
585
  }
583
586
  async receiveDataChannel({ sctpStreamParameters, label, protocol }) {
587
+ var _a;
584
588
  this.assertRecvDirection();
585
589
  const { streamId, ordered, maxPacketLifeTime, maxRetransmits } = sctpStreamParameters;
586
590
  const options = {
@@ -604,7 +608,7 @@ class Safari12 extends HandlerInterface_1.HandlerInterface {
604
608
  if (!this._transportReady) {
605
609
  const localSdpObject = sdpTransform.parse(answer.sdp);
606
610
  await this.setupTransport({
607
- localDtlsRole: this._forcedLocalDtlsRole ?? 'client',
611
+ localDtlsRole: (_a = this._forcedLocalDtlsRole) !== null && _a !== void 0 ? _a : 'client',
608
612
  localSdpObject
609
613
  });
610
614
  }
@@ -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.91";
11
+ export declare const version = "3.6.92";
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.91';
40
+ exports.version = '3.6.92';
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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mediasoup-client",
3
- "version": "3.6.91",
3
+ "version": "3.6.92",
4
4
  "description": "mediasoup client side JavaScript library",
5
5
  "contributors": [
6
6
  "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
@@ -77,11 +77,11 @@
77
77
  "@types/jest": "^29.5.2",
78
78
  "@types/sdp-transform": "^2.4.6",
79
79
  "@types/ua-parser-js": "^0.7.36",
80
- "@typescript-eslint/eslint-plugin": "^5.60.1",
81
- "@typescript-eslint/parser": "^5.60.1",
80
+ "@typescript-eslint/eslint-plugin": "^5.61.0",
81
+ "@typescript-eslint/parser": "^5.61.0",
82
82
  "eslint": "^8.44.0",
83
83
  "eslint-plugin-jest": "^27.2.2",
84
- "jest": "^29.5.0",
84
+ "jest": "^29.6.0",
85
85
  "open-cli": "^7.2.0",
86
86
  "ts-jest": "^29.1.1",
87
87
  "typescript": "^5.1.6"