@webex/plugin-meetings 2.12.1 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1203,6 +1203,14 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
1203
1203
  */
1204
1204
 
1205
1205
  _this.meetingInfoFailureReason = undefined;
1206
+ /**
1207
+ * Indicates the current status of BNR in the meeting
1208
+ * @type {BNR_STATUS}
1209
+ * @private
1210
+ * @memberof Meeting
1211
+ */
1212
+
1213
+ _this.bnrStatus = _constants.BNR_STATUS.NOT_ENABLED;
1206
1214
 
1207
1215
  _this.setUpLocusInfoListeners();
1208
1216
 
@@ -4812,61 +4820,100 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
4812
4820
 
4813
4821
  }, {
4814
4822
  key: "updateAudio",
4815
- value: function updateAudio(options) {
4816
- var _this42 = this;
4823
+ value: function () {
4824
+ var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(options) {
4825
+ var _this42 = this;
4817
4826
 
4818
- if (!this.canUpdateMedia()) {
4819
- return this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options);
4820
- }
4827
+ var sendAudio, receiveAudio, stream, audioTransceiver, track;
4828
+ return _regenerator.default.wrap(function _callee4$(_context4) {
4829
+ while (1) {
4830
+ switch (_context4.prev = _context4.next) {
4831
+ case 0:
4832
+ if (this.canUpdateMedia()) {
4833
+ _context4.next = 2;
4834
+ break;
4835
+ }
4821
4836
 
4822
- var sendAudio = options.sendAudio,
4823
- receiveAudio = options.receiveAudio,
4824
- stream = options.stream;
4825
- var audioTransceiver = this.mediaProperties.peerConnection.audioTransceiver;
4837
+ return _context4.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
4826
4838
 
4827
- var track = _util.default.getTrack(stream).audioTrack;
4839
+ case 2:
4840
+ sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream;
4841
+ audioTransceiver = this.mediaProperties.peerConnection.audioTransceiver;
4842
+ track = _util.default.getTrack(stream).audioTrack;
4828
4843
 
4829
- if (typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean') {
4830
- return _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter'));
4831
- }
4844
+ if (!(typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean')) {
4845
+ _context4.next = 7;
4846
+ break;
4847
+ }
4832
4848
 
4833
- return _util.default.validateOptions({
4834
- sendAudio: sendAudio,
4835
- localStream: stream
4836
- }).then(function () {
4837
- var previousMediaDirection = {};
4849
+ return _context4.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
4838
4850
 
4839
- if (_this42.mediaProperties.mediaDirection) {
4840
- previousMediaDirection = {
4841
- sendTrack: _this42.mediaProperties.mediaDirection.sendAudio,
4842
- receiveTrack: _this42.mediaProperties.mediaDirection.receiveAudio
4843
- };
4844
- } else {
4845
- _this42.mediaProperties.mediaDirection = {};
4846
- }
4851
+ case 7:
4852
+ if (!(sendAudio && !this.isAudioMuted() && (this.bnrStatus === _constants.BNR_STATUS.ENABLED || this.bnrStatus === _constants.BNR_STATUS.SHOULD_ENABLE))) {
4853
+ _context4.next = 12;
4854
+ break;
4855
+ }
4847
4856
 
4848
- return _util.default.updateTransceiver({
4849
- type: 'audio',
4850
- sendTrack: options.sendAudio,
4851
- receiveTrack: options.receiveAudio,
4852
- track: track,
4853
- transceiver: audioTransceiver,
4854
- peerConnection: _this42.mediaProperties.peerConnection,
4855
- previousMediaDirection: previousMediaDirection
4856
- }, {
4857
- mediaProperties: _this42.mediaProperties,
4858
- meeting: _this42,
4859
- id: _this42.id
4860
- });
4861
- }).then(function () {
4862
- _this42.setLocalAudioTrack(track);
4857
+ _context4.next = 10;
4858
+ return this.internal_enableBNR(track);
4863
4859
 
4864
- _this42.mediaProperties.mediaDirection.sendAudio = sendAudio;
4865
- _this42.mediaProperties.mediaDirection.receiveAudio = receiveAudio; // audio state could be undefined if you have not sent audio before
4860
+ case 10:
4861
+ track = _context4.sent;
4862
+ this.bnrStatus = _constants.BNR_STATUS.ENABLED;
4866
4863
 
4867
- _this42.audio = _this42.audio || (0, _muteState.default)(_constants.AUDIO, _this42, _this42.mediaProperties.mediaDirection);
4868
- });
4869
- }
4864
+ case 12:
4865
+ return _context4.abrupt("return", _util.default.validateOptions({
4866
+ sendAudio: sendAudio,
4867
+ localStream: stream
4868
+ }).then(function () {
4869
+ var previousMediaDirection = {};
4870
+
4871
+ if (_this42.mediaProperties.mediaDirection) {
4872
+ previousMediaDirection = {
4873
+ sendTrack: _this42.mediaProperties.mediaDirection.sendAudio,
4874
+ receiveTrack: _this42.mediaProperties.mediaDirection.receiveAudio
4875
+ };
4876
+ } else {
4877
+ _this42.mediaProperties.mediaDirection = {};
4878
+ }
4879
+
4880
+ return _util.default.updateTransceiver({
4881
+ type: 'audio',
4882
+ sendTrack: options.sendAudio,
4883
+ receiveTrack: options.receiveAudio,
4884
+ track: track,
4885
+ transceiver: audioTransceiver,
4886
+ peerConnection: _this42.mediaProperties.peerConnection,
4887
+ previousMediaDirection: previousMediaDirection
4888
+ }, {
4889
+ mediaProperties: _this42.mediaProperties,
4890
+ meeting: _this42,
4891
+ id: _this42.id
4892
+ });
4893
+ }).then(function () {
4894
+ _this42.setLocalAudioTrack(track);
4895
+
4896
+ _this42.mediaProperties.mediaDirection.sendAudio = sendAudio;
4897
+ _this42.mediaProperties.mediaDirection.receiveAudio = receiveAudio; // audio state could be undefined if you have not sent audio before
4898
+
4899
+ // audio state could be undefined if you have not sent audio before
4900
+ _this42.audio = _this42.audio || (0, _muteState.default)(_constants.AUDIO, _this42, _this42.mediaProperties.mediaDirection);
4901
+ }));
4902
+
4903
+ case 13:
4904
+ case "end":
4905
+ return _context4.stop();
4906
+ }
4907
+ }
4908
+ }, _callee4, this);
4909
+ }));
4910
+
4911
+ function updateAudio(_x3) {
4912
+ return _updateAudio.apply(this, arguments);
4913
+ }
4914
+
4915
+ return updateAudio;
4916
+ }()
4870
4917
  /**
4871
4918
  * Update the main video track with new parameters
4872
4919
  * @param {Object} options
@@ -6162,81 +6209,151 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6162
6209
  */
6163
6210
 
6164
6211
  }, {
6165
- key: "enableBNR",
6212
+ key: "isBnrEnabled",
6166
6213
  value:
6214
+ /**
6215
+ * Internal API to return status of BNR
6216
+ * @returns {Boolean}
6217
+ * @public
6218
+ * @memberof Meeting
6219
+ */
6220
+ function isBnrEnabled() {
6221
+ return this.bnrStatus === _constants.BNR_STATUS.ENABLED;
6222
+ }
6223
+ /**
6224
+ * Internal API to obtain BNR enabled MediaStream
6225
+ * @returns {Promise<MediaStreamTrack>}
6226
+ * @private
6227
+ * @param {MedaiStreamTrack} audioTrack from updateAudio
6228
+ * @memberof Meeting
6229
+ */
6230
+
6231
+ }, {
6232
+ key: "internal_enableBNR",
6233
+ value: function () {
6234
+ var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(audioTrack) {
6235
+ var bnrAudioTrack;
6236
+ return _regenerator.default.wrap(function _callee5$(_context5) {
6237
+ while (1) {
6238
+ switch (_context5.prev = _context5.next) {
6239
+ case 0:
6240
+ _context5.prev = 0;
6241
+
6242
+ _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. Internal enable BNR called');
6243
+
6244
+ _context5.next = 4;
6245
+ return _internalMediaCore.Media.Effects.BNR.enableBNR(audioTrack);
6246
+
6247
+ case 4:
6248
+ bnrAudioTrack = _context5.sent;
6249
+
6250
+ _loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. BNR enabled track obtained from WebRTC & returned as stream');
6251
+
6252
+ return _context5.abrupt("return", bnrAudioTrack);
6253
+
6254
+ case 9:
6255
+ _context5.prev = 9;
6256
+ _context5.t0 = _context5["catch"](0);
6257
+
6258
+ _loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context5.t0);
6259
+
6260
+ throw _context5.t0;
6261
+
6262
+ case 13:
6263
+ case "end":
6264
+ return _context5.stop();
6265
+ }
6266
+ }
6267
+ }, _callee5, null, [[0, 9]]);
6268
+ }));
6269
+
6270
+ function internal_enableBNR(_x4) {
6271
+ return _internal_enableBNR.apply(this, arguments);
6272
+ }
6273
+
6274
+ return internal_enableBNR;
6275
+ }()
6167
6276
  /**
6168
6277
  * enableBNR API
6169
6278
  * @returns {Promise<Boolean>}
6170
6279
  * @public
6171
6280
  * @memberof Meeting
6172
6281
  */
6173
- function () {
6174
- var _enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
6282
+
6283
+ }, {
6284
+ key: "enableBNR",
6285
+ value: function () {
6286
+ var _enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
6175
6287
  var isSuccess, audioStream;
6176
- return _regenerator.default.wrap(function _callee4$(_context4) {
6288
+ return _regenerator.default.wrap(function _callee6$(_context6) {
6177
6289
  while (1) {
6178
- switch (_context4.prev = _context4.next) {
6290
+ switch (_context6.prev = _context6.next) {
6179
6291
  case 0:
6180
6292
  _loggerProxy.default.logger.info('Meeting:index#enableBNR. Enable BNR called');
6181
6293
 
6182
6294
  isSuccess = false;
6183
- _context4.prev = 2;
6295
+ _context6.prev = 2;
6184
6296
 
6185
6297
  if (!(typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined')) {
6186
- _context4.next = 5;
6298
+ _context6.next = 7;
6187
6299
  break;
6188
6300
  }
6189
6301
 
6190
6302
  throw new Error("Meeting doesn't have an audioTrack attached");
6191
6303
 
6192
- case 5:
6193
- _context4.next = 7;
6194
- return _internalMediaCore.Media.Effects.BNR.enableBNR(this.mediaProperties.audioTrack);
6195
-
6196
6304
  case 7:
6197
- this.mediaProperties.audioTrack = _context4.sent;
6305
+ if (!this.isAudioMuted()) {
6306
+ _context6.next = 9;
6307
+ break;
6308
+ }
6309
+
6310
+ throw new Error('Cannot enable BNR while meeting is muted');
6311
+
6312
+ case 9:
6313
+ this.bnrStatus = _constants.BNR_STATUS.SHOULD_ENABLE;
6198
6314
  audioStream = _util2.default.createMediaStream([this.mediaProperties.audioTrack]);
6199
6315
 
6200
- _loggerProxy.default.logger.info('Meeting:index#enableBNR. BNR enabled track obtained from WebRTC & sent to updateAudio');
6316
+ _loggerProxy.default.logger.info('Meeting:index#enableBNR. MediaStream created from meeting & sent to updateAudio');
6201
6317
 
6202
- _context4.next = 12;
6318
+ _context6.next = 14;
6203
6319
  return this.updateAudio({
6204
6320
  sendAudio: true,
6205
- receiveAudio: true,
6321
+ receiveAudio: this.mediaProperties.mediaDirection.receiveAudio,
6206
6322
  stream: audioStream
6207
6323
  });
6208
6324
 
6209
- case 12:
6210
- this.isBnrEnabled = true;
6325
+ case 14:
6326
+ this.bnrStatus = _constants.BNR_STATUS.ENABLED;
6211
6327
  isSuccess = true;
6212
6328
 
6213
6329
  _metrics.default.sendBehavioralMetric(_constants2.default.ENABLE_BNR_SUCCESS);
6214
6330
 
6215
- _context4.next = 22;
6331
+ _context6.next = 25;
6216
6332
  break;
6217
6333
 
6218
- case 17:
6219
- _context4.prev = 17;
6220
- _context4.t0 = _context4["catch"](2);
6221
-
6222
- _loggerProxy.default.logger.error("Meeting:index#enableBNR. ".concat(_context4.t0));
6334
+ case 19:
6335
+ _context6.prev = 19;
6336
+ _context6.t0 = _context6["catch"](2);
6337
+ this.bnrStatus = _constants.BNR_STATUS.NOT_ENABLED;
6223
6338
 
6224
6339
  _metrics.default.sendBehavioralMetric(_constants2.default.ENABLE_BNR_FAILURE, {
6225
- reason: _context4.t0.message,
6226
- stack: _context4.t0.stack
6340
+ reason: _context6.t0.message,
6341
+ stack: _context6.t0.stack
6227
6342
  });
6228
6343
 
6229
- throw _context4.t0;
6344
+ _loggerProxy.default.logger.error('Meeting:index#enableBNR.', _context6.t0);
6230
6345
 
6231
- case 22:
6232
- return _context4.abrupt("return", isSuccess);
6346
+ throw _context6.t0;
6233
6347
 
6234
- case 23:
6348
+ case 25:
6349
+ return _context6.abrupt("return", isSuccess);
6350
+
6351
+ case 26:
6235
6352
  case "end":
6236
- return _context4.stop();
6353
+ return _context6.stop();
6237
6354
  }
6238
6355
  }
6239
- }, _callee4, this, [[2, 17]]);
6356
+ }, _callee6, this, [[2, 19]]);
6240
6357
  }));
6241
6358
 
6242
6359
  function enableBNR() {
@@ -6255,68 +6372,78 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
6255
6372
  }, {
6256
6373
  key: "disableBNR",
6257
6374
  value: function () {
6258
- var _disableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
6259
- var isSuccess, audioStream;
6260
- return _regenerator.default.wrap(function _callee5$(_context5) {
6375
+ var _disableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
6376
+ var isSuccess, audioTrack, audioStream;
6377
+ return _regenerator.default.wrap(function _callee7$(_context7) {
6261
6378
  while (1) {
6262
- switch (_context5.prev = _context5.next) {
6379
+ switch (_context7.prev = _context7.next) {
6263
6380
  case 0:
6264
6381
  _loggerProxy.default.logger.info('Meeting:index#disableBNR. Disable BNR called');
6265
6382
 
6266
6383
  isSuccess = false;
6267
- _context5.prev = 2;
6384
+ _context7.prev = 2;
6385
+
6386
+ if (this.isBnrEnabled()) {
6387
+ _context7.next = 7;
6388
+ break;
6389
+ }
6268
6390
 
6391
+ throw new Error('Can not disable as BNR is not enabled');
6392
+
6393
+ case 7:
6269
6394
  if (!(typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined')) {
6270
- _context5.next = 5;
6395
+ _context7.next = 9;
6271
6396
  break;
6272
6397
  }
6273
6398
 
6274
6399
  throw new Error("Meeting doesn't have an audioTrack attached");
6275
6400
 
6276
- case 5:
6277
- this.mediaProperties.audioTrack = _internalMediaCore.Media.Effects.BNR.disableBNR(this.mediaProperties.audioTrack);
6278
- audioStream = _util2.default.createMediaStream([this.mediaProperties.audioTrack]);
6401
+ case 9:
6402
+ audioTrack = _internalMediaCore.Media.Effects.BNR.disableBNR(this.mediaProperties.audioTrack);
6403
+ audioStream = _util2.default.createMediaStream([audioTrack]);
6279
6404
 
6280
6405
  _loggerProxy.default.logger.info('Meeting:index#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');
6281
6406
 
6282
- _context5.next = 10;
6407
+ this.bnrStatus = _constants.BNR_STATUS.SHOULD_DISABLE;
6408
+ _context7.next = 15;
6283
6409
  return this.updateAudio({
6284
6410
  sendAudio: true,
6285
- receiveAudio: true,
6411
+ receiveAudio: this.mediaProperties.mediaDirection.receiveAudio,
6286
6412
  stream: audioStream
6287
6413
  });
6288
6414
 
6289
- case 10:
6290
- this.isBnrEnabled = false;
6415
+ case 15:
6416
+ this.bnrStatus = _constants.BNR_STATUS.NOT_ENABLED;
6291
6417
  isSuccess = true;
6292
6418
 
6293
6419
  _metrics.default.sendBehavioralMetric(_constants2.default.DISABLE_BNR_SUCCESS);
6294
6420
 
6295
- _context5.next = 20;
6421
+ _context7.next = 26;
6296
6422
  break;
6297
6423
 
6298
- case 15:
6299
- _context5.prev = 15;
6300
- _context5.t0 = _context5["catch"](2);
6424
+ case 20:
6425
+ _context7.prev = 20;
6426
+ _context7.t0 = _context7["catch"](2);
6427
+ this.bnrStatus = _constants.BNR_STATUS.ENABLED;
6301
6428
 
6302
- _loggerProxy.default.logger.error("Meeting:index#disableBNR. ".concat(_context5.t0));
6429
+ _loggerProxy.default.logger.error("Meeting:index#disableBNR. ".concat(_context7.t0));
6303
6430
 
6304
6431
  _metrics.default.sendBehavioralMetric(_constants2.default.DISABLE_BNR_FAILURE, {
6305
- reason: _context5.t0.message,
6306
- stack: _context5.t0.stack
6432
+ reason: _context7.t0.message,
6433
+ stack: _context7.t0.stack
6307
6434
  });
6308
6435
 
6309
- throw _context5.t0;
6436
+ throw _context7.t0;
6310
6437
 
6311
- case 20:
6312
- return _context5.abrupt("return", isSuccess);
6438
+ case 26:
6439
+ return _context7.abrupt("return", isSuccess);
6313
6440
 
6314
- case 21:
6441
+ case 27:
6315
6442
  case "end":
6316
- return _context5.stop();
6443
+ return _context7.stop();
6317
6444
  }
6318
6445
  }
6319
- }, _callee5, this, [[2, 15]]);
6446
+ }, _callee7, this, [[2, 20]]);
6320
6447
  }));
6321
6448
 
6322
6449
  function disableBNR() {