@webex/plugin-meetings 3.0.0-beta.35 → 3.0.0-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/edit-lock-error.js +52 -0
  3. package/dist/breakouts/edit-lock-error.js.map +1 -0
  4. package/dist/breakouts/index.js +86 -2
  5. package/dist/breakouts/index.js.map +1 -1
  6. package/dist/constants.js +12 -1
  7. package/dist/constants.js.map +1 -1
  8. package/dist/media/index.js +4 -18
  9. package/dist/media/index.js.map +1 -1
  10. package/dist/media/properties.js +3 -3
  11. package/dist/media/properties.js.map +1 -1
  12. package/dist/meeting/index.js +194 -306
  13. package/dist/meeting/index.js.map +1 -1
  14. package/dist/meeting/muteState.js +7 -2
  15. package/dist/meeting/muteState.js.map +1 -1
  16. package/dist/meeting/util.js +2 -2
  17. package/dist/meeting/util.js.map +1 -1
  18. package/dist/metrics/constants.js +0 -4
  19. package/dist/metrics/constants.js.map +1 -1
  20. package/dist/reconnection-manager/index.js +1 -2
  21. package/dist/reconnection-manager/index.js.map +1 -1
  22. package/dist/statsAnalyzer/index.js +8 -4
  23. package/dist/statsAnalyzer/index.js.map +1 -1
  24. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  25. package/dist/types/constants.d.ts +11 -0
  26. package/dist/types/media/properties.d.ts +7 -6
  27. package/dist/types/meeting/index.d.ts +11 -36
  28. package/dist/types/metrics/constants.d.ts +0 -4
  29. package/package.json +19 -19
  30. package/src/breakouts/README.md +8 -2
  31. package/src/breakouts/edit-lock-error.ts +25 -0
  32. package/src/breakouts/index.ts +73 -0
  33. package/src/constants.ts +11 -0
  34. package/src/media/index.ts +14 -24
  35. package/src/media/properties.ts +16 -10
  36. package/src/meeting/index.ts +122 -204
  37. package/src/meeting/muteState.ts +5 -5
  38. package/src/meeting/util.ts +5 -4
  39. package/src/metrics/constants.ts +0 -4
  40. package/src/reconnection-manager/index.ts +1 -1
  41. package/src/statsAnalyzer/index.ts +4 -4
  42. package/test/integration/spec/converged-space-meetings.js +3 -3
  43. package/test/integration/spec/journey.js +3 -3
  44. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  45. package/test/unit/spec/breakouts/index.ts +92 -1
  46. package/test/unit/spec/media/index.ts +8 -6
  47. package/test/unit/spec/meeting/index.js +87 -114
  48. package/test/unit/spec/meeting/muteState.js +21 -22
  49. package/test/unit/spec/meeting/utils.js +3 -1
  50. package/test/utils/testUtils.js +30 -25
  51. package/dist/meeting/effectsState.js +0 -262
  52. package/dist/meeting/effectsState.js.map +0 -1
  53. package/dist/types/meeting/effectsState.d.ts +0 -42
  54. package/src/meeting/effectsState.ts +0 -211
  55. package/test/unit/spec/meeting/effectsState.js +0 -285
@@ -50,7 +50,6 @@ var _media = _interopRequireDefault(require("../media"));
50
50
  var _properties = _interopRequireDefault(require("../media/properties"));
51
51
  var _state = _interopRequireDefault(require("./state"));
52
52
  var _muteState = require("./muteState");
53
- var _effectsState = _interopRequireDefault(require("./effectsState"));
54
53
  var _locusInfo = _interopRequireDefault(require("../locus-info"));
55
54
  var _metrics = _interopRequireDefault(require("../metrics"));
56
55
  var _config = require("../metrics/config");
@@ -431,7 +430,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
431
430
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destination", void 0);
432
431
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destinationType", void 0);
433
432
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deviceUrl", void 0);
434
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "effects", void 0);
435
433
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hostId", void 0);
436
434
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "id", void 0);
437
435
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMultistream", void 0);
@@ -1304,14 +1302,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1304
1302
  * @memberof Meeting
1305
1303
  */
1306
1304
  _this.video = null;
1307
- /**
1308
- * created later
1309
- * @instance
1310
- * @type {EffectsState}
1311
- * @private
1312
- * @memberof Meeting
1313
- */
1314
- _this.effects = null;
1315
1305
  /**
1316
1306
  * @instance
1317
1307
  * @type {MeetingStateMachine}
@@ -2426,7 +2416,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2426
2416
  this.locusInfo.on(_constants.EVENTS.LOCUS_INFO_UPDATE_MEDIA_SHARES, /*#__PURE__*/function () {
2427
2417
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(payload) {
2428
2418
  var _payload$previous, _payload$previous2;
2429
- var _payload$current, contentShare, whiteboardShare, previousContentShare, previousWhiteboardShare, newShareStatus, _this13$mediaProperti, oldShareStatus, sendStartedSharingRemote, _this13$mediaProperti2;
2419
+ var _payload$current, contentShare, whiteboardShare, previousContentShare, previousWhiteboardShare, newShareStatus, _this13$mediaProperti, localShareTrack, oldShareStatus, sendStartedSharingRemote, _this13$mediaProperti2, _this13$mediaProperti3;
2430
2420
  return _regenerator.default.wrap(function _callee3$(_context3) {
2431
2421
  while (1) switch (_context3.prev = _context3.next) {
2432
2422
  case 0:
@@ -2446,49 +2436,51 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2446
2436
  }
2447
2437
  // CONTENT - sharing content remote
2448
2438
  newShareStatus = _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE;
2449
- _context3.next = 31;
2439
+ _context3.next = 32;
2450
2440
  break;
2451
2441
  case 10:
2452
2442
  if (!(_this13.selfId === contentShare.beneficiaryId && contentShare.disposition === _constants.FLOOR_ACTION.GRANTED)) {
2453
- _context3.next = 30;
2443
+ _context3.next = 31;
2454
2444
  break;
2455
2445
  }
2456
- if (!(((_this13$mediaProperti = _this13.mediaProperties.shareTrack) === null || _this13$mediaProperti === void 0 ? void 0 : _this13$mediaProperti.readyState) === 'ended')) {
2457
- _context3.next = 27;
2446
+ // @ts-ignore originalTrack is private - this will be fixed when SPARK-399694 are SPARK-399695 done
2447
+ localShareTrack = (_this13$mediaProperti = _this13.mediaProperties.shareTrack) === null || _this13$mediaProperti === void 0 ? void 0 : _this13$mediaProperti.originalTrack; // todo: remove this block of code and instead make sure we have LocalTrackEvents.Ended listener always registered (SPARK-399695)
2448
+ if (!((localShareTrack === null || localShareTrack === void 0 ? void 0 : localShareTrack.readyState) === 'ended')) {
2449
+ _context3.next = 28;
2458
2450
  break;
2459
2451
  }
2460
- _context3.prev = 12;
2452
+ _context3.prev = 13;
2461
2453
  if (!_this13.isMultistream) {
2462
- _context3.next = 18;
2454
+ _context3.next = 19;
2463
2455
  break;
2464
2456
  }
2465
- _context3.next = 16;
2466
- return _this13.unpublishTracks([_this13.mediaProperties.shareTrack]);
2467
- case 16:
2468
- _context3.next = 20;
2457
+ _context3.next = 17;
2458
+ return _this13.unpublishTracks([localShareTrack]);
2459
+ case 17:
2460
+ _context3.next = 21;
2469
2461
  break;
2470
- case 18:
2471
- _context3.next = 20;
2462
+ case 19:
2463
+ _context3.next = 21;
2472
2464
  return _this13.stopShare({
2473
2465
  skipSignalingCheck: true
2474
2466
  });
2475
- case 20:
2476
- _context3.next = 25;
2467
+ case 21:
2468
+ _context3.next = 26;
2477
2469
  break;
2478
- case 22:
2479
- _context3.prev = 22;
2480
- _context3.t0 = _context3["catch"](12);
2470
+ case 23:
2471
+ _context3.prev = 23;
2472
+ _context3.t0 = _context3["catch"](13);
2481
2473
  _loggerProxy.default.logger.log('Meeting:index#setUpLocusMediaSharesListener --> Error stopping share: ', _context3.t0);
2482
- case 25:
2483
- _context3.next = 28;
2474
+ case 26:
2475
+ _context3.next = 29;
2484
2476
  break;
2485
- case 27:
2477
+ case 28:
2486
2478
  // CONTENT - sharing content local
2487
2479
  newShareStatus = _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE;
2488
- case 28:
2489
- _context3.next = 31;
2480
+ case 29:
2481
+ _context3.next = 32;
2490
2482
  break;
2491
- case 30:
2483
+ case 31:
2492
2484
  if (whiteboardShare.disposition === _constants.FLOOR_ACTION.GRANTED) {
2493
2485
  // WHITEBOARD - sharing whiteboard
2494
2486
  newShareStatus = _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE;
@@ -2497,9 +2489,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2497
2489
  else if ((previousContentShare && contentShare.disposition === _constants.FLOOR_ACTION.RELEASED || contentShare.disposition === null) && (previousWhiteboardShare && whiteboardShare.disposition === _constants.FLOOR_ACTION.RELEASED || whiteboardShare.disposition === null)) {
2498
2490
  newShareStatus = _constants.SHARE_STATUS.NO_SHARE;
2499
2491
  }
2500
- case 31:
2492
+ case 32:
2501
2493
  if (!(newShareStatus !== _this13.shareStatus)) {
2502
- _context3.next = 73;
2494
+ _context3.next = 74;
2503
2495
  break;
2504
2496
  }
2505
2497
  oldShareStatus = _this13.shareStatus; // update our state before we send out any notifications
@@ -2507,37 +2499,37 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2507
2499
 
2508
2500
  // send out "stop" notifications for the old state
2509
2501
  _context3.t1 = oldShareStatus;
2510
- _context3.next = _context3.t1 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 37 : _context3.t1 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 39 : _context3.t1 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 41 : _context3.t1 === _constants.SHARE_STATUS.NO_SHARE ? 43 : 44;
2502
+ _context3.next = _context3.t1 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 38 : _context3.t1 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 40 : _context3.t1 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 42 : _context3.t1 === _constants.SHARE_STATUS.NO_SHARE ? 44 : 45;
2511
2503
  break;
2512
- case 37:
2504
+ case 38:
2513
2505
  _triggerProxy.default.trigger(_this13, {
2514
2506
  file: 'meetings/index',
2515
2507
  function: 'remoteShare'
2516
2508
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_REMOTE);
2517
- return _context3.abrupt("break", 45);
2518
- case 39:
2509
+ return _context3.abrupt("break", 46);
2510
+ case 40:
2519
2511
  _triggerProxy.default.trigger(_this13, {
2520
2512
  file: 'meeting/index',
2521
2513
  function: 'localShare'
2522
2514
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_LOCAL, {
2523
2515
  reason: _constants.SHARE_STOPPED_REASON.SELF_STOPPED
2524
2516
  });
2525
- return _context3.abrupt("break", 45);
2526
- case 41:
2517
+ return _context3.abrupt("break", 46);
2518
+ case 42:
2527
2519
  _triggerProxy.default.trigger(_this13, {
2528
2520
  file: 'meeting/index',
2529
2521
  function: 'stopWhiteboardShare'
2530
2522
  }, _constants.EVENT_TRIGGERS.MEETING_STOPPED_SHARING_WHITEBOARD);
2531
- return _context3.abrupt("break", 45);
2532
- case 43:
2533
- return _context3.abrupt("break", 45);
2523
+ return _context3.abrupt("break", 46);
2534
2524
  case 44:
2535
- return _context3.abrupt("break", 45);
2525
+ return _context3.abrupt("break", 46);
2536
2526
  case 45:
2527
+ return _context3.abrupt("break", 46);
2528
+ case 46:
2537
2529
  _context3.t2 = newShareStatus;
2538
- _context3.next = _context3.t2 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 48 : _context3.t2 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 62 : _context3.t2 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 65 : _context3.t2 === _constants.SHARE_STATUS.NO_SHARE ? 68 : 69;
2530
+ _context3.next = _context3.t2 === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE ? 49 : _context3.t2 === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE ? 63 : _context3.t2 === _constants.SHARE_STATUS.WHITEBOARD_SHARE_ACTIVE ? 66 : _context3.t2 === _constants.SHARE_STATUS.NO_SHARE ? 69 : 70;
2539
2531
  break;
2540
- case 48:
2532
+ case 49:
2541
2533
  sendStartedSharingRemote = function sendStartedSharingRemote() {
2542
2534
  _triggerProxy.default.trigger(_this13, {
2543
2535
  file: 'meetings/index',
@@ -2546,33 +2538,33 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2546
2538
  memberId: contentShare.beneficiaryId
2547
2539
  });
2548
2540
  };
2549
- _context3.prev = 49;
2541
+ _context3.prev = 50;
2550
2542
  if (!((_this13$mediaProperti2 = _this13.mediaProperties.mediaDirection) !== null && _this13$mediaProperti2 !== void 0 && _this13$mediaProperti2.sendShare && oldShareStatus === _constants.SHARE_STATUS.LOCAL_SHARE_ACTIVE)) {
2551
- _context3.next = 58;
2543
+ _context3.next = 59;
2552
2544
  break;
2553
2545
  }
2554
2546
  if (!_this13.isMultistream) {
2555
- _context3.next = 56;
2547
+ _context3.next = 57;
2556
2548
  break;
2557
2549
  }
2558
- _context3.next = 54;
2559
- return _this13.unpublishTracks([_this13.mediaProperties.shareTrack]);
2560
- case 54:
2561
- _context3.next = 58;
2550
+ _context3.next = 55;
2551
+ return _this13.unpublishTracks([(_this13$mediaProperti3 = _this13.mediaProperties.shareTrack) === null || _this13$mediaProperti3 === void 0 ? void 0 : _this13$mediaProperti3.originalTrack]);
2552
+ case 55:
2553
+ _context3.next = 59;
2562
2554
  break;
2563
- case 56:
2564
- _context3.next = 58;
2555
+ case 57:
2556
+ _context3.next = 59;
2565
2557
  return _this13.updateShare({
2566
2558
  sendShare: false,
2567
2559
  receiveShare: _this13.mediaProperties.mediaDirection.receiveShare
2568
2560
  });
2569
- case 58:
2570
- _context3.prev = 58;
2561
+ case 59:
2562
+ _context3.prev = 59;
2571
2563
  sendStartedSharingRemote();
2572
- return _context3.finish(58);
2573
- case 61:
2574
- return _context3.abrupt("break", 70);
2564
+ return _context3.finish(59);
2575
2565
  case 62:
2566
+ return _context3.abrupt("break", 71);
2567
+ case 63:
2576
2568
  _triggerProxy.default.trigger(_this13, {
2577
2569
  file: 'meeting/index',
2578
2570
  function: 'share'
@@ -2581,8 +2573,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2581
2573
  event: _config.eventType.LOCAL_SHARE_FLOOR_GRANTED,
2582
2574
  meeting: _this13
2583
2575
  });
2584
- return _context3.abrupt("break", 70);
2585
- case 65:
2576
+ return _context3.abrupt("break", 71);
2577
+ case 66:
2586
2578
  _triggerProxy.default.trigger(_this13, {
2587
2579
  file: 'meeting/index',
2588
2580
  function: 'startWhiteboardShare'
@@ -2594,16 +2586,16 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2594
2586
  event: _config.eventType.WHITEBOARD_SHARE_FLOOR_GRANTED,
2595
2587
  meeting: _this13
2596
2588
  });
2597
- return _context3.abrupt("break", 70);
2598
- case 68:
2599
- return _context3.abrupt("break", 70);
2589
+ return _context3.abrupt("break", 71);
2600
2590
  case 69:
2601
- return _context3.abrupt("break", 70);
2591
+ return _context3.abrupt("break", 71);
2602
2592
  case 70:
2593
+ return _context3.abrupt("break", 71);
2594
+ case 71:
2603
2595
  _this13.members.locusMediaSharesUpdate(payload);
2604
- _context3.next = 74;
2596
+ _context3.next = 75;
2605
2597
  break;
2606
- case 73:
2598
+ case 74:
2607
2599
  if (newShareStatus === _constants.SHARE_STATUS.REMOTE_SHARE_ACTIVE) {
2608
2600
  // if we got here, then some remote participant has stolen
2609
2601
  // the presentation from another remote participant
@@ -2630,11 +2622,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2630
2622
  });
2631
2623
  _this13.members.locusMediaSharesUpdate(payload);
2632
2624
  }
2633
- case 74:
2625
+ case 75:
2634
2626
  case "end":
2635
2627
  return _context3.stop();
2636
2628
  }
2637
- }, _callee3, null, [[12, 22], [49,, 58, 61]]);
2629
+ }, _callee3, null, [[13, 23], [50,, 59, 62]]);
2638
2630
  }));
2639
2631
  return function (_x2) {
2640
2632
  return _ref11.apply(this, arguments);
@@ -2960,8 +2952,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
2960
2952
  // TODO: Handle sharing and wireless sharing when meeting end
2961
2953
  if (_this20.wirelessShare) {
2962
2954
  if (_this20.mediaProperties.shareTrack) {
2963
- _this20.mediaProperties.shareTrack.onended = null;
2964
- _this20.mediaProperties.shareTrack.stop();
2955
+ _this20.setLocalShareTrack(null);
2965
2956
  }
2966
2957
  }
2967
2958
  // when multiple WEB deviceType join with same user
@@ -3430,18 +3421,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3430
3421
  }, {
3431
3422
  key: "sendLocalMediaReadyEvent",
3432
3423
  value: function sendLocalMediaReadyEvent() {
3424
+ var _this$mediaProperties2, _this$mediaProperties3;
3433
3425
  _triggerProxy.default.trigger(this, {
3434
3426
  file: 'meeting/index',
3435
- function: 'setLocalTracks'
3427
+ function: 'sendLocalMediaReadyEvent'
3436
3428
  }, _constants.EVENT_TRIGGERS.MEDIA_READY, {
3437
3429
  type: _constants.EVENT_TYPES.LOCAL,
3438
- stream: _util4.default.createMediaStream([this.mediaProperties.audioTrack, this.mediaProperties.videoTrack])
3430
+ stream: _util4.default.createMediaStream([(_this$mediaProperties2 = this.mediaProperties.audioTrack) === null || _this$mediaProperties2 === void 0 ? void 0 : _this$mediaProperties2.underlyingTrack, (_this$mediaProperties3 = this.mediaProperties.videoTrack) === null || _this$mediaProperties3 === void 0 ? void 0 : _this$mediaProperties3.underlyingTrack])
3439
3431
  });
3440
3432
  }
3441
3433
 
3442
3434
  /**
3443
3435
  * Sets the local audio track on the class and emits an event to the developer
3444
- * @param {MediaStreamTrack} audioTrack
3436
+ * @param {MediaStreamTrack} rawAudioTrack
3445
3437
  * @param {Boolean} emitEvent if true, a media ready event is emitted to the developer
3446
3438
  * @returns {undefined}
3447
3439
  * @private
@@ -3449,16 +3441,17 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3449
3441
  */
3450
3442
  }, {
3451
3443
  key: "setLocalAudioTrack",
3452
- value: function setLocalAudioTrack(audioTrack) {
3444
+ value: function setLocalAudioTrack(rawAudioTrack) {
3453
3445
  var emitEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
3454
- if (audioTrack) {
3455
- var settings = audioTrack.getSettings();
3446
+ if (rawAudioTrack) {
3447
+ var settings = rawAudioTrack.getSettings();
3448
+ var localMicrophoneTrack = new _internalMediaCore.LocalMicrophoneTrack(_util4.default.createMediaStream([rawAudioTrack]));
3456
3449
  this.mediaProperties.setMediaSettings('audio', {
3457
3450
  echoCancellation: settings.echoCancellation,
3458
3451
  noiseSuppression: settings.noiseSuppression
3459
3452
  });
3460
3453
  _loggerProxy.default.logger.log('Meeting:index#setLocalAudioTrack --> Audio settings.', (0, _stringify.default)(this.mediaProperties.mediaSettings.audio));
3461
- this.mediaProperties.setLocalAudioTrack(audioTrack);
3454
+ this.mediaProperties.setLocalAudioTrack(localMicrophoneTrack);
3462
3455
  if (this.audio) this.audio.applyClientStateLocally(this);
3463
3456
  } else {
3464
3457
  this.mediaProperties.setLocalAudioTrack(null);
@@ -3470,7 +3463,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3470
3463
 
3471
3464
  /**
3472
3465
  * Sets the local video track on the class and emits an event to the developer
3473
- * @param {MediaStreamTrack} videoTrack
3466
+ * @param {MediaStreamTrack} rawVideoTrack
3474
3467
  * @param {Boolean} emitEvent if true, a media ready event is emitted to the developer
3475
3468
  * @returns {undefined}
3476
3469
  * @private
@@ -3478,21 +3471,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3478
3471
  */
3479
3472
  }, {
3480
3473
  key: "setLocalVideoTrack",
3481
- value: function setLocalVideoTrack(videoTrack) {
3474
+ value: function setLocalVideoTrack(rawVideoTrack) {
3482
3475
  var emitEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
3483
- if (videoTrack) {
3484
- var _videoTrack$getSettin = videoTrack.getSettings(),
3485
- aspectRatio = _videoTrack$getSettin.aspectRatio,
3486
- frameRate = _videoTrack$getSettin.frameRate,
3487
- height = _videoTrack$getSettin.height,
3488
- width = _videoTrack$getSettin.width,
3489
- deviceId = _videoTrack$getSettin.deviceId;
3476
+ if (rawVideoTrack) {
3477
+ var _rawVideoTrack$getSet = rawVideoTrack.getSettings(),
3478
+ aspectRatio = _rawVideoTrack$getSet.aspectRatio,
3479
+ frameRate = _rawVideoTrack$getSet.frameRate,
3480
+ height = _rawVideoTrack$getSet.height,
3481
+ width = _rawVideoTrack$getSet.width,
3482
+ deviceId = _rawVideoTrack$getSet.deviceId;
3490
3483
  var localQualityLevel = this.mediaProperties.localQualityLevel;
3484
+ var localCameraTrack = new _internalMediaCore.LocalCameraTrack(_util4.default.createMediaStream([rawVideoTrack]));
3491
3485
  if (Number(localQualityLevel.slice(0, -1)) > height) {
3492
3486
  _loggerProxy.default.logger.warn("Meeting:index#setLocalVideoTrack --> Local video quality of ".concat(localQualityLevel, " not supported,\n downscaling to highest possible resolution of ").concat(height, "p"));
3493
3487
  this.mediaProperties.setLocalQualityLevel("".concat(height, "p"));
3494
3488
  }
3495
- this.mediaProperties.setLocalVideoTrack(videoTrack);
3489
+ this.mediaProperties.setLocalVideoTrack(localCameraTrack);
3496
3490
  if (this.video) this.video.applyClientStateLocally(this);
3497
3491
  this.mediaProperties.setMediaSettings('video', {
3498
3492
  aspectRatio: aspectRatio,
@@ -3524,6 +3518,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3524
3518
  key: "setLocalTracks",
3525
3519
  value: function setLocalTracks(localStream) {
3526
3520
  if (localStream) {
3521
+ if (this.isMultistream) {
3522
+ throw new Error('addMedia() and updateMedia() APIs are not supported with multistream, use publishTracks/unpublishTracks instead');
3523
+ }
3527
3524
  var _MeetingUtil$getTrack = _util.default.getTrack(localStream),
3528
3525
  audioTrack = _MeetingUtil$getTrack.audioTrack,
3529
3526
  videoTrack = _MeetingUtil$getTrack.videoTrack;
@@ -3535,37 +3532,40 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3535
3532
 
3536
3533
  /**
3537
3534
  * Sets the local media stream on the class and emits an event to the developer
3538
- * @param {MediaStreamTrack} localShareTrack the local media stream
3535
+ * @param {MediaStreamTrack} rawLocalShareTrack the local share media track
3539
3536
  * @returns {undefined}
3540
3537
  * @public
3541
3538
  * @memberof Meeting
3542
3539
  */
3543
3540
  }, {
3544
3541
  key: "setLocalShareTrack",
3545
- value: function setLocalShareTrack(localShareTrack) {
3546
- var settings = null;
3547
- if (localShareTrack) {
3548
- this.mediaProperties.setLocalShareTrack(localShareTrack);
3549
- settings = localShareTrack.getSettings();
3542
+ value: function setLocalShareTrack(rawLocalShareTrack) {
3543
+ if (rawLocalShareTrack) {
3544
+ var settings = rawLocalShareTrack.getSettings();
3545
+ var localDisplayTrack = new _internalMediaCore.LocalDisplayTrack(_util4.default.createMediaStream([rawLocalShareTrack]));
3546
+ this.mediaProperties.setLocalShareTrack(localDisplayTrack);
3550
3547
  this.mediaProperties.setMediaSettings('screen', {
3551
3548
  aspectRatio: settings.aspectRatio,
3552
3549
  frameRate: settings.frameRate,
3553
3550
  height: settings.height,
3554
3551
  width: settings.width,
3552
+ // @ts-ignore
3555
3553
  displaySurface: settings.displaySurface,
3554
+ // @ts-ignore
3556
3555
  cursor: settings.cursor
3557
3556
  });
3558
3557
  _loggerProxy.default.logger.log('Meeting:index#setLocalShareTrack --> Screen settings.', (0, _stringify.default)(this.mediaProperties.mediaSettings.screen));
3559
- localShareTrack.addEventListener('ended', this.handleShareTrackEnded);
3558
+ localDisplayTrack.on(_internalMediaCore.LocalTrackEvents.Ended, this.handleShareTrackEnded);
3560
3559
  _triggerProxy.default.trigger(this, {
3561
3560
  file: 'meeting/index',
3562
3561
  function: 'setLocalShareTrack'
3563
3562
  }, _constants.EVENT_TRIGGERS.MEDIA_READY, {
3564
3563
  type: _constants.EVENT_TYPES.LOCAL_SHARE,
3565
- track: localShareTrack
3564
+ track: rawLocalShareTrack
3566
3565
  });
3567
3566
  } else if (this.mediaProperties.shareTrack) {
3568
- this.mediaProperties.shareTrack.removeEventListener('ended', this.handleShareTrackEnded);
3567
+ this.mediaProperties.shareTrack.off(_internalMediaCore.LocalTrackEvents.Ended, this.handleShareTrackEnded);
3568
+ this.mediaProperties.shareTrack.stop(); // todo: this line should be removed once SPARK-399694 are SPARK-399695 are done
3569
3569
  this.mediaProperties.setLocalShareTrack(null);
3570
3570
  }
3571
3571
  }
@@ -3581,25 +3581,19 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3581
3581
  key: "closeLocalStream",
3582
3582
  value: function closeLocalStream() {
3583
3583
  var _this23 = this;
3584
- var _this$mediaProperties2 = this.mediaProperties,
3585
- audioTrack = _this$mediaProperties2.audioTrack,
3586
- videoTrack = _this$mediaProperties2.videoTrack;
3584
+ var _this$mediaProperties4 = this.mediaProperties,
3585
+ audioTrack = _this$mediaProperties4.audioTrack,
3586
+ videoTrack = _this$mediaProperties4.videoTrack;
3587
3587
  return _media.default.stopTracks(audioTrack).then(function () {
3588
3588
  return _media.default.stopTracks(videoTrack);
3589
3589
  }).then(function () {
3590
- var audioStopped = audioTrack && audioTrack.readyState === _constants.ENDED;
3591
- var videoStopped = videoTrack && videoTrack.readyState === _constants.ENDED;
3592
-
3593
- // triggers event for audio and video stop , sometime either audio or video one of them exists
3594
- if (audioStopped || videoStopped) {
3590
+ if (audioTrack || videoTrack) {
3595
3591
  _triggerProxy.default.trigger(_this23, {
3596
3592
  file: 'meeting/index',
3597
3593
  function: 'closeLocalStream'
3598
3594
  }, _constants.EVENT_TRIGGERS.MEDIA_STOPPED, {
3599
3595
  type: _constants.EVENT_TYPES.LOCAL
3600
3596
  });
3601
- } else if (audioTrack || videoTrack) {
3602
- _loggerProxy.default.logger.warn('Meeting:index#closeLocalStream --> Warning: track might already been ended or unavaliable.');
3603
3597
  }
3604
3598
  });
3605
3599
  }
@@ -3617,16 +3611,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
3617
3611
  var _this24 = this;
3618
3612
  var track = this.mediaProperties.shareTrack;
3619
3613
  return _media.default.stopTracks(track).then(function () {
3620
- if (track && track.readyState === _constants.ENDED) {
3614
+ if (track) {
3621
3615
  _triggerProxy.default.trigger(_this24, {
3622
3616
  file: 'meeting/index',
3623
3617
  function: 'closeLocalShare'
3624
3618
  }, _constants.EVENT_TRIGGERS.MEDIA_STOPPED, {
3625
3619
  type: _constants.EVENT_TYPES.LOCAL_SHARE
3626
3620
  });
3627
- } else if (track) {
3628
- // Track exists but with wrong readyState
3629
- _loggerProxy.default.logger.warn("Meeting:index#closeLocalShare --> Error: MediaStreamTrack.readyState is ".concat(track.readyState, " for localShare"));
3630
3621
  }
3631
3622
  });
3632
3623
  }
@@ -4796,6 +4787,13 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4796
4787
  value: function getMediaConnectionDebugId() {
4797
4788
  return "MC-".concat(this.id.substring(0, 4));
4798
4789
  }
4790
+
4791
+ /**
4792
+ * Creates a webrtc media connection
4793
+ *
4794
+ * @param {Object} turnServerInfo TURN server information
4795
+ * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}
4796
+ */
4799
4797
  }, {
4800
4798
  key: "createMediaConnection",
4801
4799
  value: function createMediaConnection(turnServerInfo) {
@@ -4955,7 +4953,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4955
4953
  });
4956
4954
  }).then(function () {
4957
4955
  return _this40.mediaProperties.waitForMediaConnectionConnected().catch(function () {
4958
- throw (0, _webexErrors.createMeetingsError)(30202, 'Meeting connection failed');
4956
+ throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(_this40.correlationId));
4959
4957
  });
4960
4958
  }).then(function () {
4961
4959
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " PeerConnection CONNECTED"));
@@ -5079,6 +5077,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5079
5077
  var _this42 = this;
5080
5078
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5081
5079
  var LOG_HEADER = 'Meeting:index#updateMedia -->';
5080
+ if (this.isMultistream) {
5081
+ throw new Error('updateMedia() is not supported with multistream, use publishTracks/unpublishTracks instead');
5082
+ }
5082
5083
  if (!this.canUpdateMedia()) {
5083
5084
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.ALL, options);
5084
5085
  }
@@ -5094,9 +5095,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5094
5095
  }).then(function () {
5095
5096
  return _this42.mediaProperties.webrtcMediaConnection.updateSendReceiveOptions({
5096
5097
  send: {
5097
- audio: _this42.mediaProperties.mediaDirection.sendAudio ? _this42.mediaProperties.audioTrack : null,
5098
- video: _this42.mediaProperties.mediaDirection.sendVideo ? _this42.mediaProperties.videoTrack : null,
5099
- screenShareVideo: _this42.mediaProperties.mediaDirection.sendShare ? _this42.mediaProperties.shareTrack : null
5098
+ audio: _this42.mediaProperties.mediaDirection.sendAudio ? _this42.mediaProperties.audioTrack.underlyingTrack : null,
5099
+ video: _this42.mediaProperties.mediaDirection.sendVideo ? _this42.mediaProperties.videoTrack.underlyingTrack : null,
5100
+ screenShareVideo: _this42.mediaProperties.mediaDirection.sendShare ? _this42.mediaProperties.shareTrack.underlyingTrack : null
5100
5101
  },
5101
5102
  receive: {
5102
5103
  audio: _this42.mediaProperties.mediaDirection.receiveAudio,
@@ -5158,46 +5159,36 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5158
5159
  value: function () {
5159
5160
  var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(options) {
5160
5161
  var _this43 = this;
5161
- var sendAudio, receiveAudio, stream, track, bnrEnabled;
5162
+ var sendAudio, receiveAudio, stream, track;
5162
5163
  return _regenerator.default.wrap(function _callee9$(_context9) {
5163
5164
  while (1) switch (_context9.prev = _context9.next) {
5164
5165
  case 0:
5165
- if (this.canUpdateMedia()) {
5166
+ if (!this.isMultistream) {
5166
5167
  _context9.next = 2;
5167
5168
  break;
5168
5169
  }
5169
- return _context9.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
5170
+ throw new Error('updateAudio() is not supported with multistream, use publishTracks/unpublishTracks instead');
5170
5171
  case 2:
5172
+ if (this.canUpdateMedia()) {
5173
+ _context9.next = 4;
5174
+ break;
5175
+ }
5176
+ return _context9.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
5177
+ case 4:
5171
5178
  sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream;
5172
5179
  track = _util.default.getTrack(stream).audioTrack;
5173
5180
  if (!(typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean')) {
5174
- _context9.next = 6;
5181
+ _context9.next = 8;
5175
5182
  break;
5176
5183
  }
5177
5184
  return _context9.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
5178
- case 6:
5185
+ case 8:
5179
5186
  if (this.mediaProperties.webrtcMediaConnection) {
5180
- _context9.next = 8;
5187
+ _context9.next = 10;
5181
5188
  break;
5182
5189
  }
5183
5190
  return _context9.abrupt("return", _promise.default.reject(new Error('media connection not established, call addMedia() first')));
5184
- case 8:
5185
- if (!(this.effects && this.effects.state)) {
5186
- _context9.next = 16;
5187
- break;
5188
- }
5189
- bnrEnabled = this.effects.state.bnr.enabled;
5190
- if (!(sendAudio && !this.isAudioMuted() && (bnrEnabled === _constants.BNR_STATUS.ENABLED || bnrEnabled === _constants.BNR_STATUS.SHOULD_ENABLE))) {
5191
- _context9.next = 16;
5192
- break;
5193
- }
5194
- _loggerProxy.default.logger.info('Meeting:index#updateAudio. Calling WebRTC enable bnr method');
5195
- _context9.next = 14;
5196
- return this.internal_enableBNR(track);
5197
- case 14:
5198
- track = _context9.sent;
5199
- _loggerProxy.default.logger.info('Meeting:index#updateAudio. WebRTC enable bnr request completed');
5200
- case 16:
5191
+ case 10:
5201
5192
  return _context9.abrupt("return", _util.default.validateOptions({
5202
5193
  sendAudio: sendAudio,
5203
5194
  localStream: stream
@@ -5222,7 +5213,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5222
5213
  // audio state could be undefined if you have not sent audio before
5223
5214
  _this43.audio = _this43.audio || (0, _muteState.createMuteState)(_constants.AUDIO, _this43, _this43.mediaProperties.mediaDirection);
5224
5215
  }));
5225
- case 17:
5216
+ case 11:
5226
5217
  case "end":
5227
5218
  return _context9.stop();
5228
5219
  }
@@ -5250,6 +5241,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5250
5241
  key: "updateVideo",
5251
5242
  value: function updateVideo(options) {
5252
5243
  var _this44 = this;
5244
+ if (this.isMultistream) {
5245
+ throw new Error('updateVideo() is not supported with multistream, use publishTracks/unpublishTracks instead');
5246
+ }
5253
5247
  if (!this.canUpdateMedia()) {
5254
5248
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.VIDEO, options);
5255
5249
  }
@@ -5328,6 +5322,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5328
5322
  key: "updateShare",
5329
5323
  value: function updateShare(options) {
5330
5324
  var _this45 = this;
5325
+ if (this.isMultistream) {
5326
+ throw new Error('updateShare() is not supported with multistream, use publishTracks/unpublishTracks instead');
5327
+ }
5331
5328
  if (!options.skipSignalingCheck && !this.canUpdateMedia()) {
5332
5329
  return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.SHARE, options);
5333
5330
  }
@@ -5417,6 +5414,9 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5417
5414
  this.video = this.video || (0, _muteState.createMuteState)(_constants.VIDEO, this, this.mediaProperties.mediaDirection);
5418
5415
  // Validation is already done in addMedia so no need to check if the lenght is greater then 0
5419
5416
  this.setLocalTracks(localStream);
5417
+ if (this.isMultistream && localShare) {
5418
+ throw new Error('calling addMedia() with localShare stream is not supported when using multistream');
5419
+ }
5420
5420
  this.setLocalShareTrack(_util.default.getTrack(localShare).videoTrack);
5421
5421
  }
5422
5422
 
@@ -5717,7 +5717,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5717
5717
  event: _config.eventType.SHARE_STOPPED,
5718
5718
  meeting: this
5719
5719
  });
5720
- _media.default.stopTracks(this.mediaProperties.shareTrack);
5721
5720
  if (content.floor.beneficiary.id !== this.selfId) {
5722
5721
  // remote participant started sharing and caused our sharing to stop, we don't want to send any floor action request in that case
5723
5722
  this.isSharing = false;
@@ -5901,10 +5900,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
5901
5900
  var renderInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5902
5901
  var main = renderInfo.main,
5903
5902
  content = renderInfo.content;
5904
- var _this$mediaProperties3 = this.mediaProperties,
5905
- mediaDirection = _this$mediaProperties3.mediaDirection,
5906
- remoteShare = _this$mediaProperties3.remoteShare,
5907
- remoteVideoTrack = _this$mediaProperties3.remoteVideoTrack;
5903
+ var _this$mediaProperties5 = this.mediaProperties,
5904
+ mediaDirection = _this$mediaProperties5.mediaDirection,
5905
+ remoteShare = _this$mediaProperties5.remoteShare,
5906
+ remoteVideoTrack = _this$mediaProperties5.remoteVideoTrack;
5908
5907
  var layoutInfo = (0, _cloneDeep2.default)(this.lastVideoLayoutInfo);
5909
5908
 
5910
5909
  // TODO: We need a real time value for Audio, Video and Share send indicator
@@ -6092,10 +6091,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6092
6091
  }
6093
6092
 
6094
6093
  // Determine the direction of our current media
6095
- var _this$mediaProperties4 = this.mediaProperties.mediaDirection,
6096
- receiveAudio = _this$mediaProperties4.receiveAudio,
6097
- receiveVideo = _this$mediaProperties4.receiveVideo,
6098
- sendVideo = _this$mediaProperties4.sendVideo;
6094
+ var _this$mediaProperties6 = this.mediaProperties.mediaDirection,
6095
+ receiveAudio = _this$mediaProperties6.receiveAudio,
6096
+ receiveVideo = _this$mediaProperties6.receiveVideo,
6097
+ sendVideo = _this$mediaProperties6.sendVideo;
6099
6098
  return (sendVideo ? this.setLocalVideoQuality(level) : _promise.default.resolve()).then(function () {
6100
6099
  return receiveAudio || receiveVideo ? _this55.setRemoteQualityLevel(level) : _promise.default.resolve();
6101
6100
  }).catch(function (error) {
@@ -6202,18 +6201,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6202
6201
 
6203
6202
  /**
6204
6203
  * Handle logging the media
6205
- * @param {Object} audioTrack The audio track
6206
- * @param {Object} videoTrack The video track
6204
+ * @param {Object} mediaProperties
6207
6205
  * @private
6208
6206
  * @returns {undefined}
6209
6207
  */
6210
6208
  }, {
6211
6209
  key: "handleMediaLogging",
6212
- value: function handleMediaLogging(_ref20) {
6213
- var audioTrack = _ref20.audioTrack,
6214
- videoTrack = _ref20.videoTrack;
6215
- _util.default.handleVideoLogging(videoTrack);
6216
- _util.default.handleAudioLogging(audioTrack);
6210
+ value: function handleMediaLogging(mediaProperties) {
6211
+ _util.default.handleVideoLogging(mediaProperties.videoTrack);
6212
+ _util.default.handleAudioLogging(mediaProperties.audioTrack);
6217
6213
  }
6218
6214
 
6219
6215
  /**
@@ -6466,122 +6462,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6466
6462
  * @public
6467
6463
  * @memberof Meeting
6468
6464
  */
6469
- }, {
6470
- key: "isBnrEnabled",
6471
- value:
6472
- /**
6473
- * Internal API to return status of BNR
6474
- * @returns {Boolean}
6475
- * @public
6476
- * @memberof Meeting
6477
- */
6478
- function isBnrEnabled() {
6479
- return this.effects && this.effects.isBnrEnabled();
6480
- }
6481
-
6482
- /**
6483
- * Internal API to obtain BNR enabled MediaStream
6484
- * @returns {Promise<MediaStreamTrack>}
6485
- * @private
6486
- * @param {MedaiStreamTrack} audioTrack from updateAudio
6487
- * @memberof Meeting
6488
- */
6489
- }, {
6490
- key: "internal_enableBNR",
6491
- value: function () {
6492
- var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(audioTrack) {
6493
- var bnrAudioTrack;
6494
- return _regenerator.default.wrap(function _callee12$(_context12) {
6495
- while (1) switch (_context12.prev = _context12.next) {
6496
- case 0:
6497
- _context12.prev = 0;
6498
- _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. Internal enable BNR called');
6499
- _context12.next = 4;
6500
- return _internalMediaCore.Media.Effects.BNR.enableBNR(audioTrack);
6501
- case 4:
6502
- bnrAudioTrack = _context12.sent;
6503
- _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. BNR enabled track obtained from WebRTC & returned as stream');
6504
- return _context12.abrupt("return", bnrAudioTrack);
6505
- case 9:
6506
- _context12.prev = 9;
6507
- _context12.t0 = _context12["catch"](0);
6508
- _loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context12.t0);
6509
- throw _context12.t0;
6510
- case 13:
6511
- case "end":
6512
- return _context12.stop();
6513
- }
6514
- }, _callee12, null, [[0, 9]]);
6515
- }));
6516
- function internal_enableBNR(_x7) {
6517
- return _internal_enableBNR.apply(this, arguments);
6518
- }
6519
- return internal_enableBNR;
6520
- }()
6521
- /**
6522
- * Enable the audio track with BNR for a meeting
6523
- * @returns {Promise} resolves the data from enable bnr or rejects if there is no audio or audio is muted
6524
- * @public
6525
- * @memberof Meeting
6526
- */
6527
- }, {
6528
- key: "enableBNR",
6529
- value: function enableBNR() {
6530
- if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
6531
- return _promise.default.reject(new Error("Meeting doesn't have an audioTrack attached"));
6532
- }
6533
- if (this.isAudioMuted()) {
6534
- return _promise.default.reject(new Error('Cannot enable BNR while meeting is muted'));
6535
- }
6536
- this.effects = this.effects || (0, _effectsState.default)('BNR');
6537
- var LOG_HEADER = 'Meeting:index#enableBNR -->';
6538
- return logRequest(this.effects.handleClientRequest(true, this).then(function (res) {
6539
- _loggerProxy.default.logger.info('Meeting:index#enableBNR. Enable bnr completed');
6540
- return res;
6541
- }).catch(function (error) {
6542
- throw error;
6543
- }), {
6544
- header: "".concat(LOG_HEADER, " enable bnr"),
6545
- success: "".concat(LOG_HEADER, " enable bnr success"),
6546
- failure: "".concat(LOG_HEADER, " enable bnr failure, ")
6547
- });
6548
- }
6549
-
6550
- /**
6551
- * Disable the BNR for an audio track
6552
- * @returns {Promise} resolves the data from disable bnr or rejects if there is no audio set
6553
- * @public
6554
- * @memberof Meeting
6555
- */
6556
- }, {
6557
- key: "disableBNR",
6558
- value: function disableBNR() {
6559
- if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
6560
- return _promise.default.reject(new Error("Meeting doesn't have an audioTrack attached"));
6561
- }
6562
- if (!this.isBnrEnabled()) {
6563
- return _promise.default.reject(new Error('Can not disable as BNR is not enabled'));
6564
- }
6565
- this.effects = this.effects || (0, _effectsState.default)('BNR');
6566
- var LOG_HEADER = 'Meeting:index#disableBNR -->';
6567
- return logRequest(this.effects.handleClientRequest(false, this).then(function (res) {
6568
- _loggerProxy.default.logger.info('Meeting:index#disableBNR. Disable bnr completed');
6569
- return res;
6570
- }).catch(function (error) {
6571
- throw error;
6572
- }), {
6573
- header: "".concat(LOG_HEADER, " disable bnr"),
6574
- success: "".concat(LOG_HEADER, " disable bnr success"),
6575
- failure: "".concat(LOG_HEADER, " disable bnr failure, ")
6576
- });
6577
- }
6578
-
6579
- /**
6580
- * starts keepAlives being sent
6581
- * @returns {void}
6582
- * @private
6583
- * @memberof Meeting
6584
- */
6585
6465
  }, {
6586
6466
  key: "sendReaction",
6587
6467
  value:
@@ -6647,8 +6527,8 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6647
6527
  }, {
6648
6528
  key: "checkMediaConnection",
6649
6529
  value: function checkMediaConnection() {
6650
- var _this$mediaProperties5;
6651
- if ((_this$mediaProperties5 = this.mediaProperties) !== null && _this$mediaProperties5 !== void 0 && _this$mediaProperties5.webrtcMediaConnection) {
6530
+ var _this$mediaProperties7;
6531
+ if ((_this$mediaProperties7 = this.mediaProperties) !== null && _this$mediaProperties7 !== void 0 && _this$mediaProperties7.webrtcMediaConnection) {
6652
6532
  return;
6653
6533
  }
6654
6534
  throw new Error('Webrtc media connection is missing, call addMedia() first');
@@ -6663,27 +6543,27 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6663
6543
  }, {
6664
6544
  key: "publishTracks",
6665
6545
  value: function () {
6666
- var _publishTracks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(tracks) {
6546
+ var _publishTracks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(tracks) {
6667
6547
  var _tracks$screenShare;
6668
- return _regenerator.default.wrap(function _callee13$(_context13) {
6669
- while (1) switch (_context13.prev = _context13.next) {
6548
+ return _regenerator.default.wrap(function _callee12$(_context12) {
6549
+ while (1) switch (_context12.prev = _context12.next) {
6670
6550
  case 0:
6671
6551
  this.checkMediaConnection();
6672
6552
  if (!((_tracks$screenShare = tracks.screenShare) !== null && _tracks$screenShare !== void 0 && _tracks$screenShare.video)) {
6673
- _context13.next = 8;
6553
+ _context12.next = 8;
6674
6554
  break;
6675
6555
  }
6676
6556
  // we are starting a screen share
6677
6557
  this.setLocalShareTrack(tracks.screenShare.video);
6678
- _context13.next = 5;
6558
+ _context12.next = 5;
6679
6559
  return this.requestScreenShareFloor();
6680
6560
  case 5:
6681
6561
  this.mediaProperties.mediaDirection.sendShare = true;
6682
- _context13.next = 8;
6683
- return this.mediaProperties.webrtcMediaConnection.publishTrack(tracks.screenShare.video, 'slides');
6562
+ _context12.next = 8;
6563
+ return this.mediaProperties.webrtcMediaConnection.publishTrack(this.mediaProperties.shareTrack);
6684
6564
  case 8:
6685
6565
  if (!tracks.microphone) {
6686
- _context13.next = 14;
6566
+ _context12.next = 14;
6687
6567
  break;
6688
6568
  }
6689
6569
  this.setLocalAudioTrack(tracks.microphone);
@@ -6691,11 +6571,11 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6691
6571
 
6692
6572
  // audio mute state could be undefined if you have not sent audio before
6693
6573
  this.audio = this.audio || (0, _muteState.createMuteState)(_constants.AUDIO, this, this.mediaProperties.mediaDirection);
6694
- _context13.next = 14;
6695
- return this.mediaProperties.webrtcMediaConnection.publishTrack(tracks.microphone, 'main');
6574
+ _context12.next = 14;
6575
+ return this.mediaProperties.webrtcMediaConnection.publishTrack(this.mediaProperties.audioTrack);
6696
6576
  case 14:
6697
6577
  if (!tracks.camera) {
6698
- _context13.next = 20;
6578
+ _context12.next = 20;
6699
6579
  break;
6700
6580
  }
6701
6581
  this.setLocalVideoTrack(tracks.camera);
@@ -6703,15 +6583,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6703
6583
 
6704
6584
  // video state could be undefined if you have not sent video before
6705
6585
  this.video = this.video || (0, _muteState.createMuteState)(_constants.VIDEO, this, this.mediaProperties.mediaDirection);
6706
- _context13.next = 20;
6707
- return this.mediaProperties.webrtcMediaConnection.publishTrack(tracks.camera, 'main');
6586
+ _context12.next = 20;
6587
+ return this.mediaProperties.webrtcMediaConnection.publishTrack(this.mediaProperties.videoTrack);
6708
6588
  case 20:
6709
6589
  case "end":
6710
- return _context13.stop();
6590
+ return _context12.stop();
6711
6591
  }
6712
- }, _callee13, this);
6592
+ }, _callee12, this);
6713
6593
  }));
6714
- function publishTracks(_x8) {
6594
+ function publishTracks(_x7) {
6715
6595
  return _publishTracks.apply(this, arguments);
6716
6596
  }
6717
6597
  return publishTracks;
@@ -6725,10 +6605,10 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6725
6605
  }, {
6726
6606
  key: "unpublishTracks",
6727
6607
  value: function () {
6728
- var _unpublishTracks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(tracks) {
6729
- var unpublishPromises, _iterator, _step, track;
6730
- return _regenerator.default.wrap(function _callee14$(_context14) {
6731
- while (1) switch (_context14.prev = _context14.next) {
6608
+ var _unpublishTracks = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(tracks) {
6609
+ var unpublishPromises, _iterator, _step, _this$mediaProperties8, _this$mediaProperties9, _this$mediaProperties10, track, localTrackToUnpublish, _localTrackToUnpublish, _localTrackToUnpublish2;
6610
+ return _regenerator.default.wrap(function _callee13$(_context13) {
6611
+ while (1) switch (_context13.prev = _context13.next) {
6732
6612
  case 0:
6733
6613
  this.checkMediaConnection();
6734
6614
  unpublishPromises = [];
@@ -6736,21 +6616,29 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6736
6616
  try {
6737
6617
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
6738
6618
  track = _step.value;
6739
- if (track === this.mediaProperties.shareTrack) {
6619
+ // @ts-ignore originalTrack is private - this will be fixed in SPARK-399694
6620
+ if (track === ((_this$mediaProperties8 = this.mediaProperties.shareTrack) === null || _this$mediaProperties8 === void 0 ? void 0 : _this$mediaProperties8.originalTrack)) {
6621
+ localTrackToUnpublish = this.mediaProperties.shareTrack;
6740
6622
  this.setLocalShareTrack(null);
6741
6623
  this.releaseScreenShareFloor(); // we ignore the returned promise here on purpose
6742
6624
  this.mediaProperties.mediaDirection.sendShare = false;
6743
- unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(track, 'slides'));
6625
+ unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(localTrackToUnpublish));
6744
6626
  }
6745
- if (track === this.mediaProperties.audioTrack) {
6627
+
6628
+ // @ts-ignore originalTrack is private - this will be fixed in SPARK-399694
6629
+ if (track === ((_this$mediaProperties9 = this.mediaProperties.audioTrack) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.originalTrack)) {
6630
+ _localTrackToUnpublish = this.mediaProperties.audioTrack;
6746
6631
  this.setLocalAudioTrack(null);
6747
6632
  this.mediaProperties.mediaDirection.sendAudio = false;
6748
- unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(track, 'main'));
6633
+ unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(_localTrackToUnpublish));
6749
6634
  }
6750
- if (track === this.mediaProperties.videoTrack) {
6635
+
6636
+ // @ts-ignore originalTrack is private - this will be fixed in SPARK-399694
6637
+ if (track === ((_this$mediaProperties10 = this.mediaProperties.videoTrack) === null || _this$mediaProperties10 === void 0 ? void 0 : _this$mediaProperties10.originalTrack)) {
6638
+ _localTrackToUnpublish2 = this.mediaProperties.videoTrack;
6751
6639
  this.setLocalVideoTrack(null);
6752
6640
  this.mediaProperties.mediaDirection.sendVideo = false;
6753
- unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(track, 'main'));
6641
+ unpublishPromises.push(this.mediaProperties.webrtcMediaConnection.unpublishTrack(_localTrackToUnpublish2));
6754
6642
  }
6755
6643
  }
6756
6644
  } catch (err) {
@@ -6758,15 +6646,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6758
6646
  } finally {
6759
6647
  _iterator.f();
6760
6648
  }
6761
- _context14.next = 6;
6649
+ _context13.next = 6;
6762
6650
  return _promise.default.all(unpublishPromises);
6763
6651
  case 6:
6764
6652
  case "end":
6765
- return _context14.stop();
6653
+ return _context13.stop();
6766
6654
  }
6767
- }, _callee14, this);
6655
+ }, _callee13, this);
6768
6656
  }));
6769
- function unpublishTracks(_x9) {
6657
+ function unpublishTracks(_x8) {
6770
6658
  return _unpublishTracks.apply(this, arguments);
6771
6659
  }
6772
6660
  return unpublishTracks;