mediasoup-client 3.6.52 → 3.6.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/.vimrc +21 -0
  2. package/NO_GIT/Notes.txt +18 -0
  3. package/lib/Consumer.d.ts +16 -18
  4. package/lib/Consumer.d.ts.map +1 -1
  5. package/lib/Consumer.js +11 -17
  6. package/lib/DataConsumer.d.ts +13 -15
  7. package/lib/DataConsumer.d.ts.map +1 -1
  8. package/lib/DataConsumer.js +0 -13
  9. package/lib/DataProducer.d.ts +13 -15
  10. package/lib/DataProducer.d.ts.map +1 -1
  11. package/lib/DataProducer.js +0 -13
  12. package/lib/Device.d.ts +4 -6
  13. package/lib/Device.d.ts.map +1 -1
  14. package/lib/Device.js +1 -10
  15. package/lib/EnhancedEventEmitter.d.ts +19 -3
  16. package/lib/EnhancedEventEmitter.d.ts.map +1 -1
  17. package/lib/EnhancedEventEmitter.js +50 -14
  18. package/lib/Producer.d.ts +37 -22
  19. package/lib/Producer.d.ts.map +1 -1
  20. package/lib/Producer.js +18 -28
  21. package/lib/Transport.d.ts +43 -18
  22. package/lib/Transport.d.ts.map +1 -1
  23. package/lib/Transport.js +87 -41
  24. package/lib/handlers/Chrome55.d.ts +3 -1
  25. package/lib/handlers/Chrome55.d.ts.map +1 -1
  26. package/lib/handlers/Chrome55.js +20 -12
  27. package/lib/handlers/Chrome67.d.ts +3 -1
  28. package/lib/handlers/Chrome67.d.ts.map +1 -1
  29. package/lib/handlers/Chrome67.js +20 -12
  30. package/lib/handlers/Chrome70.d.ts +3 -1
  31. package/lib/handlers/Chrome70.d.ts.map +1 -1
  32. package/lib/handlers/Chrome70.js +23 -13
  33. package/lib/handlers/Chrome74.d.ts +3 -1
  34. package/lib/handlers/Chrome74.d.ts.map +1 -1
  35. package/lib/handlers/Chrome74.js +43 -13
  36. package/lib/handlers/Edge11.d.ts +3 -1
  37. package/lib/handlers/Edge11.d.ts.map +1 -1
  38. package/lib/handlers/Edge11.js +26 -18
  39. package/lib/handlers/FakeHandler.d.ts +5 -3
  40. package/lib/handlers/FakeHandler.d.ts.map +1 -1
  41. package/lib/handlers/FakeHandler.js +14 -8
  42. package/lib/handlers/Firefox60.d.ts +3 -1
  43. package/lib/handlers/Firefox60.d.ts.map +1 -1
  44. package/lib/handlers/Firefox60.js +45 -13
  45. package/lib/handlers/HandlerInterface.d.ts +15 -11
  46. package/lib/handlers/HandlerInterface.d.ts.map +1 -1
  47. package/lib/handlers/HandlerInterface.js +0 -8
  48. package/lib/handlers/ReactNative.d.ts +3 -1
  49. package/lib/handlers/ReactNative.d.ts.map +1 -1
  50. package/lib/handlers/ReactNative.js +20 -12
  51. package/lib/handlers/Safari11.d.ts +3 -1
  52. package/lib/handlers/Safari11.d.ts.map +1 -1
  53. package/lib/handlers/Safari11.js +20 -12
  54. package/lib/handlers/Safari12.d.ts +3 -1
  55. package/lib/handlers/Safari12.d.ts.map +1 -1
  56. package/lib/handlers/Safari12.js +45 -13
  57. package/lib/handlers/ortc/edgeUtils.js +1 -5
  58. package/lib/handlers/sdp/MediaSection.js +1 -5
  59. package/lib/handlers/sdp/RemoteSdp.js +1 -5
  60. package/lib/handlers/sdp/commonUtils.js +1 -5
  61. package/lib/index.d.ts +1 -1
  62. package/lib/index.js +2 -6
  63. package/lib/ortc.js +1 -5
  64. package/lib/types.js +1 -5
  65. package/lib/utils.d.ts.map +1 -1
  66. package/package.json +7 -7
  67. package/src/Consumer.ts +44 -20
  68. package/src/DataConsumer.ts +19 -16
  69. package/src/DataProducer.ts +19 -16
  70. package/src/Device.ts +6 -6
  71. package/src/EnhancedEventEmitter.ts +105 -22
  72. package/src/Producer.ts +97 -31
  73. package/src/Transport.ts +185 -58
  74. package/src/handlers/Chrome55.ts +31 -8
  75. package/src/handlers/Chrome67.ts +31 -8
  76. package/src/handlers/Chrome70.ts +34 -8
  77. package/src/handlers/Chrome74.ts +82 -8
  78. package/src/handlers/Edge11.ts +38 -15
  79. package/src/handlers/FakeHandler.ts +22 -6
  80. package/src/handlers/Firefox60.ts +84 -8
  81. package/src/handlers/HandlerInterface.ts +19 -11
  82. package/src/handlers/ReactNative.ts +31 -8
  83. package/src/handlers/Safari11.ts +31 -8
  84. package/src/handlers/Safari12.ts +84 -8
  85. package/src/utils.ts +0 -1
@@ -485,6 +485,66 @@ export class Chrome74 extends HandlerInterface
485
485
  this._mapMidTransceiver.delete(localId);
486
486
  }
487
487
 
488
+ async pauseSending(localId: string): Promise<void>
489
+ {
490
+ this._assertSendDirection();
491
+
492
+ logger.debug('pauseSending() [localId:%s]', localId);
493
+
494
+ const transceiver = this._mapMidTransceiver.get(localId);
495
+
496
+ if (!transceiver)
497
+ throw new Error('associated RTCRtpTransceiver not found');
498
+
499
+ transceiver.direction = 'inactive';
500
+
501
+ const offer = await this._pc.createOffer();
502
+
503
+ logger.debug(
504
+ 'pauseSending() | calling pc.setLocalDescription() [offer:%o]',
505
+ offer);
506
+
507
+ await this._pc.setLocalDescription(offer);
508
+
509
+ const answer = { type: 'answer', sdp: this._remoteSdp!.getSdp() };
510
+
511
+ logger.debug(
512
+ 'pauseSending() | calling pc.setRemoteDescription() [answer:%o]',
513
+ answer);
514
+
515
+ await this._pc.setRemoteDescription(answer);
516
+ }
517
+
518
+ async resumeSending(localId: string): Promise<void>
519
+ {
520
+ this._assertSendDirection();
521
+
522
+ logger.debug('resumeSending() [localId:%s]', localId);
523
+
524
+ const transceiver = this._mapMidTransceiver.get(localId);
525
+
526
+ if (!transceiver)
527
+ throw new Error('associated RTCRtpTransceiver not found');
528
+
529
+ transceiver.direction = 'sendonly';
530
+
531
+ const offer = await this._pc.createOffer();
532
+
533
+ logger.debug(
534
+ 'resumeSending() | calling pc.setLocalDescription() [offer:%o]',
535
+ offer);
536
+
537
+ await this._pc.setLocalDescription(offer);
538
+
539
+ const answer = { type: 'answer', sdp: this._remoteSdp!.getSdp() };
540
+
541
+ logger.debug(
542
+ 'resumeSending() | calling pc.setRemoteDescription() [answer:%o]',
543
+ answer);
544
+
545
+ await this._pc.setRemoteDescription(answer);
546
+ }
547
+
488
548
  async replaceTrack(
489
549
  localId: string, track: MediaStreamTrack | null
490
550
  ): Promise<void>
@@ -748,18 +808,21 @@ export class Chrome74 extends HandlerInterface
748
808
  return results;
749
809
  }
750
810
 
751
- async stopReceiving(localId: string): Promise<void>
811
+ async stopReceiving(localIds: string[]): Promise<void>
752
812
  {
753
813
  this._assertRecvDirection();
754
814
 
755
- logger.debug('stopReceiving() [localId:%s]', localId);
815
+ for (const localId of localIds)
816
+ {
817
+ logger.debug('stopReceiving() [localId:%s]', localId);
756
818
 
757
- const transceiver = this._mapMidTransceiver.get(localId);
819
+ const transceiver = this._mapMidTransceiver.get(localId);
758
820
 
759
- if (!transceiver)
760
- throw new Error('associated RTCRtpTransceiver not found');
821
+ if (!transceiver)
822
+ throw new Error('associated RTCRtpTransceiver not found');
761
823
 
762
- this._remoteSdp!.closeMediaSection(transceiver.mid!);
824
+ this._remoteSdp!.closeMediaSection(transceiver.mid!);
825
+ }
763
826
 
764
827
  const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
765
828
 
@@ -777,7 +840,10 @@ export class Chrome74 extends HandlerInterface
777
840
 
778
841
  await this._pc.setLocalDescription(answer);
779
842
 
780
- this._mapMidTransceiver.delete(localId);
843
+ for (const localId of localIds)
844
+ {
845
+ this._mapMidTransceiver.delete(localId);
846
+ }
781
847
  }
782
848
 
783
849
  async pauseReceiving(localIds: string[]): Promise<void>
@@ -950,7 +1016,15 @@ export class Chrome74 extends HandlerInterface
950
1016
  localDtlsRole === 'client' ? 'server' : 'client');
951
1017
 
952
1018
  // Need to tell the remote transport about our parameters.
953
- await this.safeEmitAsPromise('@connect', { dtlsParameters });
1019
+ await new Promise<void>((resolve, reject) =>
1020
+ {
1021
+ this.safeEmit(
1022
+ '@connect',
1023
+ { dtlsParameters },
1024
+ resolve,
1025
+ reject
1026
+ );
1027
+ });
954
1028
 
955
1029
  this._transportReady = true;
956
1030
  }
@@ -274,6 +274,18 @@ export class Edge11 extends HandlerInterface
274
274
  }
275
275
  }
276
276
 
277
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
278
+ async pauseSending(localId: string): Promise<void>
279
+ {
280
+ // Unimplemented.
281
+ }
282
+
283
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
284
+ async resumeSending(localId: string): Promise<void>
285
+ {
286
+ // Unimplemented.
287
+ }
288
+
277
289
  async replaceTrack(
278
290
  localId: string, track: MediaStreamTrack | null
279
291
  ): Promise<void>
@@ -415,26 +427,29 @@ export class Edge11 extends HandlerInterface
415
427
  return results;
416
428
  }
417
429
 
418
- async stopReceiving(localId: string): Promise<void>
430
+ async stopReceiving(localIds: string[]): Promise<void>
419
431
  {
420
- logger.debug('stopReceiving() [localId:%s]', localId);
432
+ for (const localId of localIds)
433
+ {
434
+ logger.debug('stopReceiving() [localId:%s]', localId);
421
435
 
422
- const rtpReceiver = this._rtpReceivers.get(localId);
436
+ const rtpReceiver = this._rtpReceivers.get(localId);
423
437
 
424
- if (!rtpReceiver)
425
- throw new Error('RTCRtpReceiver not found');
438
+ if (!rtpReceiver)
439
+ throw new Error('RTCRtpReceiver not found');
426
440
 
427
- this._rtpReceivers.delete(localId);
441
+ this._rtpReceivers.delete(localId);
428
442
 
429
- try
430
- {
431
- logger.debug('stopReceiving() | calling rtpReceiver.stop()');
443
+ try
444
+ {
445
+ logger.debug('stopReceiving() | calling rtpReceiver.stop()');
432
446
 
433
- (rtpReceiver as any).stop();
434
- }
435
- catch (error)
436
- {
437
- logger.warn('stopReceiving() | rtpReceiver.stop() failed:%o', error);
447
+ (rtpReceiver as any).stop();
448
+ }
449
+ catch (error)
450
+ {
451
+ logger.warn('stopReceiving() | rtpReceiver.stop() failed:%o', error);
452
+ }
438
453
  }
439
454
  }
440
455
 
@@ -605,7 +620,15 @@ export class Edge11 extends HandlerInterface
605
620
  dtlsParameters.role = localDtlsRole;
606
621
 
607
622
  // Need to tell the remote transport about our parameters.
608
- await this.safeEmitAsPromise('@connect', { dtlsParameters });
623
+ await new Promise<void>((resolve, reject) =>
624
+ {
625
+ this.safeEmit(
626
+ '@connect',
627
+ { dtlsParameters },
628
+ resolve,
629
+ reject
630
+ );
631
+ });
609
632
 
610
633
  // Start the RTCIceTransport.
611
634
  this._iceTransport.start(
@@ -18,7 +18,8 @@ import {
18
18
  import {
19
19
  IceParameters,
20
20
  DtlsParameters,
21
- DtlsRole
21
+ DtlsRole,
22
+ ConnectionState
22
23
  } from '../Transport';
23
24
  import { RtpCapabilities, RtpParameters } from '../RtpParameters';
24
25
  import { SctpCapabilities } from '../SctpParameters';
@@ -126,7 +127,7 @@ export class FakeHandler extends HandlerInterface
126
127
  }
127
128
 
128
129
  // NOTE: Custom method for simulation purposes.
129
- setConnectionState(connectionState: string): void
130
+ setConnectionState(connectionState: ConnectionState): void
130
131
  {
131
132
  this.emit('@connectionstatechange', connectionState);
132
133
  }
@@ -248,6 +249,18 @@ export class FakeHandler extends HandlerInterface
248
249
  this._tracks.delete(Number(localId));
249
250
  }
250
251
 
252
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
253
+ async pauseSending(localId: string): Promise<void>
254
+ {
255
+ // Unimplemented.
256
+ }
257
+
258
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
259
+ async resumeSending(localId: string): Promise<void>
260
+ {
261
+ // Unimplemented.
262
+ }
263
+
251
264
  async replaceTrack(
252
265
  localId: string, track: MediaStreamTrack | null
253
266
  ): Promise<void>
@@ -349,11 +362,14 @@ export class FakeHandler extends HandlerInterface
349
362
  return results;
350
363
  }
351
364
 
352
- async stopReceiving(localId: string): Promise<void>
365
+ async stopReceiving(localIds: string[]): Promise<void>
353
366
  {
354
- logger.debug('stopReceiving() [localId:%s]', localId);
367
+ for (const localId of localIds)
368
+ {
369
+ logger.debug('stopReceiving() [localId:%s]', localId);
355
370
 
356
- this._tracks.delete(Number(localId));
371
+ this._tracks.delete(Number(localId));
372
+ }
357
373
  }
358
374
 
359
375
  async pauseReceiving(
@@ -422,7 +438,7 @@ export class FakeHandler extends HandlerInterface
422
438
  this.emit('@connectionstatechange', 'connecting');
423
439
 
424
440
  // Need to tell the remote transport about our parameters.
425
- await new Promise((resolve, reject) => (
441
+ await new Promise<void>((resolve, reject) => (
426
442
  this.emit('@connect', { dtlsParameters }, resolve, reject)
427
443
  ));
428
444
 
@@ -481,6 +481,68 @@ export class Firefox60 extends HandlerInterface
481
481
  this._mapMidTransceiver.delete(localId);
482
482
  }
483
483
 
484
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
485
+ async pauseSending(localId: string): Promise<void>
486
+ {
487
+ this._assertSendDirection();
488
+
489
+ logger.debug('pauseSending() [localId:%s]', localId);
490
+
491
+ const transceiver = this._mapMidTransceiver.get(localId);
492
+
493
+ if (!transceiver)
494
+ throw new Error('associated RTCRtpTransceiver not found');
495
+
496
+ transceiver.direction = 'inactive';
497
+
498
+ const offer = await this._pc.createOffer();
499
+
500
+ logger.debug(
501
+ 'pauseSending() | calling pc.setLocalDescription() [offer:%o]',
502
+ offer);
503
+
504
+ await this._pc.setLocalDescription(offer);
505
+
506
+ const answer = { type: 'answer', sdp: this._remoteSdp!.getSdp() };
507
+
508
+ logger.debug(
509
+ 'pauseSending() | calling pc.setRemoteDescription() [answer:%o]',
510
+ answer);
511
+
512
+ await this._pc.setRemoteDescription(answer);
513
+ }
514
+
515
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
516
+ async resumeSending(localId: string): Promise<void>
517
+ {
518
+ this._assertSendDirection();
519
+
520
+ logger.debug('resumeSending() [localId:%s]', localId);
521
+
522
+ const transceiver = this._mapMidTransceiver.get(localId);
523
+
524
+ if (!transceiver)
525
+ throw new Error('associated RTCRtpTransceiver not found');
526
+
527
+ transceiver.direction = 'sendonly';
528
+
529
+ const offer = await this._pc.createOffer();
530
+
531
+ logger.debug(
532
+ 'resumeSending() | calling pc.setLocalDescription() [offer:%o]',
533
+ offer);
534
+
535
+ await this._pc.setLocalDescription(offer);
536
+
537
+ const answer = { type: 'answer', sdp: this._remoteSdp!.getSdp() };
538
+
539
+ logger.debug(
540
+ 'resumeSending() | calling pc.setRemoteDescription() [answer:%o]',
541
+ answer);
542
+
543
+ await this._pc.setRemoteDescription(answer);
544
+ }
545
+
484
546
  async replaceTrack(
485
547
  localId: string, track: MediaStreamTrack | null
486
548
  ): Promise<void>
@@ -733,18 +795,21 @@ export class Firefox60 extends HandlerInterface
733
795
  return results;
734
796
  }
735
797
 
736
- async stopReceiving(localId: string): Promise<void>
798
+ async stopReceiving(localIds: string[]): Promise<void>
737
799
  {
738
800
  this._assertRecvDirection();
739
801
 
740
- logger.debug('stopReceiving() [localId:%s]', localId);
802
+ for (const localId of localIds)
803
+ {
804
+ logger.debug('stopReceiving() [localId:%s]', localId);
741
805
 
742
- const transceiver = this._mapMidTransceiver.get(localId);
806
+ const transceiver = this._mapMidTransceiver.get(localId);
743
807
 
744
- if (!transceiver)
745
- throw new Error('associated RTCRtpTransceiver not found');
808
+ if (!transceiver)
809
+ throw new Error('associated RTCRtpTransceiver not found');
746
810
 
747
- this._remoteSdp!.closeMediaSection(transceiver.mid!);
811
+ this._remoteSdp!.closeMediaSection(transceiver.mid!);
812
+ }
748
813
 
749
814
  const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
750
815
 
@@ -762,7 +827,10 @@ export class Firefox60 extends HandlerInterface
762
827
 
763
828
  await this._pc.setLocalDescription(answer);
764
829
 
765
- this._mapMidTransceiver.delete(localId);
830
+ for (const localId of localIds)
831
+ {
832
+ this._mapMidTransceiver.delete(localId);
833
+ }
766
834
  }
767
835
 
768
836
  async pauseReceiving(localIds: string[]): Promise<void>
@@ -931,7 +999,15 @@ export class Firefox60 extends HandlerInterface
931
999
  localDtlsRole === 'client' ? 'server' : 'client');
932
1000
 
933
1001
  // Need to tell the remote transport about our parameters.
934
- await this.safeEmitAsPromise('@connect', { dtlsParameters });
1002
+ await new Promise<void>((resolve, reject) =>
1003
+ {
1004
+ this.safeEmit(
1005
+ '@connect',
1006
+ { dtlsParameters },
1007
+ resolve,
1008
+ reject
1009
+ );
1010
+ });
935
1011
 
936
1012
  this._transportReady = true;
937
1013
  }
@@ -3,7 +3,8 @@ import { ProducerCodecOptions } from '../Producer';
3
3
  import {
4
4
  IceParameters,
5
5
  IceCandidate,
6
- DtlsParameters
6
+ DtlsParameters,
7
+ ConnectionState
7
8
  } from '../Transport';
8
9
  import {
9
10
  RtpCapabilities,
@@ -82,16 +83,19 @@ export type HandlerReceiveDataChannelResult =
82
83
  dataChannel: RTCDataChannel;
83
84
  }
84
85
 
85
- export abstract class HandlerInterface extends EnhancedEventEmitter
86
+ export type HandlerEvents =
87
+ {
88
+ '@connect':
89
+ [
90
+ { dtlsParameters: DtlsParameters },
91
+ () => void,
92
+ (error: Error) => void
93
+ ];
94
+ '@connectionstatechange': [ConnectionState];
95
+ }
96
+
97
+ export abstract class HandlerInterface extends EnhancedEventEmitter<HandlerEvents>
86
98
  {
87
- /**
88
- * @emits @connect - (
89
- * { dtlsParameters: DtlsParameters },
90
- * callback: Function,
91
- * errback: Function
92
- * )
93
- * @emits @connectionstatechange - (connectionState: ConnectionState)
94
- */
95
99
  constructor()
96
100
  {
97
101
  super();
@@ -117,6 +121,10 @@ export abstract class HandlerInterface extends EnhancedEventEmitter
117
121
 
118
122
  abstract stopSending(localId: string): Promise<void>;
119
123
 
124
+ abstract pauseSending(localId: string): Promise<void>;
125
+
126
+ abstract resumeSending(localId: string): Promise<void>;
127
+
120
128
  abstract replaceTrack(
121
129
  localId: string, track: MediaStreamTrack | null
122
130
  ): Promise<void>;
@@ -139,7 +147,7 @@ export abstract class HandlerInterface extends EnhancedEventEmitter
139
147
  optionsList: HandlerReceiveOptions[]
140
148
  ) : Promise<HandlerReceiveResult[]>
141
149
 
142
- abstract stopReceiving(localId: string): Promise<void>;
150
+ abstract stopReceiving(localIds: string[]): Promise<void>;
143
151
 
144
152
  abstract pauseReceiving(localIds: string[]): Promise<void>;
145
153
 
@@ -482,6 +482,18 @@ export class ReactNative extends HandlerInterface
482
482
  await this._pc.setRemoteDescription(answer);
483
483
  }
484
484
 
485
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
486
+ async pauseSending(localId: string): Promise<void>
487
+ {
488
+ // Unimplemented.
489
+ }
490
+
491
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
492
+ async resumeSending(localId: string): Promise<void>
493
+ {
494
+ // Unimplemented.
495
+ }
496
+
485
497
  async replaceTrack(
486
498
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
487
499
  localId: string, track: MediaStreamTrack | null
@@ -692,19 +704,22 @@ export class ReactNative extends HandlerInterface
692
704
  return results;
693
705
  }
694
706
 
695
- async stopReceiving(localId: string): Promise<void>
707
+ async stopReceiving(localIds: string[]): Promise<void>
696
708
  {
697
709
  this._assertRecvDirection();
698
710
 
699
- logger.debug('stopReceiving() [localId:%s]', localId);
711
+ for (const localId of localIds)
712
+ {
713
+ logger.debug('stopReceiving() [localId:%s]', localId);
700
714
 
701
- const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
715
+ const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
702
716
 
703
- // Remove from the map.
704
- this._mapRecvLocalIdInfo.delete(localId);
717
+ // Remove from the map.
718
+ this._mapRecvLocalIdInfo.delete(localId);
705
719
 
706
- this._remoteSdp!.planBStopReceiving(
707
- { mid: mid!, offerRtpParameters: rtpParameters! });
720
+ this._remoteSdp!.planBStopReceiving(
721
+ { mid: mid!, offerRtpParameters: rtpParameters! });
722
+ }
708
723
 
709
724
  const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
710
725
 
@@ -836,7 +851,15 @@ export class ReactNative extends HandlerInterface
836
851
  localDtlsRole === 'client' ? 'server' : 'client');
837
852
 
838
853
  // Need to tell the remote transport about our parameters.
839
- await this.safeEmitAsPromise('@connect', { dtlsParameters });
854
+ await new Promise<void>((resolve, reject) =>
855
+ {
856
+ this.safeEmit(
857
+ '@connect',
858
+ { dtlsParameters },
859
+ resolve,
860
+ reject
861
+ );
862
+ });
840
863
 
841
864
  this._transportReady = true;
842
865
  }
@@ -477,6 +477,18 @@ export class Safari11 extends HandlerInterface
477
477
  await this._pc.setRemoteDescription(answer);
478
478
  }
479
479
 
480
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
481
+ async pauseSending(localId: string): Promise<void>
482
+ {
483
+ // Unimplemented.
484
+ }
485
+
486
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
487
+ async resumeSending(localId: string): Promise<void>
488
+ {
489
+ // Unimplemented.
490
+ }
491
+
480
492
  async replaceTrack(
481
493
  localId: string, track: MediaStreamTrack | null
482
494
  ): Promise<void>
@@ -745,19 +757,22 @@ export class Safari11 extends HandlerInterface
745
757
  return results;
746
758
  }
747
759
 
748
- async stopReceiving(localId: string): Promise<void>
760
+ async stopReceiving(localIds: string[]): Promise<void>
749
761
  {
750
762
  this._assertRecvDirection();
751
763
 
752
- logger.debug('stopReceiving() [localId:%s]', localId);
764
+ for (const localId of localIds)
765
+ {
766
+ logger.debug('stopReceiving() [localId:%s]', localId);
753
767
 
754
- const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
768
+ const { mid, rtpParameters } = this._mapRecvLocalIdInfo.get(localId) || {};
755
769
 
756
- // Remove from the map.
757
- this._mapRecvLocalIdInfo.delete(localId);
770
+ // Remove from the map.
771
+ this._mapRecvLocalIdInfo.delete(localId);
758
772
 
759
- this._remoteSdp!.planBStopReceiving(
760
- { mid: mid!, offerRtpParameters: rtpParameters! });
773
+ this._remoteSdp!.planBStopReceiving(
774
+ { mid: mid!, offerRtpParameters: rtpParameters! });
775
+ }
761
776
 
762
777
  const offer = { type: 'offer', sdp: this._remoteSdp!.getSdp() };
763
778
 
@@ -894,7 +909,15 @@ export class Safari11 extends HandlerInterface
894
909
  localDtlsRole === 'client' ? 'server' : 'client');
895
910
 
896
911
  // Need to tell the remote transport about our parameters.
897
- await this.safeEmitAsPromise('@connect', { dtlsParameters });
912
+ await new Promise<void>((resolve, reject) =>
913
+ {
914
+ this.safeEmit(
915
+ '@connect',
916
+ { dtlsParameters },
917
+ resolve,
918
+ reject
919
+ );
920
+ });
898
921
 
899
922
  this._transportReady = true;
900
923
  }