@opentok/client 2.23.5 → 2.23.7

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license OpenTok.js 2.23.5 5b47d855e
2
+ * @license OpenTok.js 2.23.7 5807f4903
3
3
  *
4
4
  * Copyright (c) 2010-2022 TokBox, Inc.
5
5
  * Subject to the applicable Software Development Kit (SDK) License Agreement:
6
6
  * https://www.vonage.com/legal/communications-apis/terms-of-use/
7
7
  *
8
- * Date: Mon, 12 Sep 2022 05:31:00 GMT
8
+ * Date: Thu, 29 Sep 2022 21:06:15 GMT
9
9
  */
10
10
 
11
11
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -1499,6 +1499,8 @@ module.exports = {
1499
1499
  SCREEN_SHARING_NOT_SUPPORTED: 'OT_SCREEN_SHARING_NOT_SUPPORTED',
1500
1500
  // The WebRTC connection failed during setDescription.
1501
1501
  SET_REMOTE_DESCRIPTION_FAILED: 'OT_SET_REMOTE_DESCRIPTION_FAILED',
1502
+ // Setting the ICE configuration failed.
1503
+ FAILED_SET_CONFIGURATION: 'OT_FAILED_SET_CONFIGURATION',
1502
1504
  // Rumor.Socket cannot connect when it is already connecting or connected.
1503
1505
  SOCKET_ALREADY_CONNECTED_CONNECTING: 'OT_SOCKET_ALREADY_CONNECTED_CONNECTING',
1504
1506
  // A connection was closed abnormally (that is, with no close frame being sent) when a status code
@@ -6451,7 +6453,7 @@ const _require = __webpack_require__(138),
6451
6453
  /** @type builtInConfig */
6452
6454
 
6453
6455
 
6454
- const builtInConfig = cloneDeep({"version":"v2.23.5","buildHash":"5b47d855e","minimumVersion":{"firefox":52,"chrome":49},"debug":"false","websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"https://static.opentok.com","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
6456
+ const builtInConfig = cloneDeep({"version":"v2.23.7","buildHash":"5807f4903","minimumVersion":{"firefox":52,"chrome":49},"debug":"false","websiteURL":"http://www.tokbox.com","configURL":"https://config.opentok.com","ipWhitelistConfigURL":"","cdnURL":"https://static.opentok.com","loggingURL":"https://hlg.tokbox.com/prod","apiURL":"https://anvil.opentok.com"});
6455
6457
  const whitelistAllowedRuntimeProperties = pick(['apiURL', 'assetURL', 'cdnURL', 'sessionInfoOverrides', 'loggingURL']);
6456
6458
  const liveConfigMap = {
6457
6459
  apiUrl: 'apiURL',
@@ -9860,6 +9862,27 @@ module.exports = function PeerConnectionFactory(deps) {
9860
9862
  function FakeRTCRtpSender(track) {
9861
9863
  this.track = track;
9862
9864
  }
9865
+
9866
+ api.setIceConfig = newIceConfig => {
9867
+ try {
9868
+ // Firefox does not follow the spec laid out in MDN for attempts to change the certs
9869
+ // after they've already been set. The documentation states the following about certificates:
9870
+ // once the certificates have been set, this property is ignored in future calls to
9871
+ // RTCPeerConnection.setConfiguration().
9872
+ if (env.isFirefox) {
9873
+ newIceConfig.certificates = _peerConnection.getConfiguration().certificates;
9874
+ }
9875
+
9876
+ _peerConnection.setConfiguration(newIceConfig);
9877
+ } catch (err) {
9878
+ throw new OTHelpersError(`A peer connection failed to set configuration with ${err.message}`, Errors.FAILED_SET_CONFIGURATION);
9879
+ }
9880
+
9881
+ _iceRestartNeeded.set(true);
9882
+
9883
+ api.generateOffer();
9884
+ return _peerConnection;
9885
+ };
9863
9886
  /**
9864
9887
  * Remove a track from the underlying PeerConnection
9865
9888
  *
@@ -18734,9 +18757,37 @@ module.exports = function PublisherFactory(_ref) {
18734
18757
  };
18735
18758
  }());
18736
18759
  /**
18737
- * Starts publishing video (if it is currently not being published)
18738
- * when the <code>value</code> is <code>true</code>; stops publishing video
18739
- * (if it is currently being published) when the <code>value</code> is <code>false</code>.
18760
+ * Toggles video on or off for the publisher. It causes the video to be published
18761
+ * (if it is currently not being published, the client is connected,
18762
+ * and the publisher is publishing) when the <code>value</code> is <code>true</code>;
18763
+ * it stops publishing video (if it is currently being published) when the <code>value</code>
18764
+ * is <code>false</code>.
18765
+ *
18766
+ * <p>
18767
+ * <i>Note:</i> The behavior of <code>publishVideo</code> varies depending on whether
18768
+ * the publisher is currently connected and publishing:
18769
+ * </p>
18770
+ *
18771
+ * <ul>
18772
+ * <li>Calling <code>publishVideo(true)</code> when the publisher is not connected to a session
18773
+ * causes the publisher to capture and render video locally, but it does not stream video.</li>
18774
+ *
18775
+ * <li>Calling <code>publishVideo(false)</code> when the publisher is not connected to a session
18776
+ * causes the publisher to stop capturing video locally. No video is streamed.</li>
18777
+ *
18778
+ * <li>Calling <code>publishVideo(true)</code> when the publisher is connected to a session
18779
+ * but not currently publishing causes it to capture and render video locally, but it does not stream video.</li>
18780
+ *
18781
+ * <li>Calling <code>publishVideo(false)</code> when the publisher is connected to a session
18782
+ * but not currently publishing causes the publisher to stop capturing video locally. No video is streamed.</li>
18783
+ *
18784
+ * <li>Calling <code>publishVideo(true)</code> when the publisher is both connected to a session
18785
+ * and currently publishing causes the publisher to capture and render video locally and to
18786
+ * stream video.</li>
18787
+ *
18788
+ * <li>Calling <code>publishVideo(false)</code> when the publisher is both connected to a session
18789
+ * and currently publishing causes the publisher to stop capturing video and to stream empty video frames.</li>
18790
+ * </ul>
18740
18791
  *
18741
18792
  * @param {Boolean} value Whether to start publishing video (<code>true</code>)
18742
18793
  * or not (<code>false</code>).
@@ -20109,6 +20160,27 @@ module.exports = function PublisherFactory(_ref) {
20109
20160
 
20110
20161
 
20111
20162
  this._ = {
20163
+ setIceConfig(newIceConfig) {
20164
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
20165
+ var pcs;
20166
+ return _regenerator.default.wrap(function _callee30$(_context30) {
20167
+ while (1) switch (_context30.prev = _context30.next) {
20168
+ case 0:
20169
+ _context30.next = 2;
20170
+ return getAllPeerConnections();
20171
+
20172
+ case 2:
20173
+ pcs = _context30.sent;
20174
+ pcs.forEach(pc => pc.setIceConfig(newIceConfig));
20175
+
20176
+ case 4:
20177
+ case "end":
20178
+ return _context30.stop();
20179
+ }
20180
+ }, _callee30);
20181
+ }))();
20182
+ },
20183
+
20112
20184
  publishToSession: (session, analyticsReplacement) => {
20113
20185
  if (analyticsReplacement) {
20114
20186
  analytics = analyticsReplacement;
@@ -20382,65 +20454,65 @@ module.exports = function PublisherFactory(_ref) {
20382
20454
  },
20383
20455
 
20384
20456
  switchTracks() {
20385
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
20457
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
20386
20458
  var stream;
20387
- return _regenerator.default.wrap(function _callee30$(_context30) {
20388
- while (1) switch (_context30.prev = _context30.next) {
20459
+ return _regenerator.default.wrap(function _callee31$(_context31) {
20460
+ while (1) switch (_context31.prev = _context31.next) {
20389
20461
  case 0:
20390
- _context30.prev = 0;
20391
- _context30.next = 3;
20462
+ _context31.prev = 0;
20463
+ _context31.next = 3;
20392
20464
  return getUserMedia().catch(userMediaError);
20393
20465
 
20394
20466
  case 3:
20395
- stream = _context30.sent;
20396
- _context30.next = 10;
20467
+ stream = _context31.sent;
20468
+ _context31.next = 10;
20397
20469
  break;
20398
20470
 
20399
20471
  case 6:
20400
- _context30.prev = 6;
20401
- _context30.t0 = _context30["catch"](0);
20402
- logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context30.t0}`);
20403
- throw _context30.t0;
20472
+ _context31.prev = 6;
20473
+ _context31.t0 = _context31["catch"](0);
20474
+ logging.error(`OT.Publisher.switchTracks failed to getUserMedia: ${_context31.t0}`);
20475
+ throw _context31.t0;
20404
20476
 
20405
20477
  case 10:
20406
20478
  setNewStream(stream);
20407
- _context30.prev = 11;
20479
+ _context31.prev = 11;
20408
20480
  bindVideo();
20409
- _context30.next = 21;
20481
+ _context31.next = 21;
20410
20482
  break;
20411
20483
 
20412
20484
  case 15:
20413
- _context30.prev = 15;
20414
- _context30.t1 = _context30["catch"](11);
20485
+ _context31.prev = 15;
20486
+ _context31.t1 = _context31["catch"](11);
20415
20487
 
20416
- if (!(_context30.t1 instanceof CancellationError)) {
20417
- _context30.next = 19;
20488
+ if (!(_context31.t1 instanceof CancellationError)) {
20489
+ _context31.next = 19;
20418
20490
  break;
20419
20491
  }
20420
20492
 
20421
- return _context30.abrupt("return");
20493
+ return _context31.abrupt("return");
20422
20494
 
20423
20495
  case 19:
20424
- logging.error('Error while binding video', _context30.t1);
20425
- throw _context30.t1;
20496
+ logging.error('Error while binding video', _context31.t1);
20497
+ throw _context31.t1;
20426
20498
 
20427
20499
  case 21:
20428
- _context30.prev = 21;
20500
+ _context31.prev = 21;
20429
20501
  replaceTracks();
20430
- _context30.next = 29;
20502
+ _context31.next = 29;
20431
20503
  break;
20432
20504
 
20433
20505
  case 25:
20434
- _context30.prev = 25;
20435
- _context30.t2 = _context30["catch"](21);
20436
- logging.error('Error replacing tracks', _context30.t2);
20437
- throw _context30.t2;
20506
+ _context31.prev = 25;
20507
+ _context31.t2 = _context31["catch"](21);
20508
+ logging.error('Error replacing tracks', _context31.t2);
20509
+ throw _context31.t2;
20438
20510
 
20439
20511
  case 29:
20440
20512
  case "end":
20441
- return _context30.stop();
20513
+ return _context31.stop();
20442
20514
  }
20443
- }, _callee30, null, [[0, 6], [11, 15], [21, 25]]);
20515
+ }, _callee31, null, [[0, 6], [11, 15], [21, 25]]);
20444
20516
  }))();
20445
20517
  },
20446
20518
 
@@ -20480,32 +20552,32 @@ module.exports = function PublisherFactory(_ref) {
20480
20552
  demoOnlyCycleVideo: this.cycleVideo,
20481
20553
 
20482
20554
  testOnlyGetFramesEncoded() {
20483
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
20555
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
20484
20556
  var peerConnections;
20485
- return _regenerator.default.wrap(function _callee31$(_context31) {
20486
- while (1) switch (_context31.prev = _context31.next) {
20557
+ return _regenerator.default.wrap(function _callee32$(_context32) {
20558
+ while (1) switch (_context32.prev = _context32.next) {
20487
20559
  case 0:
20488
- _context31.next = 2;
20560
+ _context32.next = 2;
20489
20561
  return getAllPeerConnections();
20490
20562
 
20491
20563
  case 2:
20492
- peerConnections = _context31.sent;
20564
+ peerConnections = _context32.sent;
20493
20565
 
20494
20566
  if (peerConnections.length) {
20495
- _context31.next = 5;
20567
+ _context32.next = 5;
20496
20568
  break;
20497
20569
  }
20498
20570
 
20499
20571
  throw new Error('No established PeerConnections yet');
20500
20572
 
20501
20573
  case 5:
20502
- return _context31.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
20574
+ return _context32.abrupt("return", peerConnections[0]._testOnlyGetFramesEncoded());
20503
20575
 
20504
20576
  case 6:
20505
20577
  case "end":
20506
- return _context31.stop();
20578
+ return _context32.stop();
20507
20579
  }
20508
- }, _callee31);
20580
+ }, _callee32);
20509
20581
  }))();
20510
20582
  },
20511
20583
 
@@ -20547,54 +20619,54 @@ module.exports = function PublisherFactory(_ref) {
20547
20619
  });
20548
20620
  },
20549
20621
  startRelayedToRoutedTransition: function () {
20550
- var _startRelayedToRoutedTransition = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
20551
- return _regenerator.default.wrap(function _callee32$(_context32) {
20552
- while (1) switch (_context32.prev = _context32.next) {
20622
+ var _startRelayedToRoutedTransition = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
20623
+ return _regenerator.default.wrap(function _callee33$(_context33) {
20624
+ while (1) switch (_context33.prev = _context33.next) {
20553
20625
  case 0:
20554
20626
  if (!(activeSourceStreamId === 'MANTIS')) {
20555
- _context32.next = 2;
20627
+ _context33.next = 2;
20556
20628
  break;
20557
20629
  }
20558
20630
 
20559
- return _context32.abrupt("return");
20631
+ return _context33.abrupt("return");
20560
20632
 
20561
20633
  case 2:
20562
20634
  logRelayedToRoutedTransition('Attempt');
20563
20635
 
20564
20636
  if (_this.session) {
20565
- _context32.next = 6;
20637
+ _context33.next = 6;
20566
20638
  break;
20567
20639
  }
20568
20640
 
20569
20641
  logRelayedToRoutedTransition('Failure', {
20570
20642
  reason: 'Not connected to the session.'
20571
20643
  });
20572
- return _context32.abrupt("return");
20644
+ return _context33.abrupt("return");
20573
20645
 
20574
20646
  case 6:
20575
20647
  if (_this.streamId) {
20576
- _context32.next = 9;
20648
+ _context33.next = 9;
20577
20649
  break;
20578
20650
  }
20579
20651
 
20580
20652
  logRelayedToRoutedTransition('Failure', {
20581
20653
  reason: 'No streamId available'
20582
20654
  });
20583
- return _context32.abrupt("return");
20655
+ return _context33.abrupt("return");
20584
20656
 
20585
20657
  case 9:
20586
20658
  _this.session._.streamDestroy(_this.streamId, 'P2P');
20587
20659
 
20588
- _context32.t0 = _this;
20589
- _context32.next = 13;
20660
+ _context33.t0 = _this;
20661
+ _context33.next = 13;
20590
20662
  return getP2pPeerConnection();
20591
20663
 
20592
20664
  case 13:
20593
- _context32.t1 = _context32.sent;
20665
+ _context33.t1 = _context33.sent;
20594
20666
 
20595
- _context32.t0._removePeerConnection.call(_context32.t0, _context32.t1);
20667
+ _context33.t0._removePeerConnection.call(_context33.t0, _context33.t1);
20596
20668
 
20597
- _context32.next = 17;
20669
+ _context33.next = 17;
20598
20670
  return _restartSendingRtpToMantis();
20599
20671
 
20600
20672
  case 17:
@@ -20604,9 +20676,9 @@ module.exports = function PublisherFactory(_ref) {
20604
20676
 
20605
20677
  case 19:
20606
20678
  case "end":
20607
- return _context32.stop();
20679
+ return _context33.stop();
20608
20680
  }
20609
- }, _callee32);
20681
+ }, _callee33);
20610
20682
  }));
20611
20683
 
20612
20684
  function startRelayedToRoutedTransition() {
@@ -20968,19 +21040,19 @@ module.exports = function PublisherFactory(_ref) {
20968
21040
  */
20969
21041
 
20970
21042
  this.applyVideoFilter = /*#__PURE__*/function () {
20971
- var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(videoFilter) {
21043
+ var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(videoFilter) {
20972
21044
  var isSupported, message, _webRTCStream$getVide2, originalVideoTrack, filteredVideoTrack;
20973
21045
 
20974
- return _regenerator.default.wrap(function _callee33$(_context33) {
20975
- while (1) switch (_context33.prev = _context33.next) {
21046
+ return _regenerator.default.wrap(function _callee34$(_context34) {
21047
+ while (1) switch (_context34.prev = _context34.next) {
20976
21048
  case 0:
20977
21049
  logAnalyticsEvent('applyVideoFilter', 'Attempt', {
20978
21050
  videoFilter
20979
21051
  });
20980
- _context33.prev = 1;
21052
+ _context34.prev = 1;
20981
21053
 
20982
21054
  if (!_videoMediaProcessorConnector) {
20983
- _context33.next = 4;
21055
+ _context34.next = 4;
20984
21056
  break;
20985
21057
  }
20986
21058
 
@@ -20990,7 +21062,7 @@ module.exports = function PublisherFactory(_ref) {
20990
21062
  isSupported = MediaProcessor.isSupported();
20991
21063
 
20992
21064
  if (isSupported) {
20993
- _context33.next = 7;
21065
+ _context34.next = 7;
20994
21066
  break;
20995
21067
  }
20996
21068
 
@@ -20998,7 +21070,7 @@ module.exports = function PublisherFactory(_ref) {
20998
21070
 
20999
21071
  case 7:
21000
21072
  if (mediaProcessor.isValidVideoFilter(videoFilter)) {
21001
- _context33.next = 9;
21073
+ _context34.next = 9;
21002
21074
  break;
21003
21075
  }
21004
21076
 
@@ -21006,7 +21078,7 @@ module.exports = function PublisherFactory(_ref) {
21006
21078
 
21007
21079
  case 9:
21008
21080
  if (webRTCStream) {
21009
- _context33.next = 14;
21081
+ _context34.next = 14;
21010
21082
  break;
21011
21083
  }
21012
21084
 
@@ -21015,11 +21087,11 @@ module.exports = function PublisherFactory(_ref) {
21015
21087
  message
21016
21088
  });
21017
21089
  logging.warn(message);
21018
- return _context33.abrupt("return");
21090
+ return _context34.abrupt("return");
21019
21091
 
21020
21092
  case 14:
21021
21093
  if (!isScreenSharing) {
21022
- _context33.next = 16;
21094
+ _context34.next = 16;
21023
21095
  break;
21024
21096
  }
21025
21097
 
@@ -21027,36 +21099,36 @@ module.exports = function PublisherFactory(_ref) {
21027
21099
 
21028
21100
  case 16:
21029
21101
  if (!_this.getVideoFilter()) {
21030
- _context33.next = 29;
21102
+ _context34.next = 29;
21031
21103
  break;
21032
21104
  }
21033
21105
 
21034
21106
  if (!mediaProcessor.canUpdateVideoFilter(videoFilter.type)) {
21035
- _context33.next = 27;
21107
+ _context34.next = 27;
21036
21108
  break;
21037
21109
  }
21038
21110
 
21039
- _context33.prev = 18;
21040
- _context33.next = 21;
21111
+ _context34.prev = 18;
21112
+ _context34.next = 21;
21041
21113
  return mediaProcessor.updateVideoFilter(videoFilter);
21042
21114
 
21043
21115
  case 21:
21044
- return _context33.abrupt("return");
21116
+ return _context34.abrupt("return");
21045
21117
 
21046
21118
  case 24:
21047
- _context33.prev = 24;
21048
- _context33.t0 = _context33["catch"](18);
21049
- logging.warn(`Error updating video filter: ${_context33.t0}`);
21119
+ _context34.prev = 24;
21120
+ _context34.t0 = _context34["catch"](18);
21121
+ logging.warn(`Error updating video filter: ${_context34.t0}`);
21050
21122
 
21051
21123
  case 27:
21052
- _context33.next = 29;
21124
+ _context34.next = 29;
21053
21125
  return _this.clearVideoFilter();
21054
21126
 
21055
21127
  case 29:
21056
21128
  _webRTCStream$getVide2 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide2[0];
21057
21129
 
21058
21130
  if (originalVideoTrack) {
21059
- _context33.next = 35;
21131
+ _context34.next = 35;
21060
21132
  break;
21061
21133
  }
21062
21134
 
@@ -21065,40 +21137,40 @@ module.exports = function PublisherFactory(_ref) {
21065
21137
  message
21066
21138
  });
21067
21139
  logging.warn(message);
21068
- return _context33.abrupt("return");
21140
+ return _context34.abrupt("return");
21069
21141
 
21070
21142
  case 35:
21071
21143
  enableMediaProcessorLogging();
21072
- _context33.next = 38;
21144
+ _context34.next = 38;
21073
21145
  return mediaProcessor.setVideoFilter(videoFilter);
21074
21146
 
21075
21147
  case 38:
21076
- _context33.next = 40;
21148
+ _context34.next = 40;
21077
21149
  return mediaProcessor.setMediaStream(webRTCStream);
21078
21150
 
21079
21151
  case 40:
21080
- filteredVideoTrack = _context33.sent;
21152
+ filteredVideoTrack = _context34.sent;
21081
21153
 
21082
21154
  if (!filteredVideoTrack) {
21083
- _context33.next = 44;
21155
+ _context34.next = 44;
21084
21156
  break;
21085
21157
  }
21086
21158
 
21087
- _context33.next = 44;
21159
+ _context34.next = 44;
21088
21160
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
21089
21161
 
21090
21162
  case 44:
21091
- _context33.next = 51;
21163
+ _context34.next = 51;
21092
21164
  break;
21093
21165
 
21094
21166
  case 46:
21095
- _context33.prev = 46;
21096
- _context33.t1 = _context33["catch"](1);
21097
- logging.error(`Error applying video filter: ${_context33.t1}`);
21167
+ _context34.prev = 46;
21168
+ _context34.t1 = _context34["catch"](1);
21169
+ logging.error(`Error applying video filter: ${_context34.t1}`);
21098
21170
  logAnalyticsEvent('applyVideoFilter', 'Failure', {
21099
- message: _context33.t1.message
21171
+ message: _context34.t1.message
21100
21172
  });
21101
- throw _context33.t1;
21173
+ throw _context34.t1;
21102
21174
 
21103
21175
  case 51:
21104
21176
  currentVideoFilter = videoFilter;
@@ -21108,9 +21180,9 @@ module.exports = function PublisherFactory(_ref) {
21108
21180
 
21109
21181
  case 53:
21110
21182
  case "end":
21111
- return _context33.stop();
21183
+ return _context34.stop();
21112
21184
  }
21113
- }, _callee33, null, [[1, 46], [18, 24]]);
21185
+ }, _callee34, null, [[1, 46], [18, 24]]);
21114
21186
  }));
21115
21187
 
21116
21188
  return function (_x24) {
@@ -21220,18 +21292,18 @@ module.exports = function PublisherFactory(_ref) {
21220
21292
 
21221
21293
 
21222
21294
  this.setVideoMediaProcessorConnector = /*#__PURE__*/function () {
21223
- var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(mediaProcessorConnector) {
21295
+ var _ref42 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(mediaProcessorConnector) {
21224
21296
  var _webRTCStream$getVide3, filteredVideoTrack, videoTrack, _webRTCStream$getVide4, originalVideoTrack, message;
21225
21297
 
21226
- return _regenerator.default.wrap(function _callee34$(_context34) {
21227
- while (1) switch (_context34.prev = _context34.next) {
21298
+ return _regenerator.default.wrap(function _callee35$(_context35) {
21299
+ while (1) switch (_context35.prev = _context35.next) {
21228
21300
  case 0:
21229
21301
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Attempt', {
21230
21302
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
21231
21303
  });
21232
21304
 
21233
21305
  if (!_this.getVideoFilter()) {
21234
- _context34.next = 4;
21306
+ _context35.next = 4;
21235
21307
  break;
21236
21308
  }
21237
21309
 
@@ -21242,17 +21314,17 @@ module.exports = function PublisherFactory(_ref) {
21242
21314
 
21243
21315
  case 4:
21244
21316
  if (!_videoMediaProcessorConnector) {
21245
- _context34.next = 14;
21317
+ _context35.next = 14;
21246
21318
  break;
21247
21319
  }
21248
21320
 
21249
21321
  _webRTCStream$getVide3 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide3[0];
21250
- _context34.next = 8;
21322
+ _context35.next = 8;
21251
21323
  return getTrackFromDeviceId(currentDeviceId);
21252
21324
 
21253
21325
  case 8:
21254
- videoTrack = _context34.sent;
21255
- _context34.next = 11;
21326
+ videoTrack = _context35.sent;
21327
+ _context35.next = 11;
21256
21328
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
21257
21329
 
21258
21330
  case 11:
@@ -21264,18 +21336,18 @@ module.exports = function PublisherFactory(_ref) {
21264
21336
 
21265
21337
  case 14:
21266
21338
  if (mediaProcessorConnector) {
21267
- _context34.next = 17;
21339
+ _context35.next = 17;
21268
21340
  break;
21269
21341
  }
21270
21342
 
21271
21343
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success', {
21272
21344
  message: 'clearing the connector'
21273
21345
  });
21274
- return _context34.abrupt("return");
21346
+ return _context35.abrupt("return");
21275
21347
 
21276
21348
  case 17:
21277
21349
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
21278
- _context34.next = 20;
21350
+ _context35.next = 20;
21279
21351
  break;
21280
21352
  }
21281
21353
 
@@ -21289,7 +21361,7 @@ module.exports = function PublisherFactory(_ref) {
21289
21361
  _webRTCStream$getVide4 = webRTCStream.getVideoTracks(), originalVideoTrack = _webRTCStream$getVide4[0];
21290
21362
 
21291
21363
  if (originalVideoTrack) {
21292
- _context34.next = 28;
21364
+ _context35.next = 28;
21293
21365
  break;
21294
21366
  }
21295
21367
 
@@ -21299,40 +21371,40 @@ module.exports = function PublisherFactory(_ref) {
21299
21371
  });
21300
21372
  logging.warn(`setVideoMediaProcessorConnector: ${message}`);
21301
21373
  _videoMediaProcessorConnector = null;
21302
- return _context34.abrupt("return");
21374
+ return _context35.abrupt("return");
21303
21375
 
21304
21376
  case 28:
21305
- _context34.prev = 28;
21306
- _context34.next = 31;
21377
+ _context35.prev = 28;
21378
+ _context35.next = 31;
21307
21379
  return _videoMediaProcessorConnector.setTrack(originalVideoTrack);
21308
21380
 
21309
21381
  case 31:
21310
- filteredVideoTrack = _context34.sent;
21311
- _context34.next = 34;
21382
+ filteredVideoTrack = _context35.sent;
21383
+ _context35.next = 34;
21312
21384
  return replaceTrackAndUpdate(originalVideoTrack, filteredVideoTrack);
21313
21385
 
21314
21386
  case 34:
21315
- _context34.next = 42;
21387
+ _context35.next = 42;
21316
21388
  break;
21317
21389
 
21318
21390
  case 36:
21319
- _context34.prev = 36;
21320
- _context34.t0 = _context34["catch"](28);
21391
+ _context35.prev = 36;
21392
+ _context35.t0 = _context35["catch"](28);
21321
21393
  _videoMediaProcessorConnector = null;
21322
- logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context34.t0}`);
21394
+ logging.error(`setVideoMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context35.t0}`);
21323
21395
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Failure', {
21324
- message: _context34.t0.message
21396
+ message: _context35.t0.message
21325
21397
  });
21326
- throw _context34.t0;
21398
+ throw _context35.t0;
21327
21399
 
21328
21400
  case 42:
21329
21401
  logAnalyticsEvent('setVideoMediaProcessorConnector', 'Success');
21330
21402
 
21331
21403
  case 43:
21332
21404
  case "end":
21333
- return _context34.stop();
21405
+ return _context35.stop();
21334
21406
  }
21335
- }, _callee34, null, [[28, 36]]);
21407
+ }, _callee35, null, [[28, 36]]);
21336
21408
  }));
21337
21409
 
21338
21410
  return function (_x25) {
@@ -21395,23 +21467,23 @@ module.exports = function PublisherFactory(_ref) {
21395
21467
 
21396
21468
 
21397
21469
  this.setAudioMediaProcessorConnector = /*#__PURE__*/function () {
21398
- var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(mediaProcessorConnector) {
21470
+ var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(mediaProcessorConnector) {
21399
21471
  var _webRTCStream$getAudi, filteredAudioTrack, _webRTCStream$getAudi2, originalAudioTrack, message;
21400
21472
 
21401
- return _regenerator.default.wrap(function _callee35$(_context35) {
21402
- while (1) switch (_context35.prev = _context35.next) {
21473
+ return _regenerator.default.wrap(function _callee36$(_context36) {
21474
+ while (1) switch (_context36.prev = _context36.next) {
21403
21475
  case 0:
21404
21476
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Attempt', {
21405
21477
  message: mediaProcessorConnector ? 'setting the connector' : 'clearing the connector'
21406
21478
  });
21407
21479
 
21408
21480
  if (!_audioMediaProcessorConnector) {
21409
- _context35.next = 7;
21481
+ _context36.next = 7;
21410
21482
  break;
21411
21483
  }
21412
21484
 
21413
21485
  _webRTCStream$getAudi = webRTCStream.getAudioTracks(), filteredAudioTrack = _webRTCStream$getAudi[0];
21414
- _context35.next = 5;
21486
+ _context36.next = 5;
21415
21487
  return replaceAudioTrack(filteredAudioTrack, _audioMediaProcessorConnector.originalTrack);
21416
21488
 
21417
21489
  case 5:
@@ -21421,18 +21493,18 @@ module.exports = function PublisherFactory(_ref) {
21421
21493
 
21422
21494
  case 7:
21423
21495
  if (mediaProcessorConnector) {
21424
- _context35.next = 10;
21496
+ _context36.next = 10;
21425
21497
  break;
21426
21498
  }
21427
21499
 
21428
21500
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success', {
21429
21501
  message: 'clearing the connector'
21430
21502
  });
21431
- return _context35.abrupt("return");
21503
+ return _context36.abrupt("return");
21432
21504
 
21433
21505
  case 10:
21434
21506
  if (MediaProcessorConnector.isValidConnector(mediaProcessorConnector)) {
21435
- _context35.next = 13;
21507
+ _context36.next = 13;
21436
21508
  break;
21437
21509
  }
21438
21510
 
@@ -21445,7 +21517,7 @@ module.exports = function PublisherFactory(_ref) {
21445
21517
  _webRTCStream$getAudi2 = webRTCStream.getAudioTracks(), originalAudioTrack = _webRTCStream$getAudi2[0];
21446
21518
 
21447
21519
  if (originalAudioTrack) {
21448
- _context35.next = 20;
21520
+ _context36.next = 20;
21449
21521
  break;
21450
21522
  }
21451
21523
 
@@ -21455,41 +21527,41 @@ module.exports = function PublisherFactory(_ref) {
21455
21527
  });
21456
21528
  logging.warn(`setAudioMediaProcessorConnector: ${message}`);
21457
21529
  _audioMediaProcessorConnector = null;
21458
- return _context35.abrupt("return");
21530
+ return _context36.abrupt("return");
21459
21531
 
21460
21532
  case 20:
21461
21533
  _audioMediaProcessorConnector = new MediaProcessorConnector(mediaProcessorConnector);
21462
- _context35.prev = 21;
21463
- _context35.next = 24;
21534
+ _context36.prev = 21;
21535
+ _context36.next = 24;
21464
21536
  return _audioMediaProcessorConnector.setTrack(originalAudioTrack);
21465
21537
 
21466
21538
  case 24:
21467
- filteredAudioTrack = _context35.sent;
21468
- _context35.next = 27;
21539
+ filteredAudioTrack = _context36.sent;
21540
+ _context36.next = 27;
21469
21541
  return replaceAudioTrack(_this.getAudioSource(), filteredAudioTrack);
21470
21542
 
21471
21543
  case 27:
21472
- _context35.next = 35;
21544
+ _context36.next = 35;
21473
21545
  break;
21474
21546
 
21475
21547
  case 29:
21476
- _context35.prev = 29;
21477
- _context35.t0 = _context35["catch"](21);
21548
+ _context36.prev = 29;
21549
+ _context36.t0 = _context36["catch"](21);
21478
21550
  _audioMediaProcessorConnector = null;
21479
- logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context35.t0}`);
21551
+ logging.error(`setAudioMediaProcessorConnector: Error getting track from MediaProcessorConnector: ${_context36.t0}`);
21480
21552
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Failure', {
21481
- message: _context35.t0.message
21553
+ message: _context36.t0.message
21482
21554
  });
21483
- throw _context35.t0;
21555
+ throw _context36.t0;
21484
21556
 
21485
21557
  case 35:
21486
21558
  logAnalyticsEvent('setAudioMediaProcessorConnector', 'Success');
21487
21559
 
21488
21560
  case 36:
21489
21561
  case "end":
21490
- return _context35.stop();
21562
+ return _context36.stop();
21491
21563
  }
21492
- }, _callee35, null, [[21, 29]]);
21564
+ }, _callee36, null, [[21, 29]]);
21493
21565
  }));
21494
21566
 
21495
21567
  return function (_x26) {
@@ -21515,16 +21587,16 @@ module.exports = function PublisherFactory(_ref) {
21515
21587
  */
21516
21588
 
21517
21589
 
21518
- this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36() {
21590
+ this.clearVideoFilter = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
21519
21591
  var message, oldVideoFilter, _webRTCStream$getVide5, filteredVideoTrack, videoTrack;
21520
21592
 
21521
- return _regenerator.default.wrap(function _callee36$(_context36) {
21522
- while (1) switch (_context36.prev = _context36.next) {
21593
+ return _regenerator.default.wrap(function _callee37$(_context37) {
21594
+ while (1) switch (_context37.prev = _context37.next) {
21523
21595
  case 0:
21524
21596
  logAnalyticsEvent('clearVideoFilter', 'Attempt');
21525
21597
 
21526
21598
  if (_this.getVideoFilter()) {
21527
- _context36.next = 6;
21599
+ _context37.next = 6;
21528
21600
  break;
21529
21601
  }
21530
21602
 
@@ -21533,11 +21605,11 @@ module.exports = function PublisherFactory(_ref) {
21533
21605
  message
21534
21606
  });
21535
21607
  logging.debug(message);
21536
- return _context36.abrupt("return");
21608
+ return _context37.abrupt("return");
21537
21609
 
21538
21610
  case 6:
21539
21611
  if (MediaProcessor.isSupported()) {
21540
- _context36.next = 11;
21612
+ _context37.next = 11;
21541
21613
  break;
21542
21614
  }
21543
21615
 
@@ -21546,11 +21618,11 @@ module.exports = function PublisherFactory(_ref) {
21546
21618
  message
21547
21619
  });
21548
21620
  logging.warn(message);
21549
- return _context36.abrupt("return");
21621
+ return _context37.abrupt("return");
21550
21622
 
21551
21623
  case 11:
21552
21624
  if (webRTCStream) {
21553
- _context36.next = 16;
21625
+ _context37.next = 16;
21554
21626
  break;
21555
21627
  }
21556
21628
 
@@ -21559,66 +21631,66 @@ module.exports = function PublisherFactory(_ref) {
21559
21631
  message
21560
21632
  });
21561
21633
  logging.warn(message);
21562
- return _context36.abrupt("return");
21634
+ return _context37.abrupt("return");
21563
21635
 
21564
21636
  case 16:
21565
21637
  if (!currentVideoFilter) {
21566
- _context36.next = 43;
21638
+ _context37.next = 43;
21567
21639
  break;
21568
21640
  }
21569
21641
 
21570
21642
  oldVideoFilter = currentVideoFilter;
21571
21643
  currentVideoFilter = null;
21572
21644
  _webRTCStream$getVide5 = webRTCStream.getVideoTracks(), filteredVideoTrack = _webRTCStream$getVide5[0];
21573
- _context36.prev = 20;
21574
- _context36.next = 23;
21645
+ _context37.prev = 20;
21646
+ _context37.next = 23;
21575
21647
  return getTrackFromDeviceId(currentDeviceId);
21576
21648
 
21577
21649
  case 23:
21578
- videoTrack = _context36.sent;
21579
- _context36.next = 30;
21650
+ videoTrack = _context37.sent;
21651
+ _context37.next = 30;
21580
21652
  break;
21581
21653
 
21582
21654
  case 26:
21583
- _context36.prev = 26;
21584
- _context36.t0 = _context36["catch"](20);
21585
- logging.error(_context36.t0);
21586
- return _context36.abrupt("return");
21655
+ _context37.prev = 26;
21656
+ _context37.t0 = _context37["catch"](20);
21657
+ logging.error(_context37.t0);
21658
+ return _context37.abrupt("return");
21587
21659
 
21588
21660
  case 30:
21589
21661
  if (videoTrack) {
21590
- _context36.next = 33;
21662
+ _context37.next = 33;
21591
21663
  break;
21592
21664
  }
21593
21665
 
21594
21666
  logging.warn('Failed to clear filter because there is no video track.');
21595
- return _context36.abrupt("return");
21667
+ return _context37.abrupt("return");
21596
21668
 
21597
21669
  case 33:
21598
- _context36.prev = 33;
21599
- _context36.next = 36;
21670
+ _context37.prev = 33;
21671
+ _context37.next = 36;
21600
21672
  return replaceTrackAndUpdate(filteredVideoTrack, videoTrack);
21601
21673
 
21602
21674
  case 36:
21603
- _context36.next = 38;
21675
+ _context37.next = 38;
21604
21676
  return destroyMediaProcessor();
21605
21677
 
21606
21678
  case 38:
21607
- _context36.next = 43;
21679
+ _context37.next = 43;
21608
21680
  break;
21609
21681
 
21610
21682
  case 40:
21611
- _context36.prev = 40;
21612
- _context36.t1 = _context36["catch"](33);
21683
+ _context37.prev = 40;
21684
+ _context37.t1 = _context37["catch"](33);
21613
21685
  // Restore the previous filter since this call has failed. This way, this function can be
21614
21686
  // called again if needed.
21615
21687
  currentVideoFilter = oldVideoFilter;
21616
21688
 
21617
21689
  case 43:
21618
21690
  case "end":
21619
- return _context36.stop();
21691
+ return _context37.stop();
21620
21692
  }
21621
- }, _callee36, null, [[20, 26], [33, 40]]);
21693
+ }, _callee37, null, [[20, 26], [33, 40]]);
21622
21694
  }));
21623
21695
  };
21624
21696
  /**
@@ -31747,6 +31819,10 @@ module.exports = function PublisherPeerConnectionFactory(deps) {
31747
31819
  });
31748
31820
  };
31749
31821
 
31822
+ this.setIceConfig = newIceConfig => {
31823
+ _peerConnection.setIceConfig(newIceConfig);
31824
+ };
31825
+
31750
31826
  this.getSenders = function () {
31751
31827
  return _peerConnection.getSenders();
31752
31828
  };
@@ -32186,6 +32262,10 @@ module.exports = function SubscriberPeerConnectionFactory(deps) {
32186
32262
  }
32187
32263
  };
32188
32264
 
32265
+ this.setIceConfig = iceConfig => {
32266
+ _peerConnection.setIceConfig(iceConfig);
32267
+ };
32268
+
32189
32269
  this.startAudioStatsWatcher = function (disableAudioLevelStuckAt0) {
32190
32270
  if (!_subscriberAudioWatcher) {
32191
32271
  _subscriberAudioWatcher = watchSubscriberAudio(_peerConnection.getStats.bind(_peerConnection), reason => {
@@ -33699,13 +33779,16 @@ module.exports = function SubscriberFactory(_temp) {
33699
33779
  // Also https://jira.vonage.com/browse/OPENTOK-27112
33700
33780
 
33701
33781
 
33702
- peerConnection._getVideoTracks().forEach(track => {
33703
- if ((typeof window !== undefined ? window : global).webkitMediaStream) {
33704
- track.enabled = false;
33705
- } else {
33706
- track.enabled = _stream.hasVideo && _properties.subscribeToVideo;
33707
- }
33708
- }); // Binding the new stream with only its respective tracks
33782
+ if (peerConnection) {
33783
+ // No peer connection if subscribingToSelf
33784
+ peerConnection._getVideoTracks().forEach(track => {
33785
+ if ((typeof window !== undefined ? window : global).webkitMediaStream) {
33786
+ track.enabled = false;
33787
+ } else {
33788
+ track.enabled = _stream.hasVideo && _properties.subscribeToVideo;
33789
+ }
33790
+ });
33791
+ } // Binding the new stream with only its respective tracks
33709
33792
 
33710
33793
 
33711
33794
  _context7.next = 16;
@@ -33722,7 +33805,7 @@ module.exports = function SubscriberFactory(_temp) {
33722
33805
  throw new Error('Subscriber destroyed');
33723
33806
 
33724
33807
  case 19:
33725
- if ((typeof window !== undefined ? window : global).webkitMediaStream) {
33808
+ if (peerConnection && (typeof window !== undefined ? window : global).webkitMediaStream) {
33726
33809
  // Enable any video streams that we previously disabled for OPENTOK-27112
33727
33810
  peerConnection._getVideoTracks().forEach(track => {
33728
33811
  track.enabled = _stream.hasVideo && _properties.subscribeToVideo;
@@ -35541,31 +35624,72 @@ module.exports = function SubscriberFactory(_temp) {
35541
35624
 
35542
35625
  unblockAudio: () => _widgetView && _widgetView.unblockAudio(),
35543
35626
  webRtcStream: () => _webRTCStream,
35627
+ setIceConfig: function () {
35628
+ var _setIceConfig = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(iceConfig) {
35629
+ return _regenerator.default.wrap(function _callee21$(_context21) {
35630
+ while (1) switch (_context21.prev = _context21.next) {
35631
+ case 0:
35632
+ getAllPeerConnections().forEach( /*#__PURE__*/function () {
35633
+ var _ref29 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(pc) {
35634
+ return _regenerator.default.wrap(function _callee20$(_context20) {
35635
+ while (1) switch (_context20.prev = _context20.next) {
35636
+ case 0:
35637
+ _context20.next = 2;
35638
+ return pc;
35639
+
35640
+ case 2:
35641
+ return _context20.abrupt("return", _context20.sent.setIceConfig(iceConfig));
35642
+
35643
+ case 3:
35644
+ case "end":
35645
+ return _context20.stop();
35646
+ }
35647
+ }, _callee20);
35648
+ }));
35649
+
35650
+ return function (_x20) {
35651
+ return _ref29.apply(this, arguments);
35652
+ };
35653
+ }());
35654
+
35655
+ case 1:
35656
+ case "end":
35657
+ return _context21.stop();
35658
+ }
35659
+ }, _callee21);
35660
+ }));
35661
+
35662
+ function setIceConfig(_x19) {
35663
+ return _setIceConfig.apply(this, arguments);
35664
+ }
35665
+
35666
+ return setIceConfig;
35667
+ }(),
35544
35668
  privateEvents: new EventEmitter(),
35545
35669
 
35546
35670
  startRoutedToRelayedTransition() {
35547
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
35671
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
35548
35672
  var mantisPeerConnection;
35549
- return _regenerator.default.wrap(function _callee20$(_context20) {
35550
- while (1) switch (_context20.prev = _context20.next) {
35673
+ return _regenerator.default.wrap(function _callee22$(_context22) {
35674
+ while (1) switch (_context22.prev = _context22.next) {
35551
35675
  case 0:
35552
35676
  if (!(_properties.testNetwork || isLocalStream(_stream, _session))) {
35553
- _context20.next = 2;
35677
+ _context22.next = 2;
35554
35678
  break;
35555
35679
  }
35556
35680
 
35557
- return _context20.abrupt("return");
35681
+ return _context22.abrupt("return");
35558
35682
 
35559
35683
  case 2:
35560
35684
  logRoutedToRelayedTransition('Attempt');
35561
- _context20.next = 5;
35685
+ _context22.next = 5;
35562
35686
  return getPeerConnectionBySourceStreamId('MANTIS');
35563
35687
 
35564
35688
  case 5:
35565
- mantisPeerConnection = _context20.sent;
35689
+ mantisPeerConnection = _context22.sent;
35566
35690
 
35567
35691
  if (mantisPeerConnection == null ? void 0 : mantisPeerConnection.iceConnectionStateIsConnected()) {
35568
- _context20.next = 9;
35692
+ _context22.next = 9;
35569
35693
  break;
35570
35694
  }
35571
35695
 
@@ -35580,7 +35704,7 @@ module.exports = function SubscriberFactory(_temp) {
35580
35704
  logRoutedToRelayedTransition('Failure', {
35581
35705
  reason: 'Attempted to transition to Relayed without being connected in Routed mode.'
35582
35706
  });
35583
- return _context20.abrupt("return");
35707
+ return _context22.abrupt("return");
35584
35708
 
35585
35709
  case 9:
35586
35710
  socket.subscriberCreate(_stream.id, _widgetId, // subscriberId
@@ -35594,24 +35718,24 @@ module.exports = function SubscriberFactory(_temp) {
35594
35718
 
35595
35719
  case 10:
35596
35720
  case "end":
35597
- return _context20.stop();
35721
+ return _context22.stop();
35598
35722
  }
35599
- }, _callee20);
35723
+ }, _callee22);
35600
35724
  }))();
35601
35725
  },
35602
35726
 
35603
35727
  startRelayedToRoutedTransition() {
35604
- return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
35728
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
35605
35729
  var webRTCStream, mantisPc, peerConnection;
35606
- return _regenerator.default.wrap(function _callee21$(_context21) {
35607
- while (1) switch (_context21.prev = _context21.next) {
35730
+ return _regenerator.default.wrap(function _callee23$(_context23) {
35731
+ while (1) switch (_context23.prev = _context23.next) {
35608
35732
  case 0:
35609
35733
  if (!(_properties.testNetwork || isLocalStream(_stream, _session))) {
35610
- _context21.next = 2;
35734
+ _context23.next = 2;
35611
35735
  break;
35612
35736
  }
35613
35737
 
35614
- return _context21.abrupt("return");
35738
+ return _context23.abrupt("return");
35615
35739
 
35616
35740
  case 2:
35617
35741
  logRelayedToRoutedTransition('Attempt');
@@ -35620,19 +35744,19 @@ module.exports = function SubscriberFactory(_temp) {
35620
35744
  _mediaStream = _webRTCStream;
35621
35745
 
35622
35746
  if (!_shouldUseSpc) {
35623
- _context21.next = 11;
35747
+ _context23.next = 11;
35624
35748
  break;
35625
35749
  }
35626
35750
 
35627
- _context21.next = 9;
35751
+ _context23.next = 9;
35628
35752
  return getPeerConnectionBySourceStreamId('MANTIS');
35629
35753
 
35630
35754
  case 9:
35631
- mantisPc = _context21.sent;
35755
+ mantisPc = _context23.sent;
35632
35756
  _mediaStream = new MediaStream(mantisPc._getTracks());
35633
35757
 
35634
35758
  case 11:
35635
- _context21.next = 13;
35759
+ _context23.next = 13;
35636
35760
  return bindWebRTCStream(_mediaStream);
35637
35761
 
35638
35762
  case 13:
@@ -35644,12 +35768,12 @@ module.exports = function SubscriberFactory(_temp) {
35644
35768
  _activeSourceStreamId = 'MANTIS'; // remove webRTCStream
35645
35769
 
35646
35770
  removeWebRTCStream('P2P');
35647
- _context21.next = 19;
35771
+ _context23.next = 19;
35648
35772
  return getCurrentPeerConnection();
35649
35773
 
35650
35774
  case 19:
35651
- peerConnection = _context21.sent;
35652
- _context21.next = 22;
35775
+ peerConnection = _context23.sent;
35776
+ _context23.next = 22;
35653
35777
  return createAudioLevelSampler(peerConnection);
35654
35778
 
35655
35779
  case 22:
@@ -35657,9 +35781,9 @@ module.exports = function SubscriberFactory(_temp) {
35657
35781
 
35658
35782
  case 23:
35659
35783
  case "end":
35660
- return _context21.stop();
35784
+ return _context23.stop();
35661
35785
  }
35662
- }, _callee21);
35786
+ }, _callee23);
35663
35787
  }))();
35664
35788
  },
35665
35789
 
@@ -35777,10 +35901,10 @@ module.exports = function SubscriberFactory(_temp) {
35777
35901
 
35778
35902
 
35779
35903
  this.subscribeToCaptions = /*#__PURE__*/function () {
35780
- var _ref29 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(value) {
35904
+ var _ref30 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(value) {
35781
35905
  var active, attributes;
35782
- return _regenerator.default.wrap(function _callee22$(_context22) {
35783
- while (1) switch (_context22.prev = _context22.next) {
35906
+ return _regenerator.default.wrap(function _callee24$(_context24) {
35907
+ while (1) switch (_context24.prev = _context24.next) {
35784
35908
  case 0:
35785
35909
  active = castToBoolean(value, true);
35786
35910
  attributes = {
@@ -35797,13 +35921,13 @@ module.exports = function SubscriberFactory(_temp) {
35797
35921
 
35798
35922
  case 6:
35799
35923
  case "end":
35800
- return _context22.stop();
35924
+ return _context24.stop();
35801
35925
  }
35802
- }, _callee22);
35926
+ }, _callee24);
35803
35927
  }));
35804
35928
 
35805
- return function (_x19) {
35806
- return _ref29.apply(this, arguments);
35929
+ return function (_x21) {
35930
+ return _ref30.apply(this, arguments);
35807
35931
  };
35808
35932
  }();
35809
35933
  /*
@@ -64213,6 +64337,134 @@ module.exports = function SessionFactory(deps) {
64213
64337
 
64214
64338
  publisher._.unpublishFromSession(this, 'unpublished');
64215
64339
  };
64340
+ /**
64341
+ * Sets the ICE configuration for all connections in a session. This replaces any previously
64342
+ * set ICE configurations.
64343
+ *
64344
+ * <p>
64345
+ * This is a <em>beta</em> feature. It is available for projects that use the
64346
+ * <a href="https://tokbox.com/developer/guides/configurable-turn-servers/">configurable
64347
+ * TURN server add-on</a>.
64348
+ *
64349
+ * @see <a href="OT.html#initSession">OT.initSession()</a>
64350
+ *
64351
+ * @param {IceConfig} newIceConfig This object defines the ICE configuration. It has the
64352
+ * following propoerties;
64353
+ *
64354
+ * <p>
64355
+ * <ul>
64356
+ * <li>
64357
+ * <code>includeServers</code></code> (String) — Set this to 'custom' and client will use
64358
+ * only the custom TURN servers you provide in the <code>customServers</code> property
64359
+ * of the <code>newIceConfig</code> parameter. Set this to 'all' and the client will use
64360
+ * both the custom TURN servers you provide along with OpenTok TURN servers.
64361
+ * </li>
64362
+ *
64363
+ * <li>
64364
+ * <code>transportPolicy</code></code> (String) — Set this to 'all' (the default) and
64365
+ * the client will use all ICE transport types (such as host, srflx, and TURN) to establish
64366
+ * media connectivity. Set this to 'relay' to force connectivity through TURN always
64367
+ * and ignore all other ICE candidates.
64368
+ * </li>
64369
+ *
64370
+ * <li>
64371
+ * <p>
64372
+ * <code>customServers</code></code> (Array) — Set this to an array of objects defining
64373
+ * your custom TURN servers. Each object corresponds to one custom TURN server, and it
64374
+ * includes the following properties:
64375
+ * </p>
64376
+ * <p>
64377
+ * <ul>
64378
+ * <li>
64379
+ * <code>urls</code> (String or Array of Strings) — A string or an array of strings,
64380
+ * where each string is a URL supported by the TURN server (and this may be only one URL).
64381
+ * </li>
64382
+ *
64383
+ * <li>
64384
+ * <code>username</code> (String, optional) — The username for the TURN server defined
64385
+ * in this object.
64386
+ * </li>
64387
+ *
64388
+ * <li>
64389
+ * <code>credential</code> (String, optional) — The credential string for the TURN server
64390
+ * defined in this object.
64391
+ * </li>
64392
+ * </ul>
64393
+ * </p>
64394
+ * </li>
64395
+ *
64396
+ * </ul>
64397
+ * </p>
64398
+ *
64399
+ * @method #setIceConfig
64400
+ *
64401
+ * @memberOf Session
64402
+ */
64403
+
64404
+
64405
+ this.setIceConfig = /*#__PURE__*/function () {
64406
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(newIceConfig) {
64407
+ var extractServersFromIceConfig, processedIceServers;
64408
+ return _regenerator.default.wrap(function _callee$(_context) {
64409
+ while (1) switch (_context.prev = _context.next) {
64410
+ case 0:
64411
+ validateIceConfig(newIceConfig);
64412
+ analytics.logEvent({
64413
+ action: 'setIceConfig',
64414
+ variation: 'Attempt',
64415
+ payload: {
64416
+ newIceConfig
64417
+ }
64418
+ }); // future publishers will need the new iceConfig
64419
+
64420
+ iceConfig = newIceConfig;
64421
+
64422
+ extractServersFromIceConfig = iceConfigObject => ({
64423
+ iceServers: iceConfigObject.customServers,
64424
+ iceTransportPolicy: iceConfigObject.transportPolicy
64425
+ });
64426
+
64427
+ processedIceServers = extractServersFromIceConfig(newIceConfig);
64428
+ _context.prev = 5;
64429
+ _context.next = 8;
64430
+ return Promise.all(sessionObjects.publishers.map(pub => pub._.setIceConfig(processedIceServers)).concat(sessionObjects.subscribers.map(sub => sub._.setIceConfig(processedIceServers))));
64431
+
64432
+ case 8:
64433
+ _context.next = 14;
64434
+ break;
64435
+
64436
+ case 10:
64437
+ _context.prev = 10;
64438
+ _context.t0 = _context["catch"](5);
64439
+ analytics.logEvent({
64440
+ action: 'setIceConfig',
64441
+ variation: 'Failure',
64442
+ payload: {
64443
+ newIceConfig
64444
+ }
64445
+ });
64446
+ throw _context.t0;
64447
+
64448
+ case 14:
64449
+ analytics.logEvent({
64450
+ action: 'setIceConfig',
64451
+ variation: 'Success',
64452
+ payload: {
64453
+ newIceConfig
64454
+ }
64455
+ });
64456
+
64457
+ case 15:
64458
+ case "end":
64459
+ return _context.stop();
64460
+ }
64461
+ }, _callee, null, [[5, 10]]);
64462
+ }));
64463
+
64464
+ return function (_x) {
64465
+ return _ref3.apply(this, arguments);
64466
+ };
64467
+ }();
64216
64468
  /**
64217
64469
  * Subscribes to a stream that is available to the session. You can get an array of
64218
64470
  * available streams from the <code>streams</code> property of the <code>sessionConnected</code>
@@ -64896,7 +65148,7 @@ module.exports = function SessionFactory(deps) {
64896
65148
 
64897
65149
  if (!_token) {
64898
65150
  // @todo why would this happen before connect() where a token is set?
64899
- // Need a token for getting ice servers from gsi
65151
+ // Need a token for getting ICE servers from GSI
64900
65152
  return Promise.resolve({
64901
65153
  transportPolicy: _session && _session.sessionInfo && _session.sessionInfo.clientCandidates,
64902
65154
  servers: [],
@@ -64915,7 +65167,7 @@ module.exports = function SessionFactory(deps) {
64915
65167
  _session._.setIceServers(sessionInfo.iceServers);
64916
65168
 
64917
65169
  if (!_iceServerDetails) {
64918
- // No ice servers provided by gsi
65170
+ // No ICE servers provided by GSI
64919
65171
  return {
64920
65172
  transportPolicy: _session.sessionInfo.clientCandidates,
64921
65173
  servers: [],
@@ -65675,53 +65927,53 @@ module.exports = function SessionFactory(deps) {
65675
65927
  });
65676
65928
 
65677
65929
  this.setEncryptionSecret = /*#__PURE__*/function () {
65678
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(secret) {
65679
- return _regenerator.default.wrap(function _callee$(_context) {
65680
- while (1) switch (_context.prev = _context.next) {
65930
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(secret) {
65931
+ return _regenerator.default.wrap(function _callee2$(_context2) {
65932
+ while (1) switch (_context2.prev = _context2.next) {
65681
65933
  case 0:
65682
65934
  if (initialEncryptionSecret) {
65683
- _context.next = 3;
65935
+ _context2.next = 3;
65684
65936
  break;
65685
65937
  }
65686
65938
 
65687
65939
  logging.error('Encryption secret must first be set in initSession.');
65688
- return _context.abrupt("return");
65940
+ return _context2.abrupt("return");
65689
65941
 
65690
65942
  case 3:
65691
- _context.prev = 3;
65943
+ _context2.prev = 3;
65692
65944
  validateSecret(secret);
65693
- _context.next = 10;
65945
+ _context2.next = 10;
65694
65946
  break;
65695
65947
 
65696
65948
  case 7:
65697
- _context.prev = 7;
65698
- _context.t0 = _context["catch"](3);
65699
- throw otError(errors.INVALID_ENCRYPTION_SECRET, new Error(`setEncryptionSecret: ${_context.t0.message}`));
65949
+ _context2.prev = 7;
65950
+ _context2.t0 = _context2["catch"](3);
65951
+ throw otError(errors.INVALID_ENCRYPTION_SECRET, new Error(`setEncryptionSecret: ${_context2.t0.message}`));
65700
65952
 
65701
65953
  case 10:
65702
- _context.prev = 10;
65703
- _context.next = 13;
65954
+ _context2.prev = 10;
65955
+ _context2.next = 13;
65704
65956
  return _this.keyStore.set(sessionId, secret);
65705
65957
 
65706
65958
  case 13:
65707
- _context.next = 18;
65959
+ _context2.next = 18;
65708
65960
  break;
65709
65961
 
65710
65962
  case 15:
65711
- _context.prev = 15;
65712
- _context.t1 = _context["catch"](10);
65963
+ _context2.prev = 15;
65964
+ _context2.t1 = _context2["catch"](10);
65713
65965
 
65714
- _logging.error(`Error in setEncryptionSecret}: ${_context.t1.message}`);
65966
+ _logging.error(`Error in setEncryptionSecret}: ${_context2.t1.message}`);
65715
65967
 
65716
65968
  case 18:
65717
65969
  case "end":
65718
- return _context.stop();
65970
+ return _context2.stop();
65719
65971
  }
65720
- }, _callee, null, [[3, 7], [10, 15]]);
65972
+ }, _callee2, null, [[3, 7], [10, 15]]);
65721
65973
  }));
65722
65974
 
65723
- return function (_x) {
65724
- return _ref3.apply(this, arguments);
65975
+ return function (_x2) {
65976
+ return _ref4.apply(this, arguments);
65725
65977
  };
65726
65978
  }();
65727
65979