twilio-video 2.25.0 → 2.26.0

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 (65) hide show
  1. package/CHANGELOG.md +112 -1
  2. package/README.md +1 -1
  3. package/dist/twilio-video.js +1481 -1134
  4. package/dist/twilio-video.min.js +21 -21
  5. package/es5/media/track/localaudiotrack.js +28 -7
  6. package/es5/media/track/localaudiotrack.js.map +1 -1
  7. package/es5/media/track/localmediatrack.js +29 -0
  8. package/es5/media/track/localmediatrack.js.map +1 -1
  9. package/es5/media/track/localvideotrack.js +31 -10
  10. package/es5/media/track/localvideotrack.js.map +1 -1
  11. package/es5/media/track/sender.js +39 -1
  12. package/es5/media/track/sender.js.map +1 -1
  13. package/es5/room.js +50 -1
  14. package/es5/room.js.map +1 -1
  15. package/es5/transceiver.js +3 -3
  16. package/es5/transceiver.js.map +1 -1
  17. package/es5/webrtc/getstats.js +75 -58
  18. package/es5/webrtc/getstats.js.map +1 -1
  19. package/es5/webrtc/getusermedia.js +1 -1
  20. package/es5/webrtc/getusermedia.js.map +1 -1
  21. package/es5/webrtc/index.js.map +1 -1
  22. package/es5/webrtc/rtcpeerconnection/chrome.js +339 -286
  23. package/es5/webrtc/rtcpeerconnection/chrome.js.map +1 -1
  24. package/es5/webrtc/rtcpeerconnection/firefox.js +225 -179
  25. package/es5/webrtc/rtcpeerconnection/firefox.js.map +1 -1
  26. package/es5/webrtc/rtcpeerconnection/index.js.map +1 -1
  27. package/es5/webrtc/rtcpeerconnection/safari.js +276 -236
  28. package/es5/webrtc/rtcpeerconnection/safari.js.map +1 -1
  29. package/es5/webrtc/rtcrtpsender.js +12 -9
  30. package/es5/webrtc/rtcrtpsender.js.map +1 -1
  31. package/es5/webrtc/rtcsessiondescription/chrome.js +29 -22
  32. package/es5/webrtc/rtcsessiondescription/chrome.js.map +1 -1
  33. package/es5/webrtc/rtcsessiondescription/index.js.map +1 -1
  34. package/es5/webrtc/util/index.js +32 -15
  35. package/es5/webrtc/util/index.js.map +1 -1
  36. package/es5/webrtc/util/latch.js +83 -82
  37. package/es5/webrtc/util/latch.js.map +1 -1
  38. package/es5/webrtc/util/sdp.js +12 -19
  39. package/es5/webrtc/util/sdp.js.map +1 -1
  40. package/lib/media/track/localaudiotrack.js +30 -8
  41. package/lib/media/track/localmediatrack.js +29 -0
  42. package/lib/media/track/localvideotrack.js +33 -10
  43. package/lib/media/track/sender.js +42 -1
  44. package/lib/room.js +41 -1
  45. package/lib/transceiver.js +3 -3
  46. package/lib/webrtc/getstats.js +155 -171
  47. package/lib/webrtc/getusermedia.js +1 -2
  48. package/lib/webrtc/index.js +1 -1
  49. package/lib/webrtc/rtcpeerconnection/chrome.js +284 -316
  50. package/lib/webrtc/rtcpeerconnection/firefox.js +173 -197
  51. package/lib/webrtc/rtcpeerconnection/index.js +1 -1
  52. package/lib/webrtc/rtcpeerconnection/safari.js +228 -256
  53. package/lib/webrtc/rtcrtpsender.js +10 -8
  54. package/lib/webrtc/rtcsessiondescription/chrome.js +24 -24
  55. package/lib/webrtc/rtcsessiondescription/index.js +1 -1
  56. package/lib/webrtc/util/index.js +26 -33
  57. package/lib/webrtc/util/latch.js +78 -83
  58. package/lib/webrtc/util/sdp.js +32 -41
  59. package/package.json +2 -2
  60. package/tsdef/LocalAudioTrack.d.ts +3 -0
  61. package/tsdef/LocalVideoTrack.d.ts +3 -0
  62. package/tsdef/Room.d.ts +1 -0
  63. package/es5/webrtc/util/eventtarget.js +0 -34
  64. package/es5/webrtc/util/eventtarget.js.map +0 -1
  65. package/lib/webrtc/util/eventtarget.js +0 -39
@@ -1,4 +1,4 @@
1
- /*! twilio-video.js 2.25.0
1
+ /*! twilio-video.js 2.26.0
2
2
 
3
3
  The following license applies to all parts of this software except as
4
4
  documented below.
@@ -83,7 +83,7 @@ function createCancelableRoomPromise(getLocalTracks, createLocalParticipant, cre
83
83
  }
84
84
  module.exports = createCancelableRoomPromise;
85
85
 
86
- },{"./util/cancelablepromise":123}],2:[function(require,module,exports){
86
+ },{"./util/cancelablepromise":124}],2:[function(require,module,exports){
87
87
  'use strict';
88
88
  var MediaStreamTrack = require('./webrtc').MediaStreamTrack;
89
89
  var _a = require('./webrtc/util'), guessBrowser = _a.guessBrowser, guessBrowserVersion = _a.guessBrowserVersion;
@@ -999,7 +999,7 @@ function normalizeCodecSettings(nameOrSettings) {
999
999
  }
1000
1000
  module.exports = connect;
1001
1001
 
1002
- },{"./cancelableroompromise":1,"./encodingparameters":9,"./localparticipant":12,"./media/track/es5":14,"./networkqualityconfiguration":43,"./room":56,"./signaling/v2":70,"./util":131,"./util/cancelablepromise":123,"./util/constants":124,"./util/eventobserver":129,"./util/insightspublisher":132,"./util/insightspublisher/null":133,"./util/log":135,"./util/validate":149,"./webrtc":157,"./webrtc/util":170}],3:[function(require,module,exports){
1002
+ },{"./cancelableroompromise":1,"./encodingparameters":9,"./localparticipant":13,"./media/track/es5":15,"./networkqualityconfiguration":44,"./room":57,"./signaling/v2":71,"./util":132,"./util/cancelablepromise":124,"./util/constants":125,"./util/eventobserver":130,"./util/insightspublisher":133,"./util/insightspublisher/null":134,"./util/log":136,"./util/validate":150,"./webrtc":158,"./webrtc/util":170}],3:[function(require,module,exports){
1003
1003
  'use strict';
1004
1004
  var _a = require('./util/constants'), DEFAULT_LOG_LEVEL = _a.DEFAULT_LOG_LEVEL, DEFAULT_LOGGER_NAME = _a.DEFAULT_LOGGER_NAME;
1005
1005
  /**
@@ -1148,7 +1148,7 @@ module.exports = {
1148
1148
  video: createLocalVideoTrack
1149
1149
  };
1150
1150
 
1151
- },{"./util/constants":124}],4:[function(require,module,exports){
1151
+ },{"./util/constants":125}],4:[function(require,module,exports){
1152
1152
  /* eslint-disable @typescript-eslint/no-explicit-any */
1153
1153
  'use strict';
1154
1154
  var __assign = (this && this.__assign) || function () {
@@ -1406,7 +1406,7 @@ function createLocalTracks(options) {
1406
1406
  }
1407
1407
  exports.createLocalTracks = createLocalTracks;
1408
1408
 
1409
- },{"./media/track/es5":14,"./media/track/noisecancellationimpl":28,"./util":131,"./util/constants":124,"./util/log":135,"./webaudio/workaround180748":154,"./webrtc":157}],5:[function(require,module,exports){
1409
+ },{"./media/track/es5":15,"./media/track/noisecancellationimpl":29,"./util":132,"./util/constants":125,"./util/log":136,"./webaudio/workaround180748":155,"./webrtc":158}],5:[function(require,module,exports){
1410
1410
  'use strict';
1411
1411
  var __extends = (this && this.__extends) || (function () {
1412
1412
  var extendStatics = function (d, b) {
@@ -1605,7 +1605,7 @@ var DataTrackSender = /** @class */ (function (_super) {
1605
1605
  }(DataTrackTransceiver));
1606
1606
  module.exports = DataTrackSender;
1607
1607
 
1608
- },{"../util":131,"./transceiver":7}],7:[function(require,module,exports){
1608
+ },{"../util":132,"./transceiver":7}],7:[function(require,module,exports){
1609
1609
  'use strict';
1610
1610
  var __extends = (this && this.__extends) || (function () {
1611
1611
  var extendStatics = function (d, b) {
@@ -1665,7 +1665,7 @@ var DataTrackTransceiver = /** @class */ (function (_super) {
1665
1665
  }(TrackTransceiver));
1666
1666
  module.exports = DataTrackTransceiver;
1667
1667
 
1668
- },{"../transceiver":118}],8:[function(require,module,exports){
1668
+ },{"../transceiver":119}],8:[function(require,module,exports){
1669
1669
  'use strict';
1670
1670
  var __extends = (this && this.__extends) || (function () {
1671
1671
  var extendStatics = function (d, b) {
@@ -1866,7 +1866,54 @@ var EventEmitter = require('events').EventEmitter;
1866
1866
  var hidePrivateAndCertainPublicPropertiesInClass = require('./util').hidePrivateAndCertainPublicPropertiesInClass;
1867
1867
  module.exports = hidePrivateAndCertainPublicPropertiesInClass(EventEmitter, ['domain']);
1868
1868
 
1869
- },{"./util":131,"events":173}],11:[function(require,module,exports){
1869
+ },{"./util":132,"events":173}],11:[function(require,module,exports){
1870
+ 'use strict';
1871
+ var __read = (this && this.__read) || function (o, n) {
1872
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
1873
+ if (!m) return o;
1874
+ var i = m.call(o), r, ar = [], e;
1875
+ try {
1876
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
1877
+ }
1878
+ catch (error) { e = { error: error }; }
1879
+ finally {
1880
+ try {
1881
+ if (r && !r.done && (m = i["return"])) m.call(i);
1882
+ }
1883
+ finally { if (e) throw e.error; }
1884
+ }
1885
+ return ar;
1886
+ };
1887
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
1888
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1889
+ to[j] = from[i];
1890
+ return to;
1891
+ };
1892
+ var EventEmitter = require('events').EventEmitter;
1893
+ var EventTarget = /** @class */ (function () {
1894
+ function EventTarget() {
1895
+ Object.defineProperties(this, {
1896
+ _eventEmitter: {
1897
+ value: new EventEmitter()
1898
+ }
1899
+ });
1900
+ }
1901
+ EventTarget.prototype.dispatchEvent = function (event) {
1902
+ return this._eventEmitter.emit(event.type, event);
1903
+ };
1904
+ EventTarget.prototype.addEventListener = function () {
1905
+ var _a;
1906
+ return (_a = this._eventEmitter).addListener.apply(_a, __spreadArray([], __read(arguments)));
1907
+ };
1908
+ EventTarget.prototype.removeEventListener = function () {
1909
+ var _a;
1910
+ return (_a = this._eventEmitter).removeListener.apply(_a, __spreadArray([], __read(arguments)));
1911
+ };
1912
+ return EventTarget;
1913
+ }());
1914
+ module.exports = EventTarget;
1915
+
1916
+ },{"events":173}],12:[function(require,module,exports){
1870
1917
  'use strict';
1871
1918
  var __assign = (this && this.__assign) || function () {
1872
1919
  __assign = Object.assign || function(t) {
@@ -1940,7 +1987,7 @@ module.exports = {
1940
1987
  LocalDataTrack: LocalDataTrack,
1941
1988
  };
1942
1989
 
1943
- },{"../package.json":174,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":14,"./preflight/preflighttest":50,"./util/support":144,"./vendor/loglevel":151}],12:[function(require,module,exports){
1990
+ },{"../package.json":174,"./connect":2,"./createlocaltrack":3,"./createlocaltracks":4,"./media/track/es5":15,"./preflight/preflighttest":51,"./util/support":145,"./vendor/loglevel":152}],13:[function(require,module,exports){
1944
1991
  'use strict';
1945
1992
  var __extends = (this && this.__extends) || (function () {
1946
1993
  var extendStatics = function (d, b) {
@@ -2652,7 +2699,7 @@ function getTrackPublication(trackPublications, track) {
2652
2699
  }
2653
2700
  module.exports = LocalParticipant;
2654
2701
 
2655
- },{"./media/track/es5":14,"./media/track/localaudiotrackpublication":20,"./media/track/localdatatrackpublication":22,"./media/track/localvideotrackpublication":26,"./participant":45,"./util":131,"./util/constants":124,"./util/validate":149,"./webrtc":157}],13:[function(require,module,exports){
2702
+ },{"./media/track/es5":15,"./media/track/localaudiotrackpublication":21,"./media/track/localdatatrackpublication":23,"./media/track/localvideotrackpublication":27,"./participant":46,"./util":132,"./util/constants":125,"./util/validate":150,"./webrtc":158}],14:[function(require,module,exports){
2656
2703
  'use strict';
2657
2704
  var __extends = (this && this.__extends) || (function () {
2658
2705
  var extendStatics = function (d, b) {
@@ -2807,7 +2854,7 @@ var AudioTrack = /** @class */ (function (_super) {
2807
2854
  */
2808
2855
  module.exports = AudioTrack;
2809
2856
 
2810
- },{"./mediatrack":27}],14:[function(require,module,exports){
2857
+ },{"./mediatrack":28}],15:[function(require,module,exports){
2811
2858
  'use strict';
2812
2859
  module.exports = {
2813
2860
  LocalAudioTrack: require('./localaudiotrack'),
@@ -2815,7 +2862,7 @@ module.exports = {
2815
2862
  LocalDataTrack: require('./localdatatrack')
2816
2863
  };
2817
2864
 
2818
- },{"./localaudiotrack":15,"./localdatatrack":16,"./localvideotrack":17}],15:[function(require,module,exports){
2865
+ },{"./localaudiotrack":16,"./localdatatrack":17,"./localvideotrack":18}],16:[function(require,module,exports){
2819
2866
  // eslint-disable-next-line no-warning-comments
2820
2867
  // TODO(mroberts): Remove this when we go to the next major version. This is
2821
2868
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2830,7 +2877,7 @@ function LocalAudioTrack(mediaStreamTrack, options) {
2830
2877
  inherits(LocalAudioTrack, LocalAudioTrackClass);
2831
2878
  module.exports = LocalAudioTrack;
2832
2879
 
2833
- },{"../../../vendor/inherits":150,"../localaudiotrack":19}],16:[function(require,module,exports){
2880
+ },{"../../../vendor/inherits":151,"../localaudiotrack":20}],17:[function(require,module,exports){
2834
2881
  // eslint-disable-next-line no-warning-comments
2835
2882
  // TODO(mroberts): Remove this when we go to the next major version. This is
2836
2883
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2845,7 +2892,7 @@ function LocalDataTrack(options) {
2845
2892
  inherits(LocalDataTrack, LocalDataTrackClass);
2846
2893
  module.exports = LocalDataTrack;
2847
2894
 
2848
- },{"../../../vendor/inherits":150,"../localdatatrack":21}],17:[function(require,module,exports){
2895
+ },{"../../../vendor/inherits":151,"../localdatatrack":22}],18:[function(require,module,exports){
2849
2896
  // eslint-disable-next-line no-warning-comments
2850
2897
  // TODO(mroberts): Remove this when we go to the next major version. This is
2851
2898
  // only in place so that we can support ES6 classes without requiring `new`.
@@ -2860,7 +2907,7 @@ function LocalVideoTrack(mediaStreamTrack, options) {
2860
2907
  inherits(LocalVideoTrack, LocalVideoTrackClass);
2861
2908
  module.exports = LocalVideoTrack;
2862
2909
 
2863
- },{"../../../vendor/inherits":150,"../localvideotrack":25}],18:[function(require,module,exports){
2910
+ },{"../../../vendor/inherits":151,"../localvideotrack":26}],19:[function(require,module,exports){
2864
2911
  'use strict';
2865
2912
  var __extends = (this && this.__extends) || (function () {
2866
2913
  var extendStatics = function (d, b) {
@@ -2972,7 +3019,7 @@ var Track = /** @class */ (function (_super) {
2972
3019
  */
2973
3020
  module.exports = Track;
2974
3021
 
2975
- },{"../../eventemitter":10,"../../util":131,"../../util/constants":124,"../../util/log":135}],19:[function(require,module,exports){
3022
+ },{"../../eventemitter":10,"../../util":132,"../../util/constants":125,"../../util/log":136}],20:[function(require,module,exports){
2976
3023
  'use strict';
2977
3024
  var __extends = (this && this.__extends) || (function () {
2978
3025
  var extendStatics = function (d, b) {
@@ -3001,6 +3048,10 @@ var LocalMediaAudioTrack = mixinLocalMediaTrack(AudioTrack);
3001
3048
  * {@link LocalAudioTrack#stop}.
3002
3049
  * @extends AudioTrack
3003
3050
  * @property {Track.ID} id - The {@link LocalAudioTrack}'s ID
3051
+ * @property {boolean} isMuted - Whether or not the audio source has stopped sending samples to the
3052
+ * {@link LocalAudioTrack}; This can happen when the microphone is taken over by another application,
3053
+ * mainly on mobile devices; When this property toggles, then <code>muted</code> and <code>unmuted</code>
3054
+ * events are fired appropriately
3004
3055
  * @property {boolean} isStopped - Whether or not the {@link LocalAudioTrack} is
3005
3056
  * stopped
3006
3057
  * @property {NoiseCancellation?} noiseCancellation - When a LocalAudioTrack is created
@@ -3008,8 +3059,10 @@ var LocalMediaAudioTrack = mixinLocalMediaTrack(AudioTrack);
3008
3059
  * to enable or disable the noise cancellation at runtime.
3009
3060
  * @emits LocalAudioTrack#disabled
3010
3061
  * @emits LocalAudioTrack#enabled
3062
+ * @emits LocalAudioTrack#muted
3011
3063
  * @emits LocalAudioTrack#started
3012
3064
  * @emits LocalAudioTrack#stopped
3065
+ * @emits LocalAudioTrack#unmuted
3013
3066
  */
3014
3067
  var LocalAudioTrack = /** @class */ (function (_super) {
3015
3068
  __extends(LocalAudioTrack, _super);
@@ -3167,7 +3220,7 @@ var LocalAudioTrack = /** @class */ (function (_super) {
3167
3220
  });
3168
3221
  };
3169
3222
  /**
3170
- * Disable the {@link LocalAudioTrack}. This is effectively "mute".
3223
+ * Disable the {@link LocalAudioTrack}. This is equivalent to muting the audio source.
3171
3224
  * @returns {this}
3172
3225
  * @fires LocalAudioTrack#disabled
3173
3226
  */
@@ -3175,13 +3228,13 @@ var LocalAudioTrack = /** @class */ (function (_super) {
3175
3228
  return _super.prototype.disable.apply(this, arguments);
3176
3229
  };
3177
3230
  /**
3178
- * Enable the {@link LocalAudioTrack}. This is effectively "unmute".
3231
+ * Enable the {@link LocalAudioTrack}. This is equivalent to unmuting the audio source.
3179
3232
  * @returns {this}
3180
3233
  * @fires LocalAudioTrack#enabled
3181
3234
  */ /**
3182
- * Enable or disable the {@link LocalAudioTrack}. This is effectively "unmute"
3183
- * or "mute".
3184
- * @param {boolean} [enabled] - Specify false to mute the
3235
+ * Enable or disable the {@link LocalAudioTrack}. This is equivalent to unmuting or muting
3236
+ * the audio source respectively.
3237
+ * @param {boolean} [enabled] - Specify false to disable the
3185
3238
  * {@link LocalAudioTrack}
3186
3239
  * @returns {this}
3187
3240
  * @fires LocalAudioTrack#disabled
@@ -3245,16 +3298,22 @@ var LocalAudioTrack = /** @class */ (function (_super) {
3245
3298
  return LocalAudioTrack;
3246
3299
  }(LocalMediaAudioTrack));
3247
3300
  /**
3248
- * The {@link LocalAudioTrack} was disabled, i.e. "muted".
3301
+ * The {@link LocalAudioTrack} was disabled, i.e. the audio source was muted by the user.
3249
3302
  * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was
3250
3303
  * disabled
3251
3304
  * @event LocalAudioTrack#disabled
3252
3305
  */
3253
3306
  /**
3254
- * The {@link LocalAudioTrack} was enabled, i.e. "unmuted".
3307
+ * The {@link LocalAudioTrack} was enabled, i.e. the audio source was unmuted by the user.
3255
3308
  * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was enabled
3256
3309
  * @event LocalAudioTrack#enabled
3257
3310
  */
3311
+ /**
3312
+ * The {@link LocalAudioTrack} was muted because the audio source stopped sending samples, most
3313
+ * likely due to another application taking said audio source, especially on mobile devices.
3314
+ * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was muted
3315
+ * @event LocalAudioTrack#muted
3316
+ */
3258
3317
  /**
3259
3318
  * The {@link LocalAudioTrack} started. This means there is enough audio data to
3260
3319
  * begin playback.
@@ -3268,9 +3327,18 @@ var LocalAudioTrack = /** @class */ (function (_super) {
3268
3327
  * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that stopped
3269
3328
  * @event LocalAudioTrack#stopped
3270
3329
  */
3330
+ /**
3331
+ * The {@link LocalAudioTrack} was unmuted because the audio source resumed sending samples,
3332
+ * most likely due to the application that took over the said audio source has released it
3333
+ * back to the application, especially on mobile devices. This event is also fired when
3334
+ * {@link LocalAudioTrack#restart} is called on a muted {@link LocalAudioTrack} with a
3335
+ * new audio source.
3336
+ * @param {LocalAudioTrack} track - The {@link LocalAudioTrack} that was unmuted
3337
+ * @event LocalAudioTrack#unmuted
3338
+ */
3271
3339
  module.exports = LocalAudioTrack;
3272
3340
 
3273
- },{"../../util/browserdetection":122,"./audiotrack":13,"./localmediatrack":23}],20:[function(require,module,exports){
3341
+ },{"../../util/browserdetection":123,"./audiotrack":14,"./localmediatrack":24}],21:[function(require,module,exports){
3274
3342
  'use strict';
3275
3343
  var __extends = (this && this.__extends) || (function () {
3276
3344
  var extendStatics = function (d, b) {
@@ -3316,7 +3384,7 @@ var LocalAudioTrackPublication = /** @class */ (function (_super) {
3316
3384
  }(LocalTrackPublication));
3317
3385
  module.exports = LocalAudioTrackPublication;
3318
3386
 
3319
- },{"./localtrackpublication":24}],21:[function(require,module,exports){
3387
+ },{"./localtrackpublication":25}],22:[function(require,module,exports){
3320
3388
  'use strict';
3321
3389
  var __extends = (this && this.__extends) || (function () {
3322
3390
  var extendStatics = function (d, b) {
@@ -3454,7 +3522,7 @@ var LocalDataTrack = /** @class */ (function (_super) {
3454
3522
  */
3455
3523
  module.exports = LocalDataTrack;
3456
3524
 
3457
- },{"../../data/sender":6,"./":18}],22:[function(require,module,exports){
3525
+ },{"../../data/sender":6,"./":19}],23:[function(require,module,exports){
3458
3526
  'use strict';
3459
3527
  var __extends = (this && this.__extends) || (function () {
3460
3528
  var extendStatics = function (d, b) {
@@ -3500,7 +3568,7 @@ var LocalDataTrackPublication = /** @class */ (function (_super) {
3500
3568
  }(LocalTrackPublication));
3501
3569
  module.exports = LocalDataTrackPublication;
3502
3570
 
3503
- },{"./localtrackpublication":24}],23:[function(require,module,exports){
3571
+ },{"./localtrackpublication":25}],24:[function(require,module,exports){
3504
3572
  /* eslint new-cap:0 */
3505
3573
  'use strict';
3506
3574
  var __extends = (this && this.__extends) || (function () {
@@ -3535,7 +3603,9 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
3535
3603
  * enabled and disabled with {@link LocalMediaTrack#enable} and
3536
3604
  * {@link LocalMediaTrack#disable} or stopped completely with
3537
3605
  * {@link LocalMediaTrack#stop}.
3606
+ * @emits LocalMediaTrack#muted
3538
3607
  * @emits LocalMediaTrack#stopped
3608
+ * @emits LocalMediaTrack#unmuted
3539
3609
  */
3540
3610
  return /** @class */ (function (_super) {
3541
3611
  __extends(LocalMediaTrack, _super);
@@ -3573,6 +3643,12 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
3573
3643
  _gUMSilentTrackWorkaround: {
3574
3644
  value: options.gUMSilentTrackWorkaround
3575
3645
  },
3646
+ _eventsToReemitters: {
3647
+ value: new Map([
3648
+ ['muted', function () { return _this.emit('muted', _this); }],
3649
+ ['unmuted', function () { return _this.emit('unmuted', _this); }]
3650
+ ])
3651
+ },
3576
3652
  _workaroundWebKitBug1208516: {
3577
3653
  value: options.workaroundWebKitBug1208516
3578
3654
  },
@@ -3600,6 +3676,12 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
3600
3676
  return mediaTrackSender.enabled;
3601
3677
  }
3602
3678
  },
3679
+ isMuted: {
3680
+ enumerable: true,
3681
+ get: function () {
3682
+ return mediaTrackSender.muted;
3683
+ }
3684
+ },
3603
3685
  isStopped: {
3604
3686
  enumerable: true,
3605
3687
  get: function () {
@@ -3612,17 +3694,20 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
3612
3694
  if (_this._workaroundWebKitBug1208516) {
3613
3695
  _this._workaroundWebKitBug1208516Cleanup = restartWhenInadvertentlyStopped(_this);
3614
3696
  }
3697
+ _this._reemitTrackSenderEvents();
3615
3698
  return _this;
3616
3699
  }
3617
3700
  /**
3618
3701
  * @private
3619
3702
  */
3620
3703
  LocalMediaTrack.prototype._end = function () {
3704
+ var _this = this;
3621
3705
  if (this._didCallEnd) {
3622
3706
  return;
3623
3707
  }
3624
3708
  _super.prototype._end.call(this);
3625
3709
  this._didCallEnd = true;
3710
+ this._eventsToReemitters.forEach(function (reemitter, event) { return _this._trackSender.removeListener(event, reemitter); });
3626
3711
  this.emit('stopped', this);
3627
3712
  };
3628
3713
  /**
@@ -3632,6 +3717,9 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
3632
3717
  if (this._didCallEnd) {
3633
3718
  this._didCallEnd = false;
3634
3719
  }
3720
+ if (this._eventsToReemitters) {
3721
+ this._reemitTrackSenderEvents();
3722
+ }
3635
3723
  _super.prototype._initialize.call(this);
3636
3724
  };
3637
3725
  /**
@@ -3653,6 +3741,15 @@ function mixinLocalMediaTrack(AudioOrVideoTrack) {
3653
3741
  return mediaStream.getTracks()[0];
3654
3742
  });
3655
3743
  };
3744
+ /**
3745
+ * @private
3746
+ */
3747
+ LocalMediaTrack.prototype._reemitTrackSenderEvents = function () {
3748
+ var _this = this;
3749
+ this._eventsToReemitters.forEach(function (reemitter, event) { return _this._trackSender.on(event, reemitter); });
3750
+ this._trackSender.dequeue('muted');
3751
+ this._trackSender.dequeue('unmuted');
3752
+ };
3656
3753
  /**
3657
3754
  * @private
3658
3755
  */
@@ -3855,7 +3952,7 @@ function restartWhenInadvertentlyStopped(localMediaTrack) {
3855
3952
  }
3856
3953
  module.exports = mixinLocalMediaTrack;
3857
3954
 
3858
- },{"../../util":131,"../../util/browserdetection":122,"../../util/constants":124,"../../util/detectsilentaudio":125,"../../util/detectsilentvideo":126,"../../util/documentvisibilitymonitor.js":127,"../../util/localmediarestartdeferreds":134,"../../webaudio/workaround180748":154,"../../webrtc":157,"./sender":38}],24:[function(require,module,exports){
3955
+ },{"../../util":132,"../../util/browserdetection":123,"../../util/constants":125,"../../util/detectsilentaudio":126,"../../util/detectsilentvideo":127,"../../util/documentvisibilitymonitor.js":128,"../../util/localmediarestartdeferreds":135,"../../webaudio/workaround180748":155,"../../webrtc":158,"./sender":39}],25:[function(require,module,exports){
3859
3956
  /* eslint new-cap:0 */
3860
3957
  'use strict';
3861
3958
  var __extends = (this && this.__extends) || (function () {
@@ -4021,7 +4118,7 @@ var LocalTrackPublication = /** @class */ (function (_super) {
4021
4118
  */
4022
4119
  module.exports = LocalTrackPublication;
4023
4120
 
4024
- },{"../../util/constants":124,"./trackpublication":39}],25:[function(require,module,exports){
4121
+ },{"../../util/constants":125,"./trackpublication":40}],26:[function(require,module,exports){
4025
4122
  'use strict';
4026
4123
  var __extends = (this && this.__extends) || (function () {
4027
4124
  var extendStatics = function (d, b) {
@@ -4052,12 +4149,18 @@ var LocalMediaVideoTrack = mixinLocalMediaTrack(VideoTrack);
4052
4149
  * {@link LocalVideoTrack#stop}.
4053
4150
  * @extends VideoTrack
4054
4151
  * @property {Track.ID} id - The {@link LocalVideoTrack}'s ID
4152
+ * @property {boolean} isMuted - Whether or not the video source has stopped sending frames to the
4153
+ * {@link LocalVideoTrack}; This can happen when the camera is taken over by another application,
4154
+ * mainly on mobile devices; When this property toggles, then <code>muted</code> and <code>unmuted</code>
4155
+ * events are fired appropriately
4055
4156
  * @property {boolean} isStopped - Whether or not the {@link LocalVideoTrack} is
4056
4157
  * stopped
4057
4158
  * @emits LocalVideoTrack#disabled
4058
4159
  * @emits LocalVideoTrack#enabled
4160
+ * @emits LocalVideoTrack#muted
4059
4161
  * @emits LocalVideoTrack#started
4060
4162
  * @emits LocalVideoTrack#stopped
4163
+ * @emits LocalVideoTrack#unmuted
4061
4164
  */
4062
4165
  var LocalVideoTrack = /** @class */ (function (_super) {
4063
4166
  __extends(LocalVideoTrack, _super);
@@ -4184,8 +4287,8 @@ var LocalVideoTrack = /** @class */ (function (_super) {
4184
4287
  return result;
4185
4288
  };
4186
4289
  /**
4187
- * Disable the {@link LocalVideoTrack}. This is effectively "pause".
4188
- * If a {@link VideoProcessor} is added, then `processedTrack` is disabled as well.
4290
+ * Disable the {@link LocalVideoTrack}. This is equivalent to pausing a video source.
4291
+ * If a {@link VideoProcessor} is added, then <code>processedTrack</code> is also disabled.
4189
4292
  * @returns {this}
4190
4293
  * @fires VideoTrack#disabled
4191
4294
  */
@@ -4197,15 +4300,15 @@ var LocalVideoTrack = /** @class */ (function (_super) {
4197
4300
  return result;
4198
4301
  };
4199
4302
  /**
4200
- * Enable the {@link LocalVideoTrack}. This is effectively "unpause".
4201
- * If a {@link VideoProcessor} is added, then `processedTrack` is enabled as well.
4303
+ * Enable the {@link LocalVideoTrack}. This is equivalent to unpausing the video source.
4304
+ * If a {@link VideoProcessor} is added, then <code>processedTrack</code> is also enabled.
4202
4305
  * @returns {this}
4203
4306
  * @fires VideoTrack#enabled
4204
4307
  */ /**
4205
- * Enable or disable the {@link LocalVideoTrack}. This is effectively "unpause"
4206
- * or "pause". If a {@link VideoProcessor} is added,
4207
- * then `processedTrack` is enabled or disabled as well.
4208
- * @param {boolean} [enabled] - Specify false to pause the
4308
+ * Enable or disable the {@link LocalVideoTrack}. This is equivalent to unpausing or pausing
4309
+ * the video source respectively. If a {@link VideoProcessor} is added, then <code>processedTrack</code>
4310
+ * is also enabled or disabled.
4311
+ * @param {boolean} [enabled] - Specify false to disable the
4209
4312
  * {@link LocalVideoTrack}
4210
4313
  * @returns {this}
4211
4314
  * @fires VideoTrack#disabled
@@ -4343,16 +4446,22 @@ function workaroundSilentLocalVideo(localVideoTrack, doc) {
4343
4446
  };
4344
4447
  }
4345
4448
  /**
4346
- * The {@link LocalVideoTrack} was disabled, i.e. "muted".
4449
+ * The {@link LocalVideoTrack} was disabled, i.e. the video source was paused by the user.
4347
4450
  * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was
4348
4451
  * disabled
4349
4452
  * @event LocalVideoTrack#disabled
4350
4453
  */
4351
4454
  /**
4352
- * The {@link LocalVideoTrack} was enabled, i.e. "unmuted".
4455
+ * The {@link LocalVideoTrack} was enabled, i.e. the video source was unpaused by the user.
4353
4456
  * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was enabled
4354
4457
  * @event LocalVideoTrack#enabled
4355
4458
  */
4459
+ /**
4460
+ * The {@link LocalVideoTrack} was muted because the video source stopped sending frames, most
4461
+ * likely due to another application taking said video source, especially on mobile devices.
4462
+ * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was muted
4463
+ * @event LocalVideoTrack#muted
4464
+ */
4356
4465
  /**
4357
4466
  * The {@link LocalVideoTrack} started. This means there is enough video data
4358
4467
  * to begin playback.
@@ -4366,9 +4475,18 @@ function workaroundSilentLocalVideo(localVideoTrack, doc) {
4366
4475
  * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that stopped
4367
4476
  * @event LocalVideoTrack#stopped
4368
4477
  */
4478
+ /**
4479
+ * The {@link LocalVideoTrack} was unmuted because the video source resumed sending frames,
4480
+ * most likely due to the application that took over the said video source has released it
4481
+ * back to the application, especially on mobile devices. This event is also fired when
4482
+ * {@link LocalVideoTrack#restart} is called on a muted {@link LocalVideoTrack} with a
4483
+ * new video source.
4484
+ * @param {LocalVideoTrack} track - The {@link LocalVideoTrack} that was unmuted
4485
+ * @event LocalVideoTrack#unmuted
4486
+ */
4369
4487
  module.exports = LocalVideoTrack;
4370
4488
 
4371
- },{"../../util":131,"../../util/browserdetection":122,"../../util/detectsilentvideo":126,"./localmediatrack":23,"./videotrack":42}],26:[function(require,module,exports){
4489
+ },{"../../util":132,"../../util/browserdetection":123,"../../util/detectsilentvideo":127,"./localmediatrack":24,"./videotrack":43}],27:[function(require,module,exports){
4372
4490
  'use strict';
4373
4491
  var __extends = (this && this.__extends) || (function () {
4374
4492
  var extendStatics = function (d, b) {
@@ -4414,7 +4532,7 @@ var LocalVideoTrackPublication = /** @class */ (function (_super) {
4414
4532
  }(LocalTrackPublication));
4415
4533
  module.exports = LocalVideoTrackPublication;
4416
4534
 
4417
- },{"./localtrackpublication":24}],27:[function(require,module,exports){
4535
+ },{"./localtrackpublication":25}],28:[function(require,module,exports){
4418
4536
  'use strict';
4419
4537
  var __extends = (this && this.__extends) || (function () {
4420
4538
  var extendStatics = function (d, b) {
@@ -4778,7 +4896,7 @@ function shimMediaElement(el, onUnintentionallyPaused) {
4778
4896
  }
4779
4897
  module.exports = MediaTrack;
4780
4898
 
4781
- },{"../../util":131,"../../util/browserdetection":122,"../../util/localmediarestartdeferreds":134,"../../webrtc":157,"./":18}],28:[function(require,module,exports){
4899
+ },{"../../util":132,"../../util/browserdetection":123,"../../util/localmediarestartdeferreds":135,"../../webrtc":158,"./":19}],29:[function(require,module,exports){
4782
4900
  'use strict';
4783
4901
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4784
4902
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -5007,7 +5125,7 @@ function applyNoiseCancellation(mediaStreamTrack, noiseCancellationOptions, log)
5007
5125
  }
5008
5126
  exports.applyNoiseCancellation = applyNoiseCancellation;
5009
5127
 
5010
- },{"../../noisecancellationadapter":44,"../../util/log":135}],29:[function(require,module,exports){
5128
+ },{"../../noisecancellationadapter":45,"../../util/log":136}],30:[function(require,module,exports){
5011
5129
  'use strict';
5012
5130
  var __extends = (this && this.__extends) || (function () {
5013
5131
  var extendStatics = function (d, b) {
@@ -5043,7 +5161,7 @@ var MediaTrackReceiver = /** @class */ (function (_super) {
5043
5161
  }(MediaTrackTransceiver));
5044
5162
  module.exports = MediaTrackReceiver;
5045
5163
 
5046
- },{"./transceiver":40}],30:[function(require,module,exports){
5164
+ },{"./transceiver":41}],31:[function(require,module,exports){
5047
5165
  'use strict';
5048
5166
  var __extends = (this && this.__extends) || (function () {
5049
5167
  var extendStatics = function (d, b) {
@@ -5152,7 +5270,7 @@ var RemoteAudioTrack = /** @class */ (function (_super) {
5152
5270
  */
5153
5271
  module.exports = RemoteAudioTrack;
5154
5272
 
5155
- },{"./audiotrack":13,"./remotemediatrack":34}],31:[function(require,module,exports){
5273
+ },{"./audiotrack":14,"./remotemediatrack":35}],32:[function(require,module,exports){
5156
5274
  'use strict';
5157
5275
  var __extends = (this && this.__extends) || (function () {
5158
5276
  var extendStatics = function (d, b) {
@@ -5224,7 +5342,7 @@ var RemoteAudioTrackPublication = /** @class */ (function (_super) {
5224
5342
  */
5225
5343
  module.exports = RemoteAudioTrackPublication;
5226
5344
 
5227
- },{"./remotetrackpublication":35}],32:[function(require,module,exports){
5345
+ },{"./remotetrackpublication":36}],33:[function(require,module,exports){
5228
5346
  'use strict';
5229
5347
  var __extends = (this && this.__extends) || (function () {
5230
5348
  var extendStatics = function (d, b) {
@@ -5411,7 +5529,7 @@ var RemoteDataTrack = /** @class */ (function (_super) {
5411
5529
  */
5412
5530
  module.exports = RemoteDataTrack;
5413
5531
 
5414
- },{"../../util/constants":124,"./":18}],33:[function(require,module,exports){
5532
+ },{"../../util/constants":125,"./":19}],34:[function(require,module,exports){
5415
5533
  'use strict';
5416
5534
  var __extends = (this && this.__extends) || (function () {
5417
5535
  var extendStatics = function (d, b) {
@@ -5473,7 +5591,7 @@ var RemoteDataTrackPublication = /** @class */ (function (_super) {
5473
5591
  */
5474
5592
  module.exports = RemoteDataTrackPublication;
5475
5593
 
5476
- },{"./remotetrackpublication":35}],34:[function(require,module,exports){
5594
+ },{"./remotetrackpublication":36}],35:[function(require,module,exports){
5477
5595
  'use strict';
5478
5596
  var __extends = (this && this.__extends) || (function () {
5479
5597
  var extendStatics = function (d, b) {
@@ -5759,7 +5877,7 @@ function playIfPausedWhileInBackground(remoteMediaTrack) {
5759
5877
  */
5760
5878
  module.exports = mixinRemoteMediaTrack;
5761
5879
 
5762
- },{"../../util/browserdetection":122,"../../util/constants":124,"../../util/documentvisibilitymonitor.js":127}],35:[function(require,module,exports){
5880
+ },{"../../util/browserdetection":123,"../../util/constants":125,"../../util/documentvisibilitymonitor.js":128}],36:[function(require,module,exports){
5763
5881
  'use strict';
5764
5882
  var __extends = (this && this.__extends) || (function () {
5765
5883
  var extendStatics = function (d, b) {
@@ -5954,7 +6072,7 @@ var RemoteTrackPublication = /** @class */ (function (_super) {
5954
6072
  */
5955
6073
  module.exports = RemoteTrackPublication;
5956
6074
 
5957
- },{"./trackpublication":39}],36:[function(require,module,exports){
6075
+ },{"./trackpublication":40}],37:[function(require,module,exports){
5958
6076
  'use strict';
5959
6077
  var __extends = (this && this.__extends) || (function () {
5960
6078
  var extendStatics = function (d, b) {
@@ -6388,7 +6506,7 @@ function maybeUpdateDimensionHint(remoteVideoTrack) {
6388
6506
  */
6389
6507
  module.exports = RemoteVideoTrack;
6390
6508
 
6391
- },{"../../util/documentvisibilitymonitor.js":127,"../../util/nullobserver.js":138,"../../util/timeout":145,"./remotemediatrack":34,"./videotrack":42}],37:[function(require,module,exports){
6509
+ },{"../../util/documentvisibilitymonitor.js":128,"../../util/nullobserver.js":139,"../../util/timeout":146,"./remotemediatrack":35,"./videotrack":43}],38:[function(require,module,exports){
6392
6510
  'use strict';
6393
6511
  var __extends = (this && this.__extends) || (function () {
6394
6512
  var extendStatics = function (d, b) {
@@ -6460,7 +6578,7 @@ var RemoteVideoTrackPublication = /** @class */ (function (_super) {
6460
6578
  */
6461
6579
  module.exports = RemoteVideoTrackPublication;
6462
6580
 
6463
- },{"./remotetrackpublication":35}],38:[function(require,module,exports){
6581
+ },{"./remotetrackpublication":36}],39:[function(require,module,exports){
6464
6582
  'use strict';
6465
6583
  var __extends = (this && this.__extends) || (function () {
6466
6584
  var extendStatics = function (d, b) {
@@ -6511,6 +6629,12 @@ var MediaTrackSender = /** @class */ (function (_super) {
6511
6629
  _clones: {
6512
6630
  value: new Set()
6513
6631
  },
6632
+ _eventsToReemitters: {
6633
+ value: new Map([
6634
+ ['mute', function () { return _this.queue('muted'); }],
6635
+ ['unmute', function () { return _this.queue('unmuted'); }]
6636
+ ])
6637
+ },
6514
6638
  _senders: {
6515
6639
  value: new Set()
6516
6640
  },
@@ -6518,13 +6642,36 @@ var MediaTrackSender = /** @class */ (function (_super) {
6518
6642
  value: new Map()
6519
6643
  },
6520
6644
  isPublishing: {
6645
+ enumerable: true,
6521
6646
  get: function () {
6522
6647
  return !!this._clones.size;
6523
6648
  }
6649
+ },
6650
+ muted: {
6651
+ enumerable: true,
6652
+ get: function () {
6653
+ return this._track.muted;
6654
+ }
6524
6655
  }
6525
6656
  });
6657
+ _this._reemitMediaStreamTrackEvents();
6526
6658
  return _this;
6527
6659
  }
6660
+ /**
6661
+ * @private
6662
+ */
6663
+ MediaTrackSender.prototype._reemitMediaStreamTrackEvents = function (mediaStreamTrack) {
6664
+ if (mediaStreamTrack === void 0) { mediaStreamTrack = this._track; }
6665
+ var _a = this, eventsToReemitters = _a._eventsToReemitters, track = _a._track;
6666
+ eventsToReemitters.forEach(function (reemitter, event) { return mediaStreamTrack.addEventListener(event, reemitter); });
6667
+ if (track !== mediaStreamTrack) {
6668
+ eventsToReemitters.forEach(function (reemitter, event) { return track.removeEventListener(event, reemitter); });
6669
+ if (track.muted !== mediaStreamTrack.muted) {
6670
+ var reemitter = eventsToReemitters.get(mediaStreamTrack.muted ? 'mute' : 'unmute');
6671
+ reemitter();
6672
+ }
6673
+ }
6674
+ };
6528
6675
  /**
6529
6676
  * Return a new {@link MediaTrackSender} containing a clone of the underlying
6530
6677
  * MediaStreamTrack. No RTCRtpSenders are copied.
@@ -6556,6 +6703,7 @@ var MediaTrackSender = /** @class */ (function (_super) {
6556
6703
  }).concat(senders.map(function (sender) {
6557
6704
  return _this._replaceTrack(sender, mediaStreamTrack);
6558
6705
  }))).finally(function () {
6706
+ _this._reemitMediaStreamTrackEvents(mediaStreamTrack);
6559
6707
  _this._track = mediaStreamTrack;
6560
6708
  });
6561
6709
  };
@@ -6604,12 +6752,20 @@ var MediaTrackSender = /** @class */ (function (_super) {
6604
6752
  return MediaTrackSender;
6605
6753
  }(MediaTrackTransceiver));
6606
6754
  /**
6607
- * The {@link MediaTrackSender} replaced the underlying mediaStreamTrack
6755
+ * The {@link MediaTrackSender}'s underlying MediaStreamTrack was muted.
6756
+ * @event MediaTrackSender#muted
6757
+ */
6758
+ /**
6759
+ * The {@link MediaTrackSender} replaced the underlying MediaStreamTrack.
6608
6760
  * @event MediaTrackSender#replaced
6609
6761
  */
6762
+ /**
6763
+ * The {@link MediaTrackSender}'s underlying MediaStreamTrack was unmuted.
6764
+ * @event MediaTrackSender#unmuted
6765
+ */
6610
6766
  module.exports = MediaTrackSender;
6611
6767
 
6612
- },{"./transceiver":40}],39:[function(require,module,exports){
6768
+ },{"./transceiver":41}],40:[function(require,module,exports){
6613
6769
  'use strict';
6614
6770
  var __extends = (this && this.__extends) || (function () {
6615
6771
  var extendStatics = function (d, b) {
@@ -6706,7 +6862,7 @@ var TrackPublication = /** @class */ (function (_super) {
6706
6862
  */
6707
6863
  module.exports = TrackPublication;
6708
6864
 
6709
- },{"../../eventemitter":10,"../../util":131,"../../util/constants":124,"../../util/log":135}],40:[function(require,module,exports){
6865
+ },{"../../eventemitter":10,"../../util":132,"../../util/constants":125,"../../util/log":136}],41:[function(require,module,exports){
6710
6866
  'use strict';
6711
6867
  var __extends = (this && this.__extends) || (function () {
6712
6868
  var extendStatics = function (d, b) {
@@ -6773,7 +6929,7 @@ var MediaTrackTransceiver = /** @class */ (function (_super) {
6773
6929
  }(TrackTransceiver));
6774
6930
  module.exports = MediaTrackTransceiver;
6775
6931
 
6776
- },{"../../transceiver":118}],41:[function(require,module,exports){
6932
+ },{"../../transceiver":119}],42:[function(require,module,exports){
6777
6933
  'use strict';
6778
6934
  var __extends = (this && this.__extends) || (function () {
6779
6935
  var extendStatics = function (d, b) {
@@ -6928,7 +7084,7 @@ var VideoProcessorEventObserver = /** @class */ (function (_super) {
6928
7084
  }(EventEmitter));
6929
7085
  module.exports = VideoProcessorEventObserver;
6930
7086
 
6931
- },{"../../util/constants":124,"events":173}],42:[function(require,module,exports){
7087
+ },{"../../util/constants":125,"events":173}],43:[function(require,module,exports){
6932
7088
  'use strict';
6933
7089
  var __extends = (this && this.__extends) || (function () {
6934
7090
  var extendStatics = function (d, b) {
@@ -7443,7 +7599,7 @@ function dimensionsChanged(track, elem) {
7443
7599
  */
7444
7600
  module.exports = VideoTrack;
7445
7601
 
7446
- },{"../../util/constants":124,"./mediatrack":27,"./videoprocessoreventobserver":41}],43:[function(require,module,exports){
7602
+ },{"../../util/constants":125,"./mediatrack":28,"./videoprocessoreventobserver":42}],44:[function(require,module,exports){
7447
7603
  'use strict';
7448
7604
  var __extends = (this && this.__extends) || (function () {
7449
7605
  var extendStatics = function (d, b) {
@@ -7542,7 +7698,7 @@ var NetworkQualityConfigurationImpl = /** @class */ (function (_super) {
7542
7698
  }(EventEmitter));
7543
7699
  module.exports = NetworkQualityConfigurationImpl;
7544
7700
 
7545
- },{"./util":131,"./util/constants":124,"events":173}],44:[function(require,module,exports){
7701
+ },{"./util":132,"./util/constants":125,"events":173}],45:[function(require,module,exports){
7546
7702
  'use strict';
7547
7703
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7548
7704
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -7697,7 +7853,7 @@ function createNoiseCancellationAudioProcessor(noiseCancellationOptions, log) {
7697
7853
  }
7698
7854
  exports.createNoiseCancellationAudioProcessor = createNoiseCancellationAudioProcessor;
7699
7855
 
7700
- },{"./util/dynamicimport":128,"./util/log":135}],45:[function(require,module,exports){
7856
+ },{"./util/dynamicimport":129,"./util/log":136}],46:[function(require,module,exports){
7701
7857
  'use strict';
7702
7858
  var __extends = (this && this.__extends) || (function () {
7703
7859
  var extendStatics = function (d, b) {
@@ -8314,7 +8470,7 @@ function reemitTrackPublicationEvents(participant, publication) {
8314
8470
  }
8315
8471
  module.exports = Participant;
8316
8472
 
8317
- },{"./eventemitter":10,"./media/track/remoteaudiotrack":30,"./media/track/remoteaudiotrackpublication":31,"./media/track/remotedatatrack":32,"./media/track/remotedatatrackpublication":33,"./media/track/remotevideotrack":36,"./media/track/remotevideotrackpublication":37,"./util":131}],46:[function(require,module,exports){
8473
+ },{"./eventemitter":10,"./media/track/remoteaudiotrack":31,"./media/track/remoteaudiotrackpublication":32,"./media/track/remotedatatrack":33,"./media/track/remotedatatrackpublication":34,"./media/track/remotevideotrack":37,"./media/track/remotevideotrackpublication":38,"./util":132}],47:[function(require,module,exports){
8318
8474
  "use strict";
8319
8475
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8320
8476
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8468,7 +8624,7 @@ function extractSelectedActiveCandidatePair(stats) {
8468
8624
  };
8469
8625
  }
8470
8626
 
8471
- },{}],47:[function(require,module,exports){
8627
+ },{}],48:[function(require,module,exports){
8472
8628
  "use strict";
8473
8629
  Object.defineProperty(exports, "__esModule", { value: true });
8474
8630
  exports.getTurnCredentials = void 0;
@@ -8516,7 +8672,7 @@ function getTurnCredentials(token, wsServer) {
8516
8672
  }
8517
8673
  exports.getTurnCredentials = getTurnCredentials;
8518
8674
 
8519
- },{"../twilioconnection.js":119,"../util/constants":124,"../util/twilio-video-errors":146,"events":173}],48:[function(require,module,exports){
8675
+ },{"../twilioconnection.js":120,"../util/constants":125,"../util/twilio-video-errors":147,"events":173}],49:[function(require,module,exports){
8520
8676
  "use strict";
8521
8677
  var __read = (this && this.__read) || function (o, n) {
8522
8678
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -8557,7 +8713,7 @@ function makeStat(values) {
8557
8713
  }
8558
8714
  exports.makeStat = makeStat;
8559
8715
 
8560
- },{}],49:[function(require,module,exports){
8716
+ },{}],50:[function(require,module,exports){
8561
8717
  "use strict";
8562
8718
  Object.defineProperty(exports, "__esModule", { value: true });
8563
8719
  exports.mosToScore = exports.calculateMOS = void 0;
@@ -8618,7 +8774,7 @@ function mosToScore(mosValue) {
8618
8774
  }
8619
8775
  exports.mosToScore = mosToScore;
8620
8776
 
8621
- },{}],50:[function(require,module,exports){
8777
+ },{}],51:[function(require,module,exports){
8622
8778
  "use strict";
8623
8779
  var __extends = (this && this.__extends) || (function () {
8624
8780
  var extendStatics = function (d, b) {
@@ -9262,7 +9418,7 @@ function runPreflight(token, options) {
9262
9418
  }
9263
9419
  exports.runPreflight = runPreflight;
9264
9420
 
9265
- },{"../eventemitter":10,"../util/constants":124,"../util/eventobserver":129,"../util/index":131,"../util/insightspublisher":132,"../util/log":135,"../util/movingaveragedelta":136,"../util/sid":143,"../util/twilio-video-errors":146,"./getCombinedConnectionStats":46,"./getturncredentials":47,"./makestat":48,"./mos":49,"./syntheticaudio":51,"./syntheticvideo":52,"./timer":53}],51:[function(require,module,exports){
9421
+ },{"../eventemitter":10,"../util/constants":125,"../util/eventobserver":130,"../util/index":132,"../util/insightspublisher":133,"../util/log":136,"../util/movingaveragedelta":137,"../util/sid":144,"../util/twilio-video-errors":147,"./getCombinedConnectionStats":47,"./getturncredentials":48,"./makestat":49,"./mos":50,"./syntheticaudio":52,"./syntheticvideo":53,"./timer":54}],52:[function(require,module,exports){
9266
9422
  "use strict";
9267
9423
  Object.defineProperty(exports, "__esModule", { value: true });
9268
9424
  exports.syntheticAudio = void 0;
@@ -9285,7 +9441,7 @@ function syntheticAudio() {
9285
9441
  }
9286
9442
  exports.syntheticAudio = syntheticAudio;
9287
9443
 
9288
- },{"../webaudio/audiocontext":152}],52:[function(require,module,exports){
9444
+ },{"../webaudio/audiocontext":153}],53:[function(require,module,exports){
9289
9445
  "use strict";
9290
9446
  Object.defineProperty(exports, "__esModule", { value: true });
9291
9447
  exports.syntheticVideo = void 0;
@@ -9319,7 +9475,7 @@ function syntheticVideo(_a) {
9319
9475
  }
9320
9476
  exports.syntheticVideo = syntheticVideo;
9321
9477
 
9322
- },{}],53:[function(require,module,exports){
9478
+ },{}],54:[function(require,module,exports){
9323
9479
  "use strict";
9324
9480
  Object.defineProperty(exports, "__esModule", { value: true });
9325
9481
  exports.Timer = void 0;
@@ -9349,7 +9505,7 @@ var Timer = /** @class */ (function () {
9349
9505
  }());
9350
9506
  exports.Timer = Timer;
9351
9507
 
9352
- },{}],54:[function(require,module,exports){
9508
+ },{}],55:[function(require,module,exports){
9353
9509
  'use strict';
9354
9510
  var __extends = (this && this.__extends) || (function () {
9355
9511
  var extendStatics = function (d, b) {
@@ -9450,7 +9606,7 @@ var QueueingEventEmitter = /** @class */ (function (_super) {
9450
9606
  }(EventEmitter));
9451
9607
  module.exports = QueueingEventEmitter;
9452
9608
 
9453
- },{"events":173}],55:[function(require,module,exports){
9609
+ },{"events":173}],56:[function(require,module,exports){
9454
9610
  'use strict';
9455
9611
  var __extends = (this && this.__extends) || (function () {
9456
9612
  var extendStatics = function (d, b) {
@@ -9731,7 +9887,7 @@ var RemoteParticipant = /** @class */ (function (_super) {
9731
9887
  */
9732
9888
  module.exports = RemoteParticipant;
9733
9889
 
9734
- },{"./participant":45}],56:[function(require,module,exports){
9890
+ },{"./participant":46}],57:[function(require,module,exports){
9735
9891
  'use strict';
9736
9892
  var __extends = (this && this.__extends) || (function () {
9737
9893
  var extendStatics = function (d, b) {
@@ -9772,7 +9928,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
9772
9928
  var EventEmitter = require('./eventemitter');
9773
9929
  var RemoteParticipant = require('./remoteparticipant');
9774
9930
  var StatsReport = require('./stats/statsreport');
9775
- var valueToJSON = require('./util').valueToJSON;
9931
+ var _a = require('./util'), flatMap = _a.flatMap, valueToJSON = _a.valueToJSON;
9776
9932
  var nInstances = 0;
9777
9933
  /**
9778
9934
  * A {@link Room} represents communication between you and one or more
@@ -9930,6 +10086,55 @@ var Room = /** @class */ (function (_super) {
9930
10086
  });
9931
10087
  });
9932
10088
  };
10089
+ /**
10090
+ * Restart the muted local media {@link Track}s and play inadvertently paused HTMLMediaElements
10091
+ * that are attached to local and remote media {@link Track}s. This method is useful mainly on
10092
+ * mobile browsers (Safari and Chrome on iOS), where there is a possibility that the muted local
10093
+ * media {@link Track}s are never unmuted and inadvertently paused HTMLMediaElements are never
10094
+ * played again, especially after handling an incoming phone call.
10095
+ * @returns {this}
10096
+ */
10097
+ Room.prototype.refreshInactiveMedia = function () {
10098
+ var localTrackPublications = this.localParticipant.tracks;
10099
+ var localMediaTracks = Array.from(localTrackPublications.values())
10100
+ .filter(function (_a) {
10101
+ var kind = _a.track.kind;
10102
+ return kind !== 'data';
10103
+ })
10104
+ .map(function (_a) {
10105
+ var track = _a.track;
10106
+ return track;
10107
+ });
10108
+ var remoteMediaTracks = flatMap(this.participants, function (participants) { return Array.from(participants.tracks.values()); })
10109
+ .filter(function (_a) {
10110
+ var track = _a.track;
10111
+ return track && track.kind !== 'data';
10112
+ })
10113
+ .map(function (_a) {
10114
+ var track = _a.track;
10115
+ return track;
10116
+ });
10117
+ var mediaTracks = localMediaTracks.concat(remoteMediaTracks);
10118
+ var unmuteEvent = new Event('unmute');
10119
+ localMediaTracks.forEach(function (_a) {
10120
+ var isMuted = _a.isMuted, mediaStreamTrack = _a.mediaStreamTrack;
10121
+ if (isMuted) {
10122
+ mediaStreamTrack.dispatchEvent(unmuteEvent);
10123
+ }
10124
+ });
10125
+ var pauseEvent = new Event('pause');
10126
+ mediaTracks.forEach(function (_a) {
10127
+ var attachments = _a._attachments, elShims = _a._elShims;
10128
+ return attachments.forEach(function (el) {
10129
+ var shim = elShims.get(el);
10130
+ var isInadvertentlyPaused = el.paused && shim && !shim.pausedIntentionally();
10131
+ if (isInadvertentlyPaused) {
10132
+ el.dispatchEvent(pauseEvent);
10133
+ }
10134
+ });
10135
+ });
10136
+ return this;
10137
+ };
9933
10138
  Room.prototype.toJSON = function () {
9934
10139
  return valueToJSON(this);
9935
10140
  };
@@ -10358,7 +10563,7 @@ function handleSignalingEvents(room, signaling) {
10358
10563
  }
10359
10564
  module.exports = Room;
10360
10565
 
10361
- },{"./eventemitter":10,"./remoteparticipant":55,"./stats/statsreport":115,"./util":131}],57:[function(require,module,exports){
10566
+ },{"./eventemitter":10,"./remoteparticipant":56,"./stats/statsreport":116,"./util":132}],58:[function(require,module,exports){
10362
10567
  /* eslint consistent-return:0 */
10363
10568
  'use strict';
10364
10569
  var __extends = (this && this.__extends) || (function () {
@@ -10528,7 +10733,7 @@ var Signaling = /** @class */ (function (_super) {
10528
10733
  }(StateMachine));
10529
10734
  module.exports = Signaling;
10530
10735
 
10531
- },{"../statemachine":87,"./participant":60,"./room":64}],58:[function(require,module,exports){
10736
+ },{"../statemachine":88,"./participant":61,"./room":65}],59:[function(require,module,exports){
10532
10737
  'use strict';
10533
10738
  var __extends = (this && this.__extends) || (function () {
10534
10739
  var extendStatics = function (d, b) {
@@ -10610,7 +10815,7 @@ var LocalParticipantSignaling = /** @class */ (function (_super) {
10610
10815
  }(ParticipantSignaling));
10611
10816
  module.exports = LocalParticipantSignaling;
10612
10817
 
10613
- },{"./participant":60}],59:[function(require,module,exports){
10818
+ },{"./participant":61}],60:[function(require,module,exports){
10614
10819
  'use strict';
10615
10820
  var __extends = (this && this.__extends) || (function () {
10616
10821
  var extendStatics = function (d, b) {
@@ -10741,7 +10946,7 @@ function setError(publication, error) {
10741
10946
  }
10742
10947
  module.exports = LocalTrackPublicationSignaling;
10743
10948
 
10744
- },{"./track":65}],60:[function(require,module,exports){
10949
+ },{"./track":66}],61:[function(require,module,exports){
10745
10950
  'use strict';
10746
10951
  var __extends = (this && this.__extends) || (function () {
10747
10952
  var extendStatics = function (d, b) {
@@ -10966,7 +11171,7 @@ var ParticipantSignaling = /** @class */ (function (_super) {
10966
11171
  */
10967
11172
  module.exports = ParticipantSignaling;
10968
11173
 
10969
- },{"../statemachine":87,"../stats/networkqualitystats":102}],61:[function(require,module,exports){
11174
+ },{"../statemachine":88,"../stats/networkqualitystats":103}],62:[function(require,module,exports){
10970
11175
  'use strict';
10971
11176
  var __extends = (this && this.__extends) || (function () {
10972
11177
  var extendStatics = function (d, b) {
@@ -11039,7 +11244,7 @@ var RecordingSignaling = /** @class */ (function (_super) {
11039
11244
  */
11040
11245
  module.exports = RecordingSignaling;
11041
11246
 
11042
- },{"events":173}],62:[function(require,module,exports){
11247
+ },{"events":173}],63:[function(require,module,exports){
11043
11248
  'use strict';
11044
11249
  var __extends = (this && this.__extends) || (function () {
11045
11250
  var extendStatics = function (d, b) {
@@ -11079,7 +11284,7 @@ var RemoteParticipantSignaling = /** @class */ (function (_super) {
11079
11284
  }(ParticipantSignaling));
11080
11285
  module.exports = RemoteParticipantSignaling;
11081
11286
 
11082
- },{"./participant":60}],63:[function(require,module,exports){
11287
+ },{"./participant":61}],64:[function(require,module,exports){
11083
11288
  'use strict';
11084
11289
  var __extends = (this && this.__extends) || (function () {
11085
11290
  var extendStatics = function (d, b) {
@@ -11184,7 +11389,7 @@ var RemoteTrackPublicationSignaling = /** @class */ (function (_super) {
11184
11389
  }(TrackSignaling));
11185
11390
  module.exports = RemoteTrackPublicationSignaling;
11186
11391
 
11187
- },{"./track":65}],64:[function(require,module,exports){
11392
+ },{"./track":66}],65:[function(require,module,exports){
11188
11393
  'use strict';
11189
11394
  var __extends = (this && this.__extends) || (function () {
11190
11395
  var extendStatics = function (d, b) {
@@ -11465,7 +11670,7 @@ function maybeUpdateState(roomSignaling) {
11465
11670
  }
11466
11671
  module.exports = RoomSignaling;
11467
11672
 
11468
- },{"../statemachine":87,"../util":131,"../util/constants":124,"../util/log":135,"../util/timeout":145,"../util/twilio-video-errors":146,"./recording":61}],65:[function(require,module,exports){
11673
+ },{"../statemachine":88,"../util":132,"../util/constants":125,"../util/log":136,"../util/timeout":146,"../util/twilio-video-errors":147,"./recording":62}],66:[function(require,module,exports){
11469
11674
  'use strict';
11470
11675
  var __extends = (this && this.__extends) || (function () {
11471
11676
  var extendStatics = function (d, b) {
@@ -11648,7 +11853,7 @@ var TrackSignaling = /** @class */ (function (_super) {
11648
11853
  */
11649
11854
  module.exports = TrackSignaling;
11650
11855
 
11651
- },{"events":173}],66:[function(require,module,exports){
11856
+ },{"events":173}],67:[function(require,module,exports){
11652
11857
  'use strict';
11653
11858
  var CancelablePromise = require('../../util/cancelablepromise');
11654
11859
  var DefaultPeerConnectionManager = require('./peerconnectionmanager');
@@ -11765,7 +11970,7 @@ function createCancelableRoomSignalingPromise(token, wsServer, localParticipant,
11765
11970
  }
11766
11971
  module.exports = createCancelableRoomSignalingPromise;
11767
11972
 
11768
- },{"../../util":131,"../../util/cancelablepromise":123,"../../util/twilio-video-errors":146,"./peerconnectionmanager":77,"./room":83,"./twilioconnectiontransport":86}],67:[function(require,module,exports){
11973
+ },{"../../util":132,"../../util/cancelablepromise":124,"../../util/twilio-video-errors":147,"./peerconnectionmanager":78,"./room":84,"./twilioconnectiontransport":87}],68:[function(require,module,exports){
11769
11974
  'use strict';
11770
11975
  var __extends = (this && this.__extends) || (function () {
11771
11976
  var extendStatics = function (d, b) {
@@ -11843,7 +12048,7 @@ var DominantSpeakerSignaling = /** @class */ (function (_super) {
11843
12048
  */
11844
12049
  module.exports = DominantSpeakerSignaling;
11845
12050
 
11846
- },{"./mediasignaling":73}],68:[function(require,module,exports){
12051
+ },{"./mediasignaling":74}],69:[function(require,module,exports){
11847
12052
  'use strict';
11848
12053
  var Filter = require('../../util/filter');
11849
12054
  /**
@@ -11911,7 +12116,7 @@ var IceBox = /** @class */ (function () {
11911
12116
  }());
11912
12117
  module.exports = IceBox;
11913
12118
 
11914
- },{"../../util/filter":130}],69:[function(require,module,exports){
12119
+ },{"../../util/filter":131}],70:[function(require,module,exports){
11915
12120
  'use strict';
11916
12121
  var _a = require('../../util/constants'), ICE_ACTIVITY_CHECK_PERIOD_MS = _a.ICE_ACTIVITY_CHECK_PERIOD_MS, ICE_INACTIVITY_THRESHOLD_MS = _a.ICE_INACTIVITY_THRESHOLD_MS;
11917
12122
  /**
@@ -12044,7 +12249,7 @@ var IceConnectionMonitor = /** @class */ (function () {
12044
12249
  }());
12045
12250
  module.exports = IceConnectionMonitor;
12046
12251
 
12047
- },{"../../util/constants":124}],70:[function(require,module,exports){
12252
+ },{"../../util/constants":125}],71:[function(require,module,exports){
12048
12253
  'use strict';
12049
12254
  var __extends = (this && this.__extends) || (function () {
12050
12255
  var extendStatics = function (d, b) {
@@ -12109,7 +12314,7 @@ var SignalingV2 = /** @class */ (function (_super) {
12109
12314
  }(Signaling));
12110
12315
  module.exports = SignalingV2;
12111
12316
 
12112
- },{"../":57,"./cancelableroomsignalingpromise":66,"./localparticipant":71}],71:[function(require,module,exports){
12317
+ },{"../":58,"./cancelableroomsignalingpromise":67,"./localparticipant":72}],72:[function(require,module,exports){
12113
12318
  'use strict';
12114
12319
  var __extends = (this && this.__extends) || (function () {
12115
12320
  var extendStatics = function (d, b) {
@@ -12449,7 +12654,7 @@ var LocalParticipantV2 = /** @class */ (function (_super) {
12449
12654
  */
12450
12655
  module.exports = LocalParticipantV2;
12451
12656
 
12452
- },{"../../util":131,"../../util/constants":124,"../../util/log":135,"../localparticipant":58,"./localtrackpublication":72}],72:[function(require,module,exports){
12657
+ },{"../../util":132,"../../util/constants":125,"../../util/log":136,"../localparticipant":59,"./localtrackpublication":73}],73:[function(require,module,exports){
12453
12658
  'use strict';
12454
12659
  var __extends = (this && this.__extends) || (function () {
12455
12660
  var extendStatics = function (d, b) {
@@ -12576,7 +12781,7 @@ var LocalTrackPublicationV2 = /** @class */ (function (_super) {
12576
12781
  */
12577
12782
  module.exports = LocalTrackPublicationV2;
12578
12783
 
12579
- },{"../../util/twilio-video-errors":146,"../../util/twiliowarning":148,"../localtrackpublication":59}],73:[function(require,module,exports){
12784
+ },{"../../util/twilio-video-errors":147,"../../util/twiliowarning":149,"../localtrackpublication":60}],74:[function(require,module,exports){
12580
12785
  /* eslint callback-return:0 */
12581
12786
  'use strict';
12582
12787
  var __extends = (this && this.__extends) || (function () {
@@ -12673,7 +12878,7 @@ var MediaSignaling = /** @class */ (function (_super) {
12673
12878
  }(EventEmitter));
12674
12879
  module.exports = MediaSignaling;
12675
12880
 
12676
- },{"events":173}],74:[function(require,module,exports){
12881
+ },{"events":173}],75:[function(require,module,exports){
12677
12882
  /* eslint callback-return:0 */
12678
12883
  'use strict';
12679
12884
  var __extends = (this && this.__extends) || (function () {
@@ -12832,7 +13037,7 @@ function next(monitor) {
12832
13037
  */
12833
13038
  module.exports = NetworkQualityMonitor;
12834
13039
 
12835
- },{"../../stats/peerconnectionreportfactory":105,"events":173}],75:[function(require,module,exports){
13040
+ },{"../../stats/peerconnectionreportfactory":106,"events":173}],76:[function(require,module,exports){
12836
13041
  'use strict';
12837
13042
  var __extends = (this && this.__extends) || (function () {
12838
13043
  var extendStatics = function (d, b) {
@@ -13097,7 +13302,7 @@ function createNetworkQualityInputsMessage(networkQualityInputs, networkQualityR
13097
13302
  }
13098
13303
  module.exports = NetworkQualitySignaling;
13099
13304
 
13100
- },{"../../util/asyncvar":120,"../../util/timeout":145,"./mediasignaling":73}],76:[function(require,module,exports){
13305
+ },{"../../util/asyncvar":121,"../../util/timeout":146,"./mediasignaling":74}],77:[function(require,module,exports){
13101
13306
  'use strict';
13102
13307
  var __extends = (this && this.__extends) || (function () {
13103
13308
  var extendStatics = function (d, b) {
@@ -14957,7 +15162,7 @@ function setMaxBitrate(params, maxBitrate) {
14957
15162
  }
14958
15163
  module.exports = PeerConnectionV2;
14959
15164
 
14960
- },{"../../data/receiver":5,"../../media/track/receiver":29,"../../statemachine":87,"../../util":131,"../../util/backoff":121,"../../util/constants":124,"../../util/log":135,"../../util/sdp":139,"../../util/sdp/issue8329":140,"../../util/sdp/trackmatcher":142,"../../util/timeout":145,"../../util/twilio-video-errors":146,"../../webrtc":157,"../../webrtc/util":170,"./icebox":68,"./iceconnectionmonitor.js":69}],77:[function(require,module,exports){
15165
+ },{"../../data/receiver":5,"../../media/track/receiver":30,"../../statemachine":88,"../../util":132,"../../util/backoff":122,"../../util/constants":125,"../../util/log":136,"../../util/sdp":140,"../../util/sdp/issue8329":141,"../../util/sdp/trackmatcher":143,"../../util/timeout":146,"../../util/twilio-video-errors":147,"../../webrtc":158,"../../webrtc/util":170,"./icebox":69,"./iceconnectionmonitor.js":70}],78:[function(require,module,exports){
14961
15166
  'use strict';
14962
15167
  var __extends = (this && this.__extends) || (function () {
14963
15168
  var extendStatics = function (d, b) {
@@ -15525,7 +15730,7 @@ function updateConnectionState(pcm) {
15525
15730
  }
15526
15731
  module.exports = PeerConnectionManager;
15527
15732
 
15528
- },{"../../media/track/sender":38,"../../queueingeventemitter":54,"../../util":131,"../../util/twilio-video-errors":146,"../../webaudio/audiocontext":152,"../../webrtc/util":170,"./peerconnection":76}],78:[function(require,module,exports){
15733
+ },{"../../media/track/sender":39,"../../queueingeventemitter":55,"../../util":132,"../../util/twilio-video-errors":147,"../../webaudio/audiocontext":153,"../../webrtc/util":170,"./peerconnection":77}],79:[function(require,module,exports){
15529
15734
  /* eslint callback-return:0 */
15530
15735
  'use strict';
15531
15736
  var __extends = (this && this.__extends) || (function () {
@@ -15611,7 +15816,7 @@ var PublisherHintsSignaling = /** @class */ (function (_super) {
15611
15816
  }(MediaSignaling));
15612
15817
  module.exports = PublisherHintsSignaling;
15613
15818
 
15614
- },{"./mediasignaling":73}],79:[function(require,module,exports){
15819
+ },{"./mediasignaling":74}],80:[function(require,module,exports){
15615
15820
  'use strict';
15616
15821
  var __extends = (this && this.__extends) || (function () {
15617
15822
  var extendStatics = function (d, b) {
@@ -15671,7 +15876,7 @@ var RecordingV2 = /** @class */ (function (_super) {
15671
15876
  */
15672
15877
  module.exports = RecordingV2;
15673
15878
 
15674
- },{"../recording":61}],80:[function(require,module,exports){
15879
+ },{"../recording":62}],81:[function(require,module,exports){
15675
15880
  'use strict';
15676
15881
  var __extends = (this && this.__extends) || (function () {
15677
15882
  var extendStatics = function (d, b) {
@@ -15791,7 +15996,7 @@ var RemoteParticipantV2 = /** @class */ (function (_super) {
15791
15996
  }(RemoteParticipantSignaling));
15792
15997
  module.exports = RemoteParticipantV2;
15793
15998
 
15794
- },{"../remoteparticipant":62,"./remotetrackpublication":81}],81:[function(require,module,exports){
15999
+ },{"../remoteparticipant":63,"./remotetrackpublication":82}],82:[function(require,module,exports){
15795
16000
  'use strict';
15796
16001
  var __extends = (this && this.__extends) || (function () {
15797
16002
  var extendStatics = function (d, b) {
@@ -15845,7 +16050,7 @@ var RemoteTrackPublicationV2 = /** @class */ (function (_super) {
15845
16050
  */
15846
16051
  module.exports = RemoteTrackPublicationV2;
15847
16052
 
15848
- },{"../remotetrackpublication":63}],82:[function(require,module,exports){
16053
+ },{"../remotetrackpublication":64}],83:[function(require,module,exports){
15849
16054
  /* eslint callback-return:0 */
15850
16055
  'use strict';
15851
16056
  var __extends = (this && this.__extends) || (function () {
@@ -15996,7 +16201,7 @@ var RenderHintsSignaling = /** @class */ (function (_super) {
15996
16201
  }(MediaSignaling));
15997
16202
  module.exports = RenderHintsSignaling;
15998
16203
 
15999
- },{"../../util":131,"../../util/timeout":145,"./mediasignaling":73}],83:[function(require,module,exports){
16204
+ },{"../../util":132,"../../util/timeout":146,"./mediasignaling":74}],84:[function(require,module,exports){
16000
16205
  /* eslint-disable no-console */
16001
16206
  'use strict';
16002
16207
  var __extends = (this && this.__extends) || (function () {
@@ -16854,7 +17059,7 @@ function replaceNullsWithDefaults(activeIceCandidatePair, peerConnectionId) {
16854
17059
  }
16855
17060
  module.exports = RoomV2;
16856
17061
 
16857
- },{"../../stats/statsreport":115,"../../util":131,"../../util/movingaveragedelta":136,"../../util/twilio-video-errors":146,"../room":64,"./dominantspeakersignaling":67,"./networkqualitymonitor":74,"./networkqualitysignaling":75,"./publisherhintsignaling.js":78,"./recording":79,"./remoteparticipant":80,"./renderhintssignaling":82,"./trackprioritysignaling":84,"./trackswitchoffsignaling":85}],84:[function(require,module,exports){
17062
+ },{"../../stats/statsreport":116,"../../util":132,"../../util/movingaveragedelta":137,"../../util/twilio-video-errors":147,"../room":65,"./dominantspeakersignaling":68,"./networkqualitymonitor":75,"./networkqualitysignaling":76,"./publisherhintsignaling.js":79,"./recording":80,"./remoteparticipant":81,"./renderhintssignaling":83,"./trackprioritysignaling":85,"./trackswitchoffsignaling":86}],85:[function(require,module,exports){
16858
17063
  'use strict';
16859
17064
  var __extends = (this && this.__extends) || (function () {
16860
17065
  var extendStatics = function (d, b) {
@@ -16920,7 +17125,7 @@ var TrackPrioritySignaling = /** @class */ (function (_super) {
16920
17125
  }(MediaSignaling));
16921
17126
  module.exports = TrackPrioritySignaling;
16922
17127
 
16923
- },{"./mediasignaling":73}],85:[function(require,module,exports){
17128
+ },{"./mediasignaling":74}],86:[function(require,module,exports){
16924
17129
  'use strict';
16925
17130
  var __extends = (this && this.__extends) || (function () {
16926
17131
  var extendStatics = function (d, b) {
@@ -16978,7 +17183,7 @@ var TrackSwitchOffSignaling = /** @class */ (function (_super) {
16978
17183
  */
16979
17184
  module.exports = TrackSwitchOffSignaling;
16980
17185
 
16981
- },{"./mediasignaling":73}],86:[function(require,module,exports){
17186
+ },{"./mediasignaling":74}],87:[function(require,module,exports){
16982
17187
  'use strict';
16983
17188
  var __extends = (this && this.__extends) || (function () {
16984
17189
  var extendStatics = function (d, b) {
@@ -17565,7 +17770,7 @@ function setupTransport(transport) {
17565
17770
  }
17566
17771
  module.exports = TwilioConnectionTransport;
17567
17772
 
17568
- },{"../../statemachine":87,"../../twilioconnection":119,"../../util":131,"../../util/backoff":121,"../../util/constants":124,"../../util/timeout":145,"../../util/twilio-video-errors":146}],87:[function(require,module,exports){
17773
+ },{"../../statemachine":88,"../../twilioconnection":120,"../../util":132,"../../util/backoff":122,"../../util/constants":125,"../../util/timeout":146,"../../util/twilio-video-errors":147}],88:[function(require,module,exports){
17569
17774
  'use strict';
17570
17775
  var __extends = (this && this.__extends) || (function () {
17571
17776
  var extendStatics = function (d, b) {
@@ -18011,7 +18216,7 @@ function createUnreachableError(here, there) {
18011
18216
  }
18012
18217
  module.exports = StateMachine;
18013
18218
 
18014
- },{"./util":131,"events":173}],88:[function(require,module,exports){
18219
+ },{"./util":132,"events":173}],89:[function(require,module,exports){
18015
18220
  /* eslint no-undefined:0 */
18016
18221
  'use strict';
18017
18222
  /**
@@ -18024,7 +18229,7 @@ function average(xs) {
18024
18229
  }
18025
18230
  module.exports = average;
18026
18231
 
18027
- },{}],89:[function(require,module,exports){
18232
+ },{}],90:[function(require,module,exports){
18028
18233
  'use strict';
18029
18234
  /**
18030
18235
  * @property {number} [availableSend] - bps (undefined in Firefox)
@@ -18082,7 +18287,7 @@ var IceReport = /** @class */ (function () {
18082
18287
  }());
18083
18288
  module.exports = IceReport;
18084
18289
 
18085
- },{}],90:[function(require,module,exports){
18290
+ },{}],91:[function(require,module,exports){
18086
18291
  'use strict';
18087
18292
  var IceReport = require('./icereport');
18088
18293
  /**
@@ -18127,7 +18332,7 @@ var IceReportFactory = /** @class */ (function () {
18127
18332
  }());
18128
18333
  module.exports = IceReportFactory;
18129
18334
 
18130
- },{"./icereport":89}],91:[function(require,module,exports){
18335
+ },{"./icereport":90}],92:[function(require,module,exports){
18131
18336
  'use strict';
18132
18337
  var __extends = (this && this.__extends) || (function () {
18133
18338
  var extendStatics = function (d, b) {
@@ -18185,7 +18390,7 @@ var LocalAudioTrackStats = /** @class */ (function (_super) {
18185
18390
  */
18186
18391
  module.exports = LocalAudioTrackStats;
18187
18392
 
18188
- },{"./localtrackstats":92}],92:[function(require,module,exports){
18393
+ },{"./localtrackstats":93}],93:[function(require,module,exports){
18189
18394
  'use strict';
18190
18395
  var __extends = (this && this.__extends) || (function () {
18191
18396
  var extendStatics = function (d, b) {
@@ -18245,7 +18450,7 @@ var LocalTrackStats = /** @class */ (function (_super) {
18245
18450
  }(TrackStats));
18246
18451
  module.exports = LocalTrackStats;
18247
18452
 
18248
- },{"./trackstats":117}],93:[function(require,module,exports){
18453
+ },{"./trackstats":118}],94:[function(require,module,exports){
18249
18454
  'use strict';
18250
18455
  var __extends = (this && this.__extends) || (function () {
18251
18456
  var extendStatics = function (d, b) {
@@ -18338,7 +18543,7 @@ var LocalVideoTrackStats = /** @class */ (function (_super) {
18338
18543
  }(LocalTrackStats));
18339
18544
  module.exports = LocalVideoTrackStats;
18340
18545
 
18341
- },{"./localtrackstats":92}],94:[function(require,module,exports){
18546
+ },{"./localtrackstats":93}],95:[function(require,module,exports){
18342
18547
  'use strict';
18343
18548
  var __extends = (this && this.__extends) || (function () {
18344
18549
  var extendStatics = function (d, b) {
@@ -18372,7 +18577,7 @@ var NetworkQualityAudioStats = /** @class */ (function (_super) {
18372
18577
  }(NetworkQualityMediaStats));
18373
18578
  module.exports = NetworkQualityAudioStats;
18374
18579
 
18375
- },{"./networkqualitymediastats":98}],95:[function(require,module,exports){
18580
+ },{"./networkqualitymediastats":99}],96:[function(require,module,exports){
18376
18581
  'use strict';
18377
18582
  /**
18378
18583
  * Bandwidth network quality statistics.
@@ -18406,7 +18611,7 @@ var NetworkQualityBandwidthStats = /** @class */ (function () {
18406
18611
  }());
18407
18612
  module.exports = NetworkQualityBandwidthStats;
18408
18613
 
18409
- },{}],96:[function(require,module,exports){
18614
+ },{}],97:[function(require,module,exports){
18410
18615
  'use strict';
18411
18616
  /**
18412
18617
  * Fraction lost network quality statistics.
@@ -18435,7 +18640,7 @@ var NetworkQualityFractionLostStats = /** @class */ (function () {
18435
18640
  }());
18436
18641
  module.exports = NetworkQualityFractionLostStats;
18437
18642
 
18438
- },{}],97:[function(require,module,exports){
18643
+ },{}],98:[function(require,module,exports){
18439
18644
  'use strict';
18440
18645
  /**
18441
18646
  * Latency network quality statistics.
@@ -18469,7 +18674,7 @@ var NetworkQualityLatencyStats = /** @class */ (function () {
18469
18674
  }());
18470
18675
  module.exports = NetworkQualityLatencyStats;
18471
18676
 
18472
- },{}],98:[function(require,module,exports){
18677
+ },{}],99:[function(require,module,exports){
18473
18678
  'use strict';
18474
18679
  var NetworkQualitySendStats = require('./networkqualitysendstats');
18475
18680
  var NetworkQualityRecvStats = require('./networkqualityrecvstats');
@@ -18516,7 +18721,7 @@ var NetworkQualityMediaStats = /** @class */ (function () {
18516
18721
  }());
18517
18722
  module.exports = NetworkQualityMediaStats;
18518
18723
 
18519
- },{"./networkqualityrecvstats":99,"./networkqualitysendstats":101}],99:[function(require,module,exports){
18724
+ },{"./networkqualityrecvstats":100,"./networkqualitysendstats":102}],100:[function(require,module,exports){
18520
18725
  'use strict';
18521
18726
  var __extends = (this && this.__extends) || (function () {
18522
18727
  var extendStatics = function (d, b) {
@@ -18551,7 +18756,7 @@ var NetworkQualityRecvStats = /** @class */ (function (_super) {
18551
18756
  }(NetworkQualitySendOrRecvStats));
18552
18757
  module.exports = NetworkQualityRecvStats;
18553
18758
 
18554
- },{"./networkqualitysendorrecvstats":100}],100:[function(require,module,exports){
18759
+ },{"./networkqualitysendorrecvstats":101}],101:[function(require,module,exports){
18555
18760
  'use strict';
18556
18761
  var NetworkQualityBandwidthStats = require('./networkqualitybandwidthstats');
18557
18762
  var NetworkQualityFractionLostStats = require('./networkqualityfractionloststats');
@@ -18591,7 +18796,7 @@ var NetworkQualitySendOrRecvStats = /** @class */ (function () {
18591
18796
  }());
18592
18797
  module.exports = NetworkQualitySendOrRecvStats;
18593
18798
 
18594
- },{"./networkqualitybandwidthstats":95,"./networkqualityfractionloststats":96,"./networkqualitylatencystats":97}],101:[function(require,module,exports){
18799
+ },{"./networkqualitybandwidthstats":96,"./networkqualityfractionloststats":97,"./networkqualitylatencystats":98}],102:[function(require,module,exports){
18595
18800
  'use strict';
18596
18801
  var __extends = (this && this.__extends) || (function () {
18597
18802
  var extendStatics = function (d, b) {
@@ -18626,7 +18831,7 @@ var NetworkQualitySendStats = /** @class */ (function (_super) {
18626
18831
  }(NetworkQualitySendOrRecvStats));
18627
18832
  module.exports = NetworkQualitySendStats;
18628
18833
 
18629
- },{"./networkqualitysendorrecvstats":100}],102:[function(require,module,exports){
18834
+ },{"./networkqualitysendorrecvstats":101}],103:[function(require,module,exports){
18630
18835
  'use strict';
18631
18836
  var NetworkQualityAudioStats = require('./networkqualityaudiostats');
18632
18837
  var NetworkQualityVideoStats = require('./networkqualityvideostats');
@@ -18666,7 +18871,7 @@ var NetworkQualityStats = /** @class */ (function () {
18666
18871
  }());
18667
18872
  module.exports = NetworkQualityStats;
18668
18873
 
18669
- },{"./networkqualityaudiostats":94,"./networkqualityvideostats":103}],103:[function(require,module,exports){
18874
+ },{"./networkqualityaudiostats":95,"./networkqualityvideostats":104}],104:[function(require,module,exports){
18670
18875
  'use strict';
18671
18876
  var __extends = (this && this.__extends) || (function () {
18672
18877
  var extendStatics = function (d, b) {
@@ -18700,7 +18905,7 @@ var NetworkQualityVideoStats = /** @class */ (function (_super) {
18700
18905
  }(NetworkQualityMediaStats));
18701
18906
  module.exports = NetworkQualityVideoStats;
18702
18907
 
18703
- },{"./networkqualitymediastats":98}],104:[function(require,module,exports){
18908
+ },{"./networkqualitymediastats":99}],105:[function(require,module,exports){
18704
18909
  'use strict';
18705
18910
  var ReceiverReport = require('./receiverreport');
18706
18911
  var SenderReport = require('./senderreport');
@@ -18778,7 +18983,7 @@ var PeerConnectionReport = /** @class */ (function () {
18778
18983
  }());
18779
18984
  module.exports = PeerConnectionReport;
18780
18985
 
18781
- },{"./receiverreport":106,"./senderreport":113}],105:[function(require,module,exports){
18986
+ },{"./receiverreport":107,"./senderreport":114}],106:[function(require,module,exports){
18782
18987
  'use strict';
18783
18988
  var __read = (this && this.__read) || function (o, n) {
18784
18989
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -19208,7 +19413,7 @@ function updateChrome(factory) {
19208
19413
  }
19209
19414
  module.exports = PeerConnectionReportFactory;
19210
19415
 
19211
- },{"../webrtc/util":170,"./icereportfactory":90,"./peerconnectionreport":104,"./receiverreportfactory":107,"./senderreportfactory":114}],106:[function(require,module,exports){
19416
+ },{"../webrtc/util":170,"./icereportfactory":91,"./peerconnectionreport":105,"./receiverreportfactory":108,"./senderreportfactory":115}],107:[function(require,module,exports){
19212
19417
  'use strict';
19213
19418
  var __extends = (this && this.__extends) || (function () {
19214
19419
  var extendStatics = function (d, b) {
@@ -19334,7 +19539,7 @@ var ReceiverReport = /** @class */ (function (_super) {
19334
19539
  }(SenderOrReceiverReport));
19335
19540
  module.exports = ReceiverReport;
19336
19541
 
19337
- },{"./average":88,"./senderorreceiverreport":111,"./sum":116}],107:[function(require,module,exports){
19542
+ },{"./average":89,"./senderorreceiverreport":112,"./sum":117}],108:[function(require,module,exports){
19338
19543
  'use strict';
19339
19544
  var __extends = (this && this.__extends) || (function () {
19340
19545
  var extendStatics = function (d, b) {
@@ -19393,7 +19598,7 @@ var ReceiverReportFactory = /** @class */ (function (_super) {
19393
19598
  }(SenderOrReceiverReportFactory));
19394
19599
  module.exports = ReceiverReportFactory;
19395
19600
 
19396
- },{"./receiverreport":106,"./senderorreceiverreportfactory":112}],108:[function(require,module,exports){
19601
+ },{"./receiverreport":107,"./senderorreceiverreportfactory":113}],109:[function(require,module,exports){
19397
19602
  'use strict';
19398
19603
  var __extends = (this && this.__extends) || (function () {
19399
19604
  var extendStatics = function (d, b) {
@@ -19445,7 +19650,7 @@ var RemoteAudioTrackStats = /** @class */ (function (_super) {
19445
19650
  }(RemoteTrackStats));
19446
19651
  module.exports = RemoteAudioTrackStats;
19447
19652
 
19448
- },{"./remotetrackstats":109}],109:[function(require,module,exports){
19653
+ },{"./remotetrackstats":110}],110:[function(require,module,exports){
19449
19654
  'use strict';
19450
19655
  var __extends = (this && this.__extends) || (function () {
19451
19656
  var extendStatics = function (d, b) {
@@ -19497,7 +19702,7 @@ var RemoteTrackStats = /** @class */ (function (_super) {
19497
19702
  }(TrackStats));
19498
19703
  module.exports = RemoteTrackStats;
19499
19704
 
19500
- },{"./trackstats":117}],110:[function(require,module,exports){
19705
+ },{"./trackstats":118}],111:[function(require,module,exports){
19501
19706
  'use strict';
19502
19707
  var __extends = (this && this.__extends) || (function () {
19503
19708
  var extendStatics = function (d, b) {
@@ -19562,7 +19767,7 @@ var RemoteVideoTrackStats = /** @class */ (function (_super) {
19562
19767
  }(RemoteTrackStats));
19563
19768
  module.exports = RemoteVideoTrackStats;
19564
19769
 
19565
- },{"./remotetrackstats":109}],111:[function(require,module,exports){
19770
+ },{"./remotetrackstats":110}],112:[function(require,module,exports){
19566
19771
  'use strict';
19567
19772
  /**
19568
19773
  * @property {StatsId} id
@@ -19596,7 +19801,7 @@ var SenderOrReceiverReport = /** @class */ (function () {
19596
19801
  }());
19597
19802
  module.exports = SenderOrReceiverReport;
19598
19803
 
19599
- },{}],112:[function(require,module,exports){
19804
+ },{}],113:[function(require,module,exports){
19600
19805
  'use strict';
19601
19806
  /**
19602
19807
  * @property {StatsId} id
@@ -19632,7 +19837,7 @@ var SenderOrReceiverReportFactory = /** @class */ (function () {
19632
19837
  }());
19633
19838
  module.exports = SenderOrReceiverReportFactory;
19634
19839
 
19635
- },{}],113:[function(require,module,exports){
19840
+ },{}],114:[function(require,module,exports){
19636
19841
  /* eslint no-undefined:0 */
19637
19842
  'use strict';
19638
19843
  var __extends = (this && this.__extends) || (function () {
@@ -19720,7 +19925,7 @@ var SenderReport = /** @class */ (function (_super) {
19720
19925
  }(SenderOrReceiverReport));
19721
19926
  module.exports = SenderReport;
19722
19927
 
19723
- },{"./average":88,"./senderorreceiverreport":111,"./sum":116}],114:[function(require,module,exports){
19928
+ },{"./average":89,"./senderorreceiverreport":112,"./sum":117}],115:[function(require,module,exports){
19724
19929
  'use strict';
19725
19930
  var __extends = (this && this.__extends) || (function () {
19726
19931
  var extendStatics = function (d, b) {
@@ -19779,7 +19984,7 @@ var SenderReportFactory = /** @class */ (function (_super) {
19779
19984
  }(SenderOrReceiverReportFactory));
19780
19985
  module.exports = SenderReportFactory;
19781
19986
 
19782
- },{"./senderorreceiverreportfactory":112,"./senderreport":113}],115:[function(require,module,exports){
19987
+ },{"./senderorreceiverreportfactory":113,"./senderreport":114}],116:[function(require,module,exports){
19783
19988
  'use strict';
19784
19989
  var LocalAudioTrackStats = require('./localaudiotrackstats');
19785
19990
  var LocalVideoTrackStats = require('./localvideotrackstats');
@@ -19830,7 +20035,7 @@ var StatsReport = /** @class */ (function () {
19830
20035
  }());
19831
20036
  module.exports = StatsReport;
19832
20037
 
19833
- },{"./localaudiotrackstats":91,"./localvideotrackstats":93,"./remoteaudiotrackstats":108,"./remotevideotrackstats":110}],116:[function(require,module,exports){
20038
+ },{"./localaudiotrackstats":92,"./localvideotrackstats":94,"./remoteaudiotrackstats":109,"./remotevideotrackstats":111}],117:[function(require,module,exports){
19834
20039
  'use strict';
19835
20040
  /**
19836
20041
  * @param {Array<number|undefined>} xs
@@ -19841,7 +20046,7 @@ function sum(xs) {
19841
20046
  }
19842
20047
  module.exports = sum;
19843
20048
 
19844
- },{}],117:[function(require,module,exports){
20049
+ },{}],118:[function(require,module,exports){
19845
20050
  'use strict';
19846
20051
  /**
19847
20052
  * Statistics for a {@link Track}.
@@ -19900,7 +20105,7 @@ var TrackStats = /** @class */ (function () {
19900
20105
  }());
19901
20106
  module.exports = TrackStats;
19902
20107
 
19903
- },{}],118:[function(require,module,exports){
20108
+ },{}],119:[function(require,module,exports){
19904
20109
  'use strict';
19905
20110
  var __extends = (this && this.__extends) || (function () {
19906
20111
  var extendStatics = function (d, b) {
@@ -19917,11 +20122,11 @@ var __extends = (this && this.__extends) || (function () {
19917
20122
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
19918
20123
  };
19919
20124
  })();
19920
- var EventEmitter = require('events').EventEmitter;
20125
+ var QueueingEventEmitter = require('./queueingeventemitter');
19921
20126
  /**
19922
20127
  * A {@link TrackTransceiver} represents either one or more local RTCRtpSenders
19923
20128
  * or RTCDataChannels, or a single RTCRtpReceiver or remote RTCDataChannel.
19924
- * @extends EventEmitter
20129
+ * @extends QueueingEventEmitter
19925
20130
  * @property {Track.ID} id
19926
20131
  * @property {Track.kind} kind
19927
20132
  */
@@ -19955,14 +20160,14 @@ var TrackTransceiver = /** @class */ (function (_super) {
19955
20160
  this.emit('stopped');
19956
20161
  };
19957
20162
  return TrackTransceiver;
19958
- }(EventEmitter));
20163
+ }(QueueingEventEmitter));
19959
20164
  /**
19960
20165
  * The {@link TrackTransceiver} was stopped.
19961
20166
  * @event TrackTransceiver#stopped
19962
20167
  */
19963
20168
  module.exports = TrackTransceiver;
19964
20169
 
19965
- },{"events":173}],119:[function(require,module,exports){
20170
+ },{"./queueingeventemitter":55}],120:[function(require,module,exports){
19966
20171
  'use strict';
19967
20172
  var __extends = (this && this.__extends) || (function () {
19968
20173
  var extendStatics = function (d, b) {
@@ -20615,7 +20820,7 @@ TwilioConnection.CloseReason = CloseReason;
20615
20820
  */
20616
20821
  module.exports = TwilioConnection;
20617
20822
 
20618
- },{"./statemachine":87,"./util":131,"./util/log":135,"./util/networkmonitor":137,"./util/timeout":145,"ws":175}],120:[function(require,module,exports){
20823
+ },{"./statemachine":88,"./util":132,"./util/log":136,"./util/networkmonitor":138,"./util/timeout":146,"ws":175}],121:[function(require,module,exports){
20619
20824
  'use strict';
20620
20825
  var defer = require('./').defer;
20621
20826
  /**
@@ -20680,7 +20885,7 @@ var AsyncVar = /** @class */ (function () {
20680
20885
  }());
20681
20886
  module.exports = AsyncVar;
20682
20887
 
20683
- },{"./":131}],121:[function(require,module,exports){
20888
+ },{"./":132}],122:[function(require,module,exports){
20684
20889
  /**
20685
20890
  * Expose `Backoff`.
20686
20891
  */
@@ -20764,7 +20969,7 @@ var Backoff = /** @class */ (function () {
20764
20969
  }());
20765
20970
  module.exports = Backoff;
20766
20971
 
20767
- },{}],122:[function(require,module,exports){
20972
+ },{}],123:[function(require,module,exports){
20768
20973
  /* globals chrome, navigator */
20769
20974
  'use strict';
20770
20975
  var __read = (this && this.__read) || function (o, n) {
@@ -20922,7 +21127,7 @@ module.exports = {
20922
21127
  rebrandedChromeBrowser: rebrandedChromeBrowser
20923
21128
  };
20924
21129
 
20925
- },{}],123:[function(require,module,exports){
21130
+ },{}],124:[function(require,module,exports){
20926
21131
  'use strict';
20927
21132
  var __read = (this && this.__read) || function (o, n) {
20928
21133
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -21065,7 +21270,7 @@ var CancelablePromise = /** @class */ (function () {
21065
21270
  }());
21066
21271
  module.exports = CancelablePromise;
21067
21272
 
21068
- },{}],124:[function(require,module,exports){
21273
+ },{}],125:[function(require,module,exports){
21069
21274
  'use strict';
21070
21275
  /* eslint-disable camelcase */
21071
21276
  var packageInfo = require('../../package.json');
@@ -21167,7 +21372,7 @@ module.exports.videoContentPreferencesMode = {
21167
21372
  MODE_MANUAL: 'manual'
21168
21373
  };
21169
21374
 
21170
- },{"../../package.json":174}],125:[function(require,module,exports){
21375
+ },{"../../package.json":174}],126:[function(require,module,exports){
21171
21376
  'use strict';
21172
21377
  var detectSilence = require('../webaudio/detectsilence');
21173
21378
  var N_ATTEMPTS = 3;
@@ -21208,7 +21413,7 @@ function detectSilentAudio(el) {
21208
21413
  }
21209
21414
  module.exports = detectSilentAudio;
21210
21415
 
21211
- },{"../webaudio/audiocontext":152,"../webaudio/detectsilence":153}],126:[function(require,module,exports){
21416
+ },{"../webaudio/audiocontext":153,"../webaudio/detectsilence":154}],127:[function(require,module,exports){
21212
21417
  'use strict';
21213
21418
  // Cached copy of the <canvas> used to check silent video frames.
21214
21419
  var canvas = null;
@@ -21267,7 +21472,7 @@ function detectSilentVideo(el) {
21267
21472
  }
21268
21473
  module.exports = detectSilentVideo;
21269
21474
 
21270
- },{}],127:[function(require,module,exports){
21475
+ },{}],128:[function(require,module,exports){
21271
21476
  'use strict';
21272
21477
  /**
21273
21478
  * The {@link DocumentVisibilityMonitor} monitors the visibility state of the DOM
@@ -21389,7 +21594,7 @@ var DocumentVisibilityMonitor = /** @class */ (function () {
21389
21594
  }());
21390
21595
  module.exports = new DocumentVisibilityMonitor(2);
21391
21596
 
21392
- },{}],128:[function(require,module,exports){
21597
+ },{}],129:[function(require,module,exports){
21393
21598
  'use strict';
21394
21599
  module.exports = (function (scope) {
21395
21600
  var location = scope.location, URL = scope.URL;
@@ -21412,7 +21617,7 @@ module.exports = (function (scope) {
21412
21617
  };
21413
21618
  }(globalThis));
21414
21619
 
21415
- },{}],129:[function(require,module,exports){
21620
+ },{}],130:[function(require,module,exports){
21416
21621
  /* eslint-disable no-console */
21417
21622
  'use strict';
21418
21623
  var __extends = (this && this.__extends) || (function () {
@@ -21510,7 +21715,7 @@ var EventObserver = /** @class */ (function (_super) {
21510
21715
  */
21511
21716
  module.exports = EventObserver;
21512
21717
 
21513
- },{"events":173}],130:[function(require,module,exports){
21718
+ },{"events":173}],131:[function(require,module,exports){
21514
21719
  'use strict';
21515
21720
  var Filter = /** @class */ (function () {
21516
21721
  function Filter(options) {
@@ -21554,7 +21759,7 @@ var Filter = /** @class */ (function () {
21554
21759
  }());
21555
21760
  module.exports = Filter;
21556
21761
 
21557
- },{}],131:[function(require,module,exports){
21762
+ },{}],132:[function(require,module,exports){
21558
21763
  'use strict';
21559
21764
  var __extends = (this && this.__extends) || (function () {
21560
21765
  var extendStatics = function (d, b) {
@@ -22451,7 +22656,7 @@ exports.isUserMediaTrack = isUserMediaTrack;
22451
22656
  exports.waitForSometime = waitForSometime;
22452
22657
  exports.waitForEvent = waitForEvent;
22453
22658
 
22454
- },{"../webrtc/util":170,"./constants":124,"./sid":143,"./twiliowarning":148}],132:[function(require,module,exports){
22659
+ },{"../webrtc/util":170,"./constants":125,"./sid":144,"./twiliowarning":149}],133:[function(require,module,exports){
22455
22660
  /* eslint-disable camelcase */
22456
22661
  'use strict';
22457
22662
  var __extends = (this && this.__extends) || (function () {
@@ -22746,7 +22951,7 @@ function reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSi
22746
22951
  */
22747
22952
  module.exports = InsightsPublisher;
22748
22953
 
22749
- },{"..":131,"../../util":131,"../browserdetection":122,"../constants":124,"events":173,"ws":175}],133:[function(require,module,exports){
22954
+ },{"..":132,"../../util":132,"../browserdetection":123,"../constants":125,"events":173,"ws":175}],134:[function(require,module,exports){
22750
22955
  // eslint-disable-next-line no-warning-comments
22751
22956
  // TODO(mroberts): This should be described as implementing some
22752
22957
  // InsightsPublisher interface.
@@ -22791,7 +22996,7 @@ var InsightsPublisher = /** @class */ (function () {
22791
22996
  }());
22792
22997
  module.exports = InsightsPublisher;
22793
22998
 
22794
- },{}],134:[function(require,module,exports){
22999
+ },{}],135:[function(require,module,exports){
22795
23000
  'use strict';
22796
23001
  var defer = require('./').defer;
22797
23002
  /**
@@ -22853,7 +23058,7 @@ var LocalMediaRestartDeferreds = /** @class */ (function () {
22853
23058
  }());
22854
23059
  module.exports = new LocalMediaRestartDeferreds();
22855
23060
 
22856
- },{"./":131}],135:[function(require,module,exports){
23061
+ },{"./":132}],136:[function(require,module,exports){
22857
23062
  /* eslint new-cap:0 */
22858
23063
  'use strict';
22859
23064
  var __read = (this && this.__read) || function (o, n) {
@@ -23140,7 +23345,7 @@ function validateLogLevels(levels) {
23140
23345
  }
23141
23346
  module.exports = Log;
23142
23347
 
23143
- },{"../vendor/loglevel":151,"./constants":124}],136:[function(require,module,exports){
23348
+ },{"../vendor/loglevel":152,"./constants":125}],137:[function(require,module,exports){
23144
23349
  'use strict';
23145
23350
  /**
23146
23351
  * Calculates the moving average delta for the given pair ofsamples. A sample (S)
@@ -23187,7 +23392,7 @@ var MovingAverageDelta = /** @class */ (function () {
23187
23392
  }());
23188
23393
  module.exports = MovingAverageDelta;
23189
23394
 
23190
- },{}],137:[function(require,module,exports){
23395
+ },{}],138:[function(require,module,exports){
23191
23396
  'use strict';
23192
23397
  /**
23193
23398
  * Monitor the network connection status to detect interruptions and handoffs.
@@ -23276,7 +23481,7 @@ var NetworkMonitor = /** @class */ (function () {
23276
23481
  }());
23277
23482
  module.exports = NetworkMonitor;
23278
23483
 
23279
- },{}],138:[function(require,module,exports){
23484
+ },{}],139:[function(require,module,exports){
23280
23485
  /* eslint-disable no-console */
23281
23486
  'use strict';
23282
23487
  var __extends = (this && this.__extends) || (function () {
@@ -23339,7 +23544,7 @@ var NullResizeObserver = /** @class */ (function (_super) {
23339
23544
  }(NullObserver));
23340
23545
  module.exports = { NullIntersectionObserver: NullIntersectionObserver, NullResizeObserver: NullResizeObserver, NullObserver: NullObserver };
23341
23546
 
23342
- },{}],139:[function(require,module,exports){
23547
+ },{}],140:[function(require,module,exports){
23343
23548
  'use strict';
23344
23549
  var __read = (this && this.__read) || function (o, n) {
23345
23550
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -23877,7 +24082,7 @@ exports.revertSimulcast = revertSimulcast;
23877
24082
  exports.setCodecPreferences = setCodecPreferences;
23878
24083
  exports.setSimulcast = setSimulcast;
23879
24084
 
23880
- },{"../":131,"./simulcast":141}],140:[function(require,module,exports){
24085
+ },{"../":132,"./simulcast":142}],141:[function(require,module,exports){
23881
24086
  'use strict';
23882
24087
  var RTCSessionDescription = require('../../webrtc').RTCSessionDescription;
23883
24088
  var _a = require('./'), createPtToCodecName = _a.createPtToCodecName, getMediaSections = _a.getMediaSections;
@@ -24070,7 +24275,7 @@ function addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {
24070
24275
  }
24071
24276
  module.exports = workaround;
24072
24277
 
24073
- },{"../../webrtc":157,"./":139}],141:[function(require,module,exports){
24278
+ },{"../../webrtc":158,"./":140}],142:[function(require,module,exports){
24074
24279
  'use strict';
24075
24280
  var __read = (this && this.__read) || function (o, n) {
24076
24281
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -24333,7 +24538,7 @@ function setSimulcastInMediaSection(section, trackIdsToAttributes) {
24333
24538
  */
24334
24539
  module.exports = setSimulcastInMediaSection;
24335
24540
 
24336
- },{"../":131}],142:[function(require,module,exports){
24541
+ },{"../":132}],143:[function(require,module,exports){
24337
24542
  'use strict';
24338
24543
  var getMediaSections = require('./').getMediaSections;
24339
24544
  /**
@@ -24378,7 +24583,7 @@ var TrackMatcher = /** @class */ (function () {
24378
24583
  }());
24379
24584
  module.exports = TrackMatcher;
24380
24585
 
24381
- },{"./":139}],143:[function(require,module,exports){
24586
+ },{"./":140}],144:[function(require,module,exports){
24382
24587
  var SID_CHARS = '1234567890abcdef';
24383
24588
  var SID_CHAR_LENGTH = 32;
24384
24589
  // copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39
@@ -24397,7 +24602,7 @@ function createSID(prefix) {
24397
24602
  exports.sessionSID = createSID('SS');
24398
24603
  exports.createSID = createSID;
24399
24604
 
24400
- },{}],144:[function(require,module,exports){
24605
+ },{}],145:[function(require,module,exports){
24401
24606
  'use strict';
24402
24607
  var _a = require('../webrtc/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;
24403
24608
  var getSdpFormat = require('../webrtc/util/sdp').getSdpFormat;
@@ -24444,7 +24649,7 @@ function isSupported() {
24444
24649
  }
24445
24650
  module.exports = isSupported;
24446
24651
 
24447
- },{"../webrtc/util":170,"../webrtc/util/sdp":172,"./browserdetection":122}],145:[function(require,module,exports){
24652
+ },{"../webrtc/util":170,"../webrtc/util/sdp":172,"./browserdetection":123}],146:[function(require,module,exports){
24448
24653
  'use strict';
24449
24654
  /**
24450
24655
  * A {@link Timeout} represents a resettable and clearable timeout.
@@ -24539,7 +24744,7 @@ var Timeout = /** @class */ (function () {
24539
24744
  }());
24540
24745
  module.exports = Timeout;
24541
24746
 
24542
- },{}],146:[function(require,module,exports){
24747
+ },{}],147:[function(require,module,exports){
24543
24748
  // NOTE: Do not edit this file. This code is auto-generated. Contact the
24544
24749
  // Twilio SDK Team for more information.
24545
24750
  'use strict';
@@ -25563,7 +25768,7 @@ var ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {
25563
25768
  exports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;
25564
25769
  Object.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });
25565
25770
 
25566
- },{"./twilioerror":147}],147:[function(require,module,exports){
25771
+ },{"./twilioerror":148}],148:[function(require,module,exports){
25567
25772
  'use strict';
25568
25773
  var __extends = (this && this.__extends) || (function () {
25569
25774
  var extendStatics = function (d, b) {
@@ -25645,7 +25850,7 @@ var TwilioError = /** @class */ (function (_super) {
25645
25850
  }(Error));
25646
25851
  module.exports = TwilioError;
25647
25852
 
25648
- },{}],148:[function(require,module,exports){
25853
+ },{}],149:[function(require,module,exports){
25649
25854
  'use strict';
25650
25855
  /**
25651
25856
  * @private
@@ -25658,7 +25863,7 @@ var TwilioWarning = {
25658
25863
  };
25659
25864
  module.exports = TwilioWarning;
25660
25865
 
25661
- },{}],149:[function(require,module,exports){
25866
+ },{}],150:[function(require,module,exports){
25662
25867
  'use strict';
25663
25868
  var isNonArrayObject = require('./').isNonArrayObject;
25664
25869
  var _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;
@@ -25775,7 +25980,7 @@ exports.validateBandwidthProfile = validateBandwidthProfile;
25775
25980
  exports.validateLocalTrack = validateLocalTrack;
25776
25981
  exports.validateObject = validateObject;
25777
25982
 
25778
- },{"./":131,"./constants":124}],150:[function(require,module,exports){
25983
+ },{"./":132,"./constants":125}],151:[function(require,module,exports){
25779
25984
  /**
25780
25985
  * Copyright (c) 2011-2022 Isaac Z. Schlueter
25781
25986
  * Licensed under the ISC License.
@@ -25810,7 +26015,7 @@ module.exports = function inherits(ctor, superCtor) {
25810
26015
  }
25811
26016
  };
25812
26017
 
25813
- },{}],151:[function(require,module,exports){
26018
+ },{}],152:[function(require,module,exports){
25814
26019
  /**
25815
26020
  * Copyright (c) 2013 Tim Perry
25816
26021
  * Licensed under the MIT license.
@@ -26050,7 +26255,7 @@ defaultLogger.getLoggers = function getLoggers() {
26050
26255
  defaultLogger['default'] = defaultLogger;
26051
26256
  module.exports = defaultLogger;
26052
26257
 
26053
- },{}],152:[function(require,module,exports){
26258
+ },{}],153:[function(require,module,exports){
26054
26259
  /* globals webkitAudioContext, AudioContext */
26055
26260
  'use strict';
26056
26261
  var NativeAudioContext = typeof AudioContext !== 'undefined'
@@ -26133,7 +26338,7 @@ var AudioContextFactory = /** @class */ (function () {
26133
26338
  }());
26134
26339
  module.exports = new AudioContextFactory();
26135
26340
 
26136
- },{}],153:[function(require,module,exports){
26341
+ },{}],154:[function(require,module,exports){
26137
26342
  'use strict';
26138
26343
  /**
26139
26344
  * Return a Promise that resolves after `timeout` milliseconds.
@@ -26186,7 +26391,7 @@ function detectSilence(audioContext, stream, timeout) {
26186
26391
  }
26187
26392
  module.exports = detectSilence;
26188
26393
 
26189
- },{}],154:[function(require,module,exports){
26394
+ },{}],155:[function(require,module,exports){
26190
26395
  'use strict';
26191
26396
  var detectSilence = require('./detectsilence');
26192
26397
  /**
@@ -26256,11 +26461,25 @@ to get a new one, but we\'ve run out of retries; returning it anyway.');
26256
26461
  }
26257
26462
  module.exports = workaround;
26258
26463
 
26259
- },{"./audiocontext":152,"./detectsilence":153}],155:[function(require,module,exports){
26464
+ },{"./audiocontext":153,"./detectsilence":154}],156:[function(require,module,exports){
26260
26465
  'use strict';
26261
- var flatMap = require('./util').flatMap;
26262
- var guessBrowser = require('./util').guessBrowser;
26263
- var guessBrowserVersion = require('./util').guessBrowserVersion;
26466
+ var __read = (this && this.__read) || function (o, n) {
26467
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
26468
+ if (!m) return o;
26469
+ var i = m.call(o), r, ar = [], e;
26470
+ try {
26471
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
26472
+ }
26473
+ catch (error) { e = { error: error }; }
26474
+ finally {
26475
+ try {
26476
+ if (r && !r.done && (m = i["return"])) m.call(i);
26477
+ }
26478
+ finally { if (e) throw e.error; }
26479
+ }
26480
+ return ar;
26481
+ };
26482
+ var _a = require('./util'), flatMap = _a.flatMap, guessBrowser = _a.guessBrowser, guessBrowserVersion = _a.guessBrowserVersion;
26264
26483
  var getSdpFormat = require('./util/sdp').getSdpFormat;
26265
26484
  var guess = guessBrowser();
26266
26485
  var guessVersion = guessBrowserVersion();
@@ -26304,10 +26523,8 @@ function _getStats(peerConnection, options) {
26304
26523
  [localVideoTracks, 'localVideoTrackStats', false],
26305
26524
  [remoteAudioTracks, 'remoteAudioTrackStats', true],
26306
26525
  [remoteVideoTracks, 'remoteVideoTrackStats', true]
26307
- ], function (triple) {
26308
- var tracks = triple[0];
26309
- var statsArrayName = triple[1];
26310
- var isRemote = triple[2];
26526
+ ], function (_a) {
26527
+ var _b = __read(_a, 3), tracks = _b[0], statsArrayName = _b[1], isRemote = _b[2];
26311
26528
  return tracks.map(function (track) {
26312
26529
  return getTrackStats(peerConnection, track, Object.assign({
26313
26530
  isRemote: isRemote
@@ -26334,7 +26551,7 @@ function _getStats(peerConnection, options) {
26334
26551
  * @returns {Promise<StandardizedActiveIceCandidatePairStatsReport>}
26335
26552
  */
26336
26553
  function getActiveIceCandidatePairStats(peerConnection, options) {
26337
- options = options || {};
26554
+ if (options === void 0) { options = {}; }
26338
26555
  if (typeof options.testForChrome !== 'undefined' || isChrome
26339
26556
  || typeof options.testForSafari !== 'undefined' || isSafari) {
26340
26557
  return peerConnection.getStats().then(standardizeChromeOrSafariActiveIceCandidatePairStats);
@@ -26350,8 +26567,9 @@ function getActiveIceCandidatePairStats(peerConnection, options) {
26350
26567
  * @returns {?StandardizedActiveIceCandidatePairStatsReport}
26351
26568
  */
26352
26569
  function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26353
- var activeCandidatePairStats = Array.from(stats.values()).find(function (stat) {
26354
- return stat.type === 'candidate-pair' && stat.nominated;
26570
+ var activeCandidatePairStats = Array.from(stats.values()).find(function (_a) {
26571
+ var nominated = _a.nominated, type = _a.type;
26572
+ return type === 'candidate-pair' && nominated;
26355
26573
  });
26356
26574
  if (!activeCandidatePairStats) {
26357
26575
  return null;
@@ -26371,17 +26589,19 @@ function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26371
26589
  { key: 'relayProtocol', type: 'string' }
26372
26590
  ]);
26373
26591
  var standatdizedLocalCandidateStatsReport = activeLocalCandidateStats
26374
- ? standardizedLocalCandidateStatsKeys.reduce(function (report, keyInfo) {
26375
- report[keyInfo.key] = typeof activeLocalCandidateStats[keyInfo.key] === keyInfo.type
26376
- ? activeLocalCandidateStats[keyInfo.key]
26377
- : keyInfo.key === 'deleted' ? false : null;
26592
+ ? standardizedLocalCandidateStatsKeys.reduce(function (report, _a) {
26593
+ var key = _a.key, type = _a.type;
26594
+ report[key] = typeof activeLocalCandidateStats[key] === type
26595
+ ? activeLocalCandidateStats[key]
26596
+ : key === 'deleted' ? false : null;
26378
26597
  return report;
26379
26598
  }, {})
26380
26599
  : null;
26381
26600
  var standardizedRemoteCandidateStatsReport = activeRemoteCandidateStats
26382
- ? standardizedCandidateStatsKeys.reduce(function (report, keyInfo) {
26383
- report[keyInfo.key] = typeof activeRemoteCandidateStats[keyInfo.key] === keyInfo.type
26384
- ? activeRemoteCandidateStats[keyInfo.key]
26601
+ ? standardizedCandidateStatsKeys.reduce(function (report, _a) {
26602
+ var key = _a.key, type = _a.type;
26603
+ report[key] = typeof activeRemoteCandidateStats[key] === type
26604
+ ? activeRemoteCandidateStats[key]
26385
26605
  : null;
26386
26606
  return report;
26387
26607
  }, {})
@@ -26408,9 +26628,10 @@ function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26408
26628
  { key: 'totalRoundTripTime', type: 'number' },
26409
26629
  { key: 'transportId', type: 'string' },
26410
26630
  { key: 'writable', type: 'boolean' }
26411
- ].reduce(function (report, keyInfo) {
26412
- report[keyInfo.key] = typeof activeCandidatePairStats[keyInfo.key] === keyInfo.type
26413
- ? (keyInfo.fixup ? keyInfo.fixup(activeCandidatePairStats[keyInfo.key]) : activeCandidatePairStats[keyInfo.key])
26631
+ ].reduce(function (report, _a) {
26632
+ var key = _a.key, type = _a.type, fixup = _a.fixup;
26633
+ report[key] = typeof activeCandidatePairStats[key] === type
26634
+ ? (fixup ? fixup(activeCandidatePairStats[key]) : activeCandidatePairStats[key])
26414
26635
  : null;
26415
26636
  return report;
26416
26637
  }, {
@@ -26424,8 +26645,9 @@ function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26424
26645
  * @returns {?StandardizedActiveIceCandidatePairStatsReport}
26425
26646
  */
26426
26647
  function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26427
- var activeCandidatePairStats = Array.from(stats.values()).find(function (stat) {
26428
- return stat.type === 'candidate-pair' && stat.nominated;
26648
+ var activeCandidatePairStats = Array.from(stats.values()).find(function (_a) {
26649
+ var nominated = _a.nominated, type = _a.type;
26650
+ return type === 'candidate-pair' && nominated;
26429
26651
  });
26430
26652
  if (!activeCandidatePairStats) {
26431
26653
  return null;
@@ -26451,27 +26673,25 @@ function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26451
26673
  serverreflexive: 'srflx'
26452
26674
  };
26453
26675
  var standatdizedLocalCandidateStatsReport = activeLocalCandidateStats
26454
- ? standardizedLocalCandidateStatsKeys.reduce(function (report, keyInfo) {
26455
- var key = keyInfo.ffKeys && keyInfo.ffKeys.find(function (key) {
26456
- return key in activeLocalCandidateStats;
26457
- }) || keyInfo.key;
26458
- report[keyInfo.key] = typeof activeLocalCandidateStats[key] === keyInfo.type
26459
- ? key === 'candidateType'
26460
- ? candidateTypes[activeLocalCandidateStats[key]] || activeLocalCandidateStats[key]
26461
- : activeLocalCandidateStats[key]
26462
- : key === 'deleted' ? false : null;
26676
+ ? standardizedLocalCandidateStatsKeys.reduce(function (report, _a) {
26677
+ var ffKeys = _a.ffKeys, key = _a.key, type = _a.type;
26678
+ var localStatKey = ffKeys && ffKeys.find(function (key) { return key in activeLocalCandidateStats; }) || key;
26679
+ report[key] = typeof activeLocalCandidateStats[localStatKey] === type
26680
+ ? localStatKey === 'candidateType'
26681
+ ? candidateTypes[activeLocalCandidateStats[localStatKey]] || activeLocalCandidateStats[localStatKey]
26682
+ : activeLocalCandidateStats[localStatKey]
26683
+ : localStatKey === 'deleted' ? false : null;
26463
26684
  return report;
26464
26685
  }, {})
26465
26686
  : null;
26466
26687
  var standardizedRemoteCandidateStatsReport = activeRemoteCandidateStats
26467
- ? standardizedCandidateStatsKeys.reduce(function (report, keyInfo) {
26468
- var key = keyInfo.ffKeys && keyInfo.ffKeys.find(function (key) {
26469
- return key in activeRemoteCandidateStats;
26470
- }) || keyInfo.key;
26471
- report[keyInfo.key] = typeof activeRemoteCandidateStats[key] === keyInfo.type
26472
- ? key === 'candidateType'
26473
- ? candidateTypes[activeRemoteCandidateStats[key]] || activeRemoteCandidateStats[key]
26474
- : activeRemoteCandidateStats[key]
26688
+ ? standardizedCandidateStatsKeys.reduce(function (report, _a) {
26689
+ var ffKeys = _a.ffKeys, key = _a.key, type = _a.type;
26690
+ var remoteStatKey = ffKeys && ffKeys.find(function (key) { return key in activeRemoteCandidateStats; }) || key;
26691
+ report[key] = typeof activeRemoteCandidateStats[remoteStatKey] === type
26692
+ ? remoteStatKey === 'candidateType'
26693
+ ? candidateTypes[activeRemoteCandidateStats[remoteStatKey]] || activeRemoteCandidateStats[remoteStatKey]
26694
+ : activeRemoteCandidateStats[remoteStatKey]
26475
26695
  : null;
26476
26696
  return report;
26477
26697
  }, {})
@@ -26498,9 +26718,10 @@ function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26498
26718
  { key: 'totalRoundTripTime', type: 'number' },
26499
26719
  { key: 'transportId', type: 'string' },
26500
26720
  { key: 'writable', type: 'boolean' }
26501
- ].reduce(function (report, keyInfo) {
26502
- report[keyInfo.key] = typeof activeCandidatePairStats[keyInfo.key] === keyInfo.type
26503
- ? activeCandidatePairStats[keyInfo.key]
26721
+ ].reduce(function (report, _a) {
26722
+ var key = _a.key, type = _a.type;
26723
+ report[key] = typeof activeCandidatePairStats[key] === type
26724
+ ? activeCandidatePairStats[key]
26504
26725
  : null;
26505
26726
  return report;
26506
26727
  }, {
@@ -26518,17 +26739,16 @@ function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26518
26739
  function getTracks(peerConnection, kind, localOrRemote) {
26519
26740
  var getSendersOrReceivers = localOrRemote === 'local' ? 'getSenders' : 'getReceivers';
26520
26741
  if (peerConnection[getSendersOrReceivers]) {
26521
- return peerConnection[getSendersOrReceivers]().map(function (senderOrReceiver) {
26522
- return senderOrReceiver.track;
26523
- }).filter(function (track) {
26524
- return track && track.kind === kind;
26525
- });
26742
+ return peerConnection[getSendersOrReceivers]()
26743
+ .map(function (_a) {
26744
+ var track = _a.track;
26745
+ return track;
26746
+ })
26747
+ .filter(function (track) { return track && track.kind === kind; });
26526
26748
  }
26527
26749
  var getStreams = localOrRemote === 'local' ? 'getLocalStreams' : 'getRemoteStreams';
26528
- return flatMap(peerConnection[getStreams](), function (stream) {
26529
- var getTracks = kind === 'audio' ? 'getAudioTracks' : 'getVideoTracks';
26530
- return stream[getTracks]();
26531
- });
26750
+ var getTracks = kind === 'audio' ? 'getAudioTracks' : 'getVideoTracks';
26751
+ return flatMap(peerConnection[getStreams](), function (stream) { return stream[getTracks](); });
26532
26752
  }
26533
26753
  /**
26534
26754
  * Get the standardized statistics for a particular MediaStreamTrack.
@@ -26538,7 +26758,7 @@ function getTracks(peerConnection, kind, localOrRemote) {
26538
26758
  * @returns {Promise.<Array<StandardizedTrackStatsReport>>}
26539
26759
  */
26540
26760
  function getTrackStats(peerConnection, track, options) {
26541
- options = options || {};
26761
+ if (options === void 0) { options = {}; }
26542
26762
  if (typeof options.testForChrome !== 'undefined' || isChrome) {
26543
26763
  return chromeOrSafariGetTrackStats(peerConnection, track);
26544
26764
  }
@@ -26677,7 +26897,8 @@ function standardizeChromeOrSafariStats(response) {
26677
26897
  var codec = null;
26678
26898
  var localMedia = null;
26679
26899
  response.forEach(function (stat) {
26680
- switch (stat.type) {
26900
+ var type = stat.type;
26901
+ switch (type) {
26681
26902
  case 'inbound-rtp':
26682
26903
  inbound = stat;
26683
26904
  break;
@@ -26842,7 +27063,7 @@ function standardizeFirefoxStats(response, isRemote) {
26842
27063
  //
26843
27064
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1377225
26844
27065
  //
26845
- response = response || new Map();
27066
+ if (response === void 0) { response = new Map(); }
26846
27067
  var inbound = null;
26847
27068
  var outbound = null;
26848
27069
  // NOTE(mmalavalli): Starting from Firefox 63, RTC{Inbound, Outbound}RTPStreamStats.isRemote
@@ -26855,17 +27076,18 @@ function standardizeFirefoxStats(response, isRemote) {
26855
27076
  // Source: https://blog.mozilla.org/webrtc/getstats-isremote-65/
26856
27077
  //
26857
27078
  response.forEach(function (stat) {
26858
- if (stat.isRemote) {
27079
+ var isRemote = stat.isRemote, remoteId = stat.remoteId, type = stat.type;
27080
+ if (isRemote) {
26859
27081
  return;
26860
27082
  }
26861
- switch (stat.type) {
27083
+ switch (type) {
26862
27084
  case 'inbound-rtp':
26863
27085
  inbound = stat;
26864
- outbound = response.get(stat.remoteId);
27086
+ outbound = response.get(remoteId);
26865
27087
  break;
26866
27088
  case 'outbound-rtp':
26867
27089
  outbound = stat;
26868
- inbound = response.get(stat.remoteId);
27090
+ inbound = response.get(remoteId);
26869
27091
  break;
26870
27092
  }
26871
27093
  });
@@ -27050,7 +27272,7 @@ function standardizeFirefoxStats(response, isRemote) {
27050
27272
  */
27051
27273
  module.exports = getStats;
27052
27274
 
27053
- },{"./util":170,"./util/sdp":172}],156:[function(require,module,exports){
27275
+ },{"./util":170,"./util/sdp":172}],157:[function(require,module,exports){
27054
27276
  /* globals navigator */
27055
27277
  'use strict';
27056
27278
  /**
@@ -27064,17 +27286,17 @@ module.exports = getStats;
27064
27286
  * @returns Promise<MediaStream>
27065
27287
  */
27066
27288
  function getUserMedia(constraints) {
27289
+ if (constraints === void 0) { constraints = { audio: true, video: true }; }
27067
27290
  if (typeof navigator === 'object'
27068
27291
  && typeof navigator.mediaDevices === 'object'
27069
27292
  && typeof navigator.mediaDevices.getUserMedia === 'function') {
27070
- constraints = constraints || { audio: true, video: true };
27071
27293
  return navigator.mediaDevices.getUserMedia(constraints);
27072
27294
  }
27073
27295
  return Promise.reject(new Error('getUserMedia is not supported'));
27074
27296
  }
27075
27297
  module.exports = getUserMedia;
27076
27298
 
27077
- },{}],157:[function(require,module,exports){
27299
+ },{}],158:[function(require,module,exports){
27078
27300
  'use strict';
27079
27301
  var WebRTC = {};
27080
27302
  Object.defineProperties(WebRTC, {
@@ -27109,7 +27331,7 @@ Object.defineProperties(WebRTC, {
27109
27331
  });
27110
27332
  module.exports = WebRTC;
27111
27333
 
27112
- },{"./getstats":155,"./getusermedia":156,"./mediastream":158,"./mediastreamtrack":159,"./rtcicecandidate":160,"./rtcpeerconnection":163,"./rtcsessiondescription":168}],158:[function(require,module,exports){
27334
+ },{"./getstats":156,"./getusermedia":157,"./mediastream":159,"./mediastreamtrack":160,"./rtcicecandidate":161,"./rtcpeerconnection":164,"./rtcsessiondescription":169}],159:[function(require,module,exports){
27113
27335
  /* globals MediaStream */
27114
27336
  'use strict';
27115
27337
  if (typeof MediaStream === 'function') {
@@ -27121,7 +27343,7 @@ else {
27121
27343
  };
27122
27344
  }
27123
27345
 
27124
- },{}],159:[function(require,module,exports){
27346
+ },{}],160:[function(require,module,exports){
27125
27347
  /* global MediaStreamTrack */
27126
27348
  'use strict';
27127
27349
  if (typeof MediaStreamTrack === 'function') {
@@ -27133,7 +27355,7 @@ else {
27133
27355
  };
27134
27356
  }
27135
27357
 
27136
- },{}],160:[function(require,module,exports){
27358
+ },{}],161:[function(require,module,exports){
27137
27359
  /* global RTCIceCandidate */
27138
27360
  'use strict';
27139
27361
  if (typeof RTCIceCandidate === 'function') {
@@ -27145,19 +27367,53 @@ else {
27145
27367
  };
27146
27368
  }
27147
27369
 
27148
- },{}],161:[function(require,module,exports){
27370
+ },{}],162:[function(require,module,exports){
27149
27371
  /* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
27150
27372
  'use strict';
27373
+ var __extends = (this && this.__extends) || (function () {
27374
+ var extendStatics = function (d, b) {
27375
+ extendStatics = Object.setPrototypeOf ||
27376
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27377
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27378
+ return extendStatics(d, b);
27379
+ };
27380
+ return function (d, b) {
27381
+ if (typeof b !== "function" && b !== null)
27382
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27383
+ extendStatics(d, b);
27384
+ function __() { this.constructor = d; }
27385
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27386
+ };
27387
+ })();
27388
+ var __read = (this && this.__read) || function (o, n) {
27389
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27390
+ if (!m) return o;
27391
+ var i = m.call(o), r, ar = [], e;
27392
+ try {
27393
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27394
+ }
27395
+ catch (error) { e = { error: error }; }
27396
+ finally {
27397
+ try {
27398
+ if (r && !r.done && (m = i["return"])) m.call(i);
27399
+ }
27400
+ finally { if (e) throw e.error; }
27401
+ }
27402
+ return ar;
27403
+ };
27404
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
27405
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
27406
+ to[j] = from[i];
27407
+ return to;
27408
+ };
27151
27409
  var ChromeRTCSessionDescription = require('../rtcsessiondescription/chrome');
27152
- var EventTarget = require('../util/eventtarget');
27153
- var inherits = require('../../vendor/inherits');
27410
+ var EventTarget = require('../../eventtarget');
27154
27411
  var Latch = require('../util/latch');
27155
27412
  var MediaStream = require('../mediastream');
27156
27413
  var RTCRtpSenderShim = require('../rtcrtpsender');
27157
- var sdpUtils = require('../util/sdp');
27158
- var util = require('../util');
27159
- var isIOSChrome = require('../util').isIOSChrome;
27160
- var isUnifiedPlan = sdpUtils.getSdpFormat() === 'unified';
27414
+ var _a = require('../util/sdp'), getSdpFormat = _a.getSdpFormat, updatePlanBTrackIdsToSSRCs = _a.updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs = _a.updateUnifiedPlanTrackIdsToSSRCs;
27415
+ var _b = require('../util'), delegateMethods = _b.delegateMethods, interceptEvent = _b.interceptEvent, isIOSChrome = _b.isIOSChrome, legacyPromise = _b.legacyPromise, proxyProperties = _b.proxyProperties;
27416
+ var isUnifiedPlan = getSdpFormat() === 'unified';
27161
27417
  // NOTE(mroberts): This class wraps Chrome's RTCPeerConnection implementation.
27162
27418
  // It provides some functionality not currently present in Chrome, namely the
27163
27419
  // abilities to
@@ -27169,119 +27425,127 @@ var isUnifiedPlan = sdpUtils.getSdpFormat() === 'unified';
27169
27425
  //
27170
27426
  // 3. Set iceTransportPolicy.
27171
27427
  //
27172
- function ChromeRTCPeerConnection(configuration, constraints) {
27173
- if (!(this instanceof ChromeRTCPeerConnection)) {
27174
- return new ChromeRTCPeerConnection(configuration, constraints);
27175
- }
27176
- EventTarget.call(this);
27177
- configuration = configuration || {};
27178
- var newConfiguration = Object.assign(configuration.iceTransportPolicy
27179
- ? { iceTransports: configuration.iceTransportPolicy }
27180
- : {}, configuration);
27181
- util.interceptEvent(this, 'datachannel');
27182
- util.interceptEvent(this, 'signalingstatechange');
27183
- var sdpFormat = sdpUtils.getSdpFormat(newConfiguration.sdpSemantics);
27184
- var peerConnection = new RTCPeerConnection(newConfiguration, constraints);
27185
- Object.defineProperties(this, {
27186
- _appliedTracksToSSRCs: {
27187
- value: new Map(),
27188
- writable: true
27189
- },
27190
- _localStream: {
27191
- value: new MediaStream()
27192
- },
27193
- _peerConnection: {
27194
- value: peerConnection
27195
- },
27196
- _pendingLocalOffer: {
27197
- value: null,
27198
- writable: true
27199
- },
27200
- _pendingRemoteOffer: {
27201
- value: null,
27202
- writable: true
27203
- },
27204
- _rolledBackTracksToSSRCs: {
27205
- value: new Map(),
27206
- writable: true
27207
- },
27208
- _sdpFormat: {
27209
- value: sdpFormat
27210
- },
27211
- _senders: {
27212
- value: new Map()
27213
- },
27214
- _signalingStateLatch: {
27215
- value: new Latch()
27216
- },
27217
- _tracksToSSRCs: {
27218
- value: new Map(),
27219
- writable: true
27220
- },
27221
- localDescription: {
27222
- enumerable: true,
27223
- get: function () {
27224
- return this._pendingLocalOffer ? this._pendingLocalOffer : peerConnection.localDescription;
27428
+ var ChromeRTCPeerConnection = /** @class */ (function (_super) {
27429
+ __extends(ChromeRTCPeerConnection, _super);
27430
+ function ChromeRTCPeerConnection(configuration, constraints) {
27431
+ if (configuration === void 0) { configuration = {}; }
27432
+ var _this = _super.call(this) || this;
27433
+ var newConfiguration = Object.assign(configuration.iceTransportPolicy
27434
+ ? { iceTransports: configuration.iceTransportPolicy }
27435
+ : {}, configuration);
27436
+ interceptEvent(_this, 'datachannel');
27437
+ interceptEvent(_this, 'signalingstatechange');
27438
+ var sdpFormat = getSdpFormat(newConfiguration.sdpSemantics);
27439
+ var peerConnection = new RTCPeerConnection(newConfiguration, constraints);
27440
+ Object.defineProperties(_this, {
27441
+ _appliedTracksToSSRCs: {
27442
+ value: new Map(),
27443
+ writable: true
27444
+ },
27445
+ _localStream: {
27446
+ value: new MediaStream()
27447
+ },
27448
+ _peerConnection: {
27449
+ value: peerConnection
27450
+ },
27451
+ _pendingLocalOffer: {
27452
+ value: null,
27453
+ writable: true
27454
+ },
27455
+ _pendingRemoteOffer: {
27456
+ value: null,
27457
+ writable: true
27458
+ },
27459
+ _rolledBackTracksToSSRCs: {
27460
+ value: new Map(),
27461
+ writable: true
27462
+ },
27463
+ _sdpFormat: {
27464
+ value: sdpFormat
27465
+ },
27466
+ _senders: {
27467
+ value: new Map()
27468
+ },
27469
+ _signalingStateLatch: {
27470
+ value: new Latch()
27471
+ },
27472
+ _tracksToSSRCs: {
27473
+ value: new Map(),
27474
+ writable: true
27225
27475
  }
27226
- },
27227
- remoteDescription: {
27228
- enumerable: true,
27229
- get: function () {
27230
- return this._pendingRemoteOffer ? this._pendingRemoteOffer : peerConnection.remoteDescription;
27476
+ });
27477
+ peerConnection.addEventListener('datachannel', function (event) {
27478
+ shimDataChannel(event.channel);
27479
+ _this.dispatchEvent(event);
27480
+ });
27481
+ peerConnection.addEventListener('signalingstatechange', function () {
27482
+ var args = [];
27483
+ for (var _i = 0; _i < arguments.length; _i++) {
27484
+ args[_i] = arguments[_i];
27231
27485
  }
27232
- },
27233
- signalingState: {
27234
- enumerable: true,
27235
- get: function () {
27236
- if (this._pendingLocalOffer) {
27237
- return 'have-local-offer';
27238
- }
27239
- else if (this._pendingRemoteOffer) {
27240
- return 'have-remote-offer';
27241
- }
27242
- return peerConnection.signalingState;
27486
+ if (peerConnection.signalingState === 'stable') {
27487
+ _this._appliedTracksToSSRCs = new Map(_this._tracksToSSRCs);
27243
27488
  }
27489
+ if (!_this._pendingLocalOffer && !_this._pendingRemoteOffer) {
27490
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
27491
+ }
27492
+ });
27493
+ peerConnection.ontrack = function () {
27494
+ // NOTE(mroberts): adapter.js's "track" event shim only kicks off if we set
27495
+ // the ontrack property of the RTCPeerConnection.
27496
+ };
27497
+ if (typeof peerConnection.addTrack !== 'function') {
27498
+ peerConnection.addStream(_this._localStream);
27244
27499
  }
27500
+ proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);
27501
+ return _this;
27502
+ }
27503
+ Object.defineProperty(ChromeRTCPeerConnection.prototype, "localDescription", {
27504
+ get: function () {
27505
+ return this._pendingLocalOffer ? this._pendingLocalOffer : this._peerConnection.localDescription;
27506
+ },
27507
+ enumerable: false,
27508
+ configurable: true
27245
27509
  });
27246
- var self = this;
27247
- peerConnection.addEventListener('datachannel', function ondatachannel(event) {
27248
- shimDataChannel(event.channel);
27249
- self.dispatchEvent(event);
27510
+ Object.defineProperty(ChromeRTCPeerConnection.prototype, "remoteDescription", {
27511
+ get: function () {
27512
+ return this._pendingRemoteOffer ? this._pendingRemoteOffer : this._peerConnection.remoteDescription;
27513
+ },
27514
+ enumerable: false,
27515
+ configurable: true
27250
27516
  });
27251
- peerConnection.addEventListener('signalingstatechange', function onsignalingstatechange() {
27252
- if (peerConnection.signalingState === 'stable') {
27253
- self._appliedTracksToSSRCs = new Map(self._tracksToSSRCs);
27254
- }
27255
- if (!self._pendingLocalOffer && !self._pendingRemoteOffer) {
27256
- self.dispatchEvent.apply(self, arguments);
27257
- }
27517
+ Object.defineProperty(ChromeRTCPeerConnection.prototype, "signalingState", {
27518
+ get: function () {
27519
+ if (this._pendingLocalOffer) {
27520
+ return 'have-local-offer';
27521
+ }
27522
+ else if (this._pendingRemoteOffer) {
27523
+ return 'have-remote-offer';
27524
+ }
27525
+ return this._peerConnection.signalingState;
27526
+ },
27527
+ enumerable: false,
27528
+ configurable: true
27258
27529
  });
27259
- peerConnection.ontrack = function ontrack() {
27260
- // NOTE(mroberts): adapter.js's "track" event shim only kicks off if we set
27261
- // the ontrack property of the RTCPeerConnection.
27262
- };
27263
- if (typeof RTCPeerConnection.prototype.addTrack !== 'function') {
27264
- peerConnection.addStream(this._localStream);
27265
- }
27266
- util.proxyProperties(RTCPeerConnection.prototype, this, peerConnection);
27267
- }
27268
- inherits(ChromeRTCPeerConnection, EventTarget);
27269
- if (typeof RTCPeerConnection.prototype.addTrack !== 'function') {
27270
27530
  // NOTE(mmalavalli): This shim supports our limited case of adding
27271
27531
  // all MediaStreamTracks to one MediaStream. It has been implemented this
27272
27532
  // keeping in mind that this is to be maintained only until "addTrack" is
27273
27533
  // supported natively in Chrome.
27274
- ChromeRTCPeerConnection.prototype.addTrack = function addTrack() {
27275
- var args = [].slice.call(arguments);
27276
- var track = args[0];
27534
+ ChromeRTCPeerConnection.prototype.addTrack = function (track) {
27535
+ var _a;
27536
+ var rest = [];
27537
+ for (var _i = 1; _i < arguments.length; _i++) {
27538
+ rest[_i - 1] = arguments[_i];
27539
+ }
27540
+ if (typeof this._peerConnection.addTrack === 'function') {
27541
+ return (_a = this._peerConnection).addTrack.apply(_a, __spreadArray([track], __read(rest)));
27542
+ }
27277
27543
  if (this._peerConnection.signalingState === 'closed') {
27278
- throw new Error('Cannot add MediaStreamTrack [' + track.id + ', '
27279
- + track.kind + ']: RTCPeerConnection is closed');
27544
+ throw new Error("Cannot add MediaStreamTrack [" + track.id + ", \n " + track.kind + "]: RTCPeerConnection is closed");
27280
27545
  }
27281
27546
  var sender = this._senders.get(track);
27282
27547
  if (sender && sender.track) {
27283
- throw new Error('Cannot add MediaStreamTrack [' + track.id + ', '
27284
- + track.kind + ']: RTCPeerConnection already has it');
27548
+ throw new Error("Cannot add MediaStreamTrack ['" + track.id + ", \n " + track.kind + "]: RTCPeerConnection already has it");
27285
27549
  }
27286
27550
  this._peerConnection.removeStream(this._localStream);
27287
27551
  this._localStream.addTrack(track);
@@ -27294,192 +27558,207 @@ if (typeof RTCPeerConnection.prototype.addTrack !== 'function') {
27294
27558
  // MediaStreamTracks from one MediaStream. It has been implemented this
27295
27559
  // keeping in mind that this is to be maintained only until "removeTrack" is
27296
27560
  // supported natively in Chrome.
27297
- ChromeRTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
27561
+ ChromeRTCPeerConnection.prototype.removeTrack = function (sender) {
27298
27562
  if (this._peerConnection.signalingState === 'closed') {
27299
27563
  throw new Error('Cannot remove MediaStreamTrack: RTCPeerConnection is closed');
27300
27564
  }
27301
- var track = sender.track;
27302
- if (!track) {
27303
- return;
27565
+ if (typeof this._peerConnection.addTrack === 'function') {
27566
+ try {
27567
+ return this._peerConnection.removeTrack(sender);
27568
+ }
27569
+ catch (e) {
27570
+ // NOTE(mhuynh): Do nothing. In Chrome, will throw if a 'sender was not
27571
+ // created by this peer connection'. This behavior does not seem to be
27572
+ // spec compliant, so a temporary shim is introduced. A bug has been filed,
27573
+ // and is tracked here:
27574
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=860853
27575
+ }
27304
27576
  }
27305
- sender = this._senders.get(track);
27306
- if (sender && sender.track) {
27307
- sender.track = null;
27308
- this._peerConnection.removeStream(this._localStream);
27309
- this._localStream.removeTrack(track);
27310
- this._peerConnection.addStream(this._localStream);
27577
+ else {
27578
+ var track = sender.track;
27579
+ if (!track) {
27580
+ return;
27581
+ }
27582
+ sender = this._senders.get(track);
27583
+ if (sender && sender.track) {
27584
+ sender.track = null;
27585
+ this._peerConnection.removeStream(this._localStream);
27586
+ this._localStream.removeTrack(track);
27587
+ this._peerConnection.addStream(this._localStream);
27588
+ }
27311
27589
  }
27312
27590
  };
27313
- ChromeRTCPeerConnection.prototype.getSenders = function getSenders() {
27591
+ ChromeRTCPeerConnection.prototype.getSenders = function () {
27592
+ if (typeof this._peerConnection.addTrack === 'function') {
27593
+ return this._peerConnection.getSenders();
27594
+ }
27314
27595
  return Array.from(this._senders.values());
27315
27596
  };
27316
- }
27317
- else {
27318
- ChromeRTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
27319
- if (this._peerConnection.signalingState === 'closed') {
27320
- throw new Error('Cannot remove MediaStreamTrack: RTCPeerConnection is closed');
27321
- }
27322
- try {
27323
- this._peerConnection.removeTrack(sender);
27597
+ ChromeRTCPeerConnection.prototype.addIceCandidate = function (candidate) {
27598
+ var _this = this;
27599
+ var rest = [];
27600
+ for (var _i = 1; _i < arguments.length; _i++) {
27601
+ rest[_i - 1] = arguments[_i];
27602
+ }
27603
+ var promise;
27604
+ if (this.signalingState === 'have-remote-offer') {
27605
+ // NOTE(mroberts): Because the ChromeRTCPeerConnection simulates the
27606
+ // "have-remote-offer" signalingStates, we only want to invoke the true
27607
+ // addIceCandidates method when the remote description has been applied.
27608
+ promise = this._signalingStateLatch.when('low').then(function () {
27609
+ return _this._peerConnection.addIceCandidate(candidate);
27610
+ });
27324
27611
  }
27325
- catch (e) {
27326
- // NOTE(mhuynh): Do nothing. In Chrome, will throw if a 'sender was not
27327
- // created by this peer connection'. This behavior does not seem to be
27328
- // spec compliant, so a temporary shim is introduced. A bug has been filed,
27329
- // and is tracked here:
27330
- // https://bugs.chromium.org/p/chromium/issues/detail?id=860853
27612
+ else {
27613
+ promise = this._peerConnection.addIceCandidate(candidate);
27614
+ }
27615
+ return rest.length > 0
27616
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;
27617
+ };
27618
+ // NOTE(mroberts): The WebRTC spec does not specify that close should throw an
27619
+ // Error; however, in Chrome it does. We workaround this by checking the
27620
+ // signalingState manually.
27621
+ ChromeRTCPeerConnection.prototype.close = function () {
27622
+ if (this.signalingState !== 'closed') {
27623
+ this._pendingLocalOffer = null;
27624
+ this._pendingRemoteOffer = null;
27625
+ this._peerConnection.close();
27331
27626
  }
27332
27627
  };
27333
- }
27334
- ChromeRTCPeerConnection.prototype.addIceCandidate = function addIceCandidate(candidate) {
27335
- var args = [].slice.call(arguments);
27336
- var promise;
27337
- var self = this;
27338
- if (this.signalingState === 'have-remote-offer') {
27339
- // NOTE(mroberts): Because the ChromeRTCPeerConnection simulates the
27340
- // "have-remote-offer" signalingStates, we only want to invoke the true
27341
- // addIceCandidates method when the remote description has been applied.
27342
- promise = this._signalingStateLatch.when('low').then(function signalingStatesResolved() {
27343
- return self._peerConnection.addIceCandidate(candidate);
27344
- });
27345
- }
27346
- else {
27347
- promise = this._peerConnection.addIceCandidate(candidate);
27348
- }
27349
- return args.length > 1
27350
- ? util.legacyPromise(promise, args[1], args[2])
27351
- : promise;
27352
- };
27353
- // NOTE(mroberts): The WebRTC spec does not specify that close should throw an
27354
- // Error; however, in Chrome it does. We workaround this by checking the
27355
- // signalingState manually.
27356
- ChromeRTCPeerConnection.prototype.close = function close() {
27357
- if (this.signalingState !== 'closed') {
27358
- this._pendingLocalOffer = null;
27359
- this._pendingRemoteOffer = null;
27360
- this._peerConnection.close();
27361
- }
27362
- };
27363
- // NOTE(mroberts): Because we workaround Chrome's lack of rollback support by
27364
- // "faking" setRemoteDescription, we cannot create an answer until we actually
27365
- // apply the remote description. This means, once you call createAnswer, you
27366
- // can no longer rollback. This is acceptable for our use case because we will
27367
- // apply the newly-created answer almost immediately; however, this may be
27368
- // unacceptable for other use cases.
27369
- ChromeRTCPeerConnection.prototype.createAnswer = function createAnswer() {
27370
- var args = [].slice.call(arguments);
27371
- var promise;
27372
- var self = this;
27373
- if (this._pendingRemoteOffer) {
27374
- promise = this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function setRemoteDescriptionSucceeded() {
27375
- // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection
27376
- // and the underlying RTCPeerConnection implementation have converged. We
27377
- // can unblock any pending calls to addIceCandidate now.
27378
- self._signalingStateLatch.lower();
27379
- return self._peerConnection.createAnswer();
27380
- }).then(function createAnswerSucceeded(answer) {
27381
- self._pendingRemoteOffer = null;
27382
- // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
27383
- // longer need to retain the rolled back tracks to SSRCs Map.
27384
- self._rolledBackTracksToSSRCs.clear();
27385
- return new ChromeRTCSessionDescription({
27386
- type: 'answer',
27387
- sdp: updateTrackIdsToSSRCs(self._sdpFormat, self._tracksToSSRCs, answer.sdp)
27628
+ // NOTE(mroberts): Because we workaround Chrome's lack of rollback support by
27629
+ // "faking" setRemoteDescription, we cannot create an answer until we actually
27630
+ // apply the remote description. This means, once you call createAnswer, you
27631
+ // can no longer rollback. This is acceptable for our use case because we will
27632
+ // apply the newly-created answer almost immediately; however, this may be
27633
+ // unacceptable for other use cases.
27634
+ ChromeRTCPeerConnection.prototype.createAnswer = function () {
27635
+ var _this = this;
27636
+ var args = [];
27637
+ for (var _i = 0; _i < arguments.length; _i++) {
27638
+ args[_i] = arguments[_i];
27639
+ }
27640
+ var promise;
27641
+ if (this._pendingRemoteOffer) {
27642
+ promise = this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function () {
27643
+ // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection
27644
+ // and the underlying RTCPeerConnection implementation have converged. We
27645
+ // can unblock any pending calls to addIceCandidate now.
27646
+ _this._signalingStateLatch.lower();
27647
+ return _this._peerConnection.createAnswer();
27648
+ }).then(function (answer) {
27649
+ _this._pendingRemoteOffer = null;
27650
+ // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
27651
+ // longer need to retain the rolled back tracks to SSRCs Map.
27652
+ _this._rolledBackTracksToSSRCs.clear();
27653
+ return new ChromeRTCSessionDescription({
27654
+ type: 'answer',
27655
+ sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, answer.sdp)
27656
+ });
27657
+ }, function (error) {
27658
+ _this._pendingRemoteOffer = null;
27659
+ throw error;
27388
27660
  });
27389
- }, function setRemoteDescriptionOrCreateAnswerFailed(error) {
27390
- self._pendingRemoteOffer = null;
27391
- throw error;
27392
- });
27393
- }
27394
- else {
27395
- promise = this._peerConnection.createAnswer().then(function (answer) {
27396
- // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
27397
- // longer need to retain the rolled back tracks to SSRCs Map.
27398
- self._rolledBackTracksToSSRCs.clear();
27399
- return new ChromeRTCSessionDescription({
27400
- type: 'answer',
27401
- sdp: updateTrackIdsToSSRCs(self._sdpFormat, self._tracksToSSRCs, answer.sdp)
27661
+ }
27662
+ else {
27663
+ promise = this._peerConnection.createAnswer().then(function (answer) {
27664
+ // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
27665
+ // longer need to retain the rolled back tracks to SSRCs Map.
27666
+ _this._rolledBackTracksToSSRCs.clear();
27667
+ return new ChromeRTCSessionDescription({
27668
+ type: 'answer',
27669
+ sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, answer.sdp)
27670
+ });
27402
27671
  });
27403
- });
27404
- }
27405
- return args.length > 1
27406
- ? util.legacyPromise(promise, args[0], args[1])
27407
- : promise;
27408
- };
27409
- ChromeRTCPeerConnection.prototype.createOffer = function createOffer() {
27410
- var args = [].slice.call(arguments);
27411
- var options = (args.length > 1 ? args[2] : args[0]) || {};
27412
- var self = this;
27413
- if (isIOSChrome()) {
27414
- // NOTE (joma): From SafariRTCPeerConnection in order to support iOS Chrome.
27415
- if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
27416
- delete options.offerToReceiveAudio;
27417
- try {
27418
- this._audioTransceiver = isUnifiedPlan
27419
- ? this.addTransceiver('audio', { direction: 'recvonly' })
27420
- : this.addTransceiver('audio');
27421
- }
27422
- catch (e) {
27423
- return Promise.reject(e);
27424
- }
27425
27672
  }
27426
- if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
27427
- delete options.offerToReceiveVideo;
27428
- try {
27429
- this._videoTransceiver = isUnifiedPlan
27430
- ? this.addTransceiver('video', { direction: 'recvonly' })
27431
- : this.addTransceiver('video');
27673
+ return args.length > 1
27674
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(args))) : promise;
27675
+ };
27676
+ ChromeRTCPeerConnection.prototype.createOffer = function () {
27677
+ var _this = this;
27678
+ var args = [];
27679
+ for (var _i = 0; _i < arguments.length; _i++) {
27680
+ args[_i] = arguments[_i];
27681
+ }
27682
+ var _a = __read(args, 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2];
27683
+ var options = arg3 || arg1 || {};
27684
+ if (isIOSChrome()) {
27685
+ // NOTE (joma): From SafariRTCPeerConnection in order to support iOS Chrome.
27686
+ if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
27687
+ delete options.offerToReceiveAudio;
27688
+ try {
27689
+ this._audioTransceiver = isUnifiedPlan
27690
+ ? this.addTransceiver('audio', { direction: 'recvonly' })
27691
+ : this.addTransceiver('audio');
27692
+ }
27693
+ catch (e) {
27694
+ return Promise.reject(e);
27695
+ }
27432
27696
  }
27433
- catch (e) {
27434
- return Promise.reject(e);
27697
+ if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
27698
+ delete options.offerToReceiveVideo;
27699
+ try {
27700
+ this._videoTransceiver = isUnifiedPlan
27701
+ ? this.addTransceiver('video', { direction: 'recvonly' })
27702
+ : this.addTransceiver('video');
27703
+ }
27704
+ catch (e) {
27705
+ return Promise.reject(e);
27706
+ }
27435
27707
  }
27436
27708
  }
27437
- }
27438
- var promise = this._peerConnection.createOffer(options).then(function (offer) {
27439
- // NOTE(mmalavalli): If createOffer() is called immediately after rolling back, then we no
27440
- // longer need to retain the rolled back tracks to SSRCs Map.
27441
- self._rolledBackTracksToSSRCs.clear();
27442
- return new ChromeRTCSessionDescription({
27443
- type: offer.type,
27444
- sdp: updateTrackIdsToSSRCs(self._sdpFormat, self._tracksToSSRCs, offer.sdp)
27709
+ var promise = this._peerConnection.createOffer(options).then(function (offer) {
27710
+ // NOTE(mmalavalli): If createOffer() is called immediately after rolling back, then we no
27711
+ // longer need to retain the rolled back tracks to SSRCs Map.
27712
+ _this._rolledBackTracksToSSRCs.clear();
27713
+ return new ChromeRTCSessionDescription({
27714
+ type: offer.type,
27715
+ sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, offer.sdp)
27716
+ });
27445
27717
  });
27446
- });
27447
- return args.length > 1
27448
- ? util.legacyPromise(promise, args[0], args[1])
27449
- : promise;
27450
- };
27451
- ChromeRTCPeerConnection.prototype.createDataChannel = function createDataChannel(label, dataChannelDict) {
27452
- dataChannelDict = shimDataChannelInit(dataChannelDict);
27453
- var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);
27454
- shimDataChannel(dataChannel);
27455
- return dataChannel;
27456
- };
27457
- ChromeRTCPeerConnection.prototype.setLocalDescription = function setLocalDescription() {
27458
- var args = [].slice.call(arguments);
27459
- var description = args[0];
27460
- // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,
27461
- // then we need to restore the rolled back tracks to SSRCs Map.
27462
- if (this._rolledBackTracksToSSRCs.size > 0) {
27463
- this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);
27718
+ return args.length > 1
27719
+ ? legacyPromise(promise, arg1, arg2)
27720
+ : promise;
27721
+ };
27722
+ ChromeRTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {
27723
+ dataChannelDict = shimDataChannelInit(dataChannelDict);
27724
+ var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);
27725
+ shimDataChannel(dataChannel);
27726
+ return dataChannel;
27727
+ };
27728
+ ChromeRTCPeerConnection.prototype.setLocalDescription = function () {
27729
+ var args = [];
27730
+ for (var _i = 0; _i < arguments.length; _i++) {
27731
+ args[_i] = arguments[_i];
27732
+ }
27733
+ var _a = __read(args, 3), description = _a[0], arg1 = _a[1], arg2 = _a[2];
27734
+ // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,
27735
+ // then we need to restore the rolled back tracks to SSRCs Map.
27736
+ if (this._rolledBackTracksToSSRCs.size > 0) {
27737
+ this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);
27738
+ this._rolledBackTracksToSSRCs.clear();
27739
+ }
27740
+ var promise = setDescription(this, true, description);
27741
+ return args.length > 1
27742
+ ? legacyPromise(promise, arg1, arg2)
27743
+ : promise;
27744
+ };
27745
+ ChromeRTCPeerConnection.prototype.setRemoteDescription = function () {
27746
+ var args = [];
27747
+ for (var _i = 0; _i < arguments.length; _i++) {
27748
+ args[_i] = arguments[_i];
27749
+ }
27750
+ var _a = __read(args, 3), description = _a[0], arg1 = _a[1], arg2 = _a[2];
27751
+ // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,
27752
+ // then we no longer need to retain the rolled back tracks to SSRCs Map.
27464
27753
  this._rolledBackTracksToSSRCs.clear();
27465
- }
27466
- var promise = setDescription(this, true, description);
27467
- return args.length > 1
27468
- ? util.legacyPromise(promise, args[1], args[2])
27469
- : promise;
27470
- };
27471
- ChromeRTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
27472
- var args = [].slice.call(arguments);
27473
- var description = args[0];
27474
- // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,
27475
- // then we no longer need to retain the rolled back tracks to SSRCs Map.
27476
- this._rolledBackTracksToSSRCs.clear();
27477
- var promise = setDescription(this, false, description);
27478
- return args.length > 1
27479
- ? util.legacyPromise(promise, args[1], args[2])
27480
- : promise;
27481
- };
27482
- util.delegateMethods(RTCPeerConnection.prototype, ChromeRTCPeerConnection.prototype, '_peerConnection');
27754
+ var promise = setDescription(this, false, description);
27755
+ return args.length > 1
27756
+ ? legacyPromise(promise, arg1, arg2)
27757
+ : promise;
27758
+ };
27759
+ return ChromeRTCPeerConnection;
27760
+ }(EventTarget));
27761
+ delegateMethods(RTCPeerConnection.prototype, ChromeRTCPeerConnection.prototype, '_peerConnection');
27483
27762
  // NOTE(mroberts): We workaround Chrome's lack of rollback support, per the
27484
27763
  // workaround suggested here: https://bugs.chromium.org/p/webrtc/issues/detail?id=5738#c3
27485
27764
  // Namely, we "fake" setting the local or remote description and instead buffer
@@ -27514,8 +27793,7 @@ function setDescription(peerConnection, local, description) {
27514
27793
  else if (description.type === 'offer') {
27515
27794
  if (peerConnection.signalingState !== intermediateState && peerConnection.signalingState !== 'stable') {
27516
27795
  // NOTE(mroberts): Error message copied from Firefox.
27517
- return Promise.reject(new Error('Cannot set ' + (local ? 'local' : 'remote') +
27518
- ' offer in state ' + peerConnection.signalingState));
27796
+ return Promise.reject(new Error("Cannot set " + (local ? 'local' : 'remote') + " offer in state " + peerConnection.signalingState));
27519
27797
  }
27520
27798
  // We need to save this local offer in case of a rollback. We also need to
27521
27799
  // check to see if the signalingState between the ChromeRTCPeerConnection
@@ -27529,16 +27807,13 @@ function setDescription(peerConnection, local, description) {
27529
27807
  promise = Promise.resolve();
27530
27808
  // Only dispatch a signalingstatechange event if we transitioned.
27531
27809
  if (peerConnection.signalingState !== previousSignalingState) {
27532
- promise.then(function dispatchSignalingStateChangeEvent() {
27533
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
27534
- });
27810
+ promise.then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
27535
27811
  }
27536
27812
  }
27537
27813
  else if (description.type === 'rollback') {
27538
27814
  if (peerConnection.signalingState !== intermediateState) {
27539
27815
  // NOTE(mroberts): Error message copied from Firefox.
27540
- promise = Promise.reject(new Error('Cannot rollback ' +
27541
- (local ? 'local' : 'remote') + ' description in ' + peerConnection.signalingState));
27816
+ promise = Promise.reject(new Error("Cannot rollback " + (local ? 'local' : 'remote') + " description in " + peerConnection.signalingState));
27542
27817
  }
27543
27818
  else {
27544
27819
  // Reset the pending offer.
@@ -27550,9 +27825,7 @@ function setDescription(peerConnection, local, description) {
27550
27825
  peerConnection._rolledBackTracksToSSRCs = new Map(peerConnection._tracksToSSRCs);
27551
27826
  peerConnection._tracksToSSRCs = new Map(peerConnection._appliedTracksToSSRCs);
27552
27827
  promise = Promise.resolve();
27553
- promise.then(function dispatchSignalingStateChangeEvent() {
27554
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
27555
- });
27828
+ promise.then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
27556
27829
  }
27557
27830
  }
27558
27831
  return promise || peerConnection._peerConnection[setLocalDescription](unwrap(description));
@@ -27560,10 +27833,10 @@ function setDescription(peerConnection, local, description) {
27560
27833
  function setRemoteAnswer(peerConnection, answer) {
27561
27834
  // Apply the pending local offer.
27562
27835
  var pendingLocalOffer = peerConnection._pendingLocalOffer;
27563
- return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function setLocalOfferSucceeded() {
27836
+ return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function () {
27564
27837
  peerConnection._pendingLocalOffer = null;
27565
27838
  return peerConnection.setRemoteDescription(answer);
27566
- }).then(function setRemoteAnswerSucceeded() {
27839
+ }).then(function () {
27567
27840
  // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection
27568
27841
  // and the underlying RTCPeerConnection implementation have converged. We
27569
27842
  // can unblock any pending calls to addIceCandidate now.
@@ -27578,8 +27851,10 @@ function setRemoteAnswer(peerConnection, answer) {
27578
27851
  * @returns {boolean}
27579
27852
  */
27580
27853
  function hasReceiversForTracksOfKind(peerConnection, kind) {
27581
- return !!peerConnection.getTransceivers().find(function (transceiver) {
27582
- return transceiver.receiver && transceiver.receiver.track && transceiver.receiver.track.kind === kind;
27854
+ return !!peerConnection.getTransceivers().find(function (_a) {
27855
+ var _b = _a.receiver, receiver = _b === void 0 ? {} : _b;
27856
+ var _c = receiver.track, track = _c === void 0 ? {} : _c;
27857
+ return track.kind === kind;
27583
27858
  });
27584
27859
  }
27585
27860
  function unwrap(description) {
@@ -27651,19 +27926,54 @@ function shimDataChannel(dataChannel) {
27651
27926
  */
27652
27927
  function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
27653
27928
  return sdpFormat === 'unified'
27654
- ? sdpUtils.updateUnifiedPlanTrackIdsToSSRCs(tracksToSSRCs, sdp)
27655
- : sdpUtils.updatePlanBTrackIdsToSSRCs(tracksToSSRCs, sdp);
27929
+ ? updateUnifiedPlanTrackIdsToSSRCs(tracksToSSRCs, sdp)
27930
+ : updatePlanBTrackIdsToSSRCs(tracksToSSRCs, sdp);
27656
27931
  }
27657
27932
  module.exports = ChromeRTCPeerConnection;
27658
27933
 
27659
- },{"../../vendor/inherits":150,"../mediastream":158,"../rtcrtpsender":165,"../rtcsessiondescription/chrome":166,"../util":170,"../util/eventtarget":169,"../util/latch":171,"../util/sdp":172}],162:[function(require,module,exports){
27934
+ },{"../../eventtarget":11,"../mediastream":159,"../rtcrtpsender":166,"../rtcsessiondescription/chrome":167,"../util":170,"../util/latch":171,"../util/sdp":172}],163:[function(require,module,exports){
27660
27935
  /* globals RTCPeerConnection */
27661
27936
  'use strict';
27662
- var EventTarget = require('../util/eventtarget');
27937
+ var __extends = (this && this.__extends) || (function () {
27938
+ var extendStatics = function (d, b) {
27939
+ extendStatics = Object.setPrototypeOf ||
27940
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27941
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27942
+ return extendStatics(d, b);
27943
+ };
27944
+ return function (d, b) {
27945
+ if (typeof b !== "function" && b !== null)
27946
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27947
+ extendStatics(d, b);
27948
+ function __() { this.constructor = d; }
27949
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27950
+ };
27951
+ })();
27952
+ var __read = (this && this.__read) || function (o, n) {
27953
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27954
+ if (!m) return o;
27955
+ var i = m.call(o), r, ar = [], e;
27956
+ try {
27957
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27958
+ }
27959
+ catch (error) { e = { error: error }; }
27960
+ finally {
27961
+ try {
27962
+ if (r && !r.done && (m = i["return"])) m.call(i);
27963
+ }
27964
+ finally { if (e) throw e.error; }
27965
+ }
27966
+ return ar;
27967
+ };
27968
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
27969
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
27970
+ to[j] = from[i];
27971
+ return to;
27972
+ };
27973
+ var EventTarget = require('../../eventtarget');
27663
27974
  var FirefoxRTCSessionDescription = require('../rtcsessiondescription/firefox');
27664
- var inherits = require('../../vendor/inherits');
27665
27975
  var updateTracksToSSRCs = require('../util/sdp').updateUnifiedPlanTrackIdsToSSRCs;
27666
- var util = require('../util');
27976
+ var _a = require('../util'), delegateMethods = _a.delegateMethods, interceptEvent = _a.interceptEvent, legacyPromise = _a.legacyPromise, proxyProperties = _a.proxyProperties;
27667
27977
  // NOTE(mroberts): This class wraps Firefox's RTCPeerConnection implementation.
27668
27978
  // It provides some functionality not currently present in Firefox, namely the
27669
27979
  // abilities to
@@ -27684,201 +27994,212 @@ var util = require('../util');
27684
27994
  //
27685
27995
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1240897
27686
27996
  //
27687
- function FirefoxRTCPeerConnection(configuration) {
27688
- if (!(this instanceof FirefoxRTCPeerConnection)) {
27689
- return new FirefoxRTCPeerConnection(configuration);
27690
- }
27691
- EventTarget.call(this);
27692
- util.interceptEvent(this, 'signalingstatechange');
27693
- /* eslint new-cap:0 */
27694
- var peerConnection = new RTCPeerConnection(configuration);
27695
- Object.defineProperties(this, {
27696
- _initiallyNegotiatedDtlsRole: {
27697
- value: null,
27698
- writable: true
27699
- },
27700
- _isClosed: {
27701
- value: false,
27702
- writable: true
27703
- },
27704
- _peerConnection: {
27705
- value: peerConnection
27706
- },
27707
- _rollingBack: {
27708
- value: false,
27709
- writable: true
27710
- },
27711
- _tracksToSSRCs: {
27712
- value: new Map()
27713
- },
27714
- iceGatheringState: {
27715
- enumerable: true,
27716
- get: function () {
27717
- return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
27997
+ var FirefoxRTCPeerConnection = /** @class */ (function (_super) {
27998
+ __extends(FirefoxRTCPeerConnection, _super);
27999
+ function FirefoxRTCPeerConnection(configuration) {
28000
+ var _this = _super.call(this) || this;
28001
+ interceptEvent(_this, 'signalingstatechange');
28002
+ /* eslint new-cap:0 */
28003
+ var peerConnection = new RTCPeerConnection(configuration);
28004
+ Object.defineProperties(_this, {
28005
+ _initiallyNegotiatedDtlsRole: {
28006
+ value: null,
28007
+ writable: true
28008
+ },
28009
+ _isClosed: {
28010
+ value: false,
28011
+ writable: true
28012
+ },
28013
+ _peerConnection: {
28014
+ value: peerConnection
28015
+ },
28016
+ _rollingBack: {
28017
+ value: false,
28018
+ writable: true
28019
+ },
28020
+ _tracksToSSRCs: {
28021
+ value: new Map()
28022
+ },
28023
+ // NOTE(mmalavalli): Firefox throws a TypeError when the PeerConnection's
28024
+ // prototype's "peerIdentity" property is accessed. In order to overcome
28025
+ // this, we ignore this property while delegating methods.
28026
+ // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1363815
28027
+ peerIdentity: {
28028
+ enumerable: true,
28029
+ value: Promise.resolve({
28030
+ idp: '',
28031
+ name: ''
28032
+ })
27718
28033
  }
27719
- },
27720
- localDescription: {
27721
- enumerable: true,
27722
- get: function () {
27723
- return overwriteWithInitiallyNegotiatedDtlsRole(this._peerConnection.localDescription, this._initiallyNegotiatedDtlsRole);
28034
+ });
28035
+ var previousSignalingState;
28036
+ peerConnection.addEventListener('signalingstatechange', function () {
28037
+ var args = [];
28038
+ for (var _i = 0; _i < arguments.length; _i++) {
28039
+ args[_i] = arguments[_i];
27724
28040
  }
27725
- },
27726
- signalingState: {
27727
- enumerable: true,
27728
- get: function () {
27729
- return this._isClosed ? 'closed' : this._peerConnection.signalingState;
28041
+ if (!_this._rollingBack && _this.signalingState !== previousSignalingState) {
28042
+ previousSignalingState = _this.signalingState;
28043
+ // NOTE(mmalavalli): In Firefox, 'signalingstatechange' event is
28044
+ // triggered synchronously in the same tick after
28045
+ // RTCPeerConnection#close() is called. So we mimic Chrome's behavior
28046
+ // by triggering 'signalingstatechange' on the next tick.
28047
+ if (_this._isClosed) {
28048
+ setTimeout(function () { return _this.dispatchEvent.apply(_this, __spreadArray([], __read(args))); });
28049
+ }
28050
+ else {
28051
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
28052
+ }
27730
28053
  }
27731
- }
28054
+ });
28055
+ proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);
28056
+ return _this;
28057
+ }
28058
+ Object.defineProperty(FirefoxRTCPeerConnection.prototype, "iceGatheringState", {
28059
+ get: function () {
28060
+ return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
28061
+ },
28062
+ enumerable: false,
28063
+ configurable: true
27732
28064
  });
27733
- var self = this;
27734
- var previousSignalingState;
27735
- peerConnection.addEventListener('signalingstatechange', function onsignalingstatechange() {
27736
- if (!self._rollingBack && self.signalingState !== previousSignalingState) {
27737
- previousSignalingState = self.signalingState;
27738
- // NOTE(mmalavalli): In Firefox, 'signalingstatechange' event is
27739
- // triggered synchronously in the same tick after
27740
- // RTCPeerConnection#close() is called. So we mimic Chrome's behavior
27741
- // by triggering 'signalingstatechange' on the next tick.
27742
- var dispatchEventToSelf = self.dispatchEvent.apply.bind(self.dispatchEvent, self, arguments);
27743
- if (self._isClosed) {
27744
- setTimeout(dispatchEventToSelf);
27745
- }
27746
- else {
27747
- dispatchEventToSelf();
27748
- }
27749
- }
28065
+ Object.defineProperty(FirefoxRTCPeerConnection.prototype, "localDescription", {
28066
+ get: function () {
28067
+ return overwriteWithInitiallyNegotiatedDtlsRole(this._peerConnection.localDescription, this._initiallyNegotiatedDtlsRole);
28068
+ },
28069
+ enumerable: false,
28070
+ configurable: true
27750
28071
  });
27751
- util.proxyProperties(RTCPeerConnection.prototype, this, peerConnection);
27752
- }
27753
- inherits(FirefoxRTCPeerConnection, EventTarget);
27754
- // NOTE(mmalavalli): Firefox throws a TypeError when the PeerConnection's
27755
- // prototype's "peerIdentity" property is accessed. In order to overcome
27756
- // this, we ignore this property while delegating methods.
27757
- // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1363815
27758
- Object.defineProperty(FirefoxRTCPeerConnection.prototype, 'peerIdentity', {
27759
- enumerable: true,
27760
- value: Promise.resolve({
27761
- idp: '',
27762
- name: ''
27763
- })
27764
- });
27765
- FirefoxRTCPeerConnection.prototype.createAnswer = function createAnswer() {
27766
- var args = [].slice.call(arguments);
27767
- var promise;
27768
- var self = this;
27769
- promise = this._peerConnection.createAnswer().then(function createAnswerSucceeded(answer) {
27770
- saveInitiallyNegotiatedDtlsRole(self, answer);
27771
- return overwriteWithInitiallyNegotiatedDtlsRole(answer, self._initiallyNegotiatedDtlsRole);
28072
+ Object.defineProperty(FirefoxRTCPeerConnection.prototype, "signalingState", {
28073
+ get: function () {
28074
+ return this._isClosed ? 'closed' : this._peerConnection.signalingState;
28075
+ },
28076
+ enumerable: false,
28077
+ configurable: true
27772
28078
  });
27773
- return typeof args[0] === 'function'
27774
- ? util.legacyPromise(promise, args[0], args[1])
27775
- : promise;
27776
- };
27777
- // NOTE(mroberts): The WebRTC spec allows you to call createOffer from any
27778
- // signalingState other than "closed"; however, Firefox has not yet implemented
27779
- // this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388). We workaround
27780
- // this by rolling back if we are in state "have-local-offer" or
27781
- // "have-remote-offer". This is acceptable for our use case because we will
27782
- // apply the newly-created offer almost immediately; however, this may be
27783
- // unacceptable for other use cases.
27784
- FirefoxRTCPeerConnection.prototype.createOffer = function createOffer() {
27785
- var args = [].slice.call(arguments);
27786
- var options = (args.length > 1 ? args[2] : args[0]) || {};
27787
- var promise;
27788
- var self = this;
27789
- if (this.signalingState === 'have-local-offer' ||
27790
- this.signalingState === 'have-remote-offer') {
27791
- var local = this.signalingState === 'have-local-offer';
27792
- promise = rollback(this, local, function rollbackSucceeded() {
27793
- return self.createOffer(options);
27794
- });
27795
- }
27796
- else {
27797
- promise = self._peerConnection.createOffer(options);
27798
- }
27799
- promise = promise.then(function (offer) {
27800
- return new FirefoxRTCSessionDescription({
27801
- type: offer.type,
27802
- sdp: updateTracksToSSRCs(self._tracksToSSRCs, offer.sdp)
28079
+ FirefoxRTCPeerConnection.prototype.createAnswer = function () {
28080
+ var _this = this;
28081
+ var args = [];
28082
+ for (var _i = 0; _i < arguments.length; _i++) {
28083
+ args[_i] = arguments[_i];
28084
+ }
28085
+ var promise;
28086
+ promise = this._peerConnection.createAnswer().then(function (answer) {
28087
+ saveInitiallyNegotiatedDtlsRole(_this, answer);
28088
+ return overwriteWithInitiallyNegotiatedDtlsRole(answer, _this._initiallyNegotiatedDtlsRole);
28089
+ });
28090
+ return typeof args[0] === 'function'
28091
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(args))) : promise;
28092
+ };
28093
+ // NOTE(mroberts): The WebRTC spec allows you to call createOffer from any
28094
+ // signalingState other than "closed"; however, Firefox has not yet implemented
28095
+ // this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388). We workaround
28096
+ // this by rolling back if we are in state "have-local-offer" or
28097
+ // "have-remote-offer". This is acceptable for our use case because we will
28098
+ // apply the newly-created offer almost immediately; however, this may be
28099
+ // unacceptable for other use cases.
28100
+ FirefoxRTCPeerConnection.prototype.createOffer = function () {
28101
+ var _this = this;
28102
+ var args = [];
28103
+ for (var _i = 0; _i < arguments.length; _i++) {
28104
+ args[_i] = arguments[_i];
28105
+ }
28106
+ var _a = __read(args, 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2];
28107
+ var options = arg3 || arg1 || {};
28108
+ var promise;
28109
+ if (this.signalingState === 'have-local-offer' ||
28110
+ this.signalingState === 'have-remote-offer') {
28111
+ var local = this.signalingState === 'have-local-offer';
28112
+ promise = rollback(this, local, function () { return _this.createOffer(options); });
28113
+ }
28114
+ else {
28115
+ promise = this._peerConnection.createOffer(options);
28116
+ }
28117
+ promise = promise.then(function (offer) {
28118
+ return new FirefoxRTCSessionDescription({
28119
+ type: offer.type,
28120
+ sdp: updateTracksToSSRCs(_this._tracksToSSRCs, offer.sdp)
28121
+ });
27803
28122
  });
27804
- });
27805
- return args.length > 1
27806
- ? util.legacyPromise(promise, args[0], args[1])
27807
- : promise;
27808
- };
27809
- // NOTE(mroberts): While Firefox will reject the Promise returned by
27810
- // setLocalDescription when called from signalingState "have-local-offer" with
27811
- // an answer, it still updates the .localDescription property. We workaround
27812
- // this by explicitly handling this case.
27813
- FirefoxRTCPeerConnection.prototype.setLocalDescription = function setLocalDescription() {
27814
- var args = [].slice.call(arguments);
27815
- var description = args[0];
27816
- var promise;
27817
- if (description && description.type === 'answer' && this.signalingState === 'have-local-offer') {
27818
- promise = Promise.reject(new Error('Cannot set local answer in state have-local-offer'));
27819
- }
27820
- if (promise) {
27821
28123
  return args.length > 1
27822
- ? util.legacyPromise(promise, args[1], args[2])
28124
+ ? legacyPromise(promise, arg1, arg2)
27823
28125
  : promise;
27824
- }
27825
- return this._peerConnection.setLocalDescription.apply(this._peerConnection, args);
27826
- };
27827
- // NOTE(mroberts): The WebRTC spec allows you to call setRemoteDescription with
27828
- // an offer multiple times in signalingState "have-remote-offer"; however,
27829
- // Firefox has not yet implemented this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388).
27830
- // We workaround this by rolling back if we are in state "have-remote-offer".
27831
- // This is acceptable for our use case; however, this may be unacceptable for
27832
- // other use cases.
27833
- //
27834
- // While Firefox will reject the Promise returned by setRemoteDescription when
27835
- // called from signalingState "have-remote-offer" with an answer, it sill
27836
- // updates the .remoteDescription property. We workaround this by explicitly
27837
- // handling this case.
27838
- FirefoxRTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription() {
27839
- var args = [].slice.call(arguments);
27840
- var description = args[0];
27841
- var promise;
27842
- var self = this;
27843
- if (description && this.signalingState === 'have-remote-offer') {
27844
- if (description.type === 'answer') {
27845
- promise = Promise.reject(new Error('Cannot set remote answer in state have-remote-offer'));
28126
+ };
28127
+ // NOTE(mroberts): While Firefox will reject the Promise returned by
28128
+ // setLocalDescription when called from signalingState "have-local-offer" with
28129
+ // an answer, it still updates the .localDescription property. We workaround
28130
+ // this by explicitly handling this case.
28131
+ FirefoxRTCPeerConnection.prototype.setLocalDescription = function () {
28132
+ var _a;
28133
+ var args = [];
28134
+ for (var _i = 0; _i < arguments.length; _i++) {
28135
+ args[_i] = arguments[_i];
27846
28136
  }
27847
- else if (description.type === 'offer') {
27848
- promise = rollback(this, false, function rollbackSucceeded() {
27849
- return self._peerConnection.setRemoteDescription(description);
27850
- });
28137
+ var _b = __read(args), description = _b[0], rest = _b.slice(1);
28138
+ var promise;
28139
+ if (description && description.type === 'answer' && this.signalingState === 'have-local-offer') {
28140
+ promise = Promise.reject(new Error('Cannot set local answer in state have-local-offer'));
27851
28141
  }
27852
- }
27853
- if (!promise) {
27854
- promise = this._peerConnection.setRemoteDescription(description);
27855
- }
27856
- promise = promise.then(function setRemoteDescriptionSucceeded() {
27857
- saveInitiallyNegotiatedDtlsRole(self, description, true);
27858
- });
27859
- return args.length > 1
27860
- ? util.legacyPromise(promise, args[1], args[2])
27861
- : promise;
27862
- };
27863
- // NOTE(mroberts): The WebRTC spec specifies that the PeerConnection's internal
27864
- // isClosed slot should immediately be set to true; however, in Firefox it
27865
- // occurs in the next tick. We workaround this by tracking isClosed manually.
27866
- FirefoxRTCPeerConnection.prototype.close = function close() {
27867
- if (this.signalingState !== 'closed') {
27868
- this._isClosed = true;
27869
- this._peerConnection.close();
27870
- }
27871
- };
27872
- util.delegateMethods(RTCPeerConnection.prototype, FirefoxRTCPeerConnection.prototype, '_peerConnection');
28142
+ if (promise) {
28143
+ return args.length > 1
28144
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;
28145
+ }
28146
+ return (_a = this._peerConnection).setLocalDescription.apply(_a, __spreadArray([], __read(args)));
28147
+ };
28148
+ // NOTE(mroberts): The WebRTC spec allows you to call setRemoteDescription with
28149
+ // an offer multiple times in signalingState "have-remote-offer"; however,
28150
+ // Firefox has not yet implemented this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388).
28151
+ // We workaround this by rolling back if we are in state "have-remote-offer".
28152
+ // This is acceptable for our use case; however, this may be unacceptable for
28153
+ // other use cases.
28154
+ //
28155
+ // While Firefox will reject the Promise returned by setRemoteDescription when
28156
+ // called from signalingState "have-remote-offer" with an answer, it sill
28157
+ // updates the .remoteDescription property. We workaround this by explicitly
28158
+ // handling this case.
28159
+ FirefoxRTCPeerConnection.prototype.setRemoteDescription = function () {
28160
+ var _this = this;
28161
+ var args = [];
28162
+ for (var _i = 0; _i < arguments.length; _i++) {
28163
+ args[_i] = arguments[_i];
28164
+ }
28165
+ var _a = __read(args), description = _a[0], rest = _a.slice(1);
28166
+ var promise;
28167
+ if (description && this.signalingState === 'have-remote-offer') {
28168
+ if (description.type === 'answer') {
28169
+ promise = Promise.reject(new Error('Cannot set remote answer in state have-remote-offer'));
28170
+ }
28171
+ else if (description.type === 'offer') {
28172
+ promise = rollback(this, false, function () { return _this._peerConnection.setRemoteDescription(description); });
28173
+ }
28174
+ }
28175
+ if (!promise) {
28176
+ promise = this._peerConnection.setRemoteDescription(description);
28177
+ }
28178
+ promise = promise.then(function () { return saveInitiallyNegotiatedDtlsRole(_this, description, true); });
28179
+ return args.length > 1
28180
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;
28181
+ };
28182
+ // NOTE(mroberts): The WebRTC spec specifies that the PeerConnection's internal
28183
+ // isClosed slot should immediately be set to true; however, in Firefox it
28184
+ // occurs in the next tick. We workaround this by tracking isClosed manually.
28185
+ FirefoxRTCPeerConnection.prototype.close = function () {
28186
+ if (this.signalingState !== 'closed') {
28187
+ this._isClosed = true;
28188
+ this._peerConnection.close();
28189
+ }
28190
+ };
28191
+ return FirefoxRTCPeerConnection;
28192
+ }(EventTarget));
28193
+ delegateMethods(RTCPeerConnection.prototype, FirefoxRTCPeerConnection.prototype, '_peerConnection');
27873
28194
  function rollback(peerConnection, local, onceRolledBack) {
27874
28195
  var setLocalDescription = local ? 'setLocalDescription' : 'setRemoteDescription';
27875
28196
  peerConnection._rollingBack = true;
27876
28197
  return peerConnection._peerConnection[setLocalDescription](new FirefoxRTCSessionDescription({
27877
28198
  type: 'rollback'
27878
- })).then(onceRolledBack).then(function onceRolledBackSucceeded(result) {
28199
+ })).then(onceRolledBack).then(function (result) {
27879
28200
  peerConnection._rollingBack = false;
27880
28201
  return result;
27881
- }, function rollbackOrOnceRolledBackFailed(error) {
28202
+ }, function (error) {
27882
28203
  peerConnection._rollingBack = false;
27883
28204
  throw error;
27884
28205
  });
@@ -27937,7 +28258,7 @@ function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
27937
28258
  }
27938
28259
  module.exports = FirefoxRTCPeerConnection;
27939
28260
 
27940
- },{"../../vendor/inherits":150,"../rtcsessiondescription/firefox":167,"../util":170,"../util/eventtarget":169,"../util/sdp":172}],163:[function(require,module,exports){
28261
+ },{"../../eventtarget":11,"../rtcsessiondescription/firefox":168,"../util":170,"../util/sdp":172}],164:[function(require,module,exports){
27941
28262
  'use strict';
27942
28263
  if (typeof RTCPeerConnection === 'function') {
27943
28264
  var guessBrowser = require('../util').guessBrowser;
@@ -27962,253 +28283,299 @@ else {
27962
28283
  };
27963
28284
  }
27964
28285
 
27965
- },{"../util":170,"./chrome":161,"./firefox":162,"./safari":164}],164:[function(require,module,exports){
28286
+ },{"../util":170,"./chrome":162,"./firefox":163,"./safari":165}],165:[function(require,module,exports){
27966
28287
  /* globals RTCPeerConnection, RTCSessionDescription */
27967
28288
  'use strict';
27968
- var EventTarget = require('../util/eventtarget');
27969
- var inherits = require('../../vendor/inherits');
28289
+ var __extends = (this && this.__extends) || (function () {
28290
+ var extendStatics = function (d, b) {
28291
+ extendStatics = Object.setPrototypeOf ||
28292
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28293
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
28294
+ return extendStatics(d, b);
28295
+ };
28296
+ return function (d, b) {
28297
+ if (typeof b !== "function" && b !== null)
28298
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
28299
+ extendStatics(d, b);
28300
+ function __() { this.constructor = d; }
28301
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28302
+ };
28303
+ })();
28304
+ var __read = (this && this.__read) || function (o, n) {
28305
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28306
+ if (!m) return o;
28307
+ var i = m.call(o), r, ar = [], e;
28308
+ try {
28309
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
28310
+ }
28311
+ catch (error) { e = { error: error }; }
28312
+ finally {
28313
+ try {
28314
+ if (r && !r.done && (m = i["return"])) m.call(i);
28315
+ }
28316
+ finally { if (e) throw e.error; }
28317
+ }
28318
+ return ar;
28319
+ };
28320
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
28321
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
28322
+ to[j] = from[i];
28323
+ return to;
28324
+ };
28325
+ var EventTarget = require('../../eventtarget');
27970
28326
  var Latch = require('../util/latch');
27971
- var sdpUtils = require('../util/sdp');
27972
- var util = require('../util');
27973
- var isUnifiedPlan = sdpUtils.getSdpFormat() === 'unified';
28327
+ var _a = require('../util/sdp'), getSdpFormat = _a.getSdpFormat, updatePlanBTrackIdsToSSRCs = _a.updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs = _a.updateUnifiedPlanTrackIdsToSSRCs;
28328
+ var _b = require('../util'), delegateMethods = _b.delegateMethods, interceptEvent = _b.interceptEvent, proxyProperties = _b.proxyProperties;
28329
+ var isUnifiedPlan = getSdpFormat() === 'unified';
27974
28330
  var updateTrackIdsToSSRCs = isUnifiedPlan
27975
- ? sdpUtils.updateUnifiedPlanTrackIdsToSSRCs
27976
- : sdpUtils.updatePlanBTrackIdsToSSRCs;
27977
- function SafariRTCPeerConnection(configuration) {
27978
- if (!(this instanceof SafariRTCPeerConnection)) {
27979
- return new SafariRTCPeerConnection(configuration);
27980
- }
27981
- EventTarget.call(this);
27982
- util.interceptEvent(this, 'datachannel');
27983
- util.interceptEvent(this, 'iceconnectionstatechange');
27984
- util.interceptEvent(this, 'signalingstatechange');
27985
- util.interceptEvent(this, 'track');
27986
- var peerConnection = new RTCPeerConnection(configuration);
27987
- Object.defineProperties(this, {
27988
- _appliedTracksToSSRCs: {
27989
- value: new Map(),
27990
- writable: true
27991
- },
27992
- _audioTransceiver: {
27993
- value: null,
27994
- writable: true
27995
- },
27996
- _isClosed: {
27997
- value: false,
27998
- writable: true
27999
- },
28000
- _peerConnection: {
28001
- value: peerConnection
28002
- },
28003
- _pendingLocalOffer: {
28004
- value: null,
28005
- writable: true
28006
- },
28007
- _pendingRemoteOffer: {
28008
- value: null,
28009
- writable: true
28010
- },
28011
- _rolledBackTracksToSSRCs: {
28012
- value: new Map(),
28013
- writable: true
28014
- },
28015
- _signalingStateLatch: {
28016
- value: new Latch()
28331
+ ? updateUnifiedPlanTrackIdsToSSRCs
28332
+ : updatePlanBTrackIdsToSSRCs;
28333
+ var SafariRTCPeerConnection = /** @class */ (function (_super) {
28334
+ __extends(SafariRTCPeerConnection, _super);
28335
+ function SafariRTCPeerConnection(configuration) {
28336
+ var _this = _super.call(this) || this;
28337
+ interceptEvent(_this, 'datachannel');
28338
+ interceptEvent(_this, 'iceconnectionstatechange');
28339
+ interceptEvent(_this, 'signalingstatechange');
28340
+ interceptEvent(_this, 'track');
28341
+ var peerConnection = new RTCPeerConnection(configuration);
28342
+ Object.defineProperties(_this, {
28343
+ _appliedTracksToSSRCs: {
28344
+ value: new Map(),
28345
+ writable: true
28346
+ },
28347
+ _audioTransceiver: {
28348
+ value: null,
28349
+ writable: true
28350
+ },
28351
+ _isClosed: {
28352
+ value: false,
28353
+ writable: true
28354
+ },
28355
+ _peerConnection: {
28356
+ value: peerConnection
28357
+ },
28358
+ _pendingLocalOffer: {
28359
+ value: null,
28360
+ writable: true
28361
+ },
28362
+ _pendingRemoteOffer: {
28363
+ value: null,
28364
+ writable: true
28365
+ },
28366
+ _rolledBackTracksToSSRCs: {
28367
+ value: new Map(),
28368
+ writable: true
28369
+ },
28370
+ _signalingStateLatch: {
28371
+ value: new Latch()
28372
+ },
28373
+ _tracksToSSRCs: {
28374
+ value: new Map(),
28375
+ writable: true
28376
+ },
28377
+ _videoTransceiver: {
28378
+ value: null,
28379
+ writable: true
28380
+ }
28381
+ });
28382
+ peerConnection.addEventListener('datachannel', function (event) {
28383
+ shimDataChannel(event.channel);
28384
+ _this.dispatchEvent(event);
28385
+ });
28386
+ peerConnection.addEventListener('iceconnectionstatechange', function () {
28387
+ var args = [];
28388
+ for (var _i = 0; _i < arguments.length; _i++) {
28389
+ args[_i] = arguments[_i];
28390
+ }
28391
+ if (_this._isClosed) {
28392
+ return;
28393
+ }
28394
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
28395
+ });
28396
+ peerConnection.addEventListener('signalingstatechange', function () {
28397
+ var args = [];
28398
+ for (var _i = 0; _i < arguments.length; _i++) {
28399
+ args[_i] = arguments[_i];
28400
+ }
28401
+ if (_this._isClosed) {
28402
+ return;
28403
+ }
28404
+ if (peerConnection.signalingState === 'stable') {
28405
+ _this._appliedTracksToSSRCs = new Map(_this._tracksToSSRCs);
28406
+ }
28407
+ if (!_this._pendingLocalOffer && !_this._pendingRemoteOffer) {
28408
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
28409
+ }
28410
+ });
28411
+ // NOTE(syerrapragada): This ensures that SafariRTCPeerConnection's "remoteDescription", when accessed
28412
+ // in an RTCTrackEvent listener, will point to the underlying RTCPeerConnection's
28413
+ // "remoteDescription". Before this fix, this was still pointing to "_pendingRemoteOffer"
28414
+ // even though a new remote RTCSessionDescription had already been applied.
28415
+ peerConnection.addEventListener('track', function (event) {
28416
+ _this._pendingRemoteOffer = null;
28417
+ _this.dispatchEvent(event);
28418
+ });
28419
+ proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);
28420
+ return _this;
28421
+ }
28422
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "localDescription", {
28423
+ get: function () {
28424
+ return this._pendingLocalOffer || this._peerConnection.localDescription;
28017
28425
  },
28018
- _tracksToSSRCs: {
28019
- value: new Map(),
28020
- writable: true
28426
+ enumerable: false,
28427
+ configurable: true
28428
+ });
28429
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "iceConnectionState", {
28430
+ get: function () {
28431
+ return this._isClosed ? 'closed' : this._peerConnection.iceConnectionState;
28021
28432
  },
28022
- _videoTransceiver: {
28023
- value: null,
28024
- writable: true
28433
+ enumerable: false,
28434
+ configurable: true
28435
+ });
28436
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "iceGatheringState", {
28437
+ get: function () {
28438
+ return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
28025
28439
  },
28026
- localDescription: {
28027
- enumerable: true,
28028
- get: function () {
28029
- return this._pendingLocalOffer || this._peerConnection.localDescription;
28030
- }
28440
+ enumerable: false,
28441
+ configurable: true
28442
+ });
28443
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "remoteDescription", {
28444
+ get: function () {
28445
+ return this._pendingRemoteOffer || this._peerConnection.remoteDescription;
28031
28446
  },
28032
- iceConnectionState: {
28033
- enumerable: true,
28034
- get: function () {
28035
- return this._isClosed ? 'closed' : this._peerConnection.iceConnectionState;
28447
+ enumerable: false,
28448
+ configurable: true
28449
+ });
28450
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "signalingState", {
28451
+ get: function () {
28452
+ if (this._isClosed) {
28453
+ return 'closed';
28036
28454
  }
28037
- },
28038
- iceGatheringState: {
28039
- enumerable: true,
28040
- get: function () {
28041
- return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
28455
+ else if (this._pendingLocalOffer) {
28456
+ return 'have-local-offer';
28042
28457
  }
28043
- },
28044
- remoteDescription: {
28045
- enumerable: true,
28046
- get: function () {
28047
- return this._pendingRemoteOffer || this._peerConnection.remoteDescription;
28458
+ else if (this._pendingRemoteOffer) {
28459
+ return 'have-remote-offer';
28048
28460
  }
28461
+ return this._peerConnection.signalingState;
28049
28462
  },
28050
- signalingState: {
28051
- enumerable: true,
28052
- get: function () {
28053
- if (this._isClosed) {
28054
- return 'closed';
28055
- }
28056
- else if (this._pendingLocalOffer) {
28057
- return 'have-local-offer';
28058
- }
28059
- else if (this._pendingRemoteOffer) {
28060
- return 'have-remote-offer';
28061
- }
28062
- return this._peerConnection.signalingState;
28063
- }
28064
- }
28065
- });
28066
- var self = this;
28067
- peerConnection.addEventListener('datachannel', function ondatachannel(event) {
28068
- shimDataChannel(event.channel);
28069
- self.dispatchEvent(event);
28070
- });
28071
- peerConnection.addEventListener('iceconnectionstatechange', function oniceconnectionstatechange() {
28072
- if (self._isClosed) {
28073
- return;
28074
- }
28075
- self.dispatchEvent.apply(self, arguments);
28463
+ enumerable: false,
28464
+ configurable: true
28076
28465
  });
28077
- peerConnection.addEventListener('signalingstatechange', function onsignalingstatechange() {
28078
- if (self._isClosed) {
28079
- return;
28466
+ SafariRTCPeerConnection.prototype.addIceCandidate = function (candidate) {
28467
+ var _this = this;
28468
+ if (this.signalingState === 'have-remote-offer') {
28469
+ return this._signalingStateLatch.when('low').then(function () { return _this._peerConnection.addIceCandidate(candidate); });
28080
28470
  }
28081
- if (peerConnection.signalingState === 'stable') {
28082
- self._appliedTracksToSSRCs = new Map(self._tracksToSSRCs);
28471
+ return this._peerConnection.addIceCandidate(candidate);
28472
+ };
28473
+ SafariRTCPeerConnection.prototype.createOffer = function (options) {
28474
+ var _this = this;
28475
+ options = Object.assign({}, options);
28476
+ // NOTE(mroberts): In general, this is not the way to do this; however, it's
28477
+ // good enough for our application.
28478
+ if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
28479
+ delete options.offerToReceiveAudio;
28480
+ try {
28481
+ this._audioTransceiver = isUnifiedPlan
28482
+ ? this.addTransceiver('audio', { direction: 'recvonly' })
28483
+ : this.addTransceiver('audio');
28484
+ }
28485
+ catch (e) {
28486
+ return Promise.reject(e);
28487
+ }
28083
28488
  }
28084
- if (!self._pendingLocalOffer && !self._pendingRemoteOffer) {
28085
- self.dispatchEvent.apply(self, arguments);
28489
+ if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
28490
+ delete options.offerToReceiveVideo;
28491
+ try {
28492
+ this._videoTransceiver = isUnifiedPlan
28493
+ ? this.addTransceiver('video', { direction: 'recvonly' })
28494
+ : this.addTransceiver('video');
28495
+ }
28496
+ catch (e) {
28497
+ return Promise.reject(e);
28498
+ }
28086
28499
  }
28087
- });
28088
- // NOTE(syerrapragada): This ensures that SafariRTCPeerConnection's "remoteDescription", when accessed
28089
- // in an RTCTrackEvent listener, will point to the underlying RTCPeerConnection's
28090
- // "remoteDescription". Before this fix, this was still pointing to "_pendingRemoteOffer"
28091
- // even though a new remote RTCSessionDescription had already been applied.
28092
- peerConnection.addEventListener('track', function ontrack(event) {
28093
- self._pendingRemoteOffer = null;
28094
- self.dispatchEvent(event);
28095
- });
28096
- util.proxyProperties(RTCPeerConnection.prototype, this, peerConnection);
28097
- }
28098
- inherits(SafariRTCPeerConnection, EventTarget);
28099
- SafariRTCPeerConnection.prototype.addIceCandidate = function addIceCandidate(candidate) {
28100
- var self = this;
28101
- if (this.signalingState === 'have-remote-offer') {
28102
- return this._signalingStateLatch.when('low').then(function signalingStatesResolved() {
28103
- return self._peerConnection.addIceCandidate(candidate);
28500
+ return this._peerConnection.createOffer(options).then(function (offer) {
28501
+ // NOTE(mmalavalli): If createOffer() is called immediately after rolling back,
28502
+ // then we no longer need to retain the rolled back tracks to SSRCs Map.
28503
+ _this._rolledBackTracksToSSRCs.clear();
28504
+ return new RTCSessionDescription({
28505
+ type: offer.type,
28506
+ sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, offer.sdp)
28507
+ });
28104
28508
  });
28105
- }
28106
- return this._peerConnection.addIceCandidate(candidate);
28107
- };
28108
- SafariRTCPeerConnection.prototype.createOffer = function createOffer(options) {
28109
- options = Object.assign({}, options);
28110
- var self = this;
28111
- // NOTE(mroberts): In general, this is not the way to do this; however, it's
28112
- // good enough for our application.
28113
- if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
28114
- delete options.offerToReceiveAudio;
28115
- try {
28116
- this._audioTransceiver = isUnifiedPlan
28117
- ? this.addTransceiver('audio', { direction: 'recvonly' })
28118
- : this.addTransceiver('audio');
28119
- }
28120
- catch (e) {
28121
- return Promise.reject(e);
28122
- }
28123
- }
28124
- if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
28125
- delete options.offerToReceiveVideo;
28126
- try {
28127
- this._videoTransceiver = isUnifiedPlan
28128
- ? this.addTransceiver('video', { direction: 'recvonly' })
28129
- : this.addTransceiver('video');
28130
- }
28131
- catch (e) {
28132
- return Promise.reject(e);
28509
+ };
28510
+ SafariRTCPeerConnection.prototype.createAnswer = function (options) {
28511
+ var _this = this;
28512
+ if (this._pendingRemoteOffer) {
28513
+ return this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function () {
28514
+ _this._signalingStateLatch.lower();
28515
+ return _this._peerConnection.createAnswer();
28516
+ }).then(function (answer) {
28517
+ _this._pendingRemoteOffer = null;
28518
+ // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
28519
+ // longer need to retain the rolled back tracks to SSRCs Map.
28520
+ _this._rolledBackTracksToSSRCs.clear();
28521
+ return isUnifiedPlan ? new RTCSessionDescription({
28522
+ type: answer.type,
28523
+ sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, answer.sdp)
28524
+ }) : answer;
28525
+ }, function (error) {
28526
+ _this._pendingRemoteOffer = null;
28527
+ throw error;
28528
+ });
28133
28529
  }
28134
- }
28135
- return this._peerConnection.createOffer(options).then(function (offer) {
28136
- // NOTE(mmalavalli): If createOffer() is called immediately after rolling back,
28137
- // then we no longer need to retain the rolled back tracks to SSRCs Map.
28138
- self._rolledBackTracksToSSRCs.clear();
28139
- return new RTCSessionDescription({
28140
- type: offer.type,
28141
- sdp: updateTrackIdsToSSRCs(self._tracksToSSRCs, offer.sdp)
28142
- });
28143
- });
28144
- };
28145
- SafariRTCPeerConnection.prototype.createAnswer = function createAnswer(options) {
28146
- var self = this;
28147
- if (this._pendingRemoteOffer) {
28148
- return this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function setRemoteDescriptionSucceeded() {
28149
- self._signalingStateLatch.lower();
28150
- return self._peerConnection.createAnswer();
28151
- }).then(function createAnswerSucceeded(answer) {
28152
- self._pendingRemoteOffer = null;
28530
+ return this._peerConnection.createAnswer(options).then(function (answer) {
28153
28531
  // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
28154
28532
  // longer need to retain the rolled back tracks to SSRCs Map.
28155
- self._rolledBackTracksToSSRCs.clear();
28533
+ _this._rolledBackTracksToSSRCs.clear();
28156
28534
  return isUnifiedPlan ? new RTCSessionDescription({
28157
28535
  type: answer.type,
28158
- sdp: updateTrackIdsToSSRCs(self._tracksToSSRCs, answer.sdp)
28536
+ sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, answer.sdp)
28159
28537
  }) : answer;
28160
- }, function setRemoteDescriptionOrCreateAnswerFailed(error) {
28161
- self._pendingRemoteOffer = null;
28162
- throw error;
28163
28538
  });
28164
- }
28165
- return this._peerConnection.createAnswer(options).then(function createAnswerSucceeded(answer) {
28166
- // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
28167
- // longer need to retain the rolled back tracks to SSRCs Map.
28168
- self._rolledBackTracksToSSRCs.clear();
28169
- return isUnifiedPlan ? new RTCSessionDescription({
28170
- type: answer.type,
28171
- sdp: updateTrackIdsToSSRCs(self._tracksToSSRCs, answer.sdp)
28172
- }) : answer;
28173
- });
28174
- };
28175
- SafariRTCPeerConnection.prototype.createDataChannel = function createDataChannel(label, dataChannelDict) {
28176
- var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);
28177
- shimDataChannel(dataChannel);
28178
- return dataChannel;
28179
- };
28180
- SafariRTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
28181
- sender.replaceTrack(null);
28182
- this._peerConnection.removeTrack(sender);
28183
- };
28184
- SafariRTCPeerConnection.prototype.setLocalDescription = function setLocalDescription(description) {
28185
- // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,
28186
- // then we need to restore the rolled back tracks to SSRCs Map.
28187
- if (this._rolledBackTracksToSSRCs.size > 0) {
28188
- this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);
28539
+ };
28540
+ SafariRTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {
28541
+ var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);
28542
+ shimDataChannel(dataChannel);
28543
+ return dataChannel;
28544
+ };
28545
+ SafariRTCPeerConnection.prototype.removeTrack = function (sender) {
28546
+ sender.replaceTrack(null);
28547
+ this._peerConnection.removeTrack(sender);
28548
+ };
28549
+ SafariRTCPeerConnection.prototype.setLocalDescription = function (description) {
28550
+ // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,
28551
+ // then we need to restore the rolled back tracks to SSRCs Map.
28552
+ if (this._rolledBackTracksToSSRCs.size > 0) {
28553
+ this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);
28554
+ this._rolledBackTracksToSSRCs.clear();
28555
+ }
28556
+ return setDescription(this, true, description);
28557
+ };
28558
+ SafariRTCPeerConnection.prototype.setRemoteDescription = function (description) {
28559
+ // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,
28560
+ // then we no longer need to retain the rolled back tracks to SSRCs Map.
28189
28561
  this._rolledBackTracksToSSRCs.clear();
28190
- }
28191
- return setDescription(this, true, description);
28192
- };
28193
- SafariRTCPeerConnection.prototype.setRemoteDescription = function setRemoteDescription(description) {
28194
- // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,
28195
- // then we no longer need to retain the rolled back tracks to SSRCs Map.
28196
- this._rolledBackTracksToSSRCs.clear();
28197
- return setDescription(this, false, description);
28198
- };
28199
- SafariRTCPeerConnection.prototype.close = function close() {
28200
- if (this._isClosed) {
28201
- return;
28202
- }
28203
- this._isClosed = true;
28204
- this._peerConnection.close();
28205
- var self = this;
28206
- setTimeout(function () {
28207
- self.dispatchEvent(new Event('iceconnectionstatechange'));
28208
- self.dispatchEvent(new Event('signalingstatechange'));
28209
- });
28210
- };
28211
- util.delegateMethods(RTCPeerConnection.prototype, SafariRTCPeerConnection.prototype, '_peerConnection');
28562
+ return setDescription(this, false, description);
28563
+ };
28564
+ SafariRTCPeerConnection.prototype.close = function () {
28565
+ var _this = this;
28566
+ if (this._isClosed) {
28567
+ return;
28568
+ }
28569
+ this._isClosed = true;
28570
+ this._peerConnection.close();
28571
+ setTimeout(function () {
28572
+ _this.dispatchEvent(new Event('iceconnectionstatechange'));
28573
+ _this.dispatchEvent(new Event('signalingstatechange'));
28574
+ });
28575
+ };
28576
+ return SafariRTCPeerConnection;
28577
+ }(EventTarget));
28578
+ delegateMethods(RTCPeerConnection.prototype, SafariRTCPeerConnection.prototype, '_peerConnection');
28212
28579
  function setDescription(peerConnection, local, description) {
28213
28580
  function setPendingLocalOffer(offer) {
28214
28581
  if (local) {
@@ -28235,8 +28602,7 @@ function setDescription(peerConnection, local, description) {
28235
28602
  }
28236
28603
  else if (description.type === 'offer') {
28237
28604
  if (peerConnection.signalingState !== intermediateState && peerConnection.signalingState !== 'stable') {
28238
- return Promise.reject(new Error('Cannot set ' + (local ? 'local' : 'remote') +
28239
- ' offer in state ' + peerConnection.signalingState));
28605
+ return Promise.reject(new Error("Cannot set " + (local ? 'local' : 'remote') + "\n offer in state " + peerConnection.signalingState));
28240
28606
  }
28241
28607
  if (!pendingLocalOffer && peerConnection._signalingStateLatch.state === 'low') {
28242
28608
  peerConnection._signalingStateLatch.raise();
@@ -28245,16 +28611,13 @@ function setDescription(peerConnection, local, description) {
28245
28611
  setPendingLocalOffer(description);
28246
28612
  // Only dispatch a signalingstatechange event if we transitioned.
28247
28613
  if (peerConnection.signalingState !== previousSignalingState) {
28248
- return Promise.resolve().then(function dispatchSignalingStateChangeEvent() {
28249
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
28250
- });
28614
+ return Promise.resolve().then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
28251
28615
  }
28252
28616
  return Promise.resolve();
28253
28617
  }
28254
28618
  else if (description.type === 'rollback') {
28255
28619
  if (peerConnection.signalingState !== intermediateState) {
28256
- return Promise.reject(new Error('Cannot rollback ' +
28257
- (local ? 'local' : 'remote') + ' description in ' + peerConnection.signalingState));
28620
+ return Promise.reject(new Error("Cannot rollback \n " + (local ? 'local' : 'remote') + " description in " + peerConnection.signalingState));
28258
28621
  }
28259
28622
  clearPendingLocalOffer();
28260
28623
  // NOTE(mmalavalli): We store the rolled back tracks to SSRCs Map here in case
@@ -28263,20 +28626,16 @@ function setDescription(peerConnection, local, description) {
28263
28626
  // a glare scenario and this Map should be restored.
28264
28627
  peerConnection._rolledBackTracksToSSRCs = new Map(peerConnection._tracksToSSRCs);
28265
28628
  peerConnection._tracksToSSRCs = new Map(peerConnection._appliedTracksToSSRCs);
28266
- return Promise.resolve().then(function dispatchSignalingStateChangeEvent() {
28267
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
28268
- });
28629
+ return Promise.resolve().then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
28269
28630
  }
28270
28631
  return peerConnection._peerConnection[setLocalDescription](description);
28271
28632
  }
28272
28633
  function setRemoteAnswer(peerConnection, answer) {
28273
28634
  var pendingLocalOffer = peerConnection._pendingLocalOffer;
28274
- return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function setLocalOfferSucceeded() {
28635
+ return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function () {
28275
28636
  peerConnection._pendingLocalOffer = null;
28276
28637
  return peerConnection.setRemoteDescription(answer);
28277
- }).then(function setRemoteAnswerSucceeded() {
28278
- peerConnection._signalingStateLatch.lower();
28279
- });
28638
+ }).then(function () { return peerConnection._signalingStateLatch.lower(); });
28280
28639
  }
28281
28640
  /**
28282
28641
  * Whether a SafariRTCPeerConnection has any RTCRtpReceivers(s) for the given
@@ -28286,8 +28645,10 @@ function setRemoteAnswer(peerConnection, answer) {
28286
28645
  * @returns {boolean}
28287
28646
  */
28288
28647
  function hasReceiversForTracksOfKind(peerConnection, kind) {
28289
- return !!peerConnection.getTransceivers().find(function (transceiver) {
28290
- return transceiver.receiver && transceiver.receiver.track && transceiver.receiver.track.kind === kind;
28648
+ return !!peerConnection.getTransceivers().find(function (_a) {
28649
+ var _b = _a.receiver, receiver = _b === void 0 ? {} : _b;
28650
+ var _c = receiver.track, track = _c === void 0 ? {} : _c;
28651
+ return track.kind === kind;
28291
28652
  });
28292
28653
  }
28293
28654
  /**
@@ -28311,22 +28672,25 @@ function shimDataChannel(dataChannel) {
28311
28672
  }
28312
28673
  module.exports = SafariRTCPeerConnection;
28313
28674
 
28314
- },{"../../vendor/inherits":150,"../util":170,"../util/eventtarget":169,"../util/latch":171,"../util/sdp":172}],165:[function(require,module,exports){
28675
+ },{"../../eventtarget":11,"../util":170,"../util/latch":171,"../util/sdp":172}],166:[function(require,module,exports){
28315
28676
  'use strict';
28316
28677
  /**
28317
28678
  * RTCRtpSender shim.
28318
28679
  * @param {MediaStreamTrack} track
28319
28680
  * @property {MediaStreamTrack} track
28320
28681
  */
28321
- function RTCRtpSenderShim(track) {
28322
- Object.defineProperties(this, {
28323
- track: {
28324
- enumerable: true,
28325
- value: track,
28326
- writable: true
28327
- }
28328
- });
28329
- }
28682
+ var RTCRtpSenderShim = /** @class */ (function () {
28683
+ function RTCRtpSenderShim(track) {
28684
+ Object.defineProperties(this, {
28685
+ track: {
28686
+ enumerable: true,
28687
+ value: track,
28688
+ writable: true
28689
+ }
28690
+ });
28691
+ }
28692
+ return RTCRtpSenderShim;
28693
+ }());
28330
28694
  // NOTE(mmalavalli): Because of the way we will be using this shim, there
28331
28695
  // are a couple of use cases that will not be covered:
28332
28696
  //
@@ -28349,7 +28713,7 @@ function RTCRtpSenderShim(track) {
28349
28713
  // using the RTCRtpSender APIs.
28350
28714
  module.exports = RTCRtpSenderShim;
28351
28715
 
28352
- },{}],166:[function(require,module,exports){
28716
+ },{}],167:[function(require,module,exports){
28353
28717
  /* globals RTCSessionDescription */
28354
28718
  'use strict';
28355
28719
  // This class wraps Chrome's RTCSessionDescription implementation. It provides
@@ -28358,40 +28722,47 @@ module.exports = RTCRtpSenderShim;
28358
28722
  // 1. Rollback support
28359
28723
  // https://bugs.chromium.org/p/webrtc/issues/detail?id=4676
28360
28724
  //
28361
- function ChromeRTCSessionDescription(descriptionInitDict) {
28362
- if (!(this instanceof ChromeRTCSessionDescription)) {
28363
- return new ChromeRTCSessionDescription(descriptionInitDict);
28364
- }
28365
- // If this constructor is called with an object with a .type property set to
28366
- // "rollback", we should not call Chrome's RTCSessionDescription constructor,
28367
- // because this would throw an RTCSdpType error.
28368
- var description = descriptionInitDict && descriptionInitDict.type === 'rollback'
28369
- ? null
28370
- : new RTCSessionDescription(descriptionInitDict);
28371
- Object.defineProperties(this, {
28372
- _description: {
28373
- get: function () {
28374
- return description;
28725
+ var ChromeRTCSessionDescription = /** @class */ (function () {
28726
+ function ChromeRTCSessionDescription(descriptionInitDict) {
28727
+ this.descriptionInitDict = descriptionInitDict;
28728
+ // If this constructor is called with an object with a .type property set to
28729
+ // "rollback", we should not call Chrome's RTCSessionDescription constructor,
28730
+ // because this would throw an RTCSdpType error.
28731
+ var description = descriptionInitDict && descriptionInitDict.type === 'rollback'
28732
+ ? null
28733
+ : new RTCSessionDescription(descriptionInitDict);
28734
+ Object.defineProperties(this, {
28735
+ _description: {
28736
+ get: function () {
28737
+ return description;
28738
+ }
28375
28739
  }
28740
+ });
28741
+ }
28742
+ Object.defineProperty(ChromeRTCSessionDescription.prototype, "sdp", {
28743
+ get: function () {
28744
+ return this._description ? this._description.sdp : this.descriptionInitDict.sdp;
28376
28745
  },
28377
- sdp: {
28378
- enumerable: true,
28379
- value: description ? description.sdp : descriptionInitDict.sdp
28746
+ enumerable: false,
28747
+ configurable: true
28748
+ });
28749
+ Object.defineProperty(ChromeRTCSessionDescription.prototype, "type", {
28750
+ get: function () {
28751
+ return this._description ? this._description.type : this.descriptionInitDict.type;
28380
28752
  },
28381
- type: {
28382
- enumerable: true,
28383
- value: description ? description.type : descriptionInitDict.type
28384
- }
28753
+ enumerable: false,
28754
+ configurable: true
28385
28755
  });
28386
- }
28756
+ return ChromeRTCSessionDescription;
28757
+ }());
28387
28758
  module.exports = ChromeRTCSessionDescription;
28388
28759
 
28389
- },{}],167:[function(require,module,exports){
28760
+ },{}],168:[function(require,module,exports){
28390
28761
  /* globals RTCSessionDescription */
28391
28762
  'use strict';
28392
28763
  module.exports = RTCSessionDescription;
28393
28764
 
28394
- },{}],168:[function(require,module,exports){
28765
+ },{}],169:[function(require,module,exports){
28395
28766
  /* globals RTCSessionDescription */
28396
28767
  'use strict';
28397
28768
  if (typeof RTCSessionDescription === 'function') {
@@ -28414,43 +28785,29 @@ else {
28414
28785
  };
28415
28786
  }
28416
28787
 
28417
- },{"../util":170,"./chrome":166,"./firefox":167}],169:[function(require,module,exports){
28788
+ },{"../util":170,"./chrome":167,"./firefox":168}],170:[function(require,module,exports){
28418
28789
  'use strict';
28419
- var EventEmitter = require('events').EventEmitter;
28420
- /**
28421
- * Event target.
28422
- * @class
28423
- */
28424
- function EventTarget() {
28425
- Object.defineProperties(this, {
28426
- _eventEmitter: {
28427
- value: new EventEmitter()
28790
+ var __read = (this && this.__read) || function (o, n) {
28791
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28792
+ if (!m) return o;
28793
+ var i = m.call(o), r, ar = [], e;
28794
+ try {
28795
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
28796
+ }
28797
+ catch (error) { e = { error: error }; }
28798
+ finally {
28799
+ try {
28800
+ if (r && !r.done && (m = i["return"])) m.call(i);
28428
28801
  }
28429
- });
28430
- }
28431
- /**
28432
- * Dispatch an Event to the {@link EventTarget}.
28433
- * @param {Event} event
28434
- */
28435
- EventTarget.prototype.dispatchEvent = function dispatchEvent(event) {
28436
- return this._eventEmitter.emit(event.type, event);
28437
- };
28438
- /**
28439
- * Add an Event listener to the {@link EventTarget}.
28440
- */
28441
- EventTarget.prototype.addEventListener = function addEventListener() {
28442
- return this._eventEmitter.addListener.apply(this._eventEmitter, arguments);
28802
+ finally { if (e) throw e.error; }
28803
+ }
28804
+ return ar;
28443
28805
  };
28444
- /**
28445
- * Remove an Event listener to the {@link EventTarget}.
28446
- */
28447
- EventTarget.prototype.removeEventListener = function removeEventListener() {
28448
- return this._eventEmitter.removeListener.apply(this._eventEmitter, arguments);
28806
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
28807
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
28808
+ to[j] = from[i];
28809
+ return to;
28449
28810
  };
28450
- module.exports = EventTarget;
28451
-
28452
- },{"events":173}],170:[function(require,module,exports){
28453
- 'use strict';
28454
28811
  /**
28455
28812
  * Create a {@link Deferred}.
28456
28813
  * @returns {Deferred}
@@ -28557,10 +28914,7 @@ function flatMap(list, mapFn) {
28557
28914
  var listArray = list instanceof Map || list instanceof Set
28558
28915
  ? Array.from(list.values())
28559
28916
  : list;
28560
- return listArray.reduce(function (flattened, item) {
28561
- var mapped = mapFn(item);
28562
- return flattened.concat(mapped);
28563
- }, []);
28917
+ return listArray.reduce(function (flattened, item) { return flattened.concat(mapFn(item)); }, []);
28564
28918
  }
28565
28919
  /**
28566
28920
  * Get the browser's user agent, if available.
@@ -28608,8 +28962,8 @@ function guessBrowserVersion(userAgent) {
28608
28962
  if (!prefix) {
28609
28963
  return null;
28610
28964
  }
28611
- var regex = new RegExp('(' + prefix + ')/([^\\s]+)');
28612
- var match = (userAgent.match(regex) || [])[2];
28965
+ var regex = new RegExp("(" + prefix + ")/([^\\s]+)");
28966
+ var _a = __read(userAgent.match(regex) || [], 3), match = _a[2];
28613
28967
  if (!match) {
28614
28968
  return null;
28615
28969
  }
@@ -28665,14 +29019,9 @@ function interceptEvent(target, type) {
28665
29019
  * @returns {Promise<undefined>}
28666
29020
  */
28667
29021
  function legacyPromise(promise, onSuccess, onFailure) {
28668
- if (onSuccess) {
28669
- return promise.then(function (result) {
28670
- onSuccess(result);
28671
- }, function (error) {
28672
- onFailure(error);
28673
- });
28674
- }
28675
- return promise;
29022
+ return onSuccess
29023
+ ? promise.then(onSuccess, onFailure)
29024
+ : promise;
28676
29025
  }
28677
29026
  /**
28678
29027
  * Make a unique ID.
@@ -28718,7 +29067,11 @@ function proxyProperty(source, wrapper, target, propertyName) {
28718
29067
  writable: true
28719
29068
  });
28720
29069
  target.addEventListener(propertyName.slice(2), function () {
28721
- wrapper.dispatchEvent.apply(wrapper, arguments);
29070
+ var args = [];
29071
+ for (var _i = 0; _i < arguments.length; _i++) {
29072
+ args[_i] = arguments[_i];
29073
+ }
29074
+ return wrapper.dispatchEvent.apply(wrapper, __spreadArray([], __read(args)));
28722
29075
  });
28723
29076
  return;
28724
29077
  }
@@ -28772,103 +29125,103 @@ var states = {
28772
29125
  * transitioning between them ({@link Latch#raise} and {@link Latch#lower}).
28773
29126
  * @param {string} [initialState="low"] - either "high" or "low"
28774
29127
  */
28775
- function Latch(initialState) {
28776
- if (!(this instanceof Latch)) {
28777
- return new Latch(initialState);
28778
- }
28779
- var state = initialState || 'low';
28780
- Object.defineProperties(this, {
28781
- _state: {
28782
- set: function (_state) {
28783
- if (state !== _state) {
28784
- state = _state;
28785
- var whenDeferreds = this._whenDeferreds.get(state);
28786
- whenDeferreds.forEach(function (deferred) {
28787
- deferred.resolve(this);
28788
- }, this);
28789
- whenDeferreds.clear();
29128
+ var Latch = /** @class */ (function () {
29129
+ function Latch(initialState) {
29130
+ if (initialState === void 0) { initialState = 'low'; }
29131
+ var state = initialState;
29132
+ Object.defineProperties(this, {
29133
+ _state: {
29134
+ set: function (_state) {
29135
+ var _this = this;
29136
+ if (state !== _state) {
29137
+ state = _state;
29138
+ var whenDeferreds = this._whenDeferreds.get(state);
29139
+ whenDeferreds.forEach(function (deferred) { return deferred.resolve(_this); });
29140
+ whenDeferreds.clear();
29141
+ }
29142
+ },
29143
+ get: function () {
29144
+ return state;
28790
29145
  }
28791
29146
  },
28792
- get: function () {
28793
- return state;
29147
+ _whenDeferreds: {
29148
+ value: new Map([
29149
+ ['high', new Set()],
29150
+ ['low', new Set()]
29151
+ ])
28794
29152
  }
29153
+ });
29154
+ }
29155
+ Object.defineProperty(Latch.prototype, "state", {
29156
+ get: function () {
29157
+ return this._state;
28795
29158
  },
28796
- _whenDeferreds: {
28797
- value: new Map([
28798
- ['high', new Set()],
28799
- ['low', new Set()]
28800
- ])
28801
- },
28802
- state: {
28803
- enumerable: true,
28804
- get: function () {
28805
- return this._state;
28806
- }
28807
- }
29159
+ enumerable: false,
29160
+ configurable: true
28808
29161
  });
28809
- }
28810
- /**
28811
- * Transition to "low".
28812
- * @returns {this}
28813
- * @throws {Error}
28814
- */
28815
- Latch.prototype.lower = function lower() {
28816
- return this.transition('low');
28817
- };
28818
- /**
28819
- * Transition to "high".
28820
- * @returns {this}
28821
- * @throws {Error}
28822
- */
28823
- Latch.prototype.raise = function raise() {
28824
- return this.transition('high');
28825
- };
28826
- /**
28827
- * Transition to a new state.
28828
- * @param {string} newState
28829
- * @returns {this}
28830
- * @throws {Error}
28831
- */
28832
- Latch.prototype.transition = function transition(newState) {
28833
- if (!states[this.state].has(newState)) {
28834
- throw createUnreachableStateError(this.state, newState);
28835
- }
28836
- this._state = newState;
28837
- return this;
28838
- };
28839
- /**
28840
- * Return a Promise that resolves when the {@link Latch} transitions to
28841
- * the specified state.
28842
- * @param {string} state
28843
- * @returns {Promise<this>}
28844
- */
28845
- Latch.prototype.when = function when(state) {
28846
- if (this.state === state) {
28847
- return Promise.resolve(this);
28848
- }
28849
- if (!states[this.state].has(state)) {
28850
- return Promise.reject(createUnreachableStateError(this.state, state));
28851
- }
28852
- var deferred = defer();
28853
- this._whenDeferreds.get(state).add(deferred);
28854
- return deferred.promise;
28855
- };
29162
+ /**
29163
+ * Transition to "low".
29164
+ * @returns {this}
29165
+ * @throws {Error}
29166
+ */
29167
+ Latch.prototype.lower = function () {
29168
+ return this.transition('low');
29169
+ };
29170
+ /**
29171
+ * Transition to "high".
29172
+ * @returns {this}
29173
+ * @throws {Error}
29174
+ */
29175
+ Latch.prototype.raise = function () {
29176
+ return this.transition('high');
29177
+ };
29178
+ /**
29179
+ * Transition to a new state.
29180
+ * @param {string} newState
29181
+ * @returns {this}
29182
+ * @throws {Error}
29183
+ */
29184
+ Latch.prototype.transition = function (newState) {
29185
+ if (!states[this.state].has(newState)) {
29186
+ throw createUnreachableStateError(this.state, newState);
29187
+ }
29188
+ this._state = newState;
29189
+ return this;
29190
+ };
29191
+ /**
29192
+ * Return a Promise that resolves when the {@link Latch} transitions to
29193
+ * the specified state.
29194
+ * @param {string} state
29195
+ * @returns {Promise<this>}
29196
+ */
29197
+ Latch.prototype.when = function (state) {
29198
+ if (this.state === state) {
29199
+ return Promise.resolve(this);
29200
+ }
29201
+ if (!states[this.state].has(state)) {
29202
+ return Promise.reject(createUnreachableStateError(this.state, state));
29203
+ }
29204
+ var deferred = defer();
29205
+ this._whenDeferreds.get(state).add(deferred);
29206
+ return deferred.promise;
29207
+ };
29208
+ return Latch;
29209
+ }());
28856
29210
  /**
28857
- * Create an unreachable state Error.
28858
- * @param {string} from - state to be transitioned from
28859
- * @param {string} to - state to be transitioned to
28860
- * @return {Error}
28861
- */
29211
+ * Create an unreachable state Error.
29212
+ * @param {string} from - state to be transitioned from
29213
+ * @param {string} to - state to be transitioned to
29214
+ * @return {Error}
29215
+ */
28862
29216
  function createUnreachableStateError(from, to) {
28863
- return new Error('Cannot transition from "' + from + '" to "' + to + '"');
29217
+ return new Error("Cannot transition from \"" + from + "\" to \"" + to + "\"");
28864
29218
  }
28865
29219
  module.exports = Latch;
28866
29220
 
28867
29221
  },{"./":170}],172:[function(require,module,exports){
28868
29222
  /* globals RTCPeerConnection, RTCRtpTransceiver */
28869
29223
  'use strict';
28870
- var flatMap = require('./').flatMap;
28871
- var guessBrowser = require('./').guessBrowser;
29224
+ var _a = require('./'), flatMap = _a.flatMap, guessBrowser = _a.guessBrowser;
28872
29225
  // NOTE(mmalavalli): We cache Chrome's sdpSemantics support in order to prevent
28873
29226
  // instantiation of more than one RTCPeerConnection.
28874
29227
  var isSdpSemanticsSupported = null;
@@ -29009,7 +29362,7 @@ function getUnifiedPlanTrackIds(sdp) {
29009
29362
  * @returns {Set<string>}
29010
29363
  */
29011
29364
  function getPlanBSSRCs(sdp, trackId) {
29012
- var pattern = '^a=ssrc:([0-9]+) +msid:[^ ]+ +' + trackId + ' *$';
29365
+ var pattern = "^a=ssrc:([0-9]+) +msid:[^ ]+ +" + trackId + " *$";
29013
29366
  return getMatches(pattern, sdp);
29014
29367
  }
29015
29368
  /**
@@ -29020,13 +29373,11 @@ function getPlanBSSRCs(sdp, trackId) {
29020
29373
  * @returns {Array<string>} mediaSections
29021
29374
  */
29022
29375
  function getMediaSections(sdp, kind, direction) {
29023
- kind = kind || '.*';
29024
- direction = direction || '.*';
29025
- return sdp.split('\r\nm=').slice(1).map(function (mediaSection) {
29026
- return 'm=' + mediaSection;
29027
- }).filter(function (mediaSection) {
29028
- var kindPattern = new RegExp('m=' + kind, 'gm');
29029
- var directionPattern = new RegExp('a=' + direction, 'gm');
29376
+ if (kind === void 0) { kind = '.*'; }
29377
+ if (direction === void 0) { direction = '.*'; }
29378
+ return sdp.split('\r\nm=').slice(1).map(function (mediaSection) { return "m=" + mediaSection; }).filter(function (mediaSection) {
29379
+ var kindPattern = new RegExp("m=" + kind, 'gm');
29380
+ var directionPattern = new RegExp("a=" + direction, 'gm');
29030
29381
  return kindPattern.test(mediaSection) && directionPattern.test(mediaSection);
29031
29382
  });
29032
29383
  }
@@ -29046,10 +29397,8 @@ function getMediaSectionSSRCs(mediaSection) {
29046
29397
  */
29047
29398
  function getUnifiedPlanSSRCs(sdp, trackId) {
29048
29399
  var mediaSections = getMediaSections(sdp);
29049
- var msidAttrRegExp = new RegExp('^a=msid:[^ ]+ +' + trackId + ' *$', 'gm');
29050
- var matchingMediaSections = mediaSections.filter(function (mediaSection) {
29051
- return mediaSection.match(msidAttrRegExp);
29052
- });
29400
+ var msidAttrRegExp = new RegExp("^a=msid:[^ ]+ +" + trackId + " *$", 'gm');
29401
+ var matchingMediaSections = mediaSections.filter(function (mediaSection) { return mediaSection.match(msidAttrRegExp); });
29053
29402
  return new Set(flatMap(matchingMediaSections, getMediaSectionSSRCs));
29054
29403
  }
29055
29404
  /**
@@ -29060,9 +29409,7 @@ function getUnifiedPlanSSRCs(sdp, trackId) {
29060
29409
  * @returns {Map<string, Set<string>>} trackIdsToSSRCs
29061
29410
  */
29062
29411
  function getTrackIdsToSSRCs(getTrackIds, getSSRCs, sdp) {
29063
- return new Map(Array.from(getTrackIds(sdp)).map(function (trackId) {
29064
- return [trackId, getSSRCs(sdp, trackId)];
29065
- }));
29412
+ return new Map(Array.from(getTrackIds(sdp)).map(function (trackId) { return [trackId, getSSRCs(sdp, trackId)]; }));
29066
29413
  }
29067
29414
  /**
29068
29415
  * Get a Map from MediaStreamTrack IDs to SSRCs from a Plan B SDP.
@@ -29103,8 +29450,8 @@ function updateTrackIdsToSSRCs(getTrackIdsToSSRCs, trackIdsToSSRCs, sdp) {
29103
29450
  oldSSRCs.forEach(function (oldSSRC, i) {
29104
29451
  var newSSRC = newSSRCs[i];
29105
29452
  newSSRCsToOldSSRCs.set(newSSRC, oldSSRC);
29106
- var pattern = '^a=ssrc:' + newSSRC + ' (.*)$';
29107
- var replacement = 'a=ssrc:' + oldSSRC + ' $1';
29453
+ var pattern = "^a=ssrc:" + newSSRC + " (.*)$";
29454
+ var replacement = "a=ssrc:" + oldSSRC + " $1";
29108
29455
  sdp = sdp.replace(new RegExp(pattern, 'gm'), replacement);
29109
29456
  });
29110
29457
  });
@@ -29662,7 +30009,7 @@ module.exports={
29662
30009
  "name": "twilio-video",
29663
30010
  "title": "Twilio Video",
29664
30011
  "description": "Twilio Video JavaScript Library",
29665
- "version": "2.25.0",
30012
+ "version": "2.26.0",
29666
30013
  "homepage": "https://twilio.com",
29667
30014
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
29668
30015
  "contributors": [
@@ -29713,7 +30060,7 @@ module.exports={
29713
30060
  "jsdoc": "^3.5.5",
29714
30061
  "jsdoc-babel": "^0.5.0",
29715
30062
  "json-loader": "^0.5.7",
29716
- "karma": "^5.0.2",
30063
+ "karma": "6.4.1",
29717
30064
  "karma-browserify": "^8.0.0",
29718
30065
  "karma-chrome-launcher": "^2.0.0",
29719
30066
  "karma-edgium-launcher": "^4.0.0-0",
@@ -29819,9 +30166,9 @@ module.exports={
29819
30166
  },{}],175:[function(require,module,exports){
29820
30167
  module.exports = WebSocket;
29821
30168
 
29822
- },{}]},{},[11]);
30169
+ },{}]},{},[12]);
29823
30170
  ;
29824
- var Video = bundle(11);
30171
+ var Video = bundle(12);
29825
30172
  /* globals define */
29826
30173
  if (typeof define === 'function' && define.amd) {
29827
30174
  define([], function() { return Video; });