@webex/plugin-meetings 2.12.0 → 2.14.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.
- package/dist/constants.js +9 -2
- package/dist/constants.js.map +1 -1
- package/dist/meeting/effectsState.js +328 -0
- package/dist/meeting/effectsState.js.map +1 -0
- package/dist/meeting/index.js +190 -172
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +3 -1
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/package.json +7 -7
- package/src/constants.js +7 -0
- package/src/meeting/effectsState.js +206 -0
- package/src/meeting/index.js +98 -71
- package/src/meeting-info/meeting-info-v2.js +3 -1
- package/test/unit/spec/meeting/effectsState.js +292 -0
- package/test/unit/spec/meeting/index.js +54 -142
- package/test/unit/spec/meeting-info/meetinginfov2.js +21 -5
package/dist/meeting/index.js
CHANGED
|
@@ -86,6 +86,8 @@ var _state = _interopRequireDefault(require("../meeting/state"));
|
|
|
86
86
|
|
|
87
87
|
var _muteState = _interopRequireDefault(require("../meeting/muteState"));
|
|
88
88
|
|
|
89
|
+
var _effectsState = _interopRequireDefault(require("../meeting/effectsState"));
|
|
90
|
+
|
|
89
91
|
var _locusInfo = _interopRequireDefault(require("../locus-info"));
|
|
90
92
|
|
|
91
93
|
var _peerConnectionManager = _interopRequireDefault(require("../peer-connection-manager"));
|
|
@@ -780,6 +782,15 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
780
782
|
*/
|
|
781
783
|
|
|
782
784
|
_this.video = null;
|
|
785
|
+
/**
|
|
786
|
+
* created later
|
|
787
|
+
* @instance
|
|
788
|
+
* @type {EffectsState}
|
|
789
|
+
* @private
|
|
790
|
+
* @memberof Meeting
|
|
791
|
+
*/
|
|
792
|
+
|
|
793
|
+
_this.effects = null;
|
|
783
794
|
/**
|
|
784
795
|
* @instance
|
|
785
796
|
* @type {MeetingStateMachine}
|
|
@@ -4812,61 +4823,103 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
4812
4823
|
|
|
4813
4824
|
}, {
|
|
4814
4825
|
key: "updateAudio",
|
|
4815
|
-
value: function
|
|
4816
|
-
var
|
|
4826
|
+
value: function () {
|
|
4827
|
+
var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(options) {
|
|
4828
|
+
var _this42 = this;
|
|
4817
4829
|
|
|
4818
|
-
|
|
4819
|
-
return
|
|
4820
|
-
|
|
4830
|
+
var sendAudio, receiveAudio, stream, bnrEnabled, audioTransceiver, track;
|
|
4831
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
4832
|
+
while (1) {
|
|
4833
|
+
switch (_context4.prev = _context4.next) {
|
|
4834
|
+
case 0:
|
|
4835
|
+
if (this.canUpdateMedia()) {
|
|
4836
|
+
_context4.next = 2;
|
|
4837
|
+
break;
|
|
4838
|
+
}
|
|
4821
4839
|
|
|
4822
|
-
|
|
4823
|
-
receiveAudio = options.receiveAudio,
|
|
4824
|
-
stream = options.stream;
|
|
4825
|
-
var audioTransceiver = this.mediaProperties.peerConnection.audioTransceiver;
|
|
4840
|
+
return _context4.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
|
|
4826
4841
|
|
|
4827
|
-
|
|
4842
|
+
case 2:
|
|
4843
|
+
sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream, bnrEnabled = options.bnrEnabled;
|
|
4844
|
+
audioTransceiver = this.mediaProperties.peerConnection.audioTransceiver;
|
|
4845
|
+
track = _util.default.getTrack(stream).audioTrack;
|
|
4828
4846
|
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4847
|
+
if (!(typeof sendAudio !== 'boolean' || typeof receiveAudio !== 'boolean')) {
|
|
4848
|
+
_context4.next = 7;
|
|
4849
|
+
break;
|
|
4850
|
+
}
|
|
4832
4851
|
|
|
4833
|
-
|
|
4834
|
-
sendAudio: sendAudio,
|
|
4835
|
-
localStream: stream
|
|
4836
|
-
}).then(function () {
|
|
4837
|
-
var previousMediaDirection = {};
|
|
4852
|
+
return _context4.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
|
|
4838
4853
|
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
} else {
|
|
4845
|
-
_this42.mediaProperties.mediaDirection = {};
|
|
4846
|
-
}
|
|
4854
|
+
case 7:
|
|
4855
|
+
if (!(sendAudio && !this.isAudioMuted() && (bnrEnabled === _constants.BNR_STATUS.ENABLED || bnrEnabled === _constants.BNR_STATUS.SHOULD_ENABLE))) {
|
|
4856
|
+
_context4.next = 13;
|
|
4857
|
+
break;
|
|
4858
|
+
}
|
|
4847
4859
|
|
|
4848
|
-
|
|
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);
|
|
4860
|
+
_loggerProxy.default.logger.info('Meeting:index#updateAudio. Calling WebRTC enable bnr method');
|
|
4863
4861
|
|
|
4864
|
-
|
|
4865
|
-
|
|
4862
|
+
_context4.next = 11;
|
|
4863
|
+
return this.internal_enableBNR(track);
|
|
4866
4864
|
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4865
|
+
case 11:
|
|
4866
|
+
track = _context4.sent;
|
|
4867
|
+
|
|
4868
|
+
_loggerProxy.default.logger.info('Meeting:index#updateAudio. WebRTC enable bnr request completed');
|
|
4869
|
+
|
|
4870
|
+
case 13:
|
|
4871
|
+
return _context4.abrupt("return", _util.default.validateOptions({
|
|
4872
|
+
sendAudio: sendAudio,
|
|
4873
|
+
localStream: stream
|
|
4874
|
+
}).then(function () {
|
|
4875
|
+
var previousMediaDirection = {};
|
|
4876
|
+
|
|
4877
|
+
if (_this42.mediaProperties.mediaDirection) {
|
|
4878
|
+
previousMediaDirection = {
|
|
4879
|
+
sendTrack: _this42.mediaProperties.mediaDirection.sendAudio,
|
|
4880
|
+
receiveTrack: _this42.mediaProperties.mediaDirection.receiveAudio
|
|
4881
|
+
};
|
|
4882
|
+
} else {
|
|
4883
|
+
_this42.mediaProperties.mediaDirection = {};
|
|
4884
|
+
}
|
|
4885
|
+
|
|
4886
|
+
return _util.default.updateTransceiver({
|
|
4887
|
+
type: 'audio',
|
|
4888
|
+
sendTrack: options.sendAudio,
|
|
4889
|
+
receiveTrack: options.receiveAudio,
|
|
4890
|
+
track: track,
|
|
4891
|
+
transceiver: audioTransceiver,
|
|
4892
|
+
peerConnection: _this42.mediaProperties.peerConnection,
|
|
4893
|
+
previousMediaDirection: previousMediaDirection
|
|
4894
|
+
}, {
|
|
4895
|
+
mediaProperties: _this42.mediaProperties,
|
|
4896
|
+
meeting: _this42,
|
|
4897
|
+
id: _this42.id
|
|
4898
|
+
});
|
|
4899
|
+
}).then(function () {
|
|
4900
|
+
_this42.setLocalAudioTrack(track);
|
|
4901
|
+
|
|
4902
|
+
_this42.mediaProperties.mediaDirection.sendAudio = sendAudio;
|
|
4903
|
+
_this42.mediaProperties.mediaDirection.receiveAudio = receiveAudio; // audio state could be undefined if you have not sent audio before
|
|
4904
|
+
|
|
4905
|
+
// audio state could be undefined if you have not sent audio before
|
|
4906
|
+
_this42.audio = _this42.audio || (0, _muteState.default)(_constants.AUDIO, _this42, _this42.mediaProperties.mediaDirection);
|
|
4907
|
+
}));
|
|
4908
|
+
|
|
4909
|
+
case 14:
|
|
4910
|
+
case "end":
|
|
4911
|
+
return _context4.stop();
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
}, _callee4, this);
|
|
4915
|
+
}));
|
|
4916
|
+
|
|
4917
|
+
function updateAudio(_x3) {
|
|
4918
|
+
return _updateAudio.apply(this, arguments);
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4921
|
+
return updateAudio;
|
|
4922
|
+
}()
|
|
4870
4923
|
/**
|
|
4871
4924
|
* Update the main video track with new parameters
|
|
4872
4925
|
* @param {Object} options
|
|
@@ -6162,169 +6215,134 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
6162
6215
|
*/
|
|
6163
6216
|
|
|
6164
6217
|
}, {
|
|
6165
|
-
key: "
|
|
6218
|
+
key: "isBnrEnabled",
|
|
6166
6219
|
value:
|
|
6167
6220
|
/**
|
|
6168
|
-
*
|
|
6169
|
-
* @returns {
|
|
6221
|
+
* Internal API to return status of BNR
|
|
6222
|
+
* @returns {Boolean}
|
|
6170
6223
|
* @public
|
|
6171
6224
|
* @memberof Meeting
|
|
6172
6225
|
*/
|
|
6173
|
-
function () {
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6226
|
+
function isBnrEnabled() {
|
|
6227
|
+
return this.effects && this.effects.isBnrEnabled();
|
|
6228
|
+
}
|
|
6229
|
+
/**
|
|
6230
|
+
* Internal API to obtain BNR enabled MediaStream
|
|
6231
|
+
* @returns {Promise<MediaStreamTrack>}
|
|
6232
|
+
* @private
|
|
6233
|
+
* @param {MedaiStreamTrack} audioTrack from updateAudio
|
|
6234
|
+
* @memberof Meeting
|
|
6235
|
+
*/
|
|
6236
|
+
|
|
6237
|
+
}, {
|
|
6238
|
+
key: "internal_enableBNR",
|
|
6239
|
+
value: function () {
|
|
6240
|
+
var _internal_enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(audioTrack) {
|
|
6241
|
+
var bnrAudioTrack;
|
|
6242
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
6177
6243
|
while (1) {
|
|
6178
|
-
switch (
|
|
6244
|
+
switch (_context5.prev = _context5.next) {
|
|
6179
6245
|
case 0:
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
isSuccess = false;
|
|
6183
|
-
_context4.prev = 2;
|
|
6246
|
+
_context5.prev = 0;
|
|
6184
6247
|
|
|
6185
|
-
|
|
6186
|
-
_context4.next = 5;
|
|
6187
|
-
break;
|
|
6188
|
-
}
|
|
6189
|
-
|
|
6190
|
-
throw new Error("Meeting doesn't have an audioTrack attached");
|
|
6191
|
-
|
|
6192
|
-
case 5:
|
|
6193
|
-
_context4.next = 7;
|
|
6194
|
-
return _internalMediaCore.Media.Effects.BNR.enableBNR(this.mediaProperties.audioTrack);
|
|
6195
|
-
|
|
6196
|
-
case 7:
|
|
6197
|
-
this.mediaProperties.audioTrack = _context4.sent;
|
|
6198
|
-
audioStream = _util2.default.createMediaStream([this.mediaProperties.audioTrack]);
|
|
6199
|
-
|
|
6200
|
-
_loggerProxy.default.logger.info('Meeting:index#enableBNR. BNR enabled track obtained from WebRTC & sent to updateAudio');
|
|
6201
|
-
|
|
6202
|
-
_context4.next = 12;
|
|
6203
|
-
return this.updateAudio({
|
|
6204
|
-
sendAudio: true,
|
|
6205
|
-
receiveAudio: true,
|
|
6206
|
-
stream: audioStream
|
|
6207
|
-
});
|
|
6208
|
-
|
|
6209
|
-
case 12:
|
|
6210
|
-
this.isBnrEnabled = true;
|
|
6211
|
-
isSuccess = true;
|
|
6248
|
+
_loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. Internal enable BNR called');
|
|
6212
6249
|
|
|
6213
|
-
|
|
6250
|
+
_context5.next = 4;
|
|
6251
|
+
return _internalMediaCore.Media.Effects.BNR.enableBNR(audioTrack);
|
|
6214
6252
|
|
|
6215
|
-
|
|
6216
|
-
|
|
6253
|
+
case 4:
|
|
6254
|
+
bnrAudioTrack = _context5.sent;
|
|
6217
6255
|
|
|
6218
|
-
|
|
6219
|
-
_context4.prev = 17;
|
|
6220
|
-
_context4.t0 = _context4["catch"](2);
|
|
6256
|
+
_loggerProxy.default.logger.info('Meeting:index#internal_enableBNR. BNR enabled track obtained from WebRTC & returned as stream');
|
|
6221
6257
|
|
|
6222
|
-
|
|
6258
|
+
return _context5.abrupt("return", bnrAudioTrack);
|
|
6223
6259
|
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
});
|
|
6260
|
+
case 9:
|
|
6261
|
+
_context5.prev = 9;
|
|
6262
|
+
_context5.t0 = _context5["catch"](0);
|
|
6228
6263
|
|
|
6229
|
-
|
|
6264
|
+
_loggerProxy.default.logger.error('Meeting:index#internal_enableBNR.', _context5.t0);
|
|
6230
6265
|
|
|
6231
|
-
|
|
6232
|
-
return _context4.abrupt("return", isSuccess);
|
|
6266
|
+
throw _context5.t0;
|
|
6233
6267
|
|
|
6234
|
-
case
|
|
6268
|
+
case 13:
|
|
6235
6269
|
case "end":
|
|
6236
|
-
return
|
|
6270
|
+
return _context5.stop();
|
|
6237
6271
|
}
|
|
6238
6272
|
}
|
|
6239
|
-
},
|
|
6273
|
+
}, _callee5, null, [[0, 9]]);
|
|
6240
6274
|
}));
|
|
6241
6275
|
|
|
6242
|
-
function
|
|
6243
|
-
return
|
|
6276
|
+
function internal_enableBNR(_x4) {
|
|
6277
|
+
return _internal_enableBNR.apply(this, arguments);
|
|
6244
6278
|
}
|
|
6245
6279
|
|
|
6246
|
-
return
|
|
6280
|
+
return internal_enableBNR;
|
|
6247
6281
|
}()
|
|
6248
6282
|
/**
|
|
6249
|
-
*
|
|
6250
|
-
* @returns {Promise
|
|
6283
|
+
* Enable the audio track with BNR for a meeting
|
|
6284
|
+
* @returns {Promise} resolves the data from enable bnr or rejects if there is no audio or audio is muted
|
|
6251
6285
|
* @public
|
|
6252
6286
|
* @memberof Meeting
|
|
6253
6287
|
*/
|
|
6254
6288
|
|
|
6255
6289
|
}, {
|
|
6256
|
-
key: "
|
|
6257
|
-
value: function () {
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
while (1) {
|
|
6262
|
-
switch (_context5.prev = _context5.next) {
|
|
6263
|
-
case 0:
|
|
6264
|
-
_loggerProxy.default.logger.info('Meeting:index#disableBNR. Disable BNR called');
|
|
6265
|
-
|
|
6266
|
-
isSuccess = false;
|
|
6267
|
-
_context5.prev = 2;
|
|
6268
|
-
|
|
6269
|
-
if (!(typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined')) {
|
|
6270
|
-
_context5.next = 5;
|
|
6271
|
-
break;
|
|
6272
|
-
}
|
|
6273
|
-
|
|
6274
|
-
throw new Error("Meeting doesn't have an audioTrack attached");
|
|
6275
|
-
|
|
6276
|
-
case 5:
|
|
6277
|
-
this.mediaProperties.audioTrack = _internalMediaCore.Media.Effects.BNR.disableBNR(this.mediaProperties.audioTrack);
|
|
6278
|
-
audioStream = _util2.default.createMediaStream([this.mediaProperties.audioTrack]);
|
|
6279
|
-
|
|
6280
|
-
_loggerProxy.default.logger.info('Meeting:index#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');
|
|
6281
|
-
|
|
6282
|
-
_context5.next = 10;
|
|
6283
|
-
return this.updateAudio({
|
|
6284
|
-
sendAudio: true,
|
|
6285
|
-
receiveAudio: true,
|
|
6286
|
-
stream: audioStream
|
|
6287
|
-
});
|
|
6288
|
-
|
|
6289
|
-
case 10:
|
|
6290
|
-
this.isBnrEnabled = false;
|
|
6291
|
-
isSuccess = true;
|
|
6292
|
-
|
|
6293
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.DISABLE_BNR_SUCCESS);
|
|
6294
|
-
|
|
6295
|
-
_context5.next = 20;
|
|
6296
|
-
break;
|
|
6297
|
-
|
|
6298
|
-
case 15:
|
|
6299
|
-
_context5.prev = 15;
|
|
6300
|
-
_context5.t0 = _context5["catch"](2);
|
|
6301
|
-
|
|
6302
|
-
_loggerProxy.default.logger.error("Meeting:index#disableBNR. ".concat(_context5.t0));
|
|
6290
|
+
key: "enableBNR",
|
|
6291
|
+
value: function enableBNR() {
|
|
6292
|
+
if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
|
|
6293
|
+
return _promise.default.reject(new Error("Meeting doesn't have an audioTrack attached"));
|
|
6294
|
+
}
|
|
6303
6295
|
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
});
|
|
6296
|
+
if (this.isAudioMuted()) {
|
|
6297
|
+
return _promise.default.reject(new Error('Cannot enable BNR while meeting is muted'));
|
|
6298
|
+
}
|
|
6308
6299
|
|
|
6309
|
-
|
|
6300
|
+
this.effects = this.effects || (0, _effectsState.default)('BNR');
|
|
6301
|
+
var LOG_HEADER = 'Meeting:index#enableBNR -->';
|
|
6302
|
+
return logRequest(this.effects.handleClientRequest(true, this).then(function (res) {
|
|
6303
|
+
_loggerProxy.default.logger.info('Meeting:index#enableBNR. Enable bnr completed');
|
|
6310
6304
|
|
|
6311
|
-
|
|
6312
|
-
|
|
6305
|
+
return res;
|
|
6306
|
+
}).catch(function (error) {
|
|
6307
|
+
throw error;
|
|
6308
|
+
}), {
|
|
6309
|
+
header: "".concat(LOG_HEADER, " enable bnr"),
|
|
6310
|
+
success: "".concat(LOG_HEADER, " enable bnr success"),
|
|
6311
|
+
failure: "".concat(LOG_HEADER, " enable bnr failure, ")
|
|
6312
|
+
});
|
|
6313
|
+
}
|
|
6314
|
+
/**
|
|
6315
|
+
* Disable the BNR for an audio track
|
|
6316
|
+
* @returns {Promise} resolves the data from disable bnr or rejects if there is no audio set
|
|
6317
|
+
* @public
|
|
6318
|
+
* @memberof Meeting
|
|
6319
|
+
*/
|
|
6313
6320
|
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
}));
|
|
6321
|
+
}, {
|
|
6322
|
+
key: "disableBNR",
|
|
6323
|
+
value: function disableBNR() {
|
|
6324
|
+
if (typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined') {
|
|
6325
|
+
return _promise.default.reject(new Error("Meeting doesn't have an audioTrack attached"));
|
|
6326
|
+
}
|
|
6321
6327
|
|
|
6322
|
-
|
|
6323
|
-
return
|
|
6328
|
+
if (!this.isBnrEnabled()) {
|
|
6329
|
+
return _promise.default.reject(new Error('Can not disable as BNR is not enabled'));
|
|
6324
6330
|
}
|
|
6325
6331
|
|
|
6326
|
-
|
|
6327
|
-
|
|
6332
|
+
this.effects = this.effects || (0, _effectsState.default)('BNR');
|
|
6333
|
+
var LOG_HEADER = 'Meeting:index#disableBNR -->';
|
|
6334
|
+
return logRequest(this.effects.handleClientRequest(false, this).then(function (res) {
|
|
6335
|
+
_loggerProxy.default.logger.info('Meeting:index#disableBNR. Disable bnr completed');
|
|
6336
|
+
|
|
6337
|
+
return res;
|
|
6338
|
+
}).catch(function (error) {
|
|
6339
|
+
throw error;
|
|
6340
|
+
}), {
|
|
6341
|
+
header: "".concat(LOG_HEADER, " disable bnr"),
|
|
6342
|
+
success: "".concat(LOG_HEADER, " disable bnr success"),
|
|
6343
|
+
failure: "".concat(LOG_HEADER, " disable bnr failure, ")
|
|
6344
|
+
});
|
|
6345
|
+
}
|
|
6328
6346
|
}]);
|
|
6329
6347
|
return Meeting;
|
|
6330
6348
|
}(_webexCore.StatelessWebexPlugin);
|