@webex/plugin-meetings 3.0.0-beta.281 → 3.0.0-beta.282

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.
@@ -36,6 +36,7 @@ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
36
36
  var _uuid = _interopRequireDefault(require("uuid"));
37
37
  var _jsonwebtoken = _interopRequireDefault(require("jsonwebtoken"));
38
38
  var _webexCore = require("@webex/webex-core");
39
+ var _common = require("@webex/common");
39
40
  var _internalPluginMetrics = require("@webex/internal-plugin-metrics");
40
41
  var _internalMediaCore = require("@webex/internal-media-core");
41
42
  var _mediaHelpers = require("@webex/media-helpers");
@@ -367,6 +368,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
367
368
  var _super = _createSuper(Meeting);
368
369
  // comes from Locus, initialized by updateMeetingObject()
369
370
 
371
+ // used for waiting for a response
372
+
370
373
  /**
371
374
  * @param {Object} attrs
372
375
  * @param {Object} options
@@ -485,7 +488,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
485
488
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "environment", void 0);
486
489
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.MEETINGS);
487
490
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "allowMediaInLobby", void 0);
491
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "turnDiscoverySkippedReason", void 0);
492
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "turnServerUsed", void 0);
488
493
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sendSlotManager", new _sendSlotManager.default(_loggerProxy.default));
494
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deferSDPAnswer", void 0);
495
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdpResponseTimer", void 0);
489
496
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "processRelayEvent", function (e) {
490
497
  switch (e.data.relayType) {
491
498
  case _constants3.REACTION_RELAY_TYPES.REACTION:
@@ -600,6 +607,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
600
607
  latency: cdl.getLocalSDPGenRemoteSDPRecv(),
601
608
  meetingId: _this.id
602
609
  });
610
+ if (_this.deferSDPAnswer) {
611
+ _this.deferSDPAnswer.resolve();
612
+ clearTimeout(_this.sdpResponseTimer);
613
+ _this.sdpResponseTimer = undefined;
614
+ }
603
615
  logRequest(_this.roap.sendRoapOK({
604
616
  seq: event.roapMessage.seq,
605
617
  mediaId: _this.mediaId,
@@ -616,6 +628,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
616
628
  meetingId: _this.id
617
629
  }
618
630
  });
631
+
632
+ // Instantiate Defer so that the SDP offer/answer exchange timeout can start, see waitForRemoteSDPAnswer()
633
+ _this.deferSDPAnswer = new _common.Defer();
619
634
  logRequest(_this.roap.sendRoapMediaRequest({
620
635
  sdp: event.roapMessage.sdp,
621
636
  seq: event.roapMessage.seq,
@@ -1744,6 +1759,42 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1744
1759
  _this.updateTranscodedMediaConnection();
1745
1760
  }
1746
1761
  };
1762
+
1763
+ /**
1764
+ * Promise that exists if SDP offer has been generated, and resolves once sdp answer is received.
1765
+ * @instance
1766
+ * @type {Defer}
1767
+ * @private
1768
+ * @memberof Meeting
1769
+ */
1770
+ _this.deferSDPAnswer = undefined;
1771
+
1772
+ /**
1773
+ * Timer for waiting for sdp answer.
1774
+ * @instance
1775
+ * @type {ReturnType<typeof setTimeout>}
1776
+ * @private
1777
+ * @memberof Meeting
1778
+ */
1779
+ _this.sdpResponseTimer = undefined;
1780
+
1781
+ /**
1782
+ * Reason why TURN discovery is skipped.
1783
+ * @instance
1784
+ * @type {string}
1785
+ * @public
1786
+ * @memberof Meeting
1787
+ */
1788
+ _this.turnDiscoverySkippedReason = undefined;
1789
+
1790
+ /**
1791
+ * Whether TURN discovery is used or not.
1792
+ * @instance
1793
+ * @type {boolean}
1794
+ * @public
1795
+ * @memberof Meeting
1796
+ */
1797
+ _this.turnServerUsed = false;
1747
1798
  return _this;
1748
1799
  }
1749
1800
 
@@ -4153,6 +4204,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4153
4204
  if (this.config.reconnection.detection) {
4154
4205
  // @ts-ignore
4155
4206
  this.webex.internal.mercury.off(_constants.ONLINE);
4207
+ // @ts-ignore
4208
+ this.webex.internal.mercury.off(_constants.OFFLINE);
4156
4209
  }
4157
4210
  }
4158
4211
 
@@ -4871,7 +4924,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4871
4924
  // @ts-ignore - config coming from registerPlugin
4872
4925
  if (_this32.config.receiveTranscription || options.receiveTranscription) {
4873
4926
  if (_this32.isTranscriptionSupported()) {
4874
- _loggerProxy.default.logger.info('Meeting:index#join --> Attempting to enabled to recieve transcription!');
4927
+ _loggerProxy.default.logger.info('Meeting:index#join --> Attempting to enabled to receive transcription!');
4875
4928
  _this32.receiveTranscription().catch(function (error) {
4876
4929
  _loggerProxy.default.logger.error('Meeting:index#join --> Receive Transcription Failed', error);
4877
4930
  _metrics.default.sendBehavioralMetric(_constants2.default.RECEIVE_TRANSCRIPTION_AFTER_JOIN_FAILURE, {
@@ -5352,367 +5405,545 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5352
5405
  }
5353
5406
 
5354
5407
  /**
5355
- * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
5408
+ * Sets up all the references to local streams in this.mediaProperties before creating media connection
5409
+ * and before TURN discovery, so that the correct mute state is sent with TURN discovery roap messages.
5356
5410
  *
5357
- * @param {AddMediaOptions} options
5358
- * @returns {Promise}
5359
- * @public
5360
- * @memberof Meeting
5411
+ * @private
5412
+ * @param {LocalStreams} localStreams
5413
+ * @returns {Promise<void>}
5361
5414
  */
5362
5415
  }, {
5363
- key: "addMedia",
5364
- value: function addMedia() {
5365
- var _this$webex$meetings$2,
5366
- _this$webex$meetings$3,
5367
- _localStreams$screenS,
5368
- _localStreams$screenS2,
5369
- _this39 = this;
5370
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5371
- var LOG_HEADER = 'Meeting:index#addMedia -->';
5372
- var turnDiscoverySkippedReason;
5373
- var turnServerUsed = false;
5374
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options)));
5375
- if (this.meetingState !== _constants.FULL_STATE.ACTIVE) {
5376
- return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
5416
+ key: "setUpLocalStreamReferences",
5417
+ value: function () {
5418
+ var _setUpLocalStreamReferences = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(localStreams) {
5419
+ var _localStreams$screenS, _localStreams$screenS2;
5420
+ var setUpStreamPromises;
5421
+ return _regenerator.default.wrap(function _callee18$(_context18) {
5422
+ while (1) switch (_context18.prev = _context18.next) {
5423
+ case 0:
5424
+ setUpStreamPromises = [];
5425
+ if (localStreams !== null && localStreams !== void 0 && localStreams.microphone) {
5426
+ setUpStreamPromises.push(this.setLocalAudioStream(localStreams.microphone));
5427
+ }
5428
+ if (localStreams !== null && localStreams !== void 0 && localStreams.camera) {
5429
+ setUpStreamPromises.push(this.setLocalVideoStream(localStreams.camera));
5430
+ }
5431
+ if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS = localStreams.screenShare) !== null && _localStreams$screenS !== void 0 && _localStreams$screenS.video) {
5432
+ setUpStreamPromises.push(this.setLocalShareVideoStream(localStreams.screenShare.video));
5433
+ }
5434
+ if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS2 = localStreams.screenShare) !== null && _localStreams$screenS2 !== void 0 && _localStreams$screenS2.audio) {
5435
+ setUpStreamPromises.push(this.setLocalShareAudioStream(localStreams.screenShare.audio));
5436
+ }
5437
+ _context18.prev = 5;
5438
+ _context18.next = 8;
5439
+ return _promise.default.all(setUpStreamPromises);
5440
+ case 8:
5441
+ _context18.next = 14;
5442
+ break;
5443
+ case 10:
5444
+ _context18.prev = 10;
5445
+ _context18.t0 = _context18["catch"](5);
5446
+ _loggerProxy.default.logger.error("Meeting:index#addMedia():setUpLocalStreamReferences --> Error , ", _context18.t0);
5447
+ throw _context18.t0;
5448
+ case 14:
5449
+ case "end":
5450
+ return _context18.stop();
5451
+ }
5452
+ }, _callee18, this, [[5, 10]]);
5453
+ }));
5454
+ function setUpLocalStreamReferences(_x13) {
5455
+ return _setUpLocalStreamReferences.apply(this, arguments);
5377
5456
  }
5378
- if (_util.default.isUserInLeftState(this.locusInfo)) {
5379
- return _promise.default.reject(new _webexErrors.UserNotJoinedError());
5457
+ return setUpLocalStreamReferences;
5458
+ }()
5459
+ /**
5460
+ * Calls mediaProperties.waitForMediaConnectionConnected() and sends CA client.ice.end metric on failure
5461
+ *
5462
+ * @private
5463
+ * @returns {Promise<void>}
5464
+ */
5465
+ }, {
5466
+ key: "waitForMediaConnectionConnected",
5467
+ value: function () {
5468
+ var _waitForMediaConnectionConnected = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
5469
+ var _this$mediaProperties6, _this$mediaProperties7, _this$mediaProperties8, _this$mediaProperties9, _this$mediaProperties10, _this$mediaProperties11, _this$mediaProperties12, _this$mediaProperties13, _this$mediaProperties14, _this$mediaProperties15, _this$mediaProperties16, _this$mediaProperties17, _this$mediaProperties18, _this$mediaProperties19;
5470
+ return _regenerator.default.wrap(function _callee19$(_context19) {
5471
+ while (1) switch (_context19.prev = _context19.next) {
5472
+ case 0:
5473
+ _context19.prev = 0;
5474
+ _context19.next = 3;
5475
+ return this.mediaProperties.waitForMediaConnectionConnected();
5476
+ case 3:
5477
+ _context19.next = 9;
5478
+ break;
5479
+ case 5:
5480
+ _context19.prev = 5;
5481
+ _context19.t0 = _context19["catch"](0);
5482
+ // @ts-ignore
5483
+ this.webex.internal.newMetrics.submitClientEvent({
5484
+ name: 'client.ice.end',
5485
+ payload: {
5486
+ canProceed: false,
5487
+ icePhase: 'JOIN_MEETING_FINAL',
5488
+ errors: [
5489
+ // @ts-ignore
5490
+ this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
5491
+ clientErrorCode: _internalPluginMetrics.CallDiagnosticUtils.generateClientErrorCodeForIceFailure({
5492
+ signalingState: ((_this$mediaProperties6 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties6 === void 0 ? void 0 : (_this$mediaProperties7 = _this$mediaProperties6.multistreamConnection) === null || _this$mediaProperties7 === void 0 ? void 0 : (_this$mediaProperties8 = _this$mediaProperties7.pc) === null || _this$mediaProperties8 === void 0 ? void 0 : (_this$mediaProperties9 = _this$mediaProperties8.pc) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.signalingState) || ((_this$mediaProperties10 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties10 === void 0 ? void 0 : (_this$mediaProperties11 = _this$mediaProperties10.mediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.pc) === null || _this$mediaProperties12 === void 0 ? void 0 : _this$mediaProperties12.signalingState) || 'unknown',
5493
+ iceConnectionState: ((_this$mediaProperties13 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties13 === void 0 ? void 0 : (_this$mediaProperties14 = _this$mediaProperties13.multistreamConnection) === null || _this$mediaProperties14 === void 0 ? void 0 : (_this$mediaProperties15 = _this$mediaProperties14.pc) === null || _this$mediaProperties15 === void 0 ? void 0 : (_this$mediaProperties16 = _this$mediaProperties15.pc) === null || _this$mediaProperties16 === void 0 ? void 0 : _this$mediaProperties16.iceConnectionState) || ((_this$mediaProperties17 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties17 === void 0 ? void 0 : (_this$mediaProperties18 = _this$mediaProperties17.mediaConnection) === null || _this$mediaProperties18 === void 0 ? void 0 : (_this$mediaProperties19 = _this$mediaProperties18.pc) === null || _this$mediaProperties19 === void 0 ? void 0 : _this$mediaProperties19.iceConnectionState) || 'unknown',
5494
+ turnServerUsed: this.turnServerUsed
5495
+ })
5496
+ })]
5497
+ },
5498
+ options: {
5499
+ meetingId: this.id
5500
+ }
5501
+ });
5502
+ throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(this.correlationId));
5503
+ case 9:
5504
+ case "end":
5505
+ return _context19.stop();
5506
+ }
5507
+ }, _callee19, this, [[0, 5]]);
5508
+ }));
5509
+ function waitForMediaConnectionConnected() {
5510
+ return _waitForMediaConnectionConnected.apply(this, arguments);
5380
5511
  }
5381
- var localStreams = options.localStreams,
5382
- _options$audioEnabled = options.audioEnabled,
5383
- audioEnabled = _options$audioEnabled === void 0 ? true : _options$audioEnabled,
5384
- _options$videoEnabled = options.videoEnabled,
5385
- videoEnabled = _options$videoEnabled === void 0 ? true : _options$videoEnabled,
5386
- _options$shareAudioEn = options.shareAudioEnabled,
5387
- shareAudioEnabled = _options$shareAudioEn === void 0 ? true : _options$shareAudioEn,
5388
- _options$shareVideoEn = options.shareVideoEnabled,
5389
- shareVideoEnabled = _options$shareVideoEn === void 0 ? true : _options$shareVideoEn,
5390
- remoteMediaManagerConfig = options.remoteMediaManagerConfig,
5391
- bundlePolicy = options.bundlePolicy,
5392
- allowMediaInLobby = options.allowMediaInLobby;
5393
- this.allowMediaInLobby = options === null || options === void 0 ? void 0 : options.allowMediaInLobby;
5394
-
5395
- // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
5396
- // @ts-ignore - isUserUnadmitted coming from SelfUtil
5397
- if (this.isUserUnadmitted && !this.wirelessShare && !allowMediaInLobby) {
5398
- return _promise.default.reject(new _webexErrors.UserInLobbyError());
5512
+ return waitForMediaConnectionConnected;
5513
+ }()
5514
+ /**
5515
+ * Enables statsAnalyser if config allows it
5516
+ *
5517
+ * @private
5518
+ * @returns {void}
5519
+ */
5520
+ }, {
5521
+ key: "createStatsAnalyzer",
5522
+ value: function createStatsAnalyzer() {
5523
+ var _this39 = this;
5524
+ // @ts-ignore - config coming from registerPlugin
5525
+ if (this.config.stats.enableStatsAnalyzer) {
5526
+ // @ts-ignore - config coming from registerPlugin
5527
+ this.networkQualityMonitor = new _networkQualityMonitor.default(this.config.stats);
5528
+ this.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(
5529
+ // @ts-ignore - config coming from registerPlugin
5530
+ this.config.stats, function (ssrc) {
5531
+ return _this39.receiveSlotManager.findReceiveSlotBySsrc(ssrc);
5532
+ }, this.networkQualityMonitor);
5533
+ this.setupStatsAnalyzerEventHandlers();
5534
+ this.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, this.sendNetworkQualityEvent.bind(this));
5399
5535
  }
5536
+ }
5400
5537
 
5401
- // @ts-ignore
5402
- this.webex.internal.newMetrics.submitClientEvent({
5403
- name: 'client.media.capabilities',
5404
- payload: {
5405
- mediaCapabilities: {
5406
- rx: {
5407
- audio: false,
5408
- share: false,
5409
- share_audio: false,
5410
- video: false,
5411
- whiteboard: false
5412
- },
5413
- tx: {
5414
- audio: false,
5415
- share: false,
5416
- share_audio: false,
5417
- video: false,
5418
- whiteboard: false
5419
- }
5538
+ /**
5539
+ * Handles device logging
5540
+ *
5541
+ * @private
5542
+ * @static
5543
+ * @returns {Promise<void>}
5544
+ */
5545
+ }, {
5546
+ key: "waitForRemoteSDPAnswer",
5547
+ value:
5548
+ /**
5549
+ * Returns a promise. This promise is created once the local sdp offer has been successfully created and is resolved
5550
+ * once the remote sdp answer has been received.
5551
+ *
5552
+ * @private
5553
+ * @returns {Promise<void>}
5554
+ */
5555
+ function () {
5556
+ var _waitForRemoteSDPAnswer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
5557
+ var LOG_HEADER, deferSDPAnswer;
5558
+ return _regenerator.default.wrap(function _callee20$(_context20) {
5559
+ while (1) switch (_context20.prev = _context20.next) {
5560
+ case 0:
5561
+ LOG_HEADER = 'Meeting:index#addMedia():waitForRemoteSDPAnswer -->';
5562
+ if (this.deferSDPAnswer) {
5563
+ _context20.next = 4;
5564
+ break;
5565
+ }
5566
+ _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " offer not created yet"));
5567
+ return _context20.abrupt("return", _promise.default.reject(new Error('waitForRemoteSDPAnswer() called before local sdp offer created')));
5568
+ case 4:
5569
+ deferSDPAnswer = this.deferSDPAnswer;
5570
+ this.sdpResponseTimer = setTimeout(function () {
5571
+ _loggerProxy.default.logger.warn("".concat(LOG_HEADER, " timeout! no REMOTE SDP ANSWER received within ").concat(_constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT / 1000, " seconds"));
5572
+ deferSDPAnswer.reject(new Error('Timed out waiting for REMOTE SDP ANSWER'));
5573
+ }, _constants.ROAP_OFFER_ANSWER_EXCHANGE_TIMEOUT);
5574
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " waiting for REMOTE SDP ANSWER..."));
5575
+ return _context20.abrupt("return", deferSDPAnswer.promise);
5576
+ case 8:
5577
+ case "end":
5578
+ return _context20.stop();
5420
5579
  }
5421
- },
5422
- options: {
5423
- meetingId: this.id
5424
- }
5425
- });
5426
-
5427
- // when audioEnabled/videoEnabled is true, we set sendAudio/sendVideo to true even before any streams are published
5428
- // to avoid doing an extra SDP exchange when they are published for the first time
5429
- this.mediaProperties.setMediaDirection({
5430
- sendAudio: audioEnabled,
5431
- sendVideo: videoEnabled,
5432
- sendShare: false,
5433
- receiveAudio: audioEnabled,
5434
- receiveVideo: videoEnabled,
5435
- receiveShare: shareAudioEnabled || shareVideoEnabled
5436
- });
5437
- this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
5438
- correlationId: this.correlationId,
5439
- device: {
5440
- url: this.deviceUrl,
5441
- // @ts-ignore
5442
- deviceType: this.config.deviceType,
5443
- // @ts-ignore
5444
- countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
5445
- // @ts-ignore
5446
- regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
5447
- },
5448
- preferTranscoding: !this.isMultistream
5449
- }, {
5450
- // @ts-ignore
5451
- parent: this.webex
5452
- });
5453
- this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
5454
- this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
5455
- var promises = [];
5456
-
5457
- // setup all the references to local streams in this.mediaProperties before creating media connection
5458
- // and before TURN discovery, so that the correct mute state is sent with TURN discovery roap messages
5459
- if (localStreams !== null && localStreams !== void 0 && localStreams.microphone) {
5460
- promises.push(this.setLocalAudioStream(localStreams.microphone));
5461
- }
5462
- if (localStreams !== null && localStreams !== void 0 && localStreams.camera) {
5463
- promises.push(this.setLocalVideoStream(localStreams.camera));
5464
- }
5465
- if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS = localStreams.screenShare) !== null && _localStreams$screenS !== void 0 && _localStreams$screenS.video) {
5466
- promises.push(this.setLocalShareVideoStream(localStreams.screenShare.video));
5467
- }
5468
- if (localStreams !== null && localStreams !== void 0 && (_localStreams$screenS2 = localStreams.screenShare) !== null && _localStreams$screenS2 !== void 0 && _localStreams$screenS2.audio) {
5469
- promises.push(this.setLocalShareAudioStream(localStreams.screenShare.audio));
5580
+ }, _callee20, this);
5581
+ }));
5582
+ function waitForRemoteSDPAnswer() {
5583
+ return _waitForRemoteSDPAnswer.apply(this, arguments);
5470
5584
  }
5585
+ return waitForRemoteSDPAnswer;
5586
+ }()
5587
+ /**
5588
+ * Does TURN discovery, SDP offer/answer exhange, establishes ICE connection and DTLS handshake
5589
+ *
5590
+ * @private
5591
+ * @param {RemoteMediaManagerConfiguration} [remoteMediaManagerConfig]
5592
+ * @param {BundlePolicy} [bundlePolicy]
5593
+ * @returns {Promise<void>}
5594
+ */
5595
+ }, {
5596
+ key: "establishMediaConnection",
5597
+ value: function () {
5598
+ var _establishMediaConnection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(remoteMediaManagerConfig, bundlePolicy) {
5599
+ var LOG_HEADER, cdl, turnDiscoveryObject, turnServerInfo, mc;
5600
+ return _regenerator.default.wrap(function _callee21$(_context21) {
5601
+ while (1) switch (_context21.prev = _context21.next) {
5602
+ case 0:
5603
+ LOG_HEADER = 'Meeting:index#addMedia():establishMediaConnection -->'; // @ts-ignore
5604
+ cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
5605
+ _context21.prev = 2;
5606
+ // @ts-ignore
5607
+ this.webex.internal.newMetrics.submitInternalEvent({
5608
+ name: 'internal.client.add-media.turn-discovery.start'
5609
+ });
5610
+ _context21.next = 6;
5611
+ return this.roap.doTurnDiscovery(this, false);
5612
+ case 6:
5613
+ turnDiscoveryObject = _context21.sent;
5614
+ this.turnDiscoverySkippedReason = turnDiscoveryObject === null || turnDiscoveryObject === void 0 ? void 0 : turnDiscoveryObject.turnDiscoverySkippedReason;
5615
+ this.turnServerUsed = !this.turnDiscoverySkippedReason;
5471
5616
 
5472
- // @ts-ignore
5473
- var cdl = this.webex.internal.newMetrics.callDiagnosticLatencies;
5474
- return _promise.default.all(promises).then(function () {
5475
- // @ts-ignore
5476
- _this39.webex.internal.newMetrics.submitInternalEvent({
5477
- name: 'internal.client.add-media.turn-discovery.start'
5478
- });
5479
- return _this39.roap.doTurnDiscovery(_this39, false);
5480
- }).then( /*#__PURE__*/function () {
5481
- var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(turnDiscoveryObject) {
5482
- var turnServerInfo, mc;
5483
- return _regenerator.default.wrap(function _callee18$(_context18) {
5484
- while (1) switch (_context18.prev = _context18.next) {
5485
- case 0:
5486
- turnDiscoverySkippedReason = turnDiscoveryObject.turnDiscoverySkippedReason;
5487
- turnServerUsed = !turnDiscoverySkippedReason;
5488
-
5489
- // @ts-ignore
5490
- _this39.webex.internal.newMetrics.submitInternalEvent({
5491
- name: 'internal.client.add-media.turn-discovery.end'
5617
+ // @ts-ignore
5618
+ this.webex.internal.newMetrics.submitInternalEvent({
5619
+ name: 'internal.client.add-media.turn-discovery.end'
5620
+ });
5621
+ if (this.turnServerUsed) {
5622
+ _metrics.default.sendBehavioralMetric(_constants2.default.TURN_DISCOVERY_LATENCY, {
5623
+ correlation_id: this.correlationId,
5624
+ latency: cdl.getTurnDiscoveryTime(),
5625
+ turnServerUsed: this.turnServerUsed
5492
5626
  });
5493
- if (turnServerUsed) {
5494
- _metrics.default.sendBehavioralMetric(_constants2.default.TURN_DISCOVERY_LATENCY, {
5495
- correlation_id: _this39.correlationId,
5496
- latency: cdl.getTurnDiscoveryTime(),
5497
- turnServerUsed: turnServerUsed
5498
- });
5499
- }
5500
- turnServerInfo = turnDiscoveryObject.turnServerInfo;
5501
- _context18.next = 7;
5502
- return _this39.createMediaConnection(turnServerInfo, bundlePolicy);
5503
- case 7:
5504
- mc = _context18.sent;
5505
- if (!_this39.isMultistream) {
5506
- _context18.next = 15;
5507
- break;
5508
- }
5509
- _this39.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(_this39.receiveSlotManager, _this39.mediaRequestManagers, remoteMediaManagerConfig);
5510
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
5511
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
5512
- _this39.forwardEvent(_this39.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
5513
- _context18.next = 15;
5514
- return _this39.remoteMediaManager.start();
5515
- case 15:
5516
- _context18.next = 17;
5517
- return mc.initiateOffer();
5518
- case 17:
5519
- case "end":
5520
- return _context18.stop();
5521
- }
5522
- }, _callee18);
5523
- }));
5524
- return function (_x13) {
5525
- return _ref25.apply(this, arguments);
5526
- };
5527
- }()).then(function () {
5528
- _this39.setMercuryListener();
5529
- }).then(function () {
5530
- return (0, _mediaHelpers.getDevices)().then(function (devices) {
5531
- _util.default.handleDeviceLogging(devices);
5532
- }).catch(function () {});
5533
- } // getDevices may fail if we don't have browser permissions, that's ok, we still can have a media connection
5534
- ).then(function () {
5535
- _this39.handleMediaLogging(_this39.mediaProperties);
5536
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created"));
5537
-
5538
- // @ts-ignore - config coming from registerPlugin
5539
- if (_this39.config.stats.enableStatsAnalyzer) {
5540
- // @ts-ignore - config coming from registerPlugin
5541
- _this39.networkQualityMonitor = new _networkQualityMonitor.default(_this39.config.stats);
5542
- _this39.statsAnalyzer = new _statsAnalyzer.StatsAnalyzer(
5543
- // @ts-ignore - config coming from registerPlugin
5544
- _this39.config.stats, function (ssrc) {
5545
- return _this39.receiveSlotManager.findReceiveSlotBySsrc(ssrc);
5546
- }, _this39.networkQualityMonitor);
5547
- _this39.setupStatsAnalyzerEventHandlers();
5548
- _this39.networkQualityMonitor.on(_constants.EVENT_TRIGGERS.NETWORK_QUALITY, _this39.sendNetworkQualityEvent.bind(_this39));
5549
- }
5550
- }).catch(function (error) {
5551
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " Error adding media , setting up peerconnection, "), error);
5552
- throw error;
5553
- }).then(function () {
5554
- return new _promise.default(function (resolve, reject) {
5555
- var timerCount = 0;
5627
+ }
5628
+ turnServerInfo = turnDiscoveryObject.turnServerInfo;
5629
+ _context21.next = 14;
5630
+ return this.createMediaConnection(turnServerInfo, bundlePolicy);
5631
+ case 14:
5632
+ mc = _context21.sent;
5633
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " media connection created"));
5634
+ if (!this.isMultistream) {
5635
+ _context21.next = 23;
5636
+ break;
5637
+ }
5638
+ this.remoteMediaManager = new _remoteMediaManager.RemoteMediaManager(this.receiveSlotManager, this.mediaRequestManagers, remoteMediaManagerConfig);
5639
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.AudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_AUDIO_CREATED);
5640
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.ScreenShareAudioCreated, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_SCREEN_SHARE_AUDIO_CREATED);
5641
+ this.forwardEvent(this.remoteMediaManager, _remoteMediaManager.Event.VideoLayoutChanged, _constants.EVENT_TRIGGERS.REMOTE_MEDIA_VIDEO_LAYOUT_CHANGED);
5642
+ _context21.next = 23;
5643
+ return this.remoteMediaManager.start();
5644
+ case 23:
5645
+ _context21.next = 25;
5646
+ return mc.initiateOffer();
5647
+ case 25:
5648
+ _context21.next = 27;
5649
+ return this.waitForRemoteSDPAnswer();
5650
+ case 27:
5651
+ this.handleMediaLogging(this.mediaProperties);
5652
+ _context21.next = 34;
5653
+ break;
5654
+ case 30:
5655
+ _context21.prev = 30;
5656
+ _context21.t0 = _context21["catch"](2);
5657
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " error establishing media connection, "), _context21.t0);
5658
+ throw _context21.t0;
5659
+ case 34:
5660
+ _context21.next = 36;
5661
+ return this.waitForMediaConnectionConnected();
5662
+ case 36:
5663
+ case "end":
5664
+ return _context21.stop();
5665
+ }
5666
+ }, _callee21, this, [[2, 30]]);
5667
+ }));
5668
+ function establishMediaConnection(_x14, _x15) {
5669
+ return _establishMediaConnection.apply(this, arguments);
5670
+ }
5671
+ return establishMediaConnection;
5672
+ }()
5673
+ /**
5674
+ * Cleans up stats analyzer, peer connection, and turns off listeners
5675
+ *
5676
+ * @private
5677
+ * @returns {Promise<void>}
5678
+ */
5679
+ }, {
5680
+ key: "cleanUpOnAddMediaFailure",
5681
+ value: function () {
5682
+ var _cleanUpOnAddMediaFailure = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
5683
+ return _regenerator.default.wrap(function _callee22$(_context22) {
5684
+ while (1) switch (_context22.prev = _context22.next) {
5685
+ case 0:
5686
+ if (!this.statsAnalyzer) {
5687
+ _context22.next = 3;
5688
+ break;
5689
+ }
5690
+ _context22.next = 3;
5691
+ return this.statsAnalyzer.stopAnalyzer();
5692
+ case 3:
5693
+ this.statsAnalyzer = null;
5556
5694
 
5557
- // eslint-disable-next-line func-names
5558
- // eslint-disable-next-line prefer-arrow-callback
5559
- if (_this39.type === _constants._CALL_ || _this39.meetingState === _constants.FULL_STATE.ACTIVE) {
5560
- resolve();
5695
+ // when media fails, we want to upload a webrtc dump to see whats going on
5696
+ // this function is async, but returns once the stats have been gathered
5697
+ _context22.next = 6;
5698
+ return this.forceSendStatsReport({
5699
+ callFrom: 'addMedia'
5700
+ });
5701
+ case 6:
5702
+ if (this.mediaProperties.webrtcMediaConnection) {
5703
+ this.closePeerConnections();
5704
+ this.unsetPeerConnections();
5705
+ }
5706
+ case 7:
5707
+ case "end":
5708
+ return _context22.stop();
5561
5709
  }
5562
- var joiningTimer = setInterval(function () {
5563
- timerCount += 1;
5564
- if (_this39.meetingState === _constants.FULL_STATE.ACTIVE) {
5565
- clearInterval(joiningTimer);
5566
- resolve();
5567
- }
5568
- if (timerCount === 4) {
5569
- clearInterval(joiningTimer);
5570
- reject(new Error('Meeting is still not active '));
5571
- }
5572
- }, 1000);
5573
- });
5574
- }).then(function () {
5575
- return _this39.mediaProperties.waitForMediaConnectionConnected().catch(function () {
5576
- var _this39$mediaProperti, _this39$mediaProperti2, _this39$mediaProperti3, _this39$mediaProperti4, _this39$mediaProperti5, _this39$mediaProperti6, _this39$mediaProperti7, _this39$mediaProperti8, _this39$mediaProperti9, _this39$mediaProperti10, _this39$mediaProperti11, _this39$mediaProperti12, _this39$mediaProperti13, _this39$mediaProperti14;
5577
- // @ts-ignore
5578
- _this39.webex.internal.newMetrics.submitClientEvent({
5579
- name: 'client.ice.end',
5580
- payload: {
5581
- canProceed: false,
5582
- icePhase: 'JOIN_MEETING_FINAL',
5583
- errors: [
5710
+ }, _callee22, this);
5711
+ }));
5712
+ function cleanUpOnAddMediaFailure() {
5713
+ return _cleanUpOnAddMediaFailure.apply(this, arguments);
5714
+ }
5715
+ return cleanUpOnAddMediaFailure;
5716
+ }()
5717
+ /**
5718
+ * Creates a media connection to the server. Media connection is required for sending or receiving any audio/video.
5719
+ *
5720
+ * @param {AddMediaOptions} options
5721
+ * @returns {Promise<void>}
5722
+ * @public
5723
+ * @memberof Meeting
5724
+ */
5725
+ }, {
5726
+ key: "addMedia",
5727
+ value: function () {
5728
+ var _addMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
5729
+ var _this$webex$meetings$2, _this$webex$meetings$3;
5730
+ var options,
5731
+ LOG_HEADER,
5732
+ localStreams,
5733
+ _options$audioEnabled,
5734
+ audioEnabled,
5735
+ _options$videoEnabled,
5736
+ videoEnabled,
5737
+ _options$shareAudioEn,
5738
+ shareAudioEnabled,
5739
+ _options$shareVideoEn,
5740
+ shareVideoEnabled,
5741
+ remoteMediaManagerConfig,
5742
+ bundlePolicy,
5743
+ allowMediaInLobby,
5744
+ _this$remoteMediaMana,
5745
+ connectionType,
5746
+ reachabilityStats,
5747
+ _this$mediaProperties20,
5748
+ _this$mediaProperties21,
5749
+ _this$mediaProperties22,
5750
+ _this$mediaProperties23,
5751
+ _this$mediaProperties24,
5752
+ _this$mediaProperties25,
5753
+ _this$mediaProperties26,
5754
+ _this$mediaProperties27,
5755
+ _this$mediaProperties28,
5756
+ _this$mediaProperties29,
5757
+ _this$mediaProperties30,
5758
+ _this$mediaProperties31,
5759
+ _this$mediaProperties32,
5760
+ _this$mediaProperties33,
5761
+ _this$mediaProperties34,
5762
+ _this$mediaProperties35,
5763
+ _this$mediaProperties36,
5764
+ _this$mediaProperties37,
5765
+ _this$mediaProperties38,
5766
+ _this$mediaProperties39,
5767
+ _this$mediaProperties40,
5768
+ reachabilityMetrics,
5769
+ _args23 = arguments;
5770
+ return _regenerator.default.wrap(function _callee23$(_context23) {
5771
+ while (1) switch (_context23.prev = _context23.next) {
5772
+ case 0:
5773
+ options = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
5774
+ LOG_HEADER = 'Meeting:index#addMedia -->';
5775
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options)));
5776
+ if (!(this.meetingState !== _constants.FULL_STATE.ACTIVE)) {
5777
+ _context23.next = 5;
5778
+ break;
5779
+ }
5780
+ throw new _webexErrors.MeetingNotActiveError();
5781
+ case 5:
5782
+ if (!_util.default.isUserInLeftState(this.locusInfo)) {
5783
+ _context23.next = 7;
5784
+ break;
5785
+ }
5786
+ throw new _webexErrors.UserNotJoinedError();
5787
+ case 7:
5788
+ localStreams = options.localStreams, _options$audioEnabled = options.audioEnabled, audioEnabled = _options$audioEnabled === void 0 ? true : _options$audioEnabled, _options$videoEnabled = options.videoEnabled, videoEnabled = _options$videoEnabled === void 0 ? true : _options$videoEnabled, _options$shareAudioEn = options.shareAudioEnabled, shareAudioEnabled = _options$shareAudioEn === void 0 ? true : _options$shareAudioEn, _options$shareVideoEn = options.shareVideoEnabled, shareVideoEnabled = _options$shareVideoEn === void 0 ? true : _options$shareVideoEn, remoteMediaManagerConfig = options.remoteMediaManagerConfig, bundlePolicy = options.bundlePolicy, allowMediaInLobby = options.allowMediaInLobby;
5789
+ this.allowMediaInLobby = options === null || options === void 0 ? void 0 : options.allowMediaInLobby;
5790
+
5791
+ // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
5792
+ // @ts-ignore - isUserUnadmitted coming from SelfUtil
5793
+ if (!(this.isUserUnadmitted && !this.wirelessShare && !allowMediaInLobby)) {
5794
+ _context23.next = 11;
5795
+ break;
5796
+ }
5797
+ throw new _webexErrors.UserInLobbyError();
5798
+ case 11:
5584
5799
  // @ts-ignore
5585
- _this39.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
5586
- clientErrorCode: _internalPluginMetrics.CallDiagnosticUtils.generateClientErrorCodeForIceFailure({
5587
- signalingState: ((_this39$mediaProperti = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti === void 0 ? void 0 : (_this39$mediaProperti2 = _this39$mediaProperti.multistreamConnection) === null || _this39$mediaProperti2 === void 0 ? void 0 : (_this39$mediaProperti3 = _this39$mediaProperti2.pc) === null || _this39$mediaProperti3 === void 0 ? void 0 : (_this39$mediaProperti4 = _this39$mediaProperti3.pc) === null || _this39$mediaProperti4 === void 0 ? void 0 : _this39$mediaProperti4.signalingState) || ((_this39$mediaProperti5 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti5 === void 0 ? void 0 : (_this39$mediaProperti6 = _this39$mediaProperti5.mediaConnection) === null || _this39$mediaProperti6 === void 0 ? void 0 : (_this39$mediaProperti7 = _this39$mediaProperti6.pc) === null || _this39$mediaProperti7 === void 0 ? void 0 : _this39$mediaProperti7.signalingState) || 'unknown',
5588
- iceConnectionState: ((_this39$mediaProperti8 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti8 === void 0 ? void 0 : (_this39$mediaProperti9 = _this39$mediaProperti8.multistreamConnection) === null || _this39$mediaProperti9 === void 0 ? void 0 : (_this39$mediaProperti10 = _this39$mediaProperti9.pc) === null || _this39$mediaProperti10 === void 0 ? void 0 : (_this39$mediaProperti11 = _this39$mediaProperti10.pc) === null || _this39$mediaProperti11 === void 0 ? void 0 : _this39$mediaProperti11.iceConnectionState) || ((_this39$mediaProperti12 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti12 === void 0 ? void 0 : (_this39$mediaProperti13 = _this39$mediaProperti12.mediaConnection) === null || _this39$mediaProperti13 === void 0 ? void 0 : (_this39$mediaProperti14 = _this39$mediaProperti13.pc) === null || _this39$mediaProperti14 === void 0 ? void 0 : _this39$mediaProperti14.iceConnectionState) || 'unknown',
5589
- turnServerUsed: turnServerUsed
5590
- })
5591
- })]
5592
- },
5593
- options: {
5594
- meetingId: _this39.id
5595
- }
5596
- });
5597
- throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(_this39.correlationId));
5598
- });
5599
- }).then(function () {
5600
- if (_this39.mediaProperties.hasLocalShareStream()) {
5601
- return _this39.enqueueScreenShareFloorRequest();
5602
- }
5603
- return _promise.default.resolve();
5604
- }).then(function () {
5605
- return _this39.mediaProperties.getCurrentConnectionType();
5606
- }).then( /*#__PURE__*/function () {
5607
- var _ref26 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(connectionType) {
5608
- var _this39$remoteMediaMa;
5609
- var reachabilityStats;
5610
- return _regenerator.default.wrap(function _callee19$(_context19) {
5611
- while (1) switch (_context19.prev = _context19.next) {
5612
- case 0:
5613
- _context19.next = 2;
5614
- return _this39.webex.meetings.reachability.getReachabilityMetrics();
5615
- case 2:
5616
- reachabilityStats = _context19.sent;
5617
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread({
5618
- correlation_id: _this39.correlationId,
5619
- locus_id: _this39.locusUrl.split('/').pop(),
5620
- connectionType: connectionType,
5621
- isMultistream: _this39.isMultistream
5622
- }, reachabilityStats));
5623
- // @ts-ignore
5624
- _this39.webex.internal.newMetrics.submitClientEvent({
5625
- name: 'client.media-engine.ready',
5626
- options: {
5627
- meetingId: _this39.id
5800
+ this.webex.internal.newMetrics.submitClientEvent({
5801
+ name: 'client.media.capabilities',
5802
+ payload: {
5803
+ mediaCapabilities: {
5804
+ rx: {
5805
+ audio: false,
5806
+ share: false,
5807
+ share_audio: false,
5808
+ video: false,
5809
+ whiteboard: false
5810
+ },
5811
+ tx: {
5812
+ audio: false,
5813
+ share: false,
5814
+ share_audio: false,
5815
+ video: false,
5816
+ whiteboard: false
5817
+ }
5628
5818
  }
5629
- });
5630
- _loggerProxy.default.logger.info("".concat(LOG_HEADER, " successfully established media connection, type=").concat(connectionType));
5631
-
5632
- // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
5633
- (_this39$remoteMediaMa = _this39.remoteMediaManager) === null || _this39$remoteMediaMa === void 0 ? void 0 : _this39$remoteMediaMa.logAllReceiveSlots();
5634
- case 7:
5635
- case "end":
5636
- return _context19.stop();
5637
- }
5638
- }, _callee19);
5639
- }));
5640
- return function (_x14) {
5641
- return _ref26.apply(this, arguments);
5642
- };
5643
- }()).catch( /*#__PURE__*/function () {
5644
- var _ref27 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(error) {
5645
- var _this39$mediaProperti15, _this39$mediaProperti16, _this39$mediaProperti17, _this39$mediaProperti18, _this39$mediaProperti19, _this39$mediaProperti20, _this39$mediaProperti21, _this39$mediaProperti22, _this39$mediaProperti23, _this39$mediaProperti24, _this39$mediaProperti25, _this39$mediaProperti26, _this39$mediaProperti27, _this39$mediaProperti28, _this39$mediaProperti29, _this39$mediaProperti30, _this39$mediaProperti31, _this39$mediaProperti32, _this39$mediaProperti33, _this39$mediaProperti34, _this39$mediaProperti35;
5646
- var reachabilityMetrics;
5647
- return _regenerator.default.wrap(function _callee20$(_context20) {
5648
- while (1) switch (_context20.prev = _context20.next) {
5649
- case 0:
5650
- _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), error);
5819
+ },
5820
+ options: {
5821
+ meetingId: this.id
5822
+ }
5823
+ });
5651
5824
 
5825
+ // when audioEnabled/videoEnabled is true, we set sendAudio/sendVideo to true even before any streams are published
5826
+ // to avoid doing an extra SDP exchange when they are published for the first time
5827
+ this.mediaProperties.setMediaDirection({
5828
+ sendAudio: audioEnabled,
5829
+ sendVideo: videoEnabled,
5830
+ sendShare: false,
5831
+ receiveAudio: audioEnabled,
5832
+ receiveVideo: videoEnabled,
5833
+ receiveShare: shareAudioEnabled || shareVideoEnabled
5834
+ });
5835
+ this.locusMediaRequest = new _locusMediaRequest.LocusMediaRequest({
5836
+ correlationId: this.correlationId,
5837
+ device: {
5838
+ url: this.deviceUrl,
5839
+ // @ts-ignore
5840
+ deviceType: this.config.deviceType,
5841
+ // @ts-ignore
5842
+ countryCode: (_this$webex$meetings$2 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.countryCode,
5843
+ // @ts-ignore
5844
+ regionCode: (_this$webex$meetings$3 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$3 === void 0 ? void 0 : _this$webex$meetings$3.regionCode
5845
+ },
5846
+ preferTranscoding: !this.isMultistream
5847
+ }, {
5652
5848
  // @ts-ignore
5653
- _context20.next = 3;
5654
- return _this39.webex.meetings.reachability.getReachabilityMetrics();
5655
- case 3:
5656
- reachabilityMetrics = _context20.sent;
5657
- _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread({
5658
- correlation_id: _this39.correlationId,
5659
- locus_id: _this39.locusUrl.split('/').pop(),
5660
- reason: error.message,
5661
- stack: error.stack,
5662
- code: error.code,
5663
- turnDiscoverySkippedReason: turnDiscoverySkippedReason,
5664
- turnServerUsed: turnServerUsed,
5665
- isMultistream: _this39.isMultistream,
5666
- signalingState: ((_this39$mediaProperti15 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti15 === void 0 ? void 0 : (_this39$mediaProperti16 = _this39$mediaProperti15.multistreamConnection) === null || _this39$mediaProperti16 === void 0 ? void 0 : (_this39$mediaProperti17 = _this39$mediaProperti16.pc) === null || _this39$mediaProperti17 === void 0 ? void 0 : (_this39$mediaProperti18 = _this39$mediaProperti17.pc) === null || _this39$mediaProperti18 === void 0 ? void 0 : _this39$mediaProperti18.signalingState) || ((_this39$mediaProperti19 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti19 === void 0 ? void 0 : (_this39$mediaProperti20 = _this39$mediaProperti19.mediaConnection) === null || _this39$mediaProperti20 === void 0 ? void 0 : (_this39$mediaProperti21 = _this39$mediaProperti20.pc) === null || _this39$mediaProperti21 === void 0 ? void 0 : _this39$mediaProperti21.signalingState) || 'unknown',
5667
- connectionState: ((_this39$mediaProperti22 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti22 === void 0 ? void 0 : (_this39$mediaProperti23 = _this39$mediaProperti22.multistreamConnection) === null || _this39$mediaProperti23 === void 0 ? void 0 : (_this39$mediaProperti24 = _this39$mediaProperti23.pc) === null || _this39$mediaProperti24 === void 0 ? void 0 : (_this39$mediaProperti25 = _this39$mediaProperti24.pc) === null || _this39$mediaProperti25 === void 0 ? void 0 : _this39$mediaProperti25.connectionState) || ((_this39$mediaProperti26 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti26 === void 0 ? void 0 : (_this39$mediaProperti27 = _this39$mediaProperti26.mediaConnection) === null || _this39$mediaProperti27 === void 0 ? void 0 : (_this39$mediaProperti28 = _this39$mediaProperti27.pc) === null || _this39$mediaProperti28 === void 0 ? void 0 : _this39$mediaProperti28.connectionState) || 'unknown',
5668
- iceConnectionState: ((_this39$mediaProperti29 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti29 === void 0 ? void 0 : (_this39$mediaProperti30 = _this39$mediaProperti29.multistreamConnection) === null || _this39$mediaProperti30 === void 0 ? void 0 : (_this39$mediaProperti31 = _this39$mediaProperti30.pc) === null || _this39$mediaProperti31 === void 0 ? void 0 : (_this39$mediaProperti32 = _this39$mediaProperti31.pc) === null || _this39$mediaProperti32 === void 0 ? void 0 : _this39$mediaProperti32.iceConnectionState) || ((_this39$mediaProperti33 = _this39.mediaProperties.webrtcMediaConnection) === null || _this39$mediaProperti33 === void 0 ? void 0 : (_this39$mediaProperti34 = _this39$mediaProperti33.mediaConnection) === null || _this39$mediaProperti34 === void 0 ? void 0 : (_this39$mediaProperti35 = _this39$mediaProperti34.pc) === null || _this39$mediaProperti35 === void 0 ? void 0 : _this39$mediaProperti35.iceConnectionState) || 'unknown'
5669
- }, reachabilityMetrics));
5670
-
5671
- // Clean up stats analyzer, peer connection, and turn off listeners
5672
- if (!_this39.statsAnalyzer) {
5673
- _context20.next = 8;
5674
- break;
5675
- }
5676
- _context20.next = 8;
5677
- return _this39.statsAnalyzer.stopAnalyzer();
5678
- case 8:
5679
- _this39.statsAnalyzer = null;
5680
-
5681
- // when media fails, we want to upload a webrtc dump to see whats going on
5682
- // this function is async, but returns once the stats have been gathered
5683
- _context20.next = 11;
5684
- return _this39.forceSendStatsReport({
5685
- callFrom: 'addMedia'
5686
- });
5687
- case 11:
5688
- if (_this39.mediaProperties.webrtcMediaConnection) {
5689
- _this39.closePeerConnections();
5690
- _this39.unsetPeerConnections();
5849
+ parent: this.webex
5850
+ });
5851
+ this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
5852
+ this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
5853
+ _context23.prev = 16;
5854
+ _context23.next = 19;
5855
+ return this.setUpLocalStreamReferences(localStreams);
5856
+ case 19:
5857
+ this.setMercuryListener();
5858
+ this.createStatsAnalyzer();
5859
+ _context23.next = 23;
5860
+ return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy);
5861
+ case 23:
5862
+ _context23.next = 25;
5863
+ return Meeting.handleDeviceLogging();
5864
+ case 25:
5865
+ if (!this.mediaProperties.hasLocalShareStream()) {
5866
+ _context23.next = 28;
5867
+ break;
5868
+ }
5869
+ _context23.next = 28;
5870
+ return this.enqueueScreenShareFloorRequest();
5871
+ case 28:
5872
+ _context23.next = 30;
5873
+ return this.mediaProperties.getCurrentConnectionType();
5874
+ case 30:
5875
+ connectionType = _context23.sent;
5876
+ _context23.next = 33;
5877
+ return this.webex.meetings.reachability.getReachabilityMetrics();
5878
+ case 33:
5879
+ reachabilityStats = _context23.sent;
5880
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread({
5881
+ correlation_id: this.correlationId,
5882
+ locus_id: this.locusUrl.split('/').pop(),
5883
+ connectionType: connectionType,
5884
+ isMultistream: this.isMultistream
5885
+ }, reachabilityStats));
5886
+ // @ts-ignore
5887
+ this.webex.internal.newMetrics.submitClientEvent({
5888
+ name: 'client.media-engine.ready',
5889
+ options: {
5890
+ meetingId: this.id
5691
5891
  }
5892
+ });
5893
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " successfully established media connection, type=").concat(connectionType));
5692
5894
 
5693
- // Upload logs on error while adding media
5694
- _triggerProxy.default.trigger(_this39, {
5695
- file: 'meeting/index',
5696
- function: 'addMedia'
5697
- }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, _this39);
5698
- if (error instanceof _internalMediaCore.Errors.SdpError) {
5699
- _this39.leave({
5700
- reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
5701
- });
5702
- }
5703
- throw error;
5704
- case 15:
5705
- case "end":
5706
- return _context20.stop();
5707
- }
5708
- }, _callee20);
5709
- }));
5710
- return function (_x15) {
5711
- return _ref27.apply(this, arguments);
5712
- };
5713
- }());
5714
- }
5895
+ // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
5896
+ (_this$remoteMediaMana = this.remoteMediaManager) === null || _this$remoteMediaMana === void 0 ? void 0 : _this$remoteMediaMana.logAllReceiveSlots();
5897
+ _context23.next = 52;
5898
+ break;
5899
+ case 40:
5900
+ _context23.prev = 40;
5901
+ _context23.t0 = _context23["catch"](16);
5902
+ _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), _context23.t0);
5715
5903
 
5904
+ // @ts-ignore
5905
+ _context23.next = 45;
5906
+ return this.webex.meetings.reachability.getReachabilityMetrics();
5907
+ case 45:
5908
+ reachabilityMetrics = _context23.sent;
5909
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread({
5910
+ correlation_id: this.correlationId,
5911
+ locus_id: this.locusUrl.split('/').pop(),
5912
+ reason: _context23.t0.message,
5913
+ stack: _context23.t0.stack,
5914
+ code: _context23.t0.code,
5915
+ turnDiscoverySkippedReason: this.turnDiscoverySkippedReason,
5916
+ turnServerUsed: this.turnServerUsed,
5917
+ isMultistream: this.isMultistream,
5918
+ signalingState: ((_this$mediaProperties20 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties20 === void 0 ? void 0 : (_this$mediaProperties21 = _this$mediaProperties20.multistreamConnection) === null || _this$mediaProperties21 === void 0 ? void 0 : (_this$mediaProperties22 = _this$mediaProperties21.pc) === null || _this$mediaProperties22 === void 0 ? void 0 : (_this$mediaProperties23 = _this$mediaProperties22.pc) === null || _this$mediaProperties23 === void 0 ? void 0 : _this$mediaProperties23.signalingState) || ((_this$mediaProperties24 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties24 === void 0 ? void 0 : (_this$mediaProperties25 = _this$mediaProperties24.mediaConnection) === null || _this$mediaProperties25 === void 0 ? void 0 : (_this$mediaProperties26 = _this$mediaProperties25.pc) === null || _this$mediaProperties26 === void 0 ? void 0 : _this$mediaProperties26.signalingState) || 'unknown',
5919
+ connectionState: ((_this$mediaProperties27 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties27 === void 0 ? void 0 : (_this$mediaProperties28 = _this$mediaProperties27.multistreamConnection) === null || _this$mediaProperties28 === void 0 ? void 0 : (_this$mediaProperties29 = _this$mediaProperties28.pc) === null || _this$mediaProperties29 === void 0 ? void 0 : (_this$mediaProperties30 = _this$mediaProperties29.pc) === null || _this$mediaProperties30 === void 0 ? void 0 : _this$mediaProperties30.connectionState) || ((_this$mediaProperties31 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties31 === void 0 ? void 0 : (_this$mediaProperties32 = _this$mediaProperties31.mediaConnection) === null || _this$mediaProperties32 === void 0 ? void 0 : (_this$mediaProperties33 = _this$mediaProperties32.pc) === null || _this$mediaProperties33 === void 0 ? void 0 : _this$mediaProperties33.connectionState) || 'unknown',
5920
+ iceConnectionState: ((_this$mediaProperties34 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties34 === void 0 ? void 0 : (_this$mediaProperties35 = _this$mediaProperties34.multistreamConnection) === null || _this$mediaProperties35 === void 0 ? void 0 : (_this$mediaProperties36 = _this$mediaProperties35.pc) === null || _this$mediaProperties36 === void 0 ? void 0 : (_this$mediaProperties37 = _this$mediaProperties36.pc) === null || _this$mediaProperties37 === void 0 ? void 0 : _this$mediaProperties37.iceConnectionState) || ((_this$mediaProperties38 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties38 === void 0 ? void 0 : (_this$mediaProperties39 = _this$mediaProperties38.mediaConnection) === null || _this$mediaProperties39 === void 0 ? void 0 : (_this$mediaProperties40 = _this$mediaProperties39.pc) === null || _this$mediaProperties40 === void 0 ? void 0 : _this$mediaProperties40.iceConnectionState) || 'unknown'
5921
+ }, reachabilityMetrics));
5922
+ _context23.next = 49;
5923
+ return this.cleanUpOnAddMediaFailure();
5924
+ case 49:
5925
+ // Upload logs on error while adding media
5926
+ _triggerProxy.default.trigger(this, {
5927
+ file: 'meeting/index',
5928
+ function: 'addMedia'
5929
+ }, _constants.EVENTS.REQUEST_UPLOAD_LOGS, this);
5930
+ if (_context23.t0 instanceof _internalMediaCore.Errors.SdpError) {
5931
+ this.leave({
5932
+ reason: _constants.MEETING_REMOVED_REASON.MEETING_CONNECTION_FAILED
5933
+ });
5934
+ }
5935
+ throw _context23.t0;
5936
+ case 52:
5937
+ case "end":
5938
+ return _context23.stop();
5939
+ }
5940
+ }, _callee23, this, [[16, 40]]);
5941
+ }));
5942
+ function addMedia() {
5943
+ return _addMedia.apply(this, arguments);
5944
+ }
5945
+ return addMedia;
5946
+ }()
5716
5947
  /**
5717
5948
  * Informs if the peer connection is in a state that can be updated with updateMedia (audio/video/share)
5718
5949
  * @returns {Boolean}
@@ -5787,35 +6018,35 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5787
6018
  * @memberof Meeting
5788
6019
  */
5789
6020
  function () {
5790
- var _updateMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(options) {
6021
+ var _updateMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(options) {
5791
6022
  var audioEnabled, videoEnabled, shareAudioEnabled, shareVideoEnabled;
5792
- return _regenerator.default.wrap(function _callee21$(_context21) {
5793
- while (1) switch (_context21.prev = _context21.next) {
6023
+ return _regenerator.default.wrap(function _callee24$(_context24) {
6024
+ while (1) switch (_context24.prev = _context24.next) {
5794
6025
  case 0:
5795
6026
  this.checkMediaConnection();
5796
6027
  audioEnabled = options.audioEnabled, videoEnabled = options.videoEnabled, shareAudioEnabled = options.shareAudioEnabled, shareVideoEnabled = options.shareVideoEnabled;
5797
6028
  _loggerProxy.default.logger.log("Meeting:index#updateMedia --> called with options=".concat((0, _stringify.default)(options)));
5798
6029
  if (this.canUpdateMedia()) {
5799
- _context21.next = 5;
6030
+ _context24.next = 5;
5800
6031
  break;
5801
6032
  }
5802
- return _context21.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
6033
+ return _context24.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.UPDATE_MEDIA, options));
5803
6034
  case 5:
5804
6035
  if (!this.isMultistream) {
5805
- _context21.next = 10;
6036
+ _context24.next = 10;
5806
6037
  break;
5807
6038
  }
5808
6039
  if (!(shareAudioEnabled !== undefined || shareVideoEnabled !== undefined)) {
5809
- _context21.next = 8;
6040
+ _context24.next = 8;
5810
6041
  break;
5811
6042
  }
5812
6043
  throw new Error('toggling shareAudioEnabled or shareVideoEnabled in a multistream meeting is not supported, to control receiving screen share call meeting.remoteMediaManager.setLayout() with appropriate layout');
5813
6044
  case 8:
5814
- _context21.next = 12;
6045
+ _context24.next = 12;
5815
6046
  break;
5816
6047
  case 10:
5817
6048
  if (!(shareAudioEnabled !== undefined)) {
5818
- _context21.next = 12;
6049
+ _context24.next = 12;
5819
6050
  break;
5820
6051
  }
5821
6052
  throw new Error('toggling shareAudioEnabled in a transcoded meeting is not supported as of now');
@@ -5840,18 +6071,18 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5840
6071
  this.mediaProperties.mediaDirection.receiveShare = !!(shareAudioEnabled || shareVideoEnabled);
5841
6072
  }
5842
6073
  if (this.isMultistream) {
5843
- _context21.next = 18;
6074
+ _context24.next = 18;
5844
6075
  break;
5845
6076
  }
5846
- _context21.next = 18;
6077
+ _context24.next = 18;
5847
6078
  return this.updateTranscodedMediaConnection();
5848
6079
  case 18:
5849
- return _context21.abrupt("return", undefined);
6080
+ return _context24.abrupt("return", undefined);
5850
6081
  case 19:
5851
6082
  case "end":
5852
- return _context21.stop();
6083
+ return _context24.stop();
5853
6084
  }
5854
- }, _callee21, this);
6085
+ }, _callee24, this);
5855
6086
  }));
5856
6087
  function updateMedia(_x16) {
5857
6088
  return _updateMedia.apply(this, arguments);
@@ -6460,10 +6691,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6460
6691
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6461
6692
  var main = renderInfo.main,
6462
6693
  content = renderInfo.content;
6463
- var _this$mediaProperties6 = this.mediaProperties,
6464
- mediaDirection = _this$mediaProperties6.mediaDirection,
6465
- remoteShareStream = _this$mediaProperties6.remoteShareStream,
6466
- remoteVideoStream = _this$mediaProperties6.remoteVideoStream;
6694
+ var _this$mediaProperties41 = this.mediaProperties,
6695
+ mediaDirection = _this$mediaProperties41.mediaDirection,
6696
+ remoteShareStream = _this$mediaProperties41.remoteShareStream,
6697
+ remoteVideoStream = _this$mediaProperties41.remoteVideoStream;
6467
6698
  var layoutInfo = (0, _cloneDeep2.default)(this.lastVideoLayoutInfo);
6468
6699
 
6469
6700
  // TODO: We need a real time value for Audio, Video and Share send indicator
@@ -6472,7 +6703,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6472
6703
  }
6473
6704
  if (layoutType) {
6474
6705
  if (!_constants.LAYOUT_TYPES.includes(layoutType)) {
6475
- this.rejectWithErrorLog('Meeting:index#changeVideoLayout --> cannot change video layout, invalid layoutType recieved.');
6706
+ this.rejectWithErrorLog('Meeting:index#changeVideoLayout --> cannot change video layout, invalid layoutType received.');
6476
6707
  }
6477
6708
  layoutInfo.layoutType = layoutType;
6478
6709
  }
@@ -6746,8 +6977,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6746
6977
  }, {
6747
6978
  key: "checkMediaConnection",
6748
6979
  value: function checkMediaConnection() {
6749
- var _this$mediaProperties7;
6750
- if ((_this$mediaProperties7 = this.mediaProperties) !== null && _this$mediaProperties7 !== void 0 && _this$mediaProperties7.webrtcMediaConnection) {
6980
+ var _this$mediaProperties42;
6981
+ if ((_this$mediaProperties42 = this.mediaProperties) !== null && _this$mediaProperties42 !== void 0 && _this$mediaProperties42.webrtcMediaConnection) {
6751
6982
  return;
6752
6983
  }
6753
6984
  throw new _webexErrors.NoMediaEstablishedYetError();
@@ -6762,37 +6993,37 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6762
6993
  }, {
6763
6994
  key: "enableMusicMode",
6764
6995
  value: function () {
6765
- var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(shouldEnableMusicMode) {
6766
- return _regenerator.default.wrap(function _callee22$(_context22) {
6767
- while (1) switch (_context22.prev = _context22.next) {
6996
+ var _enableMusicMode = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(shouldEnableMusicMode) {
6997
+ return _regenerator.default.wrap(function _callee25$(_context25) {
6998
+ while (1) switch (_context25.prev = _context25.next) {
6768
6999
  case 0:
6769
7000
  this.checkMediaConnection();
6770
7001
  if (this.isMultistream) {
6771
- _context22.next = 3;
7002
+ _context25.next = 3;
6772
7003
  break;
6773
7004
  }
6774
7005
  throw new Error('enableMusicMode() only supported with multistream');
6775
7006
  case 3:
6776
7007
  if (!shouldEnableMusicMode) {
6777
- _context22.next = 8;
7008
+ _context25.next = 8;
6778
7009
  break;
6779
7010
  }
6780
- _context22.next = 6;
7011
+ _context25.next = 6;
6781
7012
  return this.sendSlotManager.setCodecParameters(_internalMediaCore.MediaType.AudioMain, {
6782
7013
  maxaveragebitrate: '64000',
6783
7014
  maxplaybackrate: '48000'
6784
7015
  });
6785
7016
  case 6:
6786
- _context22.next = 10;
7017
+ _context25.next = 10;
6787
7018
  break;
6788
7019
  case 8:
6789
- _context22.next = 10;
7020
+ _context25.next = 10;
6790
7021
  return this.sendSlotManager.deleteCodecParameters(_internalMediaCore.MediaType.AudioMain, ['maxaveragebitrate', 'maxplaybackrate']);
6791
7022
  case 10:
6792
7023
  case "end":
6793
- return _context22.stop();
7024
+ return _context25.stop();
6794
7025
  }
6795
- }, _callee22, this);
7026
+ }, _callee25, this);
6796
7027
  }));
6797
7028
  function enableMusicMode(_x17) {
6798
7029
  return _enableMusicMode.apply(this, arguments);
@@ -6806,10 +7037,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6806
7037
  }, {
6807
7038
  key: "updateTranscodedMediaConnection",
6808
7039
  value: function updateTranscodedMediaConnection() {
6809
- var _this$mediaProperties8,
6810
- _this$mediaProperties9,
6811
- _this$mediaProperties10,
6812
- _this$mediaProperties11,
7040
+ var _this$mediaProperties43,
7041
+ _this$mediaProperties44,
7042
+ _this$mediaProperties45,
7043
+ _this$mediaProperties46,
6813
7044
  _this51 = this;
6814
7045
  var LOG_HEADER = 'Meeting:index#updateTranscodedMediaConnection -->';
6815
7046
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " starting"));
@@ -6819,10 +7050,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6819
7050
  return this.mediaProperties.webrtcMediaConnection.update({
6820
7051
  // TODO: RoapMediaConnection is not ready to use stream classes yet, so we pass the raw MediaStreamTrack for now
6821
7052
  localTracks: {
6822
- audio: ((_this$mediaProperties8 = this.mediaProperties.audioStream) === null || _this$mediaProperties8 === void 0 ? void 0 : _this$mediaProperties8.outputTrack) || null,
6823
- video: ((_this$mediaProperties9 = this.mediaProperties.videoStream) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.outputTrack) || null,
6824
- screenShareVideo: ((_this$mediaProperties10 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties10 === void 0 ? void 0 : _this$mediaProperties10.outputTrack) || null,
6825
- screenShareAudio: ((_this$mediaProperties11 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties11 === void 0 ? void 0 : _this$mediaProperties11.outputTrack) || null
7053
+ audio: ((_this$mediaProperties43 = this.mediaProperties.audioStream) === null || _this$mediaProperties43 === void 0 ? void 0 : _this$mediaProperties43.outputTrack) || null,
7054
+ video: ((_this$mediaProperties44 = this.mediaProperties.videoStream) === null || _this$mediaProperties44 === void 0 ? void 0 : _this$mediaProperties44.outputTrack) || null,
7055
+ screenShareVideo: ((_this$mediaProperties45 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties45 === void 0 ? void 0 : _this$mediaProperties45.outputTrack) || null,
7056
+ screenShareAudio: ((_this$mediaProperties46 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties46 === void 0 ? void 0 : _this$mediaProperties46.outputTrack) || null
6826
7057
  },
6827
7058
  direction: {
6828
7059
  audio: _media.default.getDirection(true, this.mediaProperties.mediaDirection.receiveAudio, this.mediaProperties.mediaDirection.sendAudio),
@@ -6854,25 +7085,25 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6854
7085
  }, {
6855
7086
  key: "publishStream",
6856
7087
  value: function () {
6857
- var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(mediaType, stream) {
6858
- return _regenerator.default.wrap(function _callee23$(_context23) {
6859
- while (1) switch (_context23.prev = _context23.next) {
7088
+ var _publishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(mediaType, stream) {
7089
+ return _regenerator.default.wrap(function _callee26$(_context26) {
7090
+ while (1) switch (_context26.prev = _context26.next) {
6860
7091
  case 0:
6861
7092
  if (stream) {
6862
- _context23.next = 2;
7093
+ _context26.next = 2;
6863
7094
  break;
6864
7095
  }
6865
- return _context23.abrupt("return");
7096
+ return _context26.abrupt("return");
6866
7097
  case 2:
6867
7098
  if (!this.mediaProperties.webrtcMediaConnection) {
6868
- _context23.next = 7;
7099
+ _context26.next = 7;
6869
7100
  break;
6870
7101
  }
6871
7102
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6872
- _context23.next = 6;
7103
+ _context26.next = 6;
6873
7104
  break;
6874
7105
  }
6875
- _context23.next = 6;
7106
+ _context26.next = 6;
6876
7107
  return this.sendSlotManager.publishStream(mediaType, stream);
6877
7108
  case 6:
6878
7109
  this.emitPublishStateChangeEvent({
@@ -6883,9 +7114,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6883
7114
  });
6884
7115
  case 7:
6885
7116
  case "end":
6886
- return _context23.stop();
7117
+ return _context26.stop();
6887
7118
  }
6888
- }, _callee23, this);
7119
+ }, _callee26, this);
6889
7120
  }));
6890
7121
  function publishStream(_x18, _x19) {
6891
7122
  return _publishStream.apply(this, arguments);
@@ -6902,21 +7133,21 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6902
7133
  }, {
6903
7134
  key: "unpublishStream",
6904
7135
  value: function () {
6905
- var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(mediaType, stream) {
6906
- return _regenerator.default.wrap(function _callee24$(_context24) {
6907
- while (1) switch (_context24.prev = _context24.next) {
7136
+ var _unpublishStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(mediaType, stream) {
7137
+ return _regenerator.default.wrap(function _callee27$(_context27) {
7138
+ while (1) switch (_context27.prev = _context27.next) {
6908
7139
  case 0:
6909
7140
  if (stream) {
6910
- _context24.next = 2;
7141
+ _context27.next = 2;
6911
7142
  break;
6912
7143
  }
6913
- return _context24.abrupt("return");
7144
+ return _context27.abrupt("return");
6914
7145
  case 2:
6915
7146
  if (!(this.isMultistream && this.mediaProperties.webrtcMediaConnection)) {
6916
- _context24.next = 5;
7147
+ _context27.next = 5;
6917
7148
  break;
6918
7149
  }
6919
- _context24.next = 5;
7150
+ _context27.next = 5;
6920
7151
  return this.sendSlotManager.unpublishStream(mediaType);
6921
7152
  case 5:
6922
7153
  this.emitPublishStateChangeEvent({
@@ -6927,9 +7158,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6927
7158
  });
6928
7159
  case 6:
6929
7160
  case "end":
6930
- return _context24.stop();
7161
+ return _context27.stop();
6931
7162
  }
6932
- }, _callee24, this);
7163
+ }, _callee27, this);
6933
7164
  }));
6934
7165
  function unpublishStream(_x20, _x21) {
6935
7166
  return _unpublishStream.apply(this, arguments);
@@ -6945,70 +7176,70 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6945
7176
  }, {
6946
7177
  key: "publishStreams",
6947
7178
  value: function () {
6948
- var _publishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(streams) {
7179
+ var _publishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(streams) {
6949
7180
  var _streams$screenShare, _streams$screenShare2, _streams$screenShare3, _streams$screenShare4;
6950
7181
  var floorRequestNeeded, _streams$screenShare5;
6951
- return _regenerator.default.wrap(function _callee25$(_context25) {
6952
- while (1) switch (_context25.prev = _context25.next) {
7182
+ return _regenerator.default.wrap(function _callee28$(_context28) {
7183
+ while (1) switch (_context28.prev = _context28.next) {
6953
7184
  case 0:
6954
7185
  this.checkMediaConnection();
6955
7186
  if (!(!streams.microphone && !streams.camera && !((_streams$screenShare = streams.screenShare) !== null && _streams$screenShare !== void 0 && _streams$screenShare.audio) && !((_streams$screenShare2 = streams.screenShare) !== null && _streams$screenShare2 !== void 0 && _streams$screenShare2.video))) {
6956
- _context25.next = 3;
7187
+ _context28.next = 3;
6957
7188
  break;
6958
7189
  }
6959
- return _context25.abrupt("return");
7190
+ return _context28.abrupt("return");
6960
7191
  case 3:
6961
7192
  floorRequestNeeded = false; // Screenshare Audio is supported only in multi stream. So we check for screenshare audio presence only if it's a multi stream meeting
6962
7193
  if (!(this.isMultistream && (_streams$screenShare3 = streams.screenShare) !== null && _streams$screenShare3 !== void 0 && _streams$screenShare3.audio)) {
6963
- _context25.next = 8;
7194
+ _context28.next = 8;
6964
7195
  break;
6965
7196
  }
6966
- _context25.next = 7;
7197
+ _context28.next = 7;
6967
7198
  return this.setLocalShareAudioStream(streams.screenShare.audio);
6968
7199
  case 7:
6969
7200
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6970
7201
  case 8:
6971
7202
  if (!((_streams$screenShare4 = streams.screenShare) !== null && _streams$screenShare4 !== void 0 && _streams$screenShare4.video)) {
6972
- _context25.next = 12;
7203
+ _context28.next = 12;
6973
7204
  break;
6974
7205
  }
6975
- _context25.next = 11;
7206
+ _context28.next = 11;
6976
7207
  return this.setLocalShareVideoStream((_streams$screenShare5 = streams.screenShare) === null || _streams$screenShare5 === void 0 ? void 0 : _streams$screenShare5.video);
6977
7208
  case 11:
6978
7209
  floorRequestNeeded = this.screenShareFloorState === ScreenShareFloorStatus.RELEASED;
6979
7210
  case 12:
6980
7211
  if (!streams.microphone) {
6981
- _context25.next = 15;
7212
+ _context28.next = 15;
6982
7213
  break;
6983
7214
  }
6984
- _context25.next = 15;
7215
+ _context28.next = 15;
6985
7216
  return this.setLocalAudioStream(streams.microphone);
6986
7217
  case 15:
6987
7218
  if (!streams.camera) {
6988
- _context25.next = 18;
7219
+ _context28.next = 18;
6989
7220
  break;
6990
7221
  }
6991
- _context25.next = 18;
7222
+ _context28.next = 18;
6992
7223
  return this.setLocalVideoStream(streams.camera);
6993
7224
  case 18:
6994
7225
  if (this.isMultistream) {
6995
- _context25.next = 21;
7226
+ _context28.next = 21;
6996
7227
  break;
6997
7228
  }
6998
- _context25.next = 21;
7229
+ _context28.next = 21;
6999
7230
  return this.updateTranscodedMediaConnection();
7000
7231
  case 21:
7001
7232
  if (!floorRequestNeeded) {
7002
- _context25.next = 24;
7233
+ _context28.next = 24;
7003
7234
  break;
7004
7235
  }
7005
- _context25.next = 24;
7236
+ _context28.next = 24;
7006
7237
  return this.enqueueScreenShareFloorRequest();
7007
7238
  case 24:
7008
7239
  case "end":
7009
- return _context25.stop();
7240
+ return _context28.stop();
7010
7241
  }
7011
- }, _callee25, this);
7242
+ }, _callee28, this);
7012
7243
  }));
7013
7244
  function publishStreams(_x22) {
7014
7245
  return _publishStreams.apply(this, arguments);
@@ -7024,10 +7255,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
7024
7255
  }, {
7025
7256
  key: "unpublishStreams",
7026
7257
  value: function () {
7027
- var _unpublishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(streams) {
7258
+ var _unpublishStreams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29(streams) {
7028
7259
  var promises, _iterator, _step, stream;
7029
- return _regenerator.default.wrap(function _callee26$(_context26) {
7030
- while (1) switch (_context26.prev = _context26.next) {
7260
+ return _regenerator.default.wrap(function _callee29$(_context29) {
7261
+ while (1) switch (_context29.prev = _context29.next) {
7031
7262
  case 0:
7032
7263
  this.checkMediaConnection();
7033
7264
  promises = [];
@@ -7058,7 +7289,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
7058
7289
  if (!this.isMultistream) {
7059
7290
  promises.push(this.updateTranscodedMediaConnection());
7060
7291
  }
7061
- _context26.next = 7;
7292
+ _context29.next = 7;
7062
7293
  return _promise.default.all(promises);
7063
7294
  case 7:
7064
7295
  // we're allowing for the SDK to support just audio share as well
@@ -7073,9 +7304,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
7073
7304
  }
7074
7305
  case 8:
7075
7306
  case "end":
7076
- return _context26.stop();
7307
+ return _context29.stop();
7077
7308
  }
7078
- }, _callee26, this);
7309
+ }, _callee29, this);
7079
7310
  }));
7080
7311
  function unpublishStreams(_x23) {
7081
7312
  return _unpublishStreams.apply(this, arguments);
@@ -7122,6 +7353,36 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
7122
7353
  }
7123
7354
  return _promise.default.resolve();
7124
7355
  }
7356
+ }], [{
7357
+ key: "handleDeviceLogging",
7358
+ value: function () {
7359
+ var _handleDeviceLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
7360
+ var devices;
7361
+ return _regenerator.default.wrap(function _callee30$(_context30) {
7362
+ while (1) switch (_context30.prev = _context30.next) {
7363
+ case 0:
7364
+ _context30.prev = 0;
7365
+ _context30.next = 3;
7366
+ return (0, _mediaHelpers.getDevices)();
7367
+ case 3:
7368
+ devices = _context30.sent;
7369
+ _util.default.handleDeviceLogging(devices);
7370
+ _context30.next = 9;
7371
+ break;
7372
+ case 7:
7373
+ _context30.prev = 7;
7374
+ _context30.t0 = _context30["catch"](0);
7375
+ case 9:
7376
+ case "end":
7377
+ return _context30.stop();
7378
+ }
7379
+ }, _callee30, null, [[0, 7]]);
7380
+ }));
7381
+ function handleDeviceLogging() {
7382
+ return _handleDeviceLogging.apply(this, arguments);
7383
+ }
7384
+ return handleDeviceLogging;
7385
+ }()
7125
7386
  }]);
7126
7387
  return Meeting;
7127
7388
  }(_webexCore.StatelessWebexPlugin);