twilio-video 2.25.0 → 2.26.1

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 (73) hide show
  1. package/CHANGELOG.md +124 -1
  2. package/README.md +1 -1
  3. package/dist/twilio-video.js +1488 -1140
  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/twilioconnection.js +3 -0
  18. package/es5/twilioconnection.js.map +1 -1
  19. package/es5/webrtc/getstats.js +79 -64
  20. package/es5/webrtc/getstats.js.map +1 -1
  21. package/es5/webrtc/getusermedia.js +1 -1
  22. package/es5/webrtc/getusermedia.js.map +1 -1
  23. package/es5/webrtc/index.js.map +1 -1
  24. package/es5/webrtc/rtcpeerconnection/chrome.js +339 -286
  25. package/es5/webrtc/rtcpeerconnection/chrome.js.map +1 -1
  26. package/es5/webrtc/rtcpeerconnection/firefox.js +225 -179
  27. package/es5/webrtc/rtcpeerconnection/firefox.js.map +1 -1
  28. package/es5/webrtc/rtcpeerconnection/index.js.map +1 -1
  29. package/es5/webrtc/rtcpeerconnection/safari.js +276 -236
  30. package/es5/webrtc/rtcpeerconnection/safari.js.map +1 -1
  31. package/es5/webrtc/rtcrtpsender.js +12 -9
  32. package/es5/webrtc/rtcrtpsender.js.map +1 -1
  33. package/es5/webrtc/rtcsessiondescription/chrome.js +29 -22
  34. package/es5/webrtc/rtcsessiondescription/chrome.js.map +1 -1
  35. package/es5/webrtc/rtcsessiondescription/index.js.map +1 -1
  36. package/es5/webrtc/util/index.js +32 -15
  37. package/es5/webrtc/util/index.js.map +1 -1
  38. package/es5/webrtc/util/latch.js +83 -82
  39. package/es5/webrtc/util/latch.js.map +1 -1
  40. package/es5/webrtc/util/sdp.js +12 -19
  41. package/es5/webrtc/util/sdp.js.map +1 -1
  42. package/lib/media/track/localaudiotrack.js +30 -8
  43. package/lib/media/track/localmediatrack.js +29 -0
  44. package/lib/media/track/localvideotrack.js +33 -10
  45. package/lib/media/track/sender.js +42 -1
  46. package/lib/room.js +41 -1
  47. package/lib/transceiver.js +3 -3
  48. package/lib/twilioconnection.js +4 -0
  49. package/lib/webrtc/getstats.js +157 -175
  50. package/lib/webrtc/getusermedia.js +1 -2
  51. package/lib/webrtc/index.js +1 -1
  52. package/lib/webrtc/rtcpeerconnection/chrome.js +284 -316
  53. package/lib/webrtc/rtcpeerconnection/firefox.js +173 -197
  54. package/lib/webrtc/rtcpeerconnection/index.js +1 -1
  55. package/lib/webrtc/rtcpeerconnection/safari.js +228 -256
  56. package/lib/webrtc/rtcrtpsender.js +10 -8
  57. package/lib/webrtc/rtcsessiondescription/chrome.js +24 -24
  58. package/lib/webrtc/rtcsessiondescription/index.js +1 -1
  59. package/lib/webrtc/util/index.js +26 -33
  60. package/lib/webrtc/util/latch.js +78 -83
  61. package/lib/webrtc/util/sdp.js +32 -41
  62. package/package.json +2 -2
  63. package/tsdef/AudioTrack.d.ts +2 -13
  64. package/tsdef/LocalAudioTrack.d.ts +3 -0
  65. package/tsdef/LocalVideoTrack.d.ts +3 -0
  66. package/tsdef/MediaTrack.d.ts +16 -0
  67. package/tsdef/Room.d.ts +1 -0
  68. package/tsdef/VideoTrack.d.ts +2 -12
  69. package/tsdef/index.d.ts +4 -3
  70. package/tsdef/twilio-video-tests.ts +3 -0
  71. package/es5/webrtc/util/eventtarget.js +0 -34
  72. package/es5/webrtc/util/eventtarget.js.map +0 -1
  73. 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.1
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) {
@@ -20053,6 +20258,9 @@ var WS_CLOSE_NETWORK_CHANGED = 3004;
20053
20258
  var WS_CLOSE_BUSY_WAIT = 3005;
20054
20259
  var WS_CLOSE_SERVER_BUSY = 3006;
20055
20260
  var WS_CLOSE_OPEN_TIMEOUT = 3007;
20261
+ // NOTE(joma): If you want to use close code 3008, please increment
20262
+ // the close code in test/integration/spec/docker/reconnection.js
20263
+ // line number 492.
20056
20264
  var toplevel = globalThis;
20057
20265
  var WebSocket = toplevel.WebSocket ? toplevel.WebSocket : require('ws');
20058
20266
  var CloseReason = {
@@ -20615,7 +20823,7 @@ TwilioConnection.CloseReason = CloseReason;
20615
20823
  */
20616
20824
  module.exports = TwilioConnection;
20617
20825
 
20618
- },{"./statemachine":87,"./util":131,"./util/log":135,"./util/networkmonitor":137,"./util/timeout":145,"ws":175}],120:[function(require,module,exports){
20826
+ },{"./statemachine":88,"./util":132,"./util/log":136,"./util/networkmonitor":138,"./util/timeout":146,"ws":175}],121:[function(require,module,exports){
20619
20827
  'use strict';
20620
20828
  var defer = require('./').defer;
20621
20829
  /**
@@ -20680,7 +20888,7 @@ var AsyncVar = /** @class */ (function () {
20680
20888
  }());
20681
20889
  module.exports = AsyncVar;
20682
20890
 
20683
- },{"./":131}],121:[function(require,module,exports){
20891
+ },{"./":132}],122:[function(require,module,exports){
20684
20892
  /**
20685
20893
  * Expose `Backoff`.
20686
20894
  */
@@ -20764,7 +20972,7 @@ var Backoff = /** @class */ (function () {
20764
20972
  }());
20765
20973
  module.exports = Backoff;
20766
20974
 
20767
- },{}],122:[function(require,module,exports){
20975
+ },{}],123:[function(require,module,exports){
20768
20976
  /* globals chrome, navigator */
20769
20977
  'use strict';
20770
20978
  var __read = (this && this.__read) || function (o, n) {
@@ -20922,7 +21130,7 @@ module.exports = {
20922
21130
  rebrandedChromeBrowser: rebrandedChromeBrowser
20923
21131
  };
20924
21132
 
20925
- },{}],123:[function(require,module,exports){
21133
+ },{}],124:[function(require,module,exports){
20926
21134
  'use strict';
20927
21135
  var __read = (this && this.__read) || function (o, n) {
20928
21136
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -21065,7 +21273,7 @@ var CancelablePromise = /** @class */ (function () {
21065
21273
  }());
21066
21274
  module.exports = CancelablePromise;
21067
21275
 
21068
- },{}],124:[function(require,module,exports){
21276
+ },{}],125:[function(require,module,exports){
21069
21277
  'use strict';
21070
21278
  /* eslint-disable camelcase */
21071
21279
  var packageInfo = require('../../package.json');
@@ -21167,7 +21375,7 @@ module.exports.videoContentPreferencesMode = {
21167
21375
  MODE_MANUAL: 'manual'
21168
21376
  };
21169
21377
 
21170
- },{"../../package.json":174}],125:[function(require,module,exports){
21378
+ },{"../../package.json":174}],126:[function(require,module,exports){
21171
21379
  'use strict';
21172
21380
  var detectSilence = require('../webaudio/detectsilence');
21173
21381
  var N_ATTEMPTS = 3;
@@ -21208,7 +21416,7 @@ function detectSilentAudio(el) {
21208
21416
  }
21209
21417
  module.exports = detectSilentAudio;
21210
21418
 
21211
- },{"../webaudio/audiocontext":152,"../webaudio/detectsilence":153}],126:[function(require,module,exports){
21419
+ },{"../webaudio/audiocontext":153,"../webaudio/detectsilence":154}],127:[function(require,module,exports){
21212
21420
  'use strict';
21213
21421
  // Cached copy of the <canvas> used to check silent video frames.
21214
21422
  var canvas = null;
@@ -21267,7 +21475,7 @@ function detectSilentVideo(el) {
21267
21475
  }
21268
21476
  module.exports = detectSilentVideo;
21269
21477
 
21270
- },{}],127:[function(require,module,exports){
21478
+ },{}],128:[function(require,module,exports){
21271
21479
  'use strict';
21272
21480
  /**
21273
21481
  * The {@link DocumentVisibilityMonitor} monitors the visibility state of the DOM
@@ -21389,7 +21597,7 @@ var DocumentVisibilityMonitor = /** @class */ (function () {
21389
21597
  }());
21390
21598
  module.exports = new DocumentVisibilityMonitor(2);
21391
21599
 
21392
- },{}],128:[function(require,module,exports){
21600
+ },{}],129:[function(require,module,exports){
21393
21601
  'use strict';
21394
21602
  module.exports = (function (scope) {
21395
21603
  var location = scope.location, URL = scope.URL;
@@ -21412,7 +21620,7 @@ module.exports = (function (scope) {
21412
21620
  };
21413
21621
  }(globalThis));
21414
21622
 
21415
- },{}],129:[function(require,module,exports){
21623
+ },{}],130:[function(require,module,exports){
21416
21624
  /* eslint-disable no-console */
21417
21625
  'use strict';
21418
21626
  var __extends = (this && this.__extends) || (function () {
@@ -21510,7 +21718,7 @@ var EventObserver = /** @class */ (function (_super) {
21510
21718
  */
21511
21719
  module.exports = EventObserver;
21512
21720
 
21513
- },{"events":173}],130:[function(require,module,exports){
21721
+ },{"events":173}],131:[function(require,module,exports){
21514
21722
  'use strict';
21515
21723
  var Filter = /** @class */ (function () {
21516
21724
  function Filter(options) {
@@ -21554,7 +21762,7 @@ var Filter = /** @class */ (function () {
21554
21762
  }());
21555
21763
  module.exports = Filter;
21556
21764
 
21557
- },{}],131:[function(require,module,exports){
21765
+ },{}],132:[function(require,module,exports){
21558
21766
  'use strict';
21559
21767
  var __extends = (this && this.__extends) || (function () {
21560
21768
  var extendStatics = function (d, b) {
@@ -22451,7 +22659,7 @@ exports.isUserMediaTrack = isUserMediaTrack;
22451
22659
  exports.waitForSometime = waitForSometime;
22452
22660
  exports.waitForEvent = waitForEvent;
22453
22661
 
22454
- },{"../webrtc/util":170,"./constants":124,"./sid":143,"./twiliowarning":148}],132:[function(require,module,exports){
22662
+ },{"../webrtc/util":170,"./constants":125,"./sid":144,"./twiliowarning":149}],133:[function(require,module,exports){
22455
22663
  /* eslint-disable camelcase */
22456
22664
  'use strict';
22457
22665
  var __extends = (this && this.__extends) || (function () {
@@ -22746,7 +22954,7 @@ function reconnect(publisher, token, sdkName, sdkVersion, roomSid, participantSi
22746
22954
  */
22747
22955
  module.exports = InsightsPublisher;
22748
22956
 
22749
- },{"..":131,"../../util":131,"../browserdetection":122,"../constants":124,"events":173,"ws":175}],133:[function(require,module,exports){
22957
+ },{"..":132,"../../util":132,"../browserdetection":123,"../constants":125,"events":173,"ws":175}],134:[function(require,module,exports){
22750
22958
  // eslint-disable-next-line no-warning-comments
22751
22959
  // TODO(mroberts): This should be described as implementing some
22752
22960
  // InsightsPublisher interface.
@@ -22791,7 +22999,7 @@ var InsightsPublisher = /** @class */ (function () {
22791
22999
  }());
22792
23000
  module.exports = InsightsPublisher;
22793
23001
 
22794
- },{}],134:[function(require,module,exports){
23002
+ },{}],135:[function(require,module,exports){
22795
23003
  'use strict';
22796
23004
  var defer = require('./').defer;
22797
23005
  /**
@@ -22853,7 +23061,7 @@ var LocalMediaRestartDeferreds = /** @class */ (function () {
22853
23061
  }());
22854
23062
  module.exports = new LocalMediaRestartDeferreds();
22855
23063
 
22856
- },{"./":131}],135:[function(require,module,exports){
23064
+ },{"./":132}],136:[function(require,module,exports){
22857
23065
  /* eslint new-cap:0 */
22858
23066
  'use strict';
22859
23067
  var __read = (this && this.__read) || function (o, n) {
@@ -23140,7 +23348,7 @@ function validateLogLevels(levels) {
23140
23348
  }
23141
23349
  module.exports = Log;
23142
23350
 
23143
- },{"../vendor/loglevel":151,"./constants":124}],136:[function(require,module,exports){
23351
+ },{"../vendor/loglevel":152,"./constants":125}],137:[function(require,module,exports){
23144
23352
  'use strict';
23145
23353
  /**
23146
23354
  * Calculates the moving average delta for the given pair ofsamples. A sample (S)
@@ -23187,7 +23395,7 @@ var MovingAverageDelta = /** @class */ (function () {
23187
23395
  }());
23188
23396
  module.exports = MovingAverageDelta;
23189
23397
 
23190
- },{}],137:[function(require,module,exports){
23398
+ },{}],138:[function(require,module,exports){
23191
23399
  'use strict';
23192
23400
  /**
23193
23401
  * Monitor the network connection status to detect interruptions and handoffs.
@@ -23276,7 +23484,7 @@ var NetworkMonitor = /** @class */ (function () {
23276
23484
  }());
23277
23485
  module.exports = NetworkMonitor;
23278
23486
 
23279
- },{}],138:[function(require,module,exports){
23487
+ },{}],139:[function(require,module,exports){
23280
23488
  /* eslint-disable no-console */
23281
23489
  'use strict';
23282
23490
  var __extends = (this && this.__extends) || (function () {
@@ -23339,7 +23547,7 @@ var NullResizeObserver = /** @class */ (function (_super) {
23339
23547
  }(NullObserver));
23340
23548
  module.exports = { NullIntersectionObserver: NullIntersectionObserver, NullResizeObserver: NullResizeObserver, NullObserver: NullObserver };
23341
23549
 
23342
- },{}],139:[function(require,module,exports){
23550
+ },{}],140:[function(require,module,exports){
23343
23551
  'use strict';
23344
23552
  var __read = (this && this.__read) || function (o, n) {
23345
23553
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -23877,7 +24085,7 @@ exports.revertSimulcast = revertSimulcast;
23877
24085
  exports.setCodecPreferences = setCodecPreferences;
23878
24086
  exports.setSimulcast = setSimulcast;
23879
24087
 
23880
- },{"../":131,"./simulcast":141}],140:[function(require,module,exports){
24088
+ },{"../":132,"./simulcast":142}],141:[function(require,module,exports){
23881
24089
  'use strict';
23882
24090
  var RTCSessionDescription = require('../../webrtc').RTCSessionDescription;
23883
24091
  var _a = require('./'), createPtToCodecName = _a.createPtToCodecName, getMediaSections = _a.getMediaSections;
@@ -24070,7 +24278,7 @@ function addFmtpAttributeForRtxPt(mediaSection, rtxPt, pt) {
24070
24278
  }
24071
24279
  module.exports = workaround;
24072
24280
 
24073
- },{"../../webrtc":157,"./":139}],141:[function(require,module,exports){
24281
+ },{"../../webrtc":158,"./":140}],142:[function(require,module,exports){
24074
24282
  'use strict';
24075
24283
  var __read = (this && this.__read) || function (o, n) {
24076
24284
  var m = typeof Symbol === "function" && o[Symbol.iterator];
@@ -24333,7 +24541,7 @@ function setSimulcastInMediaSection(section, trackIdsToAttributes) {
24333
24541
  */
24334
24542
  module.exports = setSimulcastInMediaSection;
24335
24543
 
24336
- },{"../":131}],142:[function(require,module,exports){
24544
+ },{"../":132}],143:[function(require,module,exports){
24337
24545
  'use strict';
24338
24546
  var getMediaSections = require('./').getMediaSections;
24339
24547
  /**
@@ -24378,7 +24586,7 @@ var TrackMatcher = /** @class */ (function () {
24378
24586
  }());
24379
24587
  module.exports = TrackMatcher;
24380
24588
 
24381
- },{"./":139}],143:[function(require,module,exports){
24589
+ },{"./":140}],144:[function(require,module,exports){
24382
24590
  var SID_CHARS = '1234567890abcdef';
24383
24591
  var SID_CHAR_LENGTH = 32;
24384
24592
  // copied from: https://code.hq.twilio.com/flex/monkey/blob/0fdce2b6c52d6be0b17a5cdb92f0c54f119b8ea8/src/client/lib/sid.ts#L39
@@ -24397,7 +24605,7 @@ function createSID(prefix) {
24397
24605
  exports.sessionSID = createSID('SS');
24398
24606
  exports.createSID = createSID;
24399
24607
 
24400
- },{}],144:[function(require,module,exports){
24608
+ },{}],145:[function(require,module,exports){
24401
24609
  'use strict';
24402
24610
  var _a = require('../webrtc/util'), guessBrowser = _a.guessBrowser, isWebRTCSupported = _a.support;
24403
24611
  var getSdpFormat = require('../webrtc/util/sdp').getSdpFormat;
@@ -24444,7 +24652,7 @@ function isSupported() {
24444
24652
  }
24445
24653
  module.exports = isSupported;
24446
24654
 
24447
- },{"../webrtc/util":170,"../webrtc/util/sdp":172,"./browserdetection":122}],145:[function(require,module,exports){
24655
+ },{"../webrtc/util":170,"../webrtc/util/sdp":172,"./browserdetection":123}],146:[function(require,module,exports){
24448
24656
  'use strict';
24449
24657
  /**
24450
24658
  * A {@link Timeout} represents a resettable and clearable timeout.
@@ -24539,7 +24747,7 @@ var Timeout = /** @class */ (function () {
24539
24747
  }());
24540
24748
  module.exports = Timeout;
24541
24749
 
24542
- },{}],146:[function(require,module,exports){
24750
+ },{}],147:[function(require,module,exports){
24543
24751
  // NOTE: Do not edit this file. This code is auto-generated. Contact the
24544
24752
  // Twilio SDK Team for more information.
24545
24753
  'use strict';
@@ -25563,7 +25771,7 @@ var ConfigurationAcquireTurnFailedError = /** @class */ (function (_super) {
25563
25771
  exports.ConfigurationAcquireTurnFailedError = ConfigurationAcquireTurnFailedError;
25564
25772
  Object.defineProperty(TwilioErrorByCode, 53501, { value: ConfigurationAcquireTurnFailedError });
25565
25773
 
25566
- },{"./twilioerror":147}],147:[function(require,module,exports){
25774
+ },{"./twilioerror":148}],148:[function(require,module,exports){
25567
25775
  'use strict';
25568
25776
  var __extends = (this && this.__extends) || (function () {
25569
25777
  var extendStatics = function (d, b) {
@@ -25645,7 +25853,7 @@ var TwilioError = /** @class */ (function (_super) {
25645
25853
  }(Error));
25646
25854
  module.exports = TwilioError;
25647
25855
 
25648
- },{}],148:[function(require,module,exports){
25856
+ },{}],149:[function(require,module,exports){
25649
25857
  'use strict';
25650
25858
  /**
25651
25859
  * @private
@@ -25658,7 +25866,7 @@ var TwilioWarning = {
25658
25866
  };
25659
25867
  module.exports = TwilioWarning;
25660
25868
 
25661
- },{}],149:[function(require,module,exports){
25869
+ },{}],150:[function(require,module,exports){
25662
25870
  'use strict';
25663
25871
  var isNonArrayObject = require('./').isNonArrayObject;
25664
25872
  var _a = require('./constants'), E = _a.typeErrors, clientTrackSwitchOffControl = _a.clientTrackSwitchOffControl, videoContentPreferencesMode = _a.videoContentPreferencesMode, subscriptionMode = _a.subscriptionMode, trackPriority = _a.trackPriority, trackSwitchOffMode = _a.trackSwitchOffMode;
@@ -25775,7 +25983,7 @@ exports.validateBandwidthProfile = validateBandwidthProfile;
25775
25983
  exports.validateLocalTrack = validateLocalTrack;
25776
25984
  exports.validateObject = validateObject;
25777
25985
 
25778
- },{"./":131,"./constants":124}],150:[function(require,module,exports){
25986
+ },{"./":132,"./constants":125}],151:[function(require,module,exports){
25779
25987
  /**
25780
25988
  * Copyright (c) 2011-2022 Isaac Z. Schlueter
25781
25989
  * Licensed under the ISC License.
@@ -25810,7 +26018,7 @@ module.exports = function inherits(ctor, superCtor) {
25810
26018
  }
25811
26019
  };
25812
26020
 
25813
- },{}],151:[function(require,module,exports){
26021
+ },{}],152:[function(require,module,exports){
25814
26022
  /**
25815
26023
  * Copyright (c) 2013 Tim Perry
25816
26024
  * Licensed under the MIT license.
@@ -26050,7 +26258,7 @@ defaultLogger.getLoggers = function getLoggers() {
26050
26258
  defaultLogger['default'] = defaultLogger;
26051
26259
  module.exports = defaultLogger;
26052
26260
 
26053
- },{}],152:[function(require,module,exports){
26261
+ },{}],153:[function(require,module,exports){
26054
26262
  /* globals webkitAudioContext, AudioContext */
26055
26263
  'use strict';
26056
26264
  var NativeAudioContext = typeof AudioContext !== 'undefined'
@@ -26133,7 +26341,7 @@ var AudioContextFactory = /** @class */ (function () {
26133
26341
  }());
26134
26342
  module.exports = new AudioContextFactory();
26135
26343
 
26136
- },{}],153:[function(require,module,exports){
26344
+ },{}],154:[function(require,module,exports){
26137
26345
  'use strict';
26138
26346
  /**
26139
26347
  * Return a Promise that resolves after `timeout` milliseconds.
@@ -26186,7 +26394,7 @@ function detectSilence(audioContext, stream, timeout) {
26186
26394
  }
26187
26395
  module.exports = detectSilence;
26188
26396
 
26189
- },{}],154:[function(require,module,exports){
26397
+ },{}],155:[function(require,module,exports){
26190
26398
  'use strict';
26191
26399
  var detectSilence = require('./detectsilence');
26192
26400
  /**
@@ -26256,11 +26464,25 @@ to get a new one, but we\'ve run out of retries; returning it anyway.');
26256
26464
  }
26257
26465
  module.exports = workaround;
26258
26466
 
26259
- },{"./audiocontext":152,"./detectsilence":153}],155:[function(require,module,exports){
26467
+ },{"./audiocontext":153,"./detectsilence":154}],156:[function(require,module,exports){
26260
26468
  'use strict';
26261
- var flatMap = require('./util').flatMap;
26262
- var guessBrowser = require('./util').guessBrowser;
26263
- var guessBrowserVersion = require('./util').guessBrowserVersion;
26469
+ var __read = (this && this.__read) || function (o, n) {
26470
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
26471
+ if (!m) return o;
26472
+ var i = m.call(o), r, ar = [], e;
26473
+ try {
26474
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
26475
+ }
26476
+ catch (error) { e = { error: error }; }
26477
+ finally {
26478
+ try {
26479
+ if (r && !r.done && (m = i["return"])) m.call(i);
26480
+ }
26481
+ finally { if (e) throw e.error; }
26482
+ }
26483
+ return ar;
26484
+ };
26485
+ var _a = require('./util'), flatMap = _a.flatMap, guessBrowser = _a.guessBrowser, guessBrowserVersion = _a.guessBrowserVersion;
26264
26486
  var getSdpFormat = require('./util/sdp').getSdpFormat;
26265
26487
  var guess = guessBrowser();
26266
26488
  var guessVersion = guessBrowserVersion();
@@ -26304,14 +26526,10 @@ function _getStats(peerConnection, options) {
26304
26526
  [localVideoTracks, 'localVideoTrackStats', false],
26305
26527
  [remoteAudioTracks, 'remoteAudioTrackStats', true],
26306
26528
  [remoteVideoTracks, 'remoteVideoTrackStats', true]
26307
- ], function (triple) {
26308
- var tracks = triple[0];
26309
- var statsArrayName = triple[1];
26310
- var isRemote = triple[2];
26529
+ ], function (_a) {
26530
+ var _b = __read(_a, 3), tracks = _b[0], statsArrayName = _b[1], isRemote = _b[2];
26311
26531
  return tracks.map(function (track) {
26312
- return getTrackStats(peerConnection, track, Object.assign({
26313
- isRemote: isRemote
26314
- }, options)).then(function (trackStatsArray) {
26532
+ return getTrackStats(peerConnection, track, Object.assign({ isRemote: isRemote }, options)).then(function (trackStatsArray) {
26315
26533
  trackStatsArray.forEach(function (trackStats) {
26316
26534
  trackStats.trackId = track.id;
26317
26535
  statsResponse[statsArrayName].push(trackStats);
@@ -26334,7 +26552,7 @@ function _getStats(peerConnection, options) {
26334
26552
  * @returns {Promise<StandardizedActiveIceCandidatePairStatsReport>}
26335
26553
  */
26336
26554
  function getActiveIceCandidatePairStats(peerConnection, options) {
26337
- options = options || {};
26555
+ if (options === void 0) { options = {}; }
26338
26556
  if (typeof options.testForChrome !== 'undefined' || isChrome
26339
26557
  || typeof options.testForSafari !== 'undefined' || isSafari) {
26340
26558
  return peerConnection.getStats().then(standardizeChromeOrSafariActiveIceCandidatePairStats);
@@ -26350,8 +26568,9 @@ function getActiveIceCandidatePairStats(peerConnection, options) {
26350
26568
  * @returns {?StandardizedActiveIceCandidatePairStatsReport}
26351
26569
  */
26352
26570
  function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26353
- var activeCandidatePairStats = Array.from(stats.values()).find(function (stat) {
26354
- return stat.type === 'candidate-pair' && stat.nominated;
26571
+ var activeCandidatePairStats = Array.from(stats.values()).find(function (_a) {
26572
+ var nominated = _a.nominated, type = _a.type;
26573
+ return type === 'candidate-pair' && nominated;
26355
26574
  });
26356
26575
  if (!activeCandidatePairStats) {
26357
26576
  return null;
@@ -26371,17 +26590,19 @@ function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26371
26590
  { key: 'relayProtocol', type: 'string' }
26372
26591
  ]);
26373
26592
  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;
26593
+ ? standardizedLocalCandidateStatsKeys.reduce(function (report, _a) {
26594
+ var key = _a.key, type = _a.type;
26595
+ report[key] = typeof activeLocalCandidateStats[key] === type
26596
+ ? activeLocalCandidateStats[key]
26597
+ : key === 'deleted' ? false : null;
26378
26598
  return report;
26379
26599
  }, {})
26380
26600
  : null;
26381
26601
  var standardizedRemoteCandidateStatsReport = activeRemoteCandidateStats
26382
- ? standardizedCandidateStatsKeys.reduce(function (report, keyInfo) {
26383
- report[keyInfo.key] = typeof activeRemoteCandidateStats[keyInfo.key] === keyInfo.type
26384
- ? activeRemoteCandidateStats[keyInfo.key]
26602
+ ? standardizedCandidateStatsKeys.reduce(function (report, _a) {
26603
+ var key = _a.key, type = _a.type;
26604
+ report[key] = typeof activeRemoteCandidateStats[key] === type
26605
+ ? activeRemoteCandidateStats[key]
26385
26606
  : null;
26386
26607
  return report;
26387
26608
  }, {})
@@ -26408,9 +26629,10 @@ function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26408
26629
  { key: 'totalRoundTripTime', type: 'number' },
26409
26630
  { key: 'transportId', type: 'string' },
26410
26631
  { 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])
26632
+ ].reduce(function (report, _a) {
26633
+ var key = _a.key, type = _a.type, fixup = _a.fixup;
26634
+ report[key] = typeof activeCandidatePairStats[key] === type
26635
+ ? (fixup ? fixup(activeCandidatePairStats[key]) : activeCandidatePairStats[key])
26414
26636
  : null;
26415
26637
  return report;
26416
26638
  }, {
@@ -26424,8 +26646,9 @@ function standardizeChromeOrSafariActiveIceCandidatePairStats(stats) {
26424
26646
  * @returns {?StandardizedActiveIceCandidatePairStatsReport}
26425
26647
  */
26426
26648
  function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26427
- var activeCandidatePairStats = Array.from(stats.values()).find(function (stat) {
26428
- return stat.type === 'candidate-pair' && stat.nominated;
26649
+ var activeCandidatePairStats = Array.from(stats.values()).find(function (_a) {
26650
+ var nominated = _a.nominated, type = _a.type;
26651
+ return type === 'candidate-pair' && nominated;
26429
26652
  });
26430
26653
  if (!activeCandidatePairStats) {
26431
26654
  return null;
@@ -26451,27 +26674,25 @@ function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26451
26674
  serverreflexive: 'srflx'
26452
26675
  };
26453
26676
  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;
26677
+ ? standardizedLocalCandidateStatsKeys.reduce(function (report, _a) {
26678
+ var ffKeys = _a.ffKeys, key = _a.key, type = _a.type;
26679
+ var localStatKey = ffKeys && ffKeys.find(function (key) { return key in activeLocalCandidateStats; }) || key;
26680
+ report[key] = typeof activeLocalCandidateStats[localStatKey] === type
26681
+ ? localStatKey === 'candidateType'
26682
+ ? candidateTypes[activeLocalCandidateStats[localStatKey]] || activeLocalCandidateStats[localStatKey]
26683
+ : activeLocalCandidateStats[localStatKey]
26684
+ : localStatKey === 'deleted' ? false : null;
26463
26685
  return report;
26464
26686
  }, {})
26465
26687
  : null;
26466
26688
  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]
26689
+ ? standardizedCandidateStatsKeys.reduce(function (report, _a) {
26690
+ var ffKeys = _a.ffKeys, key = _a.key, type = _a.type;
26691
+ var remoteStatKey = ffKeys && ffKeys.find(function (key) { return key in activeRemoteCandidateStats; }) || key;
26692
+ report[key] = typeof activeRemoteCandidateStats[remoteStatKey] === type
26693
+ ? remoteStatKey === 'candidateType'
26694
+ ? candidateTypes[activeRemoteCandidateStats[remoteStatKey]] || activeRemoteCandidateStats[remoteStatKey]
26695
+ : activeRemoteCandidateStats[remoteStatKey]
26475
26696
  : null;
26476
26697
  return report;
26477
26698
  }, {})
@@ -26498,9 +26719,10 @@ function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26498
26719
  { key: 'totalRoundTripTime', type: 'number' },
26499
26720
  { key: 'transportId', type: 'string' },
26500
26721
  { key: 'writable', type: 'boolean' }
26501
- ].reduce(function (report, keyInfo) {
26502
- report[keyInfo.key] = typeof activeCandidatePairStats[keyInfo.key] === keyInfo.type
26503
- ? activeCandidatePairStats[keyInfo.key]
26722
+ ].reduce(function (report, _a) {
26723
+ var key = _a.key, type = _a.type;
26724
+ report[key] = typeof activeCandidatePairStats[key] === type
26725
+ ? activeCandidatePairStats[key]
26504
26726
  : null;
26505
26727
  return report;
26506
26728
  }, {
@@ -26518,17 +26740,16 @@ function standardizeFirefoxActiveIceCandidatePairStats(stats) {
26518
26740
  function getTracks(peerConnection, kind, localOrRemote) {
26519
26741
  var getSendersOrReceivers = localOrRemote === 'local' ? 'getSenders' : 'getReceivers';
26520
26742
  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
- });
26743
+ return peerConnection[getSendersOrReceivers]()
26744
+ .map(function (_a) {
26745
+ var track = _a.track;
26746
+ return track;
26747
+ })
26748
+ .filter(function (track) { return track && track.kind === kind; });
26526
26749
  }
26527
26750
  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
- });
26751
+ var getTracks = kind === 'audio' ? 'getAudioTracks' : 'getVideoTracks';
26752
+ return flatMap(peerConnection[getStreams](), function (stream) { return stream[getTracks](); });
26532
26753
  }
26533
26754
  /**
26534
26755
  * Get the standardized statistics for a particular MediaStreamTrack.
@@ -26538,7 +26759,7 @@ function getTracks(peerConnection, kind, localOrRemote) {
26538
26759
  * @returns {Promise.<Array<StandardizedTrackStatsReport>>}
26539
26760
  */
26540
26761
  function getTrackStats(peerConnection, track, options) {
26541
- options = options || {};
26762
+ if (options === void 0) { options = {}; }
26542
26763
  if (typeof options.testForChrome !== 'undefined' || isChrome) {
26543
26764
  return chromeOrSafariGetTrackStats(peerConnection, track);
26544
26765
  }
@@ -26677,7 +26898,8 @@ function standardizeChromeOrSafariStats(response) {
26677
26898
  var codec = null;
26678
26899
  var localMedia = null;
26679
26900
  response.forEach(function (stat) {
26680
- switch (stat.type) {
26901
+ var type = stat.type;
26902
+ switch (type) {
26681
26903
  case 'inbound-rtp':
26682
26904
  inbound = stat;
26683
26905
  break;
@@ -26701,7 +26923,7 @@ function standardizeChromeOrSafariStats(response) {
26701
26923
  break;
26702
26924
  }
26703
26925
  });
26704
- var isRemote = track && track.remoteSource;
26926
+ var isRemote = track ? track.remoteSource : !localMedia;
26705
26927
  var mainSources = isRemote ? [inbound] : outbound;
26706
26928
  var stats = [];
26707
26929
  var remoteSource = isRemote ? remoteOutbound : remoteInbound; // remote rtp stats
@@ -26746,7 +26968,7 @@ function standardizeChromeOrSafariStats(response) {
26746
26968
  }
26747
26969
  else {
26748
26970
  standardizedStats.frameWidthSent = frameWidth;
26749
- standardizedStats.frameWidthInput = track.frameWidth;
26971
+ standardizedStats.frameWidthInput = track ? track.frameWidth : localMedia.width;
26750
26972
  }
26751
26973
  }
26752
26974
  var frameHeight = getStatValue('frameHeight');
@@ -26756,7 +26978,7 @@ function standardizeChromeOrSafariStats(response) {
26756
26978
  }
26757
26979
  else {
26758
26980
  standardizedStats.frameHeightSent = frameHeight;
26759
- standardizedStats.frameHeightInput = track.frameHeight;
26981
+ standardizedStats.frameHeightInput = track ? track.frameHeight : localMedia.height;
26760
26982
  }
26761
26983
  }
26762
26984
  var framesPerSecond = getStatValue('framesPerSecond');
@@ -26842,7 +27064,7 @@ function standardizeFirefoxStats(response, isRemote) {
26842
27064
  //
26843
27065
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1377225
26844
27066
  //
26845
- response = response || new Map();
27067
+ if (response === void 0) { response = new Map(); }
26846
27068
  var inbound = null;
26847
27069
  var outbound = null;
26848
27070
  // NOTE(mmalavalli): Starting from Firefox 63, RTC{Inbound, Outbound}RTPStreamStats.isRemote
@@ -26855,17 +27077,18 @@ function standardizeFirefoxStats(response, isRemote) {
26855
27077
  // Source: https://blog.mozilla.org/webrtc/getstats-isremote-65/
26856
27078
  //
26857
27079
  response.forEach(function (stat) {
26858
- if (stat.isRemote) {
27080
+ var isRemote = stat.isRemote, remoteId = stat.remoteId, type = stat.type;
27081
+ if (isRemote) {
26859
27082
  return;
26860
27083
  }
26861
- switch (stat.type) {
27084
+ switch (type) {
26862
27085
  case 'inbound-rtp':
26863
27086
  inbound = stat;
26864
- outbound = response.get(stat.remoteId);
27087
+ outbound = response.get(remoteId);
26865
27088
  break;
26866
27089
  case 'outbound-rtp':
26867
27090
  outbound = stat;
26868
- inbound = response.get(stat.remoteId);
27091
+ inbound = response.get(remoteId);
26869
27092
  break;
26870
27093
  }
26871
27094
  });
@@ -27050,7 +27273,7 @@ function standardizeFirefoxStats(response, isRemote) {
27050
27273
  */
27051
27274
  module.exports = getStats;
27052
27275
 
27053
- },{"./util":170,"./util/sdp":172}],156:[function(require,module,exports){
27276
+ },{"./util":170,"./util/sdp":172}],157:[function(require,module,exports){
27054
27277
  /* globals navigator */
27055
27278
  'use strict';
27056
27279
  /**
@@ -27064,17 +27287,17 @@ module.exports = getStats;
27064
27287
  * @returns Promise<MediaStream>
27065
27288
  */
27066
27289
  function getUserMedia(constraints) {
27290
+ if (constraints === void 0) { constraints = { audio: true, video: true }; }
27067
27291
  if (typeof navigator === 'object'
27068
27292
  && typeof navigator.mediaDevices === 'object'
27069
27293
  && typeof navigator.mediaDevices.getUserMedia === 'function') {
27070
- constraints = constraints || { audio: true, video: true };
27071
27294
  return navigator.mediaDevices.getUserMedia(constraints);
27072
27295
  }
27073
27296
  return Promise.reject(new Error('getUserMedia is not supported'));
27074
27297
  }
27075
27298
  module.exports = getUserMedia;
27076
27299
 
27077
- },{}],157:[function(require,module,exports){
27300
+ },{}],158:[function(require,module,exports){
27078
27301
  'use strict';
27079
27302
  var WebRTC = {};
27080
27303
  Object.defineProperties(WebRTC, {
@@ -27109,7 +27332,7 @@ Object.defineProperties(WebRTC, {
27109
27332
  });
27110
27333
  module.exports = WebRTC;
27111
27334
 
27112
- },{"./getstats":155,"./getusermedia":156,"./mediastream":158,"./mediastreamtrack":159,"./rtcicecandidate":160,"./rtcpeerconnection":163,"./rtcsessiondescription":168}],158:[function(require,module,exports){
27335
+ },{"./getstats":156,"./getusermedia":157,"./mediastream":159,"./mediastreamtrack":160,"./rtcicecandidate":161,"./rtcpeerconnection":164,"./rtcsessiondescription":169}],159:[function(require,module,exports){
27113
27336
  /* globals MediaStream */
27114
27337
  'use strict';
27115
27338
  if (typeof MediaStream === 'function') {
@@ -27121,7 +27344,7 @@ else {
27121
27344
  };
27122
27345
  }
27123
27346
 
27124
- },{}],159:[function(require,module,exports){
27347
+ },{}],160:[function(require,module,exports){
27125
27348
  /* global MediaStreamTrack */
27126
27349
  'use strict';
27127
27350
  if (typeof MediaStreamTrack === 'function') {
@@ -27133,7 +27356,7 @@ else {
27133
27356
  };
27134
27357
  }
27135
27358
 
27136
- },{}],160:[function(require,module,exports){
27359
+ },{}],161:[function(require,module,exports){
27137
27360
  /* global RTCIceCandidate */
27138
27361
  'use strict';
27139
27362
  if (typeof RTCIceCandidate === 'function') {
@@ -27145,19 +27368,53 @@ else {
27145
27368
  };
27146
27369
  }
27147
27370
 
27148
- },{}],161:[function(require,module,exports){
27371
+ },{}],162:[function(require,module,exports){
27149
27372
  /* globals RTCDataChannel, RTCPeerConnection, RTCSessionDescription */
27150
27373
  'use strict';
27374
+ var __extends = (this && this.__extends) || (function () {
27375
+ var extendStatics = function (d, b) {
27376
+ extendStatics = Object.setPrototypeOf ||
27377
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27378
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27379
+ return extendStatics(d, b);
27380
+ };
27381
+ return function (d, b) {
27382
+ if (typeof b !== "function" && b !== null)
27383
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27384
+ extendStatics(d, b);
27385
+ function __() { this.constructor = d; }
27386
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27387
+ };
27388
+ })();
27389
+ var __read = (this && this.__read) || function (o, n) {
27390
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27391
+ if (!m) return o;
27392
+ var i = m.call(o), r, ar = [], e;
27393
+ try {
27394
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27395
+ }
27396
+ catch (error) { e = { error: error }; }
27397
+ finally {
27398
+ try {
27399
+ if (r && !r.done && (m = i["return"])) m.call(i);
27400
+ }
27401
+ finally { if (e) throw e.error; }
27402
+ }
27403
+ return ar;
27404
+ };
27405
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
27406
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
27407
+ to[j] = from[i];
27408
+ return to;
27409
+ };
27151
27410
  var ChromeRTCSessionDescription = require('../rtcsessiondescription/chrome');
27152
- var EventTarget = require('../util/eventtarget');
27153
- var inherits = require('../../vendor/inherits');
27411
+ var EventTarget = require('../../eventtarget');
27154
27412
  var Latch = require('../util/latch');
27155
27413
  var MediaStream = require('../mediastream');
27156
27414
  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';
27415
+ var _a = require('../util/sdp'), getSdpFormat = _a.getSdpFormat, updatePlanBTrackIdsToSSRCs = _a.updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs = _a.updateUnifiedPlanTrackIdsToSSRCs;
27416
+ var _b = require('../util'), delegateMethods = _b.delegateMethods, interceptEvent = _b.interceptEvent, isIOSChrome = _b.isIOSChrome, legacyPromise = _b.legacyPromise, proxyProperties = _b.proxyProperties;
27417
+ var isUnifiedPlan = getSdpFormat() === 'unified';
27161
27418
  // NOTE(mroberts): This class wraps Chrome's RTCPeerConnection implementation.
27162
27419
  // It provides some functionality not currently present in Chrome, namely the
27163
27420
  // abilities to
@@ -27169,119 +27426,127 @@ var isUnifiedPlan = sdpUtils.getSdpFormat() === 'unified';
27169
27426
  //
27170
27427
  // 3. Set iceTransportPolicy.
27171
27428
  //
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;
27429
+ var ChromeRTCPeerConnection = /** @class */ (function (_super) {
27430
+ __extends(ChromeRTCPeerConnection, _super);
27431
+ function ChromeRTCPeerConnection(configuration, constraints) {
27432
+ if (configuration === void 0) { configuration = {}; }
27433
+ var _this = _super.call(this) || this;
27434
+ var newConfiguration = Object.assign(configuration.iceTransportPolicy
27435
+ ? { iceTransports: configuration.iceTransportPolicy }
27436
+ : {}, configuration);
27437
+ interceptEvent(_this, 'datachannel');
27438
+ interceptEvent(_this, 'signalingstatechange');
27439
+ var sdpFormat = getSdpFormat(newConfiguration.sdpSemantics);
27440
+ var peerConnection = new RTCPeerConnection(newConfiguration, constraints);
27441
+ Object.defineProperties(_this, {
27442
+ _appliedTracksToSSRCs: {
27443
+ value: new Map(),
27444
+ writable: true
27445
+ },
27446
+ _localStream: {
27447
+ value: new MediaStream()
27448
+ },
27449
+ _peerConnection: {
27450
+ value: peerConnection
27451
+ },
27452
+ _pendingLocalOffer: {
27453
+ value: null,
27454
+ writable: true
27455
+ },
27456
+ _pendingRemoteOffer: {
27457
+ value: null,
27458
+ writable: true
27459
+ },
27460
+ _rolledBackTracksToSSRCs: {
27461
+ value: new Map(),
27462
+ writable: true
27463
+ },
27464
+ _sdpFormat: {
27465
+ value: sdpFormat
27466
+ },
27467
+ _senders: {
27468
+ value: new Map()
27469
+ },
27470
+ _signalingStateLatch: {
27471
+ value: new Latch()
27472
+ },
27473
+ _tracksToSSRCs: {
27474
+ value: new Map(),
27475
+ writable: true
27225
27476
  }
27226
- },
27227
- remoteDescription: {
27228
- enumerable: true,
27229
- get: function () {
27230
- return this._pendingRemoteOffer ? this._pendingRemoteOffer : peerConnection.remoteDescription;
27477
+ });
27478
+ peerConnection.addEventListener('datachannel', function (event) {
27479
+ shimDataChannel(event.channel);
27480
+ _this.dispatchEvent(event);
27481
+ });
27482
+ peerConnection.addEventListener('signalingstatechange', function () {
27483
+ var args = [];
27484
+ for (var _i = 0; _i < arguments.length; _i++) {
27485
+ args[_i] = arguments[_i];
27231
27486
  }
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;
27487
+ if (peerConnection.signalingState === 'stable') {
27488
+ _this._appliedTracksToSSRCs = new Map(_this._tracksToSSRCs);
27243
27489
  }
27490
+ if (!_this._pendingLocalOffer && !_this._pendingRemoteOffer) {
27491
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
27492
+ }
27493
+ });
27494
+ peerConnection.ontrack = function () {
27495
+ // NOTE(mroberts): adapter.js's "track" event shim only kicks off if we set
27496
+ // the ontrack property of the RTCPeerConnection.
27497
+ };
27498
+ if (typeof peerConnection.addTrack !== 'function') {
27499
+ peerConnection.addStream(_this._localStream);
27244
27500
  }
27501
+ proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);
27502
+ return _this;
27503
+ }
27504
+ Object.defineProperty(ChromeRTCPeerConnection.prototype, "localDescription", {
27505
+ get: function () {
27506
+ return this._pendingLocalOffer ? this._pendingLocalOffer : this._peerConnection.localDescription;
27507
+ },
27508
+ enumerable: false,
27509
+ configurable: true
27245
27510
  });
27246
- var self = this;
27247
- peerConnection.addEventListener('datachannel', function ondatachannel(event) {
27248
- shimDataChannel(event.channel);
27249
- self.dispatchEvent(event);
27511
+ Object.defineProperty(ChromeRTCPeerConnection.prototype, "remoteDescription", {
27512
+ get: function () {
27513
+ return this._pendingRemoteOffer ? this._pendingRemoteOffer : this._peerConnection.remoteDescription;
27514
+ },
27515
+ enumerable: false,
27516
+ configurable: true
27250
27517
  });
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
- }
27518
+ Object.defineProperty(ChromeRTCPeerConnection.prototype, "signalingState", {
27519
+ get: function () {
27520
+ if (this._pendingLocalOffer) {
27521
+ return 'have-local-offer';
27522
+ }
27523
+ else if (this._pendingRemoteOffer) {
27524
+ return 'have-remote-offer';
27525
+ }
27526
+ return this._peerConnection.signalingState;
27527
+ },
27528
+ enumerable: false,
27529
+ configurable: true
27258
27530
  });
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
27531
  // NOTE(mmalavalli): This shim supports our limited case of adding
27271
27532
  // all MediaStreamTracks to one MediaStream. It has been implemented this
27272
27533
  // keeping in mind that this is to be maintained only until "addTrack" is
27273
27534
  // supported natively in Chrome.
27274
- ChromeRTCPeerConnection.prototype.addTrack = function addTrack() {
27275
- var args = [].slice.call(arguments);
27276
- var track = args[0];
27535
+ ChromeRTCPeerConnection.prototype.addTrack = function (track) {
27536
+ var _a;
27537
+ var rest = [];
27538
+ for (var _i = 1; _i < arguments.length; _i++) {
27539
+ rest[_i - 1] = arguments[_i];
27540
+ }
27541
+ if (typeof this._peerConnection.addTrack === 'function') {
27542
+ return (_a = this._peerConnection).addTrack.apply(_a, __spreadArray([track], __read(rest)));
27543
+ }
27277
27544
  if (this._peerConnection.signalingState === 'closed') {
27278
- throw new Error('Cannot add MediaStreamTrack [' + track.id + ', '
27279
- + track.kind + ']: RTCPeerConnection is closed');
27545
+ throw new Error("Cannot add MediaStreamTrack [" + track.id + ", \n " + track.kind + "]: RTCPeerConnection is closed");
27280
27546
  }
27281
27547
  var sender = this._senders.get(track);
27282
27548
  if (sender && sender.track) {
27283
- throw new Error('Cannot add MediaStreamTrack [' + track.id + ', '
27284
- + track.kind + ']: RTCPeerConnection already has it');
27549
+ throw new Error("Cannot add MediaStreamTrack ['" + track.id + ", \n " + track.kind + "]: RTCPeerConnection already has it");
27285
27550
  }
27286
27551
  this._peerConnection.removeStream(this._localStream);
27287
27552
  this._localStream.addTrack(track);
@@ -27294,192 +27559,207 @@ if (typeof RTCPeerConnection.prototype.addTrack !== 'function') {
27294
27559
  // MediaStreamTracks from one MediaStream. It has been implemented this
27295
27560
  // keeping in mind that this is to be maintained only until "removeTrack" is
27296
27561
  // supported natively in Chrome.
27297
- ChromeRTCPeerConnection.prototype.removeTrack = function removeTrack(sender) {
27562
+ ChromeRTCPeerConnection.prototype.removeTrack = function (sender) {
27298
27563
  if (this._peerConnection.signalingState === 'closed') {
27299
27564
  throw new Error('Cannot remove MediaStreamTrack: RTCPeerConnection is closed');
27300
27565
  }
27301
- var track = sender.track;
27302
- if (!track) {
27303
- return;
27566
+ if (typeof this._peerConnection.addTrack === 'function') {
27567
+ try {
27568
+ return this._peerConnection.removeTrack(sender);
27569
+ }
27570
+ catch (e) {
27571
+ // NOTE(mhuynh): Do nothing. In Chrome, will throw if a 'sender was not
27572
+ // created by this peer connection'. This behavior does not seem to be
27573
+ // spec compliant, so a temporary shim is introduced. A bug has been filed,
27574
+ // and is tracked here:
27575
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=860853
27576
+ }
27304
27577
  }
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);
27578
+ else {
27579
+ var track = sender.track;
27580
+ if (!track) {
27581
+ return;
27582
+ }
27583
+ sender = this._senders.get(track);
27584
+ if (sender && sender.track) {
27585
+ sender.track = null;
27586
+ this._peerConnection.removeStream(this._localStream);
27587
+ this._localStream.removeTrack(track);
27588
+ this._peerConnection.addStream(this._localStream);
27589
+ }
27311
27590
  }
27312
27591
  };
27313
- ChromeRTCPeerConnection.prototype.getSenders = function getSenders() {
27592
+ ChromeRTCPeerConnection.prototype.getSenders = function () {
27593
+ if (typeof this._peerConnection.addTrack === 'function') {
27594
+ return this._peerConnection.getSenders();
27595
+ }
27314
27596
  return Array.from(this._senders.values());
27315
27597
  };
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);
27598
+ ChromeRTCPeerConnection.prototype.addIceCandidate = function (candidate) {
27599
+ var _this = this;
27600
+ var rest = [];
27601
+ for (var _i = 1; _i < arguments.length; _i++) {
27602
+ rest[_i - 1] = arguments[_i];
27603
+ }
27604
+ var promise;
27605
+ if (this.signalingState === 'have-remote-offer') {
27606
+ // NOTE(mroberts): Because the ChromeRTCPeerConnection simulates the
27607
+ // "have-remote-offer" signalingStates, we only want to invoke the true
27608
+ // addIceCandidates method when the remote description has been applied.
27609
+ promise = this._signalingStateLatch.when('low').then(function () {
27610
+ return _this._peerConnection.addIceCandidate(candidate);
27611
+ });
27324
27612
  }
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
27613
+ else {
27614
+ promise = this._peerConnection.addIceCandidate(candidate);
27615
+ }
27616
+ return rest.length > 0
27617
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;
27618
+ };
27619
+ // NOTE(mroberts): The WebRTC spec does not specify that close should throw an
27620
+ // Error; however, in Chrome it does. We workaround this by checking the
27621
+ // signalingState manually.
27622
+ ChromeRTCPeerConnection.prototype.close = function () {
27623
+ if (this.signalingState !== 'closed') {
27624
+ this._pendingLocalOffer = null;
27625
+ this._pendingRemoteOffer = null;
27626
+ this._peerConnection.close();
27331
27627
  }
27332
27628
  };
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)
27629
+ // NOTE(mroberts): Because we workaround Chrome's lack of rollback support by
27630
+ // "faking" setRemoteDescription, we cannot create an answer until we actually
27631
+ // apply the remote description. This means, once you call createAnswer, you
27632
+ // can no longer rollback. This is acceptable for our use case because we will
27633
+ // apply the newly-created answer almost immediately; however, this may be
27634
+ // unacceptable for other use cases.
27635
+ ChromeRTCPeerConnection.prototype.createAnswer = function () {
27636
+ var _this = this;
27637
+ var args = [];
27638
+ for (var _i = 0; _i < arguments.length; _i++) {
27639
+ args[_i] = arguments[_i];
27640
+ }
27641
+ var promise;
27642
+ if (this._pendingRemoteOffer) {
27643
+ promise = this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function () {
27644
+ // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection
27645
+ // and the underlying RTCPeerConnection implementation have converged. We
27646
+ // can unblock any pending calls to addIceCandidate now.
27647
+ _this._signalingStateLatch.lower();
27648
+ return _this._peerConnection.createAnswer();
27649
+ }).then(function (answer) {
27650
+ _this._pendingRemoteOffer = null;
27651
+ // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
27652
+ // longer need to retain the rolled back tracks to SSRCs Map.
27653
+ _this._rolledBackTracksToSSRCs.clear();
27654
+ return new ChromeRTCSessionDescription({
27655
+ type: 'answer',
27656
+ sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, answer.sdp)
27657
+ });
27658
+ }, function (error) {
27659
+ _this._pendingRemoteOffer = null;
27660
+ throw error;
27388
27661
  });
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)
27662
+ }
27663
+ else {
27664
+ promise = this._peerConnection.createAnswer().then(function (answer) {
27665
+ // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
27666
+ // longer need to retain the rolled back tracks to SSRCs Map.
27667
+ _this._rolledBackTracksToSSRCs.clear();
27668
+ return new ChromeRTCSessionDescription({
27669
+ type: 'answer',
27670
+ sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, answer.sdp)
27671
+ });
27402
27672
  });
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
27673
  }
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');
27674
+ return args.length > 1
27675
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(args))) : promise;
27676
+ };
27677
+ ChromeRTCPeerConnection.prototype.createOffer = function () {
27678
+ var _this = this;
27679
+ var args = [];
27680
+ for (var _i = 0; _i < arguments.length; _i++) {
27681
+ args[_i] = arguments[_i];
27682
+ }
27683
+ var _a = __read(args, 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2];
27684
+ var options = arg3 || arg1 || {};
27685
+ if (isIOSChrome()) {
27686
+ // NOTE (joma): From SafariRTCPeerConnection in order to support iOS Chrome.
27687
+ if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
27688
+ delete options.offerToReceiveAudio;
27689
+ try {
27690
+ this._audioTransceiver = isUnifiedPlan
27691
+ ? this.addTransceiver('audio', { direction: 'recvonly' })
27692
+ : this.addTransceiver('audio');
27693
+ }
27694
+ catch (e) {
27695
+ return Promise.reject(e);
27696
+ }
27432
27697
  }
27433
- catch (e) {
27434
- return Promise.reject(e);
27698
+ if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
27699
+ delete options.offerToReceiveVideo;
27700
+ try {
27701
+ this._videoTransceiver = isUnifiedPlan
27702
+ ? this.addTransceiver('video', { direction: 'recvonly' })
27703
+ : this.addTransceiver('video');
27704
+ }
27705
+ catch (e) {
27706
+ return Promise.reject(e);
27707
+ }
27435
27708
  }
27436
27709
  }
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)
27710
+ var promise = this._peerConnection.createOffer(options).then(function (offer) {
27711
+ // NOTE(mmalavalli): If createOffer() is called immediately after rolling back, then we no
27712
+ // longer need to retain the rolled back tracks to SSRCs Map.
27713
+ _this._rolledBackTracksToSSRCs.clear();
27714
+ return new ChromeRTCSessionDescription({
27715
+ type: offer.type,
27716
+ sdp: updateTrackIdsToSSRCs(_this._sdpFormat, _this._tracksToSSRCs, offer.sdp)
27717
+ });
27445
27718
  });
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);
27719
+ return args.length > 1
27720
+ ? legacyPromise(promise, arg1, arg2)
27721
+ : promise;
27722
+ };
27723
+ ChromeRTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {
27724
+ dataChannelDict = shimDataChannelInit(dataChannelDict);
27725
+ var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);
27726
+ shimDataChannel(dataChannel);
27727
+ return dataChannel;
27728
+ };
27729
+ ChromeRTCPeerConnection.prototype.setLocalDescription = function () {
27730
+ var args = [];
27731
+ for (var _i = 0; _i < arguments.length; _i++) {
27732
+ args[_i] = arguments[_i];
27733
+ }
27734
+ var _a = __read(args, 3), description = _a[0], arg1 = _a[1], arg2 = _a[2];
27735
+ // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,
27736
+ // then we need to restore the rolled back tracks to SSRCs Map.
27737
+ if (this._rolledBackTracksToSSRCs.size > 0) {
27738
+ this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);
27739
+ this._rolledBackTracksToSSRCs.clear();
27740
+ }
27741
+ var promise = setDescription(this, true, description);
27742
+ return args.length > 1
27743
+ ? legacyPromise(promise, arg1, arg2)
27744
+ : promise;
27745
+ };
27746
+ ChromeRTCPeerConnection.prototype.setRemoteDescription = function () {
27747
+ var args = [];
27748
+ for (var _i = 0; _i < arguments.length; _i++) {
27749
+ args[_i] = arguments[_i];
27750
+ }
27751
+ var _a = __read(args, 3), description = _a[0], arg1 = _a[1], arg2 = _a[2];
27752
+ // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,
27753
+ // then we no longer need to retain the rolled back tracks to SSRCs Map.
27464
27754
  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');
27755
+ var promise = setDescription(this, false, description);
27756
+ return args.length > 1
27757
+ ? legacyPromise(promise, arg1, arg2)
27758
+ : promise;
27759
+ };
27760
+ return ChromeRTCPeerConnection;
27761
+ }(EventTarget));
27762
+ delegateMethods(RTCPeerConnection.prototype, ChromeRTCPeerConnection.prototype, '_peerConnection');
27483
27763
  // NOTE(mroberts): We workaround Chrome's lack of rollback support, per the
27484
27764
  // workaround suggested here: https://bugs.chromium.org/p/webrtc/issues/detail?id=5738#c3
27485
27765
  // Namely, we "fake" setting the local or remote description and instead buffer
@@ -27514,8 +27794,7 @@ function setDescription(peerConnection, local, description) {
27514
27794
  else if (description.type === 'offer') {
27515
27795
  if (peerConnection.signalingState !== intermediateState && peerConnection.signalingState !== 'stable') {
27516
27796
  // NOTE(mroberts): Error message copied from Firefox.
27517
- return Promise.reject(new Error('Cannot set ' + (local ? 'local' : 'remote') +
27518
- ' offer in state ' + peerConnection.signalingState));
27797
+ return Promise.reject(new Error("Cannot set " + (local ? 'local' : 'remote') + " offer in state " + peerConnection.signalingState));
27519
27798
  }
27520
27799
  // We need to save this local offer in case of a rollback. We also need to
27521
27800
  // check to see if the signalingState between the ChromeRTCPeerConnection
@@ -27529,16 +27808,13 @@ function setDescription(peerConnection, local, description) {
27529
27808
  promise = Promise.resolve();
27530
27809
  // Only dispatch a signalingstatechange event if we transitioned.
27531
27810
  if (peerConnection.signalingState !== previousSignalingState) {
27532
- promise.then(function dispatchSignalingStateChangeEvent() {
27533
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
27534
- });
27811
+ promise.then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
27535
27812
  }
27536
27813
  }
27537
27814
  else if (description.type === 'rollback') {
27538
27815
  if (peerConnection.signalingState !== intermediateState) {
27539
27816
  // NOTE(mroberts): Error message copied from Firefox.
27540
- promise = Promise.reject(new Error('Cannot rollback ' +
27541
- (local ? 'local' : 'remote') + ' description in ' + peerConnection.signalingState));
27817
+ promise = Promise.reject(new Error("Cannot rollback " + (local ? 'local' : 'remote') + " description in " + peerConnection.signalingState));
27542
27818
  }
27543
27819
  else {
27544
27820
  // Reset the pending offer.
@@ -27550,9 +27826,7 @@ function setDescription(peerConnection, local, description) {
27550
27826
  peerConnection._rolledBackTracksToSSRCs = new Map(peerConnection._tracksToSSRCs);
27551
27827
  peerConnection._tracksToSSRCs = new Map(peerConnection._appliedTracksToSSRCs);
27552
27828
  promise = Promise.resolve();
27553
- promise.then(function dispatchSignalingStateChangeEvent() {
27554
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
27555
- });
27829
+ promise.then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
27556
27830
  }
27557
27831
  }
27558
27832
  return promise || peerConnection._peerConnection[setLocalDescription](unwrap(description));
@@ -27560,10 +27834,10 @@ function setDescription(peerConnection, local, description) {
27560
27834
  function setRemoteAnswer(peerConnection, answer) {
27561
27835
  // Apply the pending local offer.
27562
27836
  var pendingLocalOffer = peerConnection._pendingLocalOffer;
27563
- return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function setLocalOfferSucceeded() {
27837
+ return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function () {
27564
27838
  peerConnection._pendingLocalOffer = null;
27565
27839
  return peerConnection.setRemoteDescription(answer);
27566
- }).then(function setRemoteAnswerSucceeded() {
27840
+ }).then(function () {
27567
27841
  // NOTE(mroberts): The signalingStates between the ChromeRTCPeerConnection
27568
27842
  // and the underlying RTCPeerConnection implementation have converged. We
27569
27843
  // can unblock any pending calls to addIceCandidate now.
@@ -27578,8 +27852,10 @@ function setRemoteAnswer(peerConnection, answer) {
27578
27852
  * @returns {boolean}
27579
27853
  */
27580
27854
  function hasReceiversForTracksOfKind(peerConnection, kind) {
27581
- return !!peerConnection.getTransceivers().find(function (transceiver) {
27582
- return transceiver.receiver && transceiver.receiver.track && transceiver.receiver.track.kind === kind;
27855
+ return !!peerConnection.getTransceivers().find(function (_a) {
27856
+ var _b = _a.receiver, receiver = _b === void 0 ? {} : _b;
27857
+ var _c = receiver.track, track = _c === void 0 ? {} : _c;
27858
+ return track.kind === kind;
27583
27859
  });
27584
27860
  }
27585
27861
  function unwrap(description) {
@@ -27651,19 +27927,54 @@ function shimDataChannel(dataChannel) {
27651
27927
  */
27652
27928
  function updateTrackIdsToSSRCs(sdpFormat, tracksToSSRCs, sdp) {
27653
27929
  return sdpFormat === 'unified'
27654
- ? sdpUtils.updateUnifiedPlanTrackIdsToSSRCs(tracksToSSRCs, sdp)
27655
- : sdpUtils.updatePlanBTrackIdsToSSRCs(tracksToSSRCs, sdp);
27930
+ ? updateUnifiedPlanTrackIdsToSSRCs(tracksToSSRCs, sdp)
27931
+ : updatePlanBTrackIdsToSSRCs(tracksToSSRCs, sdp);
27656
27932
  }
27657
27933
  module.exports = ChromeRTCPeerConnection;
27658
27934
 
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){
27935
+ },{"../../eventtarget":11,"../mediastream":159,"../rtcrtpsender":166,"../rtcsessiondescription/chrome":167,"../util":170,"../util/latch":171,"../util/sdp":172}],163:[function(require,module,exports){
27660
27936
  /* globals RTCPeerConnection */
27661
27937
  'use strict';
27662
- var EventTarget = require('../util/eventtarget');
27938
+ var __extends = (this && this.__extends) || (function () {
27939
+ var extendStatics = function (d, b) {
27940
+ extendStatics = Object.setPrototypeOf ||
27941
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27942
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27943
+ return extendStatics(d, b);
27944
+ };
27945
+ return function (d, b) {
27946
+ if (typeof b !== "function" && b !== null)
27947
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
27948
+ extendStatics(d, b);
27949
+ function __() { this.constructor = d; }
27950
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
27951
+ };
27952
+ })();
27953
+ var __read = (this && this.__read) || function (o, n) {
27954
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
27955
+ if (!m) return o;
27956
+ var i = m.call(o), r, ar = [], e;
27957
+ try {
27958
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27959
+ }
27960
+ catch (error) { e = { error: error }; }
27961
+ finally {
27962
+ try {
27963
+ if (r && !r.done && (m = i["return"])) m.call(i);
27964
+ }
27965
+ finally { if (e) throw e.error; }
27966
+ }
27967
+ return ar;
27968
+ };
27969
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
27970
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
27971
+ to[j] = from[i];
27972
+ return to;
27973
+ };
27974
+ var EventTarget = require('../../eventtarget');
27663
27975
  var FirefoxRTCSessionDescription = require('../rtcsessiondescription/firefox');
27664
- var inherits = require('../../vendor/inherits');
27665
27976
  var updateTracksToSSRCs = require('../util/sdp').updateUnifiedPlanTrackIdsToSSRCs;
27666
- var util = require('../util');
27977
+ var _a = require('../util'), delegateMethods = _a.delegateMethods, interceptEvent = _a.interceptEvent, legacyPromise = _a.legacyPromise, proxyProperties = _a.proxyProperties;
27667
27978
  // NOTE(mroberts): This class wraps Firefox's RTCPeerConnection implementation.
27668
27979
  // It provides some functionality not currently present in Firefox, namely the
27669
27980
  // abilities to
@@ -27684,201 +27995,212 @@ var util = require('../util');
27684
27995
  //
27685
27996
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1240897
27686
27997
  //
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;
27998
+ var FirefoxRTCPeerConnection = /** @class */ (function (_super) {
27999
+ __extends(FirefoxRTCPeerConnection, _super);
28000
+ function FirefoxRTCPeerConnection(configuration) {
28001
+ var _this = _super.call(this) || this;
28002
+ interceptEvent(_this, 'signalingstatechange');
28003
+ /* eslint new-cap:0 */
28004
+ var peerConnection = new RTCPeerConnection(configuration);
28005
+ Object.defineProperties(_this, {
28006
+ _initiallyNegotiatedDtlsRole: {
28007
+ value: null,
28008
+ writable: true
28009
+ },
28010
+ _isClosed: {
28011
+ value: false,
28012
+ writable: true
28013
+ },
28014
+ _peerConnection: {
28015
+ value: peerConnection
28016
+ },
28017
+ _rollingBack: {
28018
+ value: false,
28019
+ writable: true
28020
+ },
28021
+ _tracksToSSRCs: {
28022
+ value: new Map()
28023
+ },
28024
+ // NOTE(mmalavalli): Firefox throws a TypeError when the PeerConnection's
28025
+ // prototype's "peerIdentity" property is accessed. In order to overcome
28026
+ // this, we ignore this property while delegating methods.
28027
+ // Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1363815
28028
+ peerIdentity: {
28029
+ enumerable: true,
28030
+ value: Promise.resolve({
28031
+ idp: '',
28032
+ name: ''
28033
+ })
27718
28034
  }
27719
- },
27720
- localDescription: {
27721
- enumerable: true,
27722
- get: function () {
27723
- return overwriteWithInitiallyNegotiatedDtlsRole(this._peerConnection.localDescription, this._initiallyNegotiatedDtlsRole);
28035
+ });
28036
+ var previousSignalingState;
28037
+ peerConnection.addEventListener('signalingstatechange', function () {
28038
+ var args = [];
28039
+ for (var _i = 0; _i < arguments.length; _i++) {
28040
+ args[_i] = arguments[_i];
27724
28041
  }
27725
- },
27726
- signalingState: {
27727
- enumerable: true,
27728
- get: function () {
27729
- return this._isClosed ? 'closed' : this._peerConnection.signalingState;
28042
+ if (!_this._rollingBack && _this.signalingState !== previousSignalingState) {
28043
+ previousSignalingState = _this.signalingState;
28044
+ // NOTE(mmalavalli): In Firefox, 'signalingstatechange' event is
28045
+ // triggered synchronously in the same tick after
28046
+ // RTCPeerConnection#close() is called. So we mimic Chrome's behavior
28047
+ // by triggering 'signalingstatechange' on the next tick.
28048
+ if (_this._isClosed) {
28049
+ setTimeout(function () { return _this.dispatchEvent.apply(_this, __spreadArray([], __read(args))); });
28050
+ }
28051
+ else {
28052
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
28053
+ }
27730
28054
  }
27731
- }
28055
+ });
28056
+ proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);
28057
+ return _this;
28058
+ }
28059
+ Object.defineProperty(FirefoxRTCPeerConnection.prototype, "iceGatheringState", {
28060
+ get: function () {
28061
+ return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
28062
+ },
28063
+ enumerable: false,
28064
+ configurable: true
27732
28065
  });
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
- }
28066
+ Object.defineProperty(FirefoxRTCPeerConnection.prototype, "localDescription", {
28067
+ get: function () {
28068
+ return overwriteWithInitiallyNegotiatedDtlsRole(this._peerConnection.localDescription, this._initiallyNegotiatedDtlsRole);
28069
+ },
28070
+ enumerable: false,
28071
+ configurable: true
27750
28072
  });
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);
28073
+ Object.defineProperty(FirefoxRTCPeerConnection.prototype, "signalingState", {
28074
+ get: function () {
28075
+ return this._isClosed ? 'closed' : this._peerConnection.signalingState;
28076
+ },
28077
+ enumerable: false,
28078
+ configurable: true
27772
28079
  });
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)
28080
+ FirefoxRTCPeerConnection.prototype.createAnswer = function () {
28081
+ var _this = this;
28082
+ var args = [];
28083
+ for (var _i = 0; _i < arguments.length; _i++) {
28084
+ args[_i] = arguments[_i];
28085
+ }
28086
+ var promise;
28087
+ promise = this._peerConnection.createAnswer().then(function (answer) {
28088
+ saveInitiallyNegotiatedDtlsRole(_this, answer);
28089
+ return overwriteWithInitiallyNegotiatedDtlsRole(answer, _this._initiallyNegotiatedDtlsRole);
28090
+ });
28091
+ return typeof args[0] === 'function'
28092
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(args))) : promise;
28093
+ };
28094
+ // NOTE(mroberts): The WebRTC spec allows you to call createOffer from any
28095
+ // signalingState other than "closed"; however, Firefox has not yet implemented
28096
+ // this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388). We workaround
28097
+ // this by rolling back if we are in state "have-local-offer" or
28098
+ // "have-remote-offer". This is acceptable for our use case because we will
28099
+ // apply the newly-created offer almost immediately; however, this may be
28100
+ // unacceptable for other use cases.
28101
+ FirefoxRTCPeerConnection.prototype.createOffer = function () {
28102
+ var _this = this;
28103
+ var args = [];
28104
+ for (var _i = 0; _i < arguments.length; _i++) {
28105
+ args[_i] = arguments[_i];
28106
+ }
28107
+ var _a = __read(args, 3), arg1 = _a[0], arg2 = _a[1], arg3 = _a[2];
28108
+ var options = arg3 || arg1 || {};
28109
+ var promise;
28110
+ if (this.signalingState === 'have-local-offer' ||
28111
+ this.signalingState === 'have-remote-offer') {
28112
+ var local = this.signalingState === 'have-local-offer';
28113
+ promise = rollback(this, local, function () { return _this.createOffer(options); });
28114
+ }
28115
+ else {
28116
+ promise = this._peerConnection.createOffer(options);
28117
+ }
28118
+ promise = promise.then(function (offer) {
28119
+ return new FirefoxRTCSessionDescription({
28120
+ type: offer.type,
28121
+ sdp: updateTracksToSSRCs(_this._tracksToSSRCs, offer.sdp)
28122
+ });
27803
28123
  });
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
28124
  return args.length > 1
27822
- ? util.legacyPromise(promise, args[1], args[2])
28125
+ ? legacyPromise(promise, arg1, arg2)
27823
28126
  : 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'));
28127
+ };
28128
+ // NOTE(mroberts): While Firefox will reject the Promise returned by
28129
+ // setLocalDescription when called from signalingState "have-local-offer" with
28130
+ // an answer, it still updates the .localDescription property. We workaround
28131
+ // this by explicitly handling this case.
28132
+ FirefoxRTCPeerConnection.prototype.setLocalDescription = function () {
28133
+ var _a;
28134
+ var args = [];
28135
+ for (var _i = 0; _i < arguments.length; _i++) {
28136
+ args[_i] = arguments[_i];
27846
28137
  }
27847
- else if (description.type === 'offer') {
27848
- promise = rollback(this, false, function rollbackSucceeded() {
27849
- return self._peerConnection.setRemoteDescription(description);
27850
- });
28138
+ var _b = __read(args), description = _b[0], rest = _b.slice(1);
28139
+ var promise;
28140
+ if (description && description.type === 'answer' && this.signalingState === 'have-local-offer') {
28141
+ promise = Promise.reject(new Error('Cannot set local answer in state have-local-offer'));
27851
28142
  }
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');
28143
+ if (promise) {
28144
+ return args.length > 1
28145
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;
28146
+ }
28147
+ return (_a = this._peerConnection).setLocalDescription.apply(_a, __spreadArray([], __read(args)));
28148
+ };
28149
+ // NOTE(mroberts): The WebRTC spec allows you to call setRemoteDescription with
28150
+ // an offer multiple times in signalingState "have-remote-offer"; however,
28151
+ // Firefox has not yet implemented this (https://bugzilla.mozilla.org/show_bug.cgi?id=1072388).
28152
+ // We workaround this by rolling back if we are in state "have-remote-offer".
28153
+ // This is acceptable for our use case; however, this may be unacceptable for
28154
+ // other use cases.
28155
+ //
28156
+ // While Firefox will reject the Promise returned by setRemoteDescription when
28157
+ // called from signalingState "have-remote-offer" with an answer, it sill
28158
+ // updates the .remoteDescription property. We workaround this by explicitly
28159
+ // handling this case.
28160
+ FirefoxRTCPeerConnection.prototype.setRemoteDescription = function () {
28161
+ var _this = this;
28162
+ var args = [];
28163
+ for (var _i = 0; _i < arguments.length; _i++) {
28164
+ args[_i] = arguments[_i];
28165
+ }
28166
+ var _a = __read(args), description = _a[0], rest = _a.slice(1);
28167
+ var promise;
28168
+ if (description && this.signalingState === 'have-remote-offer') {
28169
+ if (description.type === 'answer') {
28170
+ promise = Promise.reject(new Error('Cannot set remote answer in state have-remote-offer'));
28171
+ }
28172
+ else if (description.type === 'offer') {
28173
+ promise = rollback(this, false, function () { return _this._peerConnection.setRemoteDescription(description); });
28174
+ }
28175
+ }
28176
+ if (!promise) {
28177
+ promise = this._peerConnection.setRemoteDescription(description);
28178
+ }
28179
+ promise = promise.then(function () { return saveInitiallyNegotiatedDtlsRole(_this, description, true); });
28180
+ return args.length > 1
28181
+ ? legacyPromise.apply(void 0, __spreadArray([promise], __read(rest))) : promise;
28182
+ };
28183
+ // NOTE(mroberts): The WebRTC spec specifies that the PeerConnection's internal
28184
+ // isClosed slot should immediately be set to true; however, in Firefox it
28185
+ // occurs in the next tick. We workaround this by tracking isClosed manually.
28186
+ FirefoxRTCPeerConnection.prototype.close = function () {
28187
+ if (this.signalingState !== 'closed') {
28188
+ this._isClosed = true;
28189
+ this._peerConnection.close();
28190
+ }
28191
+ };
28192
+ return FirefoxRTCPeerConnection;
28193
+ }(EventTarget));
28194
+ delegateMethods(RTCPeerConnection.prototype, FirefoxRTCPeerConnection.prototype, '_peerConnection');
27873
28195
  function rollback(peerConnection, local, onceRolledBack) {
27874
28196
  var setLocalDescription = local ? 'setLocalDescription' : 'setRemoteDescription';
27875
28197
  peerConnection._rollingBack = true;
27876
28198
  return peerConnection._peerConnection[setLocalDescription](new FirefoxRTCSessionDescription({
27877
28199
  type: 'rollback'
27878
- })).then(onceRolledBack).then(function onceRolledBackSucceeded(result) {
28200
+ })).then(onceRolledBack).then(function (result) {
27879
28201
  peerConnection._rollingBack = false;
27880
28202
  return result;
27881
- }, function rollbackOrOnceRolledBackFailed(error) {
28203
+ }, function (error) {
27882
28204
  peerConnection._rollingBack = false;
27883
28205
  throw error;
27884
28206
  });
@@ -27937,7 +28259,7 @@ function overwriteWithInitiallyNegotiatedDtlsRole(description, dtlsRole) {
27937
28259
  }
27938
28260
  module.exports = FirefoxRTCPeerConnection;
27939
28261
 
27940
- },{"../../vendor/inherits":150,"../rtcsessiondescription/firefox":167,"../util":170,"../util/eventtarget":169,"../util/sdp":172}],163:[function(require,module,exports){
28262
+ },{"../../eventtarget":11,"../rtcsessiondescription/firefox":168,"../util":170,"../util/sdp":172}],164:[function(require,module,exports){
27941
28263
  'use strict';
27942
28264
  if (typeof RTCPeerConnection === 'function') {
27943
28265
  var guessBrowser = require('../util').guessBrowser;
@@ -27962,253 +28284,299 @@ else {
27962
28284
  };
27963
28285
  }
27964
28286
 
27965
- },{"../util":170,"./chrome":161,"./firefox":162,"./safari":164}],164:[function(require,module,exports){
28287
+ },{"../util":170,"./chrome":162,"./firefox":163,"./safari":165}],165:[function(require,module,exports){
27966
28288
  /* globals RTCPeerConnection, RTCSessionDescription */
27967
28289
  'use strict';
27968
- var EventTarget = require('../util/eventtarget');
27969
- var inherits = require('../../vendor/inherits');
28290
+ var __extends = (this && this.__extends) || (function () {
28291
+ var extendStatics = function (d, b) {
28292
+ extendStatics = Object.setPrototypeOf ||
28293
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
28294
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
28295
+ return extendStatics(d, b);
28296
+ };
28297
+ return function (d, b) {
28298
+ if (typeof b !== "function" && b !== null)
28299
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
28300
+ extendStatics(d, b);
28301
+ function __() { this.constructor = d; }
28302
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28303
+ };
28304
+ })();
28305
+ var __read = (this && this.__read) || function (o, n) {
28306
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28307
+ if (!m) return o;
28308
+ var i = m.call(o), r, ar = [], e;
28309
+ try {
28310
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
28311
+ }
28312
+ catch (error) { e = { error: error }; }
28313
+ finally {
28314
+ try {
28315
+ if (r && !r.done && (m = i["return"])) m.call(i);
28316
+ }
28317
+ finally { if (e) throw e.error; }
28318
+ }
28319
+ return ar;
28320
+ };
28321
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
28322
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
28323
+ to[j] = from[i];
28324
+ return to;
28325
+ };
28326
+ var EventTarget = require('../../eventtarget');
27970
28327
  var Latch = require('../util/latch');
27971
- var sdpUtils = require('../util/sdp');
27972
- var util = require('../util');
27973
- var isUnifiedPlan = sdpUtils.getSdpFormat() === 'unified';
28328
+ var _a = require('../util/sdp'), getSdpFormat = _a.getSdpFormat, updatePlanBTrackIdsToSSRCs = _a.updatePlanBTrackIdsToSSRCs, updateUnifiedPlanTrackIdsToSSRCs = _a.updateUnifiedPlanTrackIdsToSSRCs;
28329
+ var _b = require('../util'), delegateMethods = _b.delegateMethods, interceptEvent = _b.interceptEvent, proxyProperties = _b.proxyProperties;
28330
+ var isUnifiedPlan = getSdpFormat() === 'unified';
27974
28331
  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()
28332
+ ? updateUnifiedPlanTrackIdsToSSRCs
28333
+ : updatePlanBTrackIdsToSSRCs;
28334
+ var SafariRTCPeerConnection = /** @class */ (function (_super) {
28335
+ __extends(SafariRTCPeerConnection, _super);
28336
+ function SafariRTCPeerConnection(configuration) {
28337
+ var _this = _super.call(this) || this;
28338
+ interceptEvent(_this, 'datachannel');
28339
+ interceptEvent(_this, 'iceconnectionstatechange');
28340
+ interceptEvent(_this, 'signalingstatechange');
28341
+ interceptEvent(_this, 'track');
28342
+ var peerConnection = new RTCPeerConnection(configuration);
28343
+ Object.defineProperties(_this, {
28344
+ _appliedTracksToSSRCs: {
28345
+ value: new Map(),
28346
+ writable: true
28347
+ },
28348
+ _audioTransceiver: {
28349
+ value: null,
28350
+ writable: true
28351
+ },
28352
+ _isClosed: {
28353
+ value: false,
28354
+ writable: true
28355
+ },
28356
+ _peerConnection: {
28357
+ value: peerConnection
28358
+ },
28359
+ _pendingLocalOffer: {
28360
+ value: null,
28361
+ writable: true
28362
+ },
28363
+ _pendingRemoteOffer: {
28364
+ value: null,
28365
+ writable: true
28366
+ },
28367
+ _rolledBackTracksToSSRCs: {
28368
+ value: new Map(),
28369
+ writable: true
28370
+ },
28371
+ _signalingStateLatch: {
28372
+ value: new Latch()
28373
+ },
28374
+ _tracksToSSRCs: {
28375
+ value: new Map(),
28376
+ writable: true
28377
+ },
28378
+ _videoTransceiver: {
28379
+ value: null,
28380
+ writable: true
28381
+ }
28382
+ });
28383
+ peerConnection.addEventListener('datachannel', function (event) {
28384
+ shimDataChannel(event.channel);
28385
+ _this.dispatchEvent(event);
28386
+ });
28387
+ peerConnection.addEventListener('iceconnectionstatechange', function () {
28388
+ var args = [];
28389
+ for (var _i = 0; _i < arguments.length; _i++) {
28390
+ args[_i] = arguments[_i];
28391
+ }
28392
+ if (_this._isClosed) {
28393
+ return;
28394
+ }
28395
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
28396
+ });
28397
+ peerConnection.addEventListener('signalingstatechange', function () {
28398
+ var args = [];
28399
+ for (var _i = 0; _i < arguments.length; _i++) {
28400
+ args[_i] = arguments[_i];
28401
+ }
28402
+ if (_this._isClosed) {
28403
+ return;
28404
+ }
28405
+ if (peerConnection.signalingState === 'stable') {
28406
+ _this._appliedTracksToSSRCs = new Map(_this._tracksToSSRCs);
28407
+ }
28408
+ if (!_this._pendingLocalOffer && !_this._pendingRemoteOffer) {
28409
+ _this.dispatchEvent.apply(_this, __spreadArray([], __read(args)));
28410
+ }
28411
+ });
28412
+ // NOTE(syerrapragada): This ensures that SafariRTCPeerConnection's "remoteDescription", when accessed
28413
+ // in an RTCTrackEvent listener, will point to the underlying RTCPeerConnection's
28414
+ // "remoteDescription". Before this fix, this was still pointing to "_pendingRemoteOffer"
28415
+ // even though a new remote RTCSessionDescription had already been applied.
28416
+ peerConnection.addEventListener('track', function (event) {
28417
+ _this._pendingRemoteOffer = null;
28418
+ _this.dispatchEvent(event);
28419
+ });
28420
+ proxyProperties(RTCPeerConnection.prototype, _this, peerConnection);
28421
+ return _this;
28422
+ }
28423
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "localDescription", {
28424
+ get: function () {
28425
+ return this._pendingLocalOffer || this._peerConnection.localDescription;
28017
28426
  },
28018
- _tracksToSSRCs: {
28019
- value: new Map(),
28020
- writable: true
28427
+ enumerable: false,
28428
+ configurable: true
28429
+ });
28430
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "iceConnectionState", {
28431
+ get: function () {
28432
+ return this._isClosed ? 'closed' : this._peerConnection.iceConnectionState;
28021
28433
  },
28022
- _videoTransceiver: {
28023
- value: null,
28024
- writable: true
28434
+ enumerable: false,
28435
+ configurable: true
28436
+ });
28437
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "iceGatheringState", {
28438
+ get: function () {
28439
+ return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
28025
28440
  },
28026
- localDescription: {
28027
- enumerable: true,
28028
- get: function () {
28029
- return this._pendingLocalOffer || this._peerConnection.localDescription;
28030
- }
28441
+ enumerable: false,
28442
+ configurable: true
28443
+ });
28444
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "remoteDescription", {
28445
+ get: function () {
28446
+ return this._pendingRemoteOffer || this._peerConnection.remoteDescription;
28031
28447
  },
28032
- iceConnectionState: {
28033
- enumerable: true,
28034
- get: function () {
28035
- return this._isClosed ? 'closed' : this._peerConnection.iceConnectionState;
28448
+ enumerable: false,
28449
+ configurable: true
28450
+ });
28451
+ Object.defineProperty(SafariRTCPeerConnection.prototype, "signalingState", {
28452
+ get: function () {
28453
+ if (this._isClosed) {
28454
+ return 'closed';
28036
28455
  }
28037
- },
28038
- iceGatheringState: {
28039
- enumerable: true,
28040
- get: function () {
28041
- return this._isClosed ? 'complete' : this._peerConnection.iceGatheringState;
28456
+ else if (this._pendingLocalOffer) {
28457
+ return 'have-local-offer';
28042
28458
  }
28043
- },
28044
- remoteDescription: {
28045
- enumerable: true,
28046
- get: function () {
28047
- return this._pendingRemoteOffer || this._peerConnection.remoteDescription;
28459
+ else if (this._pendingRemoteOffer) {
28460
+ return 'have-remote-offer';
28048
28461
  }
28462
+ return this._peerConnection.signalingState;
28049
28463
  },
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);
28464
+ enumerable: false,
28465
+ configurable: true
28076
28466
  });
28077
- peerConnection.addEventListener('signalingstatechange', function onsignalingstatechange() {
28078
- if (self._isClosed) {
28079
- return;
28467
+ SafariRTCPeerConnection.prototype.addIceCandidate = function (candidate) {
28468
+ var _this = this;
28469
+ if (this.signalingState === 'have-remote-offer') {
28470
+ return this._signalingStateLatch.when('low').then(function () { return _this._peerConnection.addIceCandidate(candidate); });
28080
28471
  }
28081
- if (peerConnection.signalingState === 'stable') {
28082
- self._appliedTracksToSSRCs = new Map(self._tracksToSSRCs);
28472
+ return this._peerConnection.addIceCandidate(candidate);
28473
+ };
28474
+ SafariRTCPeerConnection.prototype.createOffer = function (options) {
28475
+ var _this = this;
28476
+ options = Object.assign({}, options);
28477
+ // NOTE(mroberts): In general, this is not the way to do this; however, it's
28478
+ // good enough for our application.
28479
+ if (options.offerToReceiveVideo && !this._audioTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'audio'))) {
28480
+ delete options.offerToReceiveAudio;
28481
+ try {
28482
+ this._audioTransceiver = isUnifiedPlan
28483
+ ? this.addTransceiver('audio', { direction: 'recvonly' })
28484
+ : this.addTransceiver('audio');
28485
+ }
28486
+ catch (e) {
28487
+ return Promise.reject(e);
28488
+ }
28083
28489
  }
28084
- if (!self._pendingLocalOffer && !self._pendingRemoteOffer) {
28085
- self.dispatchEvent.apply(self, arguments);
28490
+ if (options.offerToReceiveVideo && !this._videoTransceiver && !(isUnifiedPlan && hasReceiversForTracksOfKind(this, 'video'))) {
28491
+ delete options.offerToReceiveVideo;
28492
+ try {
28493
+ this._videoTransceiver = isUnifiedPlan
28494
+ ? this.addTransceiver('video', { direction: 'recvonly' })
28495
+ : this.addTransceiver('video');
28496
+ }
28497
+ catch (e) {
28498
+ return Promise.reject(e);
28499
+ }
28086
28500
  }
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);
28501
+ return this._peerConnection.createOffer(options).then(function (offer) {
28502
+ // NOTE(mmalavalli): If createOffer() is called immediately after rolling back,
28503
+ // then we no longer need to retain the rolled back tracks to SSRCs Map.
28504
+ _this._rolledBackTracksToSSRCs.clear();
28505
+ return new RTCSessionDescription({
28506
+ type: offer.type,
28507
+ sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, offer.sdp)
28508
+ });
28104
28509
  });
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);
28510
+ };
28511
+ SafariRTCPeerConnection.prototype.createAnswer = function (options) {
28512
+ var _this = this;
28513
+ if (this._pendingRemoteOffer) {
28514
+ return this._peerConnection.setRemoteDescription(this._pendingRemoteOffer).then(function () {
28515
+ _this._signalingStateLatch.lower();
28516
+ return _this._peerConnection.createAnswer();
28517
+ }).then(function (answer) {
28518
+ _this._pendingRemoteOffer = null;
28519
+ // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
28520
+ // longer need to retain the rolled back tracks to SSRCs Map.
28521
+ _this._rolledBackTracksToSSRCs.clear();
28522
+ return isUnifiedPlan ? new RTCSessionDescription({
28523
+ type: answer.type,
28524
+ sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, answer.sdp)
28525
+ }) : answer;
28526
+ }, function (error) {
28527
+ _this._pendingRemoteOffer = null;
28528
+ throw error;
28529
+ });
28133
28530
  }
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;
28531
+ return this._peerConnection.createAnswer(options).then(function (answer) {
28153
28532
  // NOTE(mmalavalli): If createAnswer() is called immediately after rolling back, then we no
28154
28533
  // longer need to retain the rolled back tracks to SSRCs Map.
28155
- self._rolledBackTracksToSSRCs.clear();
28534
+ _this._rolledBackTracksToSSRCs.clear();
28156
28535
  return isUnifiedPlan ? new RTCSessionDescription({
28157
28536
  type: answer.type,
28158
- sdp: updateTrackIdsToSSRCs(self._tracksToSSRCs, answer.sdp)
28537
+ sdp: updateTrackIdsToSSRCs(_this._tracksToSSRCs, answer.sdp)
28159
28538
  }) : answer;
28160
- }, function setRemoteDescriptionOrCreateAnswerFailed(error) {
28161
- self._pendingRemoteOffer = null;
28162
- throw error;
28163
28539
  });
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);
28540
+ };
28541
+ SafariRTCPeerConnection.prototype.createDataChannel = function (label, dataChannelDict) {
28542
+ var dataChannel = this._peerConnection.createDataChannel(label, dataChannelDict);
28543
+ shimDataChannel(dataChannel);
28544
+ return dataChannel;
28545
+ };
28546
+ SafariRTCPeerConnection.prototype.removeTrack = function (sender) {
28547
+ sender.replaceTrack(null);
28548
+ this._peerConnection.removeTrack(sender);
28549
+ };
28550
+ SafariRTCPeerConnection.prototype.setLocalDescription = function (description) {
28551
+ // NOTE(mmalavalli): If setLocalDescription() is called immediately after rolling back,
28552
+ // then we need to restore the rolled back tracks to SSRCs Map.
28553
+ if (this._rolledBackTracksToSSRCs.size > 0) {
28554
+ this._tracksToSSRCs = new Map(this._rolledBackTracksToSSRCs);
28555
+ this._rolledBackTracksToSSRCs.clear();
28556
+ }
28557
+ return setDescription(this, true, description);
28558
+ };
28559
+ SafariRTCPeerConnection.prototype.setRemoteDescription = function (description) {
28560
+ // NOTE(mmalavalli): If setRemoteDescription() is called immediately after rolling back,
28561
+ // then we no longer need to retain the rolled back tracks to SSRCs Map.
28189
28562
  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');
28563
+ return setDescription(this, false, description);
28564
+ };
28565
+ SafariRTCPeerConnection.prototype.close = function () {
28566
+ var _this = this;
28567
+ if (this._isClosed) {
28568
+ return;
28569
+ }
28570
+ this._isClosed = true;
28571
+ this._peerConnection.close();
28572
+ setTimeout(function () {
28573
+ _this.dispatchEvent(new Event('iceconnectionstatechange'));
28574
+ _this.dispatchEvent(new Event('signalingstatechange'));
28575
+ });
28576
+ };
28577
+ return SafariRTCPeerConnection;
28578
+ }(EventTarget));
28579
+ delegateMethods(RTCPeerConnection.prototype, SafariRTCPeerConnection.prototype, '_peerConnection');
28212
28580
  function setDescription(peerConnection, local, description) {
28213
28581
  function setPendingLocalOffer(offer) {
28214
28582
  if (local) {
@@ -28235,8 +28603,7 @@ function setDescription(peerConnection, local, description) {
28235
28603
  }
28236
28604
  else if (description.type === 'offer') {
28237
28605
  if (peerConnection.signalingState !== intermediateState && peerConnection.signalingState !== 'stable') {
28238
- return Promise.reject(new Error('Cannot set ' + (local ? 'local' : 'remote') +
28239
- ' offer in state ' + peerConnection.signalingState));
28606
+ return Promise.reject(new Error("Cannot set " + (local ? 'local' : 'remote') + "\n offer in state " + peerConnection.signalingState));
28240
28607
  }
28241
28608
  if (!pendingLocalOffer && peerConnection._signalingStateLatch.state === 'low') {
28242
28609
  peerConnection._signalingStateLatch.raise();
@@ -28245,16 +28612,13 @@ function setDescription(peerConnection, local, description) {
28245
28612
  setPendingLocalOffer(description);
28246
28613
  // Only dispatch a signalingstatechange event if we transitioned.
28247
28614
  if (peerConnection.signalingState !== previousSignalingState) {
28248
- return Promise.resolve().then(function dispatchSignalingStateChangeEvent() {
28249
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
28250
- });
28615
+ return Promise.resolve().then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
28251
28616
  }
28252
28617
  return Promise.resolve();
28253
28618
  }
28254
28619
  else if (description.type === 'rollback') {
28255
28620
  if (peerConnection.signalingState !== intermediateState) {
28256
- return Promise.reject(new Error('Cannot rollback ' +
28257
- (local ? 'local' : 'remote') + ' description in ' + peerConnection.signalingState));
28621
+ return Promise.reject(new Error("Cannot rollback \n " + (local ? 'local' : 'remote') + " description in " + peerConnection.signalingState));
28258
28622
  }
28259
28623
  clearPendingLocalOffer();
28260
28624
  // NOTE(mmalavalli): We store the rolled back tracks to SSRCs Map here in case
@@ -28263,20 +28627,16 @@ function setDescription(peerConnection, local, description) {
28263
28627
  // a glare scenario and this Map should be restored.
28264
28628
  peerConnection._rolledBackTracksToSSRCs = new Map(peerConnection._tracksToSSRCs);
28265
28629
  peerConnection._tracksToSSRCs = new Map(peerConnection._appliedTracksToSSRCs);
28266
- return Promise.resolve().then(function dispatchSignalingStateChangeEvent() {
28267
- peerConnection.dispatchEvent(new Event('signalingstatechange'));
28268
- });
28630
+ return Promise.resolve().then(function () { return peerConnection.dispatchEvent(new Event('signalingstatechange')); });
28269
28631
  }
28270
28632
  return peerConnection._peerConnection[setLocalDescription](description);
28271
28633
  }
28272
28634
  function setRemoteAnswer(peerConnection, answer) {
28273
28635
  var pendingLocalOffer = peerConnection._pendingLocalOffer;
28274
- return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function setLocalOfferSucceeded() {
28636
+ return peerConnection._peerConnection.setLocalDescription(pendingLocalOffer).then(function () {
28275
28637
  peerConnection._pendingLocalOffer = null;
28276
28638
  return peerConnection.setRemoteDescription(answer);
28277
- }).then(function setRemoteAnswerSucceeded() {
28278
- peerConnection._signalingStateLatch.lower();
28279
- });
28639
+ }).then(function () { return peerConnection._signalingStateLatch.lower(); });
28280
28640
  }
28281
28641
  /**
28282
28642
  * Whether a SafariRTCPeerConnection has any RTCRtpReceivers(s) for the given
@@ -28286,8 +28646,10 @@ function setRemoteAnswer(peerConnection, answer) {
28286
28646
  * @returns {boolean}
28287
28647
  */
28288
28648
  function hasReceiversForTracksOfKind(peerConnection, kind) {
28289
- return !!peerConnection.getTransceivers().find(function (transceiver) {
28290
- return transceiver.receiver && transceiver.receiver.track && transceiver.receiver.track.kind === kind;
28649
+ return !!peerConnection.getTransceivers().find(function (_a) {
28650
+ var _b = _a.receiver, receiver = _b === void 0 ? {} : _b;
28651
+ var _c = receiver.track, track = _c === void 0 ? {} : _c;
28652
+ return track.kind === kind;
28291
28653
  });
28292
28654
  }
28293
28655
  /**
@@ -28311,22 +28673,25 @@ function shimDataChannel(dataChannel) {
28311
28673
  }
28312
28674
  module.exports = SafariRTCPeerConnection;
28313
28675
 
28314
- },{"../../vendor/inherits":150,"../util":170,"../util/eventtarget":169,"../util/latch":171,"../util/sdp":172}],165:[function(require,module,exports){
28676
+ },{"../../eventtarget":11,"../util":170,"../util/latch":171,"../util/sdp":172}],166:[function(require,module,exports){
28315
28677
  'use strict';
28316
28678
  /**
28317
28679
  * RTCRtpSender shim.
28318
28680
  * @param {MediaStreamTrack} track
28319
28681
  * @property {MediaStreamTrack} track
28320
28682
  */
28321
- function RTCRtpSenderShim(track) {
28322
- Object.defineProperties(this, {
28323
- track: {
28324
- enumerable: true,
28325
- value: track,
28326
- writable: true
28327
- }
28328
- });
28329
- }
28683
+ var RTCRtpSenderShim = /** @class */ (function () {
28684
+ function RTCRtpSenderShim(track) {
28685
+ Object.defineProperties(this, {
28686
+ track: {
28687
+ enumerable: true,
28688
+ value: track,
28689
+ writable: true
28690
+ }
28691
+ });
28692
+ }
28693
+ return RTCRtpSenderShim;
28694
+ }());
28330
28695
  // NOTE(mmalavalli): Because of the way we will be using this shim, there
28331
28696
  // are a couple of use cases that will not be covered:
28332
28697
  //
@@ -28349,7 +28714,7 @@ function RTCRtpSenderShim(track) {
28349
28714
  // using the RTCRtpSender APIs.
28350
28715
  module.exports = RTCRtpSenderShim;
28351
28716
 
28352
- },{}],166:[function(require,module,exports){
28717
+ },{}],167:[function(require,module,exports){
28353
28718
  /* globals RTCSessionDescription */
28354
28719
  'use strict';
28355
28720
  // This class wraps Chrome's RTCSessionDescription implementation. It provides
@@ -28358,40 +28723,47 @@ module.exports = RTCRtpSenderShim;
28358
28723
  // 1. Rollback support
28359
28724
  // https://bugs.chromium.org/p/webrtc/issues/detail?id=4676
28360
28725
  //
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;
28726
+ var ChromeRTCSessionDescription = /** @class */ (function () {
28727
+ function ChromeRTCSessionDescription(descriptionInitDict) {
28728
+ this.descriptionInitDict = descriptionInitDict;
28729
+ // If this constructor is called with an object with a .type property set to
28730
+ // "rollback", we should not call Chrome's RTCSessionDescription constructor,
28731
+ // because this would throw an RTCSdpType error.
28732
+ var description = descriptionInitDict && descriptionInitDict.type === 'rollback'
28733
+ ? null
28734
+ : new RTCSessionDescription(descriptionInitDict);
28735
+ Object.defineProperties(this, {
28736
+ _description: {
28737
+ get: function () {
28738
+ return description;
28739
+ }
28375
28740
  }
28741
+ });
28742
+ }
28743
+ Object.defineProperty(ChromeRTCSessionDescription.prototype, "sdp", {
28744
+ get: function () {
28745
+ return this._description ? this._description.sdp : this.descriptionInitDict.sdp;
28376
28746
  },
28377
- sdp: {
28378
- enumerable: true,
28379
- value: description ? description.sdp : descriptionInitDict.sdp
28747
+ enumerable: false,
28748
+ configurable: true
28749
+ });
28750
+ Object.defineProperty(ChromeRTCSessionDescription.prototype, "type", {
28751
+ get: function () {
28752
+ return this._description ? this._description.type : this.descriptionInitDict.type;
28380
28753
  },
28381
- type: {
28382
- enumerable: true,
28383
- value: description ? description.type : descriptionInitDict.type
28384
- }
28754
+ enumerable: false,
28755
+ configurable: true
28385
28756
  });
28386
- }
28757
+ return ChromeRTCSessionDescription;
28758
+ }());
28387
28759
  module.exports = ChromeRTCSessionDescription;
28388
28760
 
28389
- },{}],167:[function(require,module,exports){
28761
+ },{}],168:[function(require,module,exports){
28390
28762
  /* globals RTCSessionDescription */
28391
28763
  'use strict';
28392
28764
  module.exports = RTCSessionDescription;
28393
28765
 
28394
- },{}],168:[function(require,module,exports){
28766
+ },{}],169:[function(require,module,exports){
28395
28767
  /* globals RTCSessionDescription */
28396
28768
  'use strict';
28397
28769
  if (typeof RTCSessionDescription === 'function') {
@@ -28414,43 +28786,29 @@ else {
28414
28786
  };
28415
28787
  }
28416
28788
 
28417
- },{"../util":170,"./chrome":166,"./firefox":167}],169:[function(require,module,exports){
28789
+ },{"../util":170,"./chrome":167,"./firefox":168}],170:[function(require,module,exports){
28418
28790
  '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()
28791
+ var __read = (this && this.__read) || function (o, n) {
28792
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
28793
+ if (!m) return o;
28794
+ var i = m.call(o), r, ar = [], e;
28795
+ try {
28796
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
28797
+ }
28798
+ catch (error) { e = { error: error }; }
28799
+ finally {
28800
+ try {
28801
+ if (r && !r.done && (m = i["return"])) m.call(i);
28428
28802
  }
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);
28803
+ finally { if (e) throw e.error; }
28804
+ }
28805
+ return ar;
28443
28806
  };
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);
28807
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
28808
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
28809
+ to[j] = from[i];
28810
+ return to;
28449
28811
  };
28450
- module.exports = EventTarget;
28451
-
28452
- },{"events":173}],170:[function(require,module,exports){
28453
- 'use strict';
28454
28812
  /**
28455
28813
  * Create a {@link Deferred}.
28456
28814
  * @returns {Deferred}
@@ -28557,10 +28915,7 @@ function flatMap(list, mapFn) {
28557
28915
  var listArray = list instanceof Map || list instanceof Set
28558
28916
  ? Array.from(list.values())
28559
28917
  : list;
28560
- return listArray.reduce(function (flattened, item) {
28561
- var mapped = mapFn(item);
28562
- return flattened.concat(mapped);
28563
- }, []);
28918
+ return listArray.reduce(function (flattened, item) { return flattened.concat(mapFn(item)); }, []);
28564
28919
  }
28565
28920
  /**
28566
28921
  * Get the browser's user agent, if available.
@@ -28608,8 +28963,8 @@ function guessBrowserVersion(userAgent) {
28608
28963
  if (!prefix) {
28609
28964
  return null;
28610
28965
  }
28611
- var regex = new RegExp('(' + prefix + ')/([^\\s]+)');
28612
- var match = (userAgent.match(regex) || [])[2];
28966
+ var regex = new RegExp("(" + prefix + ")/([^\\s]+)");
28967
+ var _a = __read(userAgent.match(regex) || [], 3), match = _a[2];
28613
28968
  if (!match) {
28614
28969
  return null;
28615
28970
  }
@@ -28665,14 +29020,9 @@ function interceptEvent(target, type) {
28665
29020
  * @returns {Promise<undefined>}
28666
29021
  */
28667
29022
  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;
29023
+ return onSuccess
29024
+ ? promise.then(onSuccess, onFailure)
29025
+ : promise;
28676
29026
  }
28677
29027
  /**
28678
29028
  * Make a unique ID.
@@ -28718,7 +29068,11 @@ function proxyProperty(source, wrapper, target, propertyName) {
28718
29068
  writable: true
28719
29069
  });
28720
29070
  target.addEventListener(propertyName.slice(2), function () {
28721
- wrapper.dispatchEvent.apply(wrapper, arguments);
29071
+ var args = [];
29072
+ for (var _i = 0; _i < arguments.length; _i++) {
29073
+ args[_i] = arguments[_i];
29074
+ }
29075
+ return wrapper.dispatchEvent.apply(wrapper, __spreadArray([], __read(args)));
28722
29076
  });
28723
29077
  return;
28724
29078
  }
@@ -28772,103 +29126,103 @@ var states = {
28772
29126
  * transitioning between them ({@link Latch#raise} and {@link Latch#lower}).
28773
29127
  * @param {string} [initialState="low"] - either "high" or "low"
28774
29128
  */
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();
29129
+ var Latch = /** @class */ (function () {
29130
+ function Latch(initialState) {
29131
+ if (initialState === void 0) { initialState = 'low'; }
29132
+ var state = initialState;
29133
+ Object.defineProperties(this, {
29134
+ _state: {
29135
+ set: function (_state) {
29136
+ var _this = this;
29137
+ if (state !== _state) {
29138
+ state = _state;
29139
+ var whenDeferreds = this._whenDeferreds.get(state);
29140
+ whenDeferreds.forEach(function (deferred) { return deferred.resolve(_this); });
29141
+ whenDeferreds.clear();
29142
+ }
29143
+ },
29144
+ get: function () {
29145
+ return state;
28790
29146
  }
28791
29147
  },
28792
- get: function () {
28793
- return state;
29148
+ _whenDeferreds: {
29149
+ value: new Map([
29150
+ ['high', new Set()],
29151
+ ['low', new Set()]
29152
+ ])
28794
29153
  }
29154
+ });
29155
+ }
29156
+ Object.defineProperty(Latch.prototype, "state", {
29157
+ get: function () {
29158
+ return this._state;
28795
29159
  },
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
- }
29160
+ enumerable: false,
29161
+ configurable: true
28808
29162
  });
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
- };
29163
+ /**
29164
+ * Transition to "low".
29165
+ * @returns {this}
29166
+ * @throws {Error}
29167
+ */
29168
+ Latch.prototype.lower = function () {
29169
+ return this.transition('low');
29170
+ };
29171
+ /**
29172
+ * Transition to "high".
29173
+ * @returns {this}
29174
+ * @throws {Error}
29175
+ */
29176
+ Latch.prototype.raise = function () {
29177
+ return this.transition('high');
29178
+ };
29179
+ /**
29180
+ * Transition to a new state.
29181
+ * @param {string} newState
29182
+ * @returns {this}
29183
+ * @throws {Error}
29184
+ */
29185
+ Latch.prototype.transition = function (newState) {
29186
+ if (!states[this.state].has(newState)) {
29187
+ throw createUnreachableStateError(this.state, newState);
29188
+ }
29189
+ this._state = newState;
29190
+ return this;
29191
+ };
29192
+ /**
29193
+ * Return a Promise that resolves when the {@link Latch} transitions to
29194
+ * the specified state.
29195
+ * @param {string} state
29196
+ * @returns {Promise<this>}
29197
+ */
29198
+ Latch.prototype.when = function (state) {
29199
+ if (this.state === state) {
29200
+ return Promise.resolve(this);
29201
+ }
29202
+ if (!states[this.state].has(state)) {
29203
+ return Promise.reject(createUnreachableStateError(this.state, state));
29204
+ }
29205
+ var deferred = defer();
29206
+ this._whenDeferreds.get(state).add(deferred);
29207
+ return deferred.promise;
29208
+ };
29209
+ return Latch;
29210
+ }());
28856
29211
  /**
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
- */
29212
+ * Create an unreachable state Error.
29213
+ * @param {string} from - state to be transitioned from
29214
+ * @param {string} to - state to be transitioned to
29215
+ * @return {Error}
29216
+ */
28862
29217
  function createUnreachableStateError(from, to) {
28863
- return new Error('Cannot transition from "' + from + '" to "' + to + '"');
29218
+ return new Error("Cannot transition from \"" + from + "\" to \"" + to + "\"");
28864
29219
  }
28865
29220
  module.exports = Latch;
28866
29221
 
28867
29222
  },{"./":170}],172:[function(require,module,exports){
28868
29223
  /* globals RTCPeerConnection, RTCRtpTransceiver */
28869
29224
  'use strict';
28870
- var flatMap = require('./').flatMap;
28871
- var guessBrowser = require('./').guessBrowser;
29225
+ var _a = require('./'), flatMap = _a.flatMap, guessBrowser = _a.guessBrowser;
28872
29226
  // NOTE(mmalavalli): We cache Chrome's sdpSemantics support in order to prevent
28873
29227
  // instantiation of more than one RTCPeerConnection.
28874
29228
  var isSdpSemanticsSupported = null;
@@ -29009,7 +29363,7 @@ function getUnifiedPlanTrackIds(sdp) {
29009
29363
  * @returns {Set<string>}
29010
29364
  */
29011
29365
  function getPlanBSSRCs(sdp, trackId) {
29012
- var pattern = '^a=ssrc:([0-9]+) +msid:[^ ]+ +' + trackId + ' *$';
29366
+ var pattern = "^a=ssrc:([0-9]+) +msid:[^ ]+ +" + trackId + " *$";
29013
29367
  return getMatches(pattern, sdp);
29014
29368
  }
29015
29369
  /**
@@ -29020,13 +29374,11 @@ function getPlanBSSRCs(sdp, trackId) {
29020
29374
  * @returns {Array<string>} mediaSections
29021
29375
  */
29022
29376
  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');
29377
+ if (kind === void 0) { kind = '.*'; }
29378
+ if (direction === void 0) { direction = '.*'; }
29379
+ return sdp.split('\r\nm=').slice(1).map(function (mediaSection) { return "m=" + mediaSection; }).filter(function (mediaSection) {
29380
+ var kindPattern = new RegExp("m=" + kind, 'gm');
29381
+ var directionPattern = new RegExp("a=" + direction, 'gm');
29030
29382
  return kindPattern.test(mediaSection) && directionPattern.test(mediaSection);
29031
29383
  });
29032
29384
  }
@@ -29046,10 +29398,8 @@ function getMediaSectionSSRCs(mediaSection) {
29046
29398
  */
29047
29399
  function getUnifiedPlanSSRCs(sdp, trackId) {
29048
29400
  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
- });
29401
+ var msidAttrRegExp = new RegExp("^a=msid:[^ ]+ +" + trackId + " *$", 'gm');
29402
+ var matchingMediaSections = mediaSections.filter(function (mediaSection) { return mediaSection.match(msidAttrRegExp); });
29053
29403
  return new Set(flatMap(matchingMediaSections, getMediaSectionSSRCs));
29054
29404
  }
29055
29405
  /**
@@ -29060,9 +29410,7 @@ function getUnifiedPlanSSRCs(sdp, trackId) {
29060
29410
  * @returns {Map<string, Set<string>>} trackIdsToSSRCs
29061
29411
  */
29062
29412
  function getTrackIdsToSSRCs(getTrackIds, getSSRCs, sdp) {
29063
- return new Map(Array.from(getTrackIds(sdp)).map(function (trackId) {
29064
- return [trackId, getSSRCs(sdp, trackId)];
29065
- }));
29413
+ return new Map(Array.from(getTrackIds(sdp)).map(function (trackId) { return [trackId, getSSRCs(sdp, trackId)]; }));
29066
29414
  }
29067
29415
  /**
29068
29416
  * Get a Map from MediaStreamTrack IDs to SSRCs from a Plan B SDP.
@@ -29103,8 +29451,8 @@ function updateTrackIdsToSSRCs(getTrackIdsToSSRCs, trackIdsToSSRCs, sdp) {
29103
29451
  oldSSRCs.forEach(function (oldSSRC, i) {
29104
29452
  var newSSRC = newSSRCs[i];
29105
29453
  newSSRCsToOldSSRCs.set(newSSRC, oldSSRC);
29106
- var pattern = '^a=ssrc:' + newSSRC + ' (.*)$';
29107
- var replacement = 'a=ssrc:' + oldSSRC + ' $1';
29454
+ var pattern = "^a=ssrc:" + newSSRC + " (.*)$";
29455
+ var replacement = "a=ssrc:" + oldSSRC + " $1";
29108
29456
  sdp = sdp.replace(new RegExp(pattern, 'gm'), replacement);
29109
29457
  });
29110
29458
  });
@@ -29662,7 +30010,7 @@ module.exports={
29662
30010
  "name": "twilio-video",
29663
30011
  "title": "Twilio Video",
29664
30012
  "description": "Twilio Video JavaScript Library",
29665
- "version": "2.25.0",
30013
+ "version": "2.26.1",
29666
30014
  "homepage": "https://twilio.com",
29667
30015
  "author": "Mark Andrus Roberts <mroberts@twilio.com>",
29668
30016
  "contributors": [
@@ -29713,7 +30061,7 @@ module.exports={
29713
30061
  "jsdoc": "^3.5.5",
29714
30062
  "jsdoc-babel": "^0.5.0",
29715
30063
  "json-loader": "^0.5.7",
29716
- "karma": "^5.0.2",
30064
+ "karma": "6.4.1",
29717
30065
  "karma-browserify": "^8.0.0",
29718
30066
  "karma-chrome-launcher": "^2.0.0",
29719
30067
  "karma-edgium-launcher": "^4.0.0-0",
@@ -29819,9 +30167,9 @@ module.exports={
29819
30167
  },{}],175:[function(require,module,exports){
29820
30168
  module.exports = WebSocket;
29821
30169
 
29822
- },{}]},{},[11]);
30170
+ },{}]},{},[12]);
29823
30171
  ;
29824
- var Video = bundle(11);
30172
+ var Video = bundle(12);
29825
30173
  /* globals define */
29826
30174
  if (typeof define === 'function' && define.amd) {
29827
30175
  define([], function() { return Video; });