@webex/plugin-meetings 2.13.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/meeting/effectsState.js +328 -0
- package/dist/meeting/effectsState.js.map +1 -0
- package/dist/meeting/index.js +68 -177
- package/dist/meeting/index.js.map +1 -1
- package/package.json +6 -6
- package/src/meeting/effectsState.js +206 -0
- package/src/meeting/index.js +64 -97
- package/test/unit/spec/meeting/effectsState.js +292 -0
- package/test/unit/spec/meeting/index.js +30 -176
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.default = void 0;
|
|
12
|
+
|
|
13
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
14
|
+
|
|
15
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
16
|
+
|
|
17
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
18
|
+
|
|
19
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
20
|
+
|
|
21
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
22
|
+
|
|
23
|
+
var _internalMediaCore = require("@webex/internal-media-core");
|
|
24
|
+
|
|
25
|
+
var _constants = _interopRequireDefault(require("../metrics/constants"));
|
|
26
|
+
|
|
27
|
+
var _metrics = _interopRequireDefault(require("../metrics"));
|
|
28
|
+
|
|
29
|
+
var _util = _interopRequireDefault(require("../media/util"));
|
|
30
|
+
|
|
31
|
+
var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
|
|
32
|
+
|
|
33
|
+
var _constants2 = require("../constants");
|
|
34
|
+
|
|
35
|
+
/* eslint-disable no-param-reassign */
|
|
36
|
+
var createEffectsState = function createEffectsState(type) {
|
|
37
|
+
_loggerProxy.default.logger.info("Meeting:effectState#createEffectsState --> creating effectsState for effect ".concat(type));
|
|
38
|
+
|
|
39
|
+
return new EffectsState(type);
|
|
40
|
+
};
|
|
41
|
+
/* The purpose of this class is to manage the effects state(for eg., BNR).
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var EffectsState = /*#__PURE__*/function () {
|
|
46
|
+
function EffectsState(type) {
|
|
47
|
+
(0, _classCallCheck2.default)(this, EffectsState);
|
|
48
|
+
this.effectType = type;
|
|
49
|
+
this.state = {
|
|
50
|
+
bnr: {
|
|
51
|
+
enabled: _constants2.BNR_STATUS.NOT_ENABLED
|
|
52
|
+
},
|
|
53
|
+
callToWebrtcBNRInProgress: false
|
|
54
|
+
}; // these 2 hold the resolve, reject methods for the promise we returned to the client in last handleClientRequest() call
|
|
55
|
+
|
|
56
|
+
this.pendingPromiseResolve = null;
|
|
57
|
+
this.pendingPromiseReject = null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @memberof EffectsState
|
|
61
|
+
* @param {Boolean} [isEnable] true for enableBNR, false for disableBNR request
|
|
62
|
+
* @param {Object} [meeting] the meeting object
|
|
63
|
+
* @returns {Promise}
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
(0, _createClass2.default)(EffectsState, [{
|
|
68
|
+
key: "handleClientRequest",
|
|
69
|
+
value: function () {
|
|
70
|
+
var _handleClientRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(isEnable, meeting) {
|
|
71
|
+
var _this = this;
|
|
72
|
+
|
|
73
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
74
|
+
while (1) {
|
|
75
|
+
switch (_context.prev = _context.next) {
|
|
76
|
+
case 0:
|
|
77
|
+
return _context.abrupt("return", new _promise.default(function (resolve, reject) {
|
|
78
|
+
if (_this.pendingPromiseResolve) {
|
|
79
|
+
// resolve the last promise we returned to the client as the client has issued a new request that has superseded the previous one
|
|
80
|
+
_this.pendingPromiseResolve();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_this.pendingPromiseResolve = resolve;
|
|
84
|
+
_this.pendingPromiseReject = reject;
|
|
85
|
+
if (isEnable) _this.enableBNR(meeting);else _this.disableBNR(meeting);
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
case 1:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context.stop();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, _callee);
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
function handleClientRequest(_x, _x2) {
|
|
97
|
+
return _handleClientRequest.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return handleClientRequest;
|
|
101
|
+
}()
|
|
102
|
+
/**
|
|
103
|
+
* Internal API to return status of BNR
|
|
104
|
+
* @memberof EffectsState
|
|
105
|
+
* @returns {Boolean}
|
|
106
|
+
* @public
|
|
107
|
+
* @memberof Meeting
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
}, {
|
|
111
|
+
key: "isBnrEnabled",
|
|
112
|
+
value: function isBnrEnabled() {
|
|
113
|
+
return this.state.bnr.enabled === _constants2.BNR_STATUS.ENABLED;
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "resolvePromise",
|
|
117
|
+
value: function resolvePromise() {
|
|
118
|
+
if (this.pendingPromiseResolve) {
|
|
119
|
+
this.pendingPromiseResolve(true);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.pendingPromiseResolve = null;
|
|
123
|
+
this.pendingPromiseReject = null;
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "rejectPromise",
|
|
127
|
+
value: function rejectPromise(e) {
|
|
128
|
+
if (this.pendingPromiseReject) {
|
|
129
|
+
this.pendingPromiseReject(e);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
this.pendingPromiseResolve = null;
|
|
133
|
+
this.pendingPromiseReject = null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* enableBNR API
|
|
137
|
+
* @param {Object} meeting the meeting object
|
|
138
|
+
* @returns {Promise<Boolean>}
|
|
139
|
+
* @public
|
|
140
|
+
* @memberof EffectsState
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
}, {
|
|
144
|
+
key: "enableBNR",
|
|
145
|
+
value: function () {
|
|
146
|
+
var _enableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(meeting) {
|
|
147
|
+
var bnr, audioStream;
|
|
148
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
149
|
+
while (1) {
|
|
150
|
+
switch (_context2.prev = _context2.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
_loggerProxy.default.logger.info('Meeting:effectState#enableBNR. Enable BNR called');
|
|
153
|
+
|
|
154
|
+
if (!this.isBnrEnabled()) {
|
|
155
|
+
_context2.next = 4;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
_loggerProxy.default.logger.warn('Meeting:index#enableBNR. BNR is already enabled');
|
|
160
|
+
|
|
161
|
+
return _context2.abrupt("return", this.resolvePromise());
|
|
162
|
+
|
|
163
|
+
case 4:
|
|
164
|
+
if (!this.state.callToWebrtcBNRInProgress) {
|
|
165
|
+
_context2.next = 7;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
_loggerProxy.default.logger.warn('Meeting:effectState#enableBNR. Call to WebRTC in progress, we need to wait for it to complete');
|
|
170
|
+
|
|
171
|
+
return _context2.abrupt("return", this.resolvePromise());
|
|
172
|
+
|
|
173
|
+
case 7:
|
|
174
|
+
bnr = this.state.bnr;
|
|
175
|
+
_context2.prev = 8;
|
|
176
|
+
bnr.enabled = _constants2.BNR_STATUS.SHOULD_ENABLE;
|
|
177
|
+
this.state.callToWebrtcBNRInProgress = true;
|
|
178
|
+
audioStream = _util.default.createMediaStream([meeting.mediaProperties.audioTrack]);
|
|
179
|
+
|
|
180
|
+
_loggerProxy.default.logger.info('Meeting:effectState#enableBNR. MediaStream created from meeting & sent to updateAudio');
|
|
181
|
+
|
|
182
|
+
_context2.next = 15;
|
|
183
|
+
return meeting.updateAudio({
|
|
184
|
+
sendAudio: true,
|
|
185
|
+
receiveAudio: meeting.mediaProperties.mediaDirection.receiveAudio,
|
|
186
|
+
stream: audioStream,
|
|
187
|
+
bnrEnabled: bnr.enabled
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
case 15:
|
|
191
|
+
_loggerProxy.default.logger.info('Meeting:effectState#enableBNR. Updated meeting audio with bnr enabled track');
|
|
192
|
+
|
|
193
|
+
bnr.enabled = _constants2.BNR_STATUS.ENABLED;
|
|
194
|
+
this.state.callToWebrtcBNRInProgress = false;
|
|
195
|
+
|
|
196
|
+
_metrics.default.sendBehavioralMetric(_constants.default.ENABLE_BNR_SUCCESS);
|
|
197
|
+
|
|
198
|
+
_context2.next = 29;
|
|
199
|
+
break;
|
|
200
|
+
|
|
201
|
+
case 21:
|
|
202
|
+
_context2.prev = 21;
|
|
203
|
+
_context2.t0 = _context2["catch"](8);
|
|
204
|
+
bnr.enabled = _constants2.BNR_STATUS.NOT_ENABLED;
|
|
205
|
+
this.state.callToWebrtcBNRInProgress = false;
|
|
206
|
+
|
|
207
|
+
_loggerProxy.default.logger.error('Meeting:index#enableBNR.', _context2.t0);
|
|
208
|
+
|
|
209
|
+
_metrics.default.sendBehavioralMetric(_constants.default.ENABLE_BNR_FAILURE, {
|
|
210
|
+
reason: _context2.t0.message,
|
|
211
|
+
stack: _context2.t0.stack
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
this.rejectPromise(_context2.t0);
|
|
215
|
+
throw _context2.t0;
|
|
216
|
+
|
|
217
|
+
case 29:
|
|
218
|
+
return _context2.abrupt("return", this.resolvePromise());
|
|
219
|
+
|
|
220
|
+
case 30:
|
|
221
|
+
case "end":
|
|
222
|
+
return _context2.stop();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}, _callee2, this, [[8, 21]]);
|
|
226
|
+
}));
|
|
227
|
+
|
|
228
|
+
function enableBNR(_x3) {
|
|
229
|
+
return _enableBNR.apply(this, arguments);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return enableBNR;
|
|
233
|
+
}()
|
|
234
|
+
/**
|
|
235
|
+
* disableBNR API
|
|
236
|
+
* @param {Object} meeting the meeting object
|
|
237
|
+
* @returns {Promise<Boolean>}
|
|
238
|
+
* @public
|
|
239
|
+
* @memberof EffectsState
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
}, {
|
|
243
|
+
key: "disableBNR",
|
|
244
|
+
value: function () {
|
|
245
|
+
var _disableBNR = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(meeting) {
|
|
246
|
+
var bnr, audioTrack, audioStream;
|
|
247
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
248
|
+
while (1) {
|
|
249
|
+
switch (_context3.prev = _context3.next) {
|
|
250
|
+
case 0:
|
|
251
|
+
_loggerProxy.default.logger.info('Meeting:effectState#disableBNR. Disable BNR called');
|
|
252
|
+
|
|
253
|
+
bnr = this.state.bnr;
|
|
254
|
+
_context3.prev = 2;
|
|
255
|
+
|
|
256
|
+
if (!this.state.callToWebrtcBNRInProgress) {
|
|
257
|
+
_context3.next = 6;
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
_loggerProxy.default.logger.info('Meeting:effectState#disableBNR. Call to WebRTC in progress, we need to wait for it to complete');
|
|
262
|
+
|
|
263
|
+
return _context3.abrupt("return", this.resolvePromise());
|
|
264
|
+
|
|
265
|
+
case 6:
|
|
266
|
+
bnr.enabled = _constants2.BNR_STATUS.SHOULD_DISABLE;
|
|
267
|
+
this.state.callToWebrtcBNRInProgress = true;
|
|
268
|
+
audioTrack = _internalMediaCore.Media.Effects.BNR.disableBNR(meeting.mediaProperties.audioTrack);
|
|
269
|
+
audioStream = _util.default.createMediaStream([audioTrack]);
|
|
270
|
+
|
|
271
|
+
_loggerProxy.default.logger.info('Meeting:effectState#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');
|
|
272
|
+
|
|
273
|
+
_context3.next = 13;
|
|
274
|
+
return meeting.updateAudio({
|
|
275
|
+
sendAudio: true,
|
|
276
|
+
receiveAudio: meeting.mediaProperties.mediaDirection.receiveAudio,
|
|
277
|
+
stream: audioStream
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
case 13:
|
|
281
|
+
bnr.enabled = _constants2.BNR_STATUS.NOT_ENABLED;
|
|
282
|
+
this.state.callToWebrtcBNRInProgress = false;
|
|
283
|
+
|
|
284
|
+
_metrics.default.sendBehavioralMetric(_constants.default.DISABLE_BNR_SUCCESS);
|
|
285
|
+
|
|
286
|
+
_context3.next = 26;
|
|
287
|
+
break;
|
|
288
|
+
|
|
289
|
+
case 18:
|
|
290
|
+
_context3.prev = 18;
|
|
291
|
+
_context3.t0 = _context3["catch"](2);
|
|
292
|
+
bnr.enabled = _constants2.BNR_STATUS.ENABLED;
|
|
293
|
+
this.state.callToWebrtcBNRInProgress = false;
|
|
294
|
+
|
|
295
|
+
_loggerProxy.default.logger.error("Meeting:index#disableBNR. ".concat(_context3.t0));
|
|
296
|
+
|
|
297
|
+
_metrics.default.sendBehavioralMetric(_constants.default.DISABLE_BNR_FAILURE, {
|
|
298
|
+
reason: _context3.t0.message,
|
|
299
|
+
stack: _context3.t0.stack
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
this.rejectPromise(_context3.t0);
|
|
303
|
+
throw _context3.t0;
|
|
304
|
+
|
|
305
|
+
case 26:
|
|
306
|
+
return _context3.abrupt("return", this.resolvePromise());
|
|
307
|
+
|
|
308
|
+
case 27:
|
|
309
|
+
case "end":
|
|
310
|
+
return _context3.stop();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}, _callee3, this, [[2, 18]]);
|
|
314
|
+
}));
|
|
315
|
+
|
|
316
|
+
function disableBNR(_x4) {
|
|
317
|
+
return _disableBNR.apply(this, arguments);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return disableBNR;
|
|
321
|
+
}()
|
|
322
|
+
}]);
|
|
323
|
+
return EffectsState;
|
|
324
|
+
}();
|
|
325
|
+
|
|
326
|
+
var _default = createEffectsState;
|
|
327
|
+
exports.default = _default;
|
|
328
|
+
//# sourceMappingURL=effectsState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEffectsState","type","LoggerProxy","logger","info","EffectsState","effectType","state","bnr","enabled","BNR_STATUS","NOT_ENABLED","callToWebrtcBNRInProgress","pendingPromiseResolve","pendingPromiseReject","isEnable","meeting","resolve","reject","enableBNR","disableBNR","ENABLED","e","isBnrEnabled","warn","resolvePromise","SHOULD_ENABLE","audioStream","MediaUtil","createMediaStream","mediaProperties","audioTrack","updateAudio","sendAudio","receiveAudio","mediaDirection","stream","bnrEnabled","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","ENABLE_BNR_SUCCESS","error","ENABLE_BNR_FAILURE","reason","message","stack","rejectPromise","SHOULD_DISABLE","WebRTCMedia","Effects","BNR","DISABLE_BNR_SUCCESS","DISABLE_BNR_FAILURE"],"sources":["effectsState.js"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport {Media as WebRTCMedia} from '@webex/internal-media-core';\n\nimport BEHAVIORAL_METRICS from '../metrics/constants';\nimport Metrics from '../metrics';\nimport MediaUtil from '../media/util';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport {BNR_STATUS} from '../constants';\n\nconst createEffectsState = (type) => {\n LoggerProxy.logger.info(`Meeting:effectState#createEffectsState --> creating effectsState for effect ${type}`);\n\n return new EffectsState(type);\n};\n\n/* The purpose of this class is to manage the effects state(for eg., BNR).\n*/\nclass EffectsState {\n constructor(type) {\n this.effectType = type;\n this.state = {\n bnr: {\n enabled: BNR_STATUS.NOT_ENABLED\n },\n callToWebrtcBNRInProgress: false\n };\n // these 2 hold the resolve, reject methods for the promise we returned to the client in last handleClientRequest() call\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n }\n\n /**\n * @memberof EffectsState\n * @param {Boolean} [isEnable] true for enableBNR, false for disableBNR request\n * @param {Object} [meeting] the meeting object\n * @returns {Promise}\n */\n async handleClientRequest(isEnable, meeting) {\n return new Promise((resolve, reject) => {\n if (this.pendingPromiseResolve) {\n // resolve the last promise we returned to the client as the client has issued a new request that has superseded the previous one\n this.pendingPromiseResolve();\n }\n this.pendingPromiseResolve = resolve;\n this.pendingPromiseReject = reject;\n\n if (isEnable) this.enableBNR(meeting);\n else this.disableBNR(meeting);\n });\n }\n\n /**\n * Internal API to return status of BNR\n * @memberof EffectsState\n * @returns {Boolean}\n * @public\n * @memberof Meeting\n */\n isBnrEnabled() {\n return this.state.bnr.enabled === BNR_STATUS.ENABLED;\n }\n\n resolvePromise() {\n if (this.pendingPromiseResolve) {\n this.pendingPromiseResolve(true);\n }\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n }\n\n rejectPromise(e) {\n if (this.pendingPromiseReject) {\n this.pendingPromiseReject(e);\n }\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n }\n\n /**\n * enableBNR API\n * @param {Object} meeting the meeting object\n * @returns {Promise<Boolean>}\n * @public\n * @memberof EffectsState\n */\n async enableBNR(meeting) {\n LoggerProxy.logger.info('Meeting:effectState#enableBNR. Enable BNR called');\n\n if (this.isBnrEnabled()) {\n LoggerProxy.logger.warn('Meeting:index#enableBNR. BNR is already enabled');\n\n return this.resolvePromise();\n }\n\n if (this.state.callToWebrtcBNRInProgress) {\n LoggerProxy.logger.warn('Meeting:effectState#enableBNR. Call to WebRTC in progress, we need to wait for it to complete');\n\n return this.resolvePromise();\n }\n\n const {bnr} = this.state;\n\n try {\n bnr.enabled = BNR_STATUS.SHOULD_ENABLE;\n this.state.callToWebrtcBNRInProgress = true;\n const audioStream = MediaUtil.createMediaStream([meeting.mediaProperties.audioTrack]);\n\n LoggerProxy.logger.info('Meeting:effectState#enableBNR. MediaStream created from meeting & sent to updateAudio');\n await meeting.updateAudio({\n sendAudio: true,\n receiveAudio: meeting.mediaProperties.mediaDirection.receiveAudio,\n stream: audioStream,\n bnrEnabled: bnr.enabled\n });\n\n LoggerProxy.logger.info('Meeting:effectState#enableBNR. Updated meeting audio with bnr enabled track');\n bnr.enabled = BNR_STATUS.ENABLED;\n this.state.callToWebrtcBNRInProgress = false;\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.ENABLE_BNR_SUCCESS,\n );\n }\n catch (error) {\n bnr.enabled = BNR_STATUS.NOT_ENABLED;\n this.state.callToWebrtcBNRInProgress = false;\n LoggerProxy.logger.error('Meeting:index#enableBNR.', error);\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.ENABLE_BNR_FAILURE,\n {\n reason: error.message,\n stack: error.stack\n }\n );\n this.rejectPromise(error);\n\n throw error;\n }\n\n return this.resolvePromise();\n }\n\n /**\n * disableBNR API\n * @param {Object} meeting the meeting object\n * @returns {Promise<Boolean>}\n * @public\n * @memberof EffectsState\n */\n async disableBNR(meeting) {\n LoggerProxy.logger.info('Meeting:effectState#disableBNR. Disable BNR called');\n\n const {bnr} = this.state;\n\n try {\n if (this.state.callToWebrtcBNRInProgress) {\n LoggerProxy.logger.info('Meeting:effectState#disableBNR. Call to WebRTC in progress, we need to wait for it to complete');\n\n return this.resolvePromise();\n }\n\n bnr.enabled = BNR_STATUS.SHOULD_DISABLE;\n this.state.callToWebrtcBNRInProgress = true;\n\n const audioTrack = WebRTCMedia.Effects.BNR.disableBNR(meeting.mediaProperties.audioTrack);\n\n const audioStream = MediaUtil.createMediaStream([audioTrack]);\n\n LoggerProxy.logger.info('Meeting:effectState#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');\n\n await meeting.updateAudio({\n sendAudio: true,\n receiveAudio: meeting.mediaProperties.mediaDirection.receiveAudio,\n stream: audioStream\n });\n\n bnr.enabled = BNR_STATUS.NOT_ENABLED;\n\n this.state.callToWebrtcBNRInProgress = false;\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.DISABLE_BNR_SUCCESS\n );\n }\n catch (error) {\n bnr.enabled = BNR_STATUS.ENABLED;\n this.state.callToWebrtcBNRInProgress = false;\n LoggerProxy.logger.error(`Meeting:index#disableBNR. ${error}`);\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.DISABLE_BNR_FAILURE,\n {\n reason: error.message,\n stack: error.stack\n }\n );\n this.rejectPromise(error);\n\n throw error;\n }\n\n return this.resolvePromise();\n }\n}\n\nexport default createEffectsState;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAPA;AASA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,IAAD,EAAU;EACnCC,qBAAYC,MAAZ,CAAmBC,IAAnB,uFAAuGH,IAAvG;;EAEA,OAAO,IAAII,YAAJ,CAAiBJ,IAAjB,CAAP;AACD,CAJD;AAMA;AACA;;;IACMI,Y;EACJ,sBAAYJ,IAAZ,EAAkB;IAAA;IAChB,KAAKK,UAAL,GAAkBL,IAAlB;IACA,KAAKM,KAAL,GAAa;MACXC,GAAG,EAAE;QACHC,OAAO,EAAEC,uBAAWC;MADjB,CADM;MAIXC,yBAAyB,EAAE;IAJhB,CAAb,CAFgB,CAQhB;;IACA,KAAKC,qBAAL,GAA6B,IAA7B;IACA,KAAKC,oBAAL,GAA4B,IAA5B;EACD;EAED;AACF;AACA;AACA;AACA;AACA;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,mBADrB;;gBA/BJ;gBAAA;;cAAA;gBAAA;gBAAA;gBAoCI5C,GAAG,CAACC,OAAJ,GAAcC,uBAAWW,OAAzB;gBACA,KAAKd,KAAL,CAAWK,yBAAX,GAAuC,KAAvC;;gBACAV,qBAAYC,MAAZ,CAAmBuC,KAAnB;;gBAEAJ,iBAAQC,oBAAR,CACEC,mBAAmBa,mBADrB,EAEE;kBACET,MAAM,EAAE,aAAMC,OADhB;kBAEEC,KAAK,EAAE,aAAMA;gBAFf,CAFF;;gBAOA,KAAKC,aAAL;gBA/CJ;;cAAA;gBAAA,kCAoDS,KAAKtB,cAAL,EApDT;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;;;eAwDazB,kB"}
|
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}
|
|
@@ -1203,14 +1214,6 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
1203
1214
|
*/
|
|
1204
1215
|
|
|
1205
1216
|
_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;
|
|
1214
1217
|
|
|
1215
1218
|
_this.setUpLocusInfoListeners();
|
|
1216
1219
|
|
|
@@ -4824,7 +4827,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
4824
4827
|
var _updateAudio = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(options) {
|
|
4825
4828
|
var _this42 = this;
|
|
4826
4829
|
|
|
4827
|
-
var sendAudio, receiveAudio, stream, audioTransceiver, track;
|
|
4830
|
+
var sendAudio, receiveAudio, stream, bnrEnabled, audioTransceiver, track;
|
|
4828
4831
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
4829
4832
|
while (1) {
|
|
4830
4833
|
switch (_context4.prev = _context4.next) {
|
|
@@ -4837,7 +4840,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
4837
4840
|
return _context4.abrupt("return", this.enqueueMediaUpdate(MEDIA_UPDATE_TYPE.AUDIO, options));
|
|
4838
4841
|
|
|
4839
4842
|
case 2:
|
|
4840
|
-
sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream;
|
|
4843
|
+
sendAudio = options.sendAudio, receiveAudio = options.receiveAudio, stream = options.stream, bnrEnabled = options.bnrEnabled;
|
|
4841
4844
|
audioTransceiver = this.mediaProperties.peerConnection.audioTransceiver;
|
|
4842
4845
|
track = _util.default.getTrack(stream).audioTrack;
|
|
4843
4846
|
|
|
@@ -4849,19 +4852,22 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
4849
4852
|
return _context4.abrupt("return", _promise.default.reject(new _parameter.default('Pass sendAudio and receiveAudio parameter')));
|
|
4850
4853
|
|
|
4851
4854
|
case 7:
|
|
4852
|
-
if (!(sendAudio && !this.isAudioMuted() && (
|
|
4853
|
-
_context4.next =
|
|
4855
|
+
if (!(sendAudio && !this.isAudioMuted() && (bnrEnabled === _constants.BNR_STATUS.ENABLED || bnrEnabled === _constants.BNR_STATUS.SHOULD_ENABLE))) {
|
|
4856
|
+
_context4.next = 13;
|
|
4854
4857
|
break;
|
|
4855
4858
|
}
|
|
4856
4859
|
|
|
4857
|
-
|
|
4860
|
+
_loggerProxy.default.logger.info('Meeting:index#updateAudio. Calling WebRTC enable bnr method');
|
|
4861
|
+
|
|
4862
|
+
_context4.next = 11;
|
|
4858
4863
|
return this.internal_enableBNR(track);
|
|
4859
4864
|
|
|
4860
|
-
case
|
|
4865
|
+
case 11:
|
|
4861
4866
|
track = _context4.sent;
|
|
4862
|
-
this.bnrStatus = _constants.BNR_STATUS.ENABLED;
|
|
4863
4867
|
|
|
4864
|
-
|
|
4868
|
+
_loggerProxy.default.logger.info('Meeting:index#updateAudio. WebRTC enable bnr request completed');
|
|
4869
|
+
|
|
4870
|
+
case 13:
|
|
4865
4871
|
return _context4.abrupt("return", _util.default.validateOptions({
|
|
4866
4872
|
sendAudio: sendAudio,
|
|
4867
4873
|
localStream: stream
|
|
@@ -4900,7 +4906,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
4900
4906
|
_this42.audio = _this42.audio || (0, _muteState.default)(_constants.AUDIO, _this42, _this42.mediaProperties.mediaDirection);
|
|
4901
4907
|
}));
|
|
4902
4908
|
|
|
4903
|
-
case
|
|
4909
|
+
case 14:
|
|
4904
4910
|
case "end":
|
|
4905
4911
|
return _context4.stop();
|
|
4906
4912
|
}
|
|
@@ -6218,7 +6224,7 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
6218
6224
|
* @memberof Meeting
|
|
6219
6225
|
*/
|
|
6220
6226
|
function isBnrEnabled() {
|
|
6221
|
-
return this.
|
|
6227
|
+
return this.effects && this.effects.isBnrEnabled();
|
|
6222
6228
|
}
|
|
6223
6229
|
/**
|
|
6224
6230
|
* Internal API to obtain BNR enabled MediaStream
|
|
@@ -6274,184 +6280,69 @@ var Meeting = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
|
6274
6280
|
return internal_enableBNR;
|
|
6275
6281
|
}()
|
|
6276
6282
|
/**
|
|
6277
|
-
*
|
|
6278
|
-
* @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
|
|
6279
6285
|
* @public
|
|
6280
6286
|
* @memberof Meeting
|
|
6281
6287
|
*/
|
|
6282
6288
|
|
|
6283
6289
|
}, {
|
|
6284
6290
|
key: "enableBNR",
|
|
6285
|
-
value: function () {
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
while (1) {
|
|
6290
|
-
switch (_context6.prev = _context6.next) {
|
|
6291
|
-
case 0:
|
|
6292
|
-
_loggerProxy.default.logger.info('Meeting:index#enableBNR. Enable BNR called');
|
|
6293
|
-
|
|
6294
|
-
isSuccess = false;
|
|
6295
|
-
_context6.prev = 2;
|
|
6296
|
-
|
|
6297
|
-
if (!(typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined')) {
|
|
6298
|
-
_context6.next = 7;
|
|
6299
|
-
break;
|
|
6300
|
-
}
|
|
6301
|
-
|
|
6302
|
-
throw new Error("Meeting doesn't have an audioTrack attached");
|
|
6303
|
-
|
|
6304
|
-
case 7:
|
|
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;
|
|
6314
|
-
audioStream = _util2.default.createMediaStream([this.mediaProperties.audioTrack]);
|
|
6315
|
-
|
|
6316
|
-
_loggerProxy.default.logger.info('Meeting:index#enableBNR. MediaStream created from meeting & sent to updateAudio');
|
|
6317
|
-
|
|
6318
|
-
_context6.next = 14;
|
|
6319
|
-
return this.updateAudio({
|
|
6320
|
-
sendAudio: true,
|
|
6321
|
-
receiveAudio: this.mediaProperties.mediaDirection.receiveAudio,
|
|
6322
|
-
stream: audioStream
|
|
6323
|
-
});
|
|
6324
|
-
|
|
6325
|
-
case 14:
|
|
6326
|
-
this.bnrStatus = _constants.BNR_STATUS.ENABLED;
|
|
6327
|
-
isSuccess = true;
|
|
6328
|
-
|
|
6329
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.ENABLE_BNR_SUCCESS);
|
|
6330
|
-
|
|
6331
|
-
_context6.next = 25;
|
|
6332
|
-
break;
|
|
6333
|
-
|
|
6334
|
-
case 19:
|
|
6335
|
-
_context6.prev = 19;
|
|
6336
|
-
_context6.t0 = _context6["catch"](2);
|
|
6337
|
-
this.bnrStatus = _constants.BNR_STATUS.NOT_ENABLED;
|
|
6338
|
-
|
|
6339
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.ENABLE_BNR_FAILURE, {
|
|
6340
|
-
reason: _context6.t0.message,
|
|
6341
|
-
stack: _context6.t0.stack
|
|
6342
|
-
});
|
|
6343
|
-
|
|
6344
|
-
_loggerProxy.default.logger.error('Meeting:index#enableBNR.', _context6.t0);
|
|
6345
|
-
|
|
6346
|
-
throw _context6.t0;
|
|
6347
|
-
|
|
6348
|
-
case 25:
|
|
6349
|
-
return _context6.abrupt("return", isSuccess);
|
|
6350
|
-
|
|
6351
|
-
case 26:
|
|
6352
|
-
case "end":
|
|
6353
|
-
return _context6.stop();
|
|
6354
|
-
}
|
|
6355
|
-
}
|
|
6356
|
-
}, _callee6, this, [[2, 19]]);
|
|
6357
|
-
}));
|
|
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
|
+
}
|
|
6358
6295
|
|
|
6359
|
-
|
|
6360
|
-
return
|
|
6296
|
+
if (this.isAudioMuted()) {
|
|
6297
|
+
return _promise.default.reject(new Error('Cannot enable BNR while meeting is muted'));
|
|
6361
6298
|
}
|
|
6362
6299
|
|
|
6363
|
-
|
|
6364
|
-
|
|
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');
|
|
6304
|
+
|
|
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
|
+
}
|
|
6365
6314
|
/**
|
|
6366
|
-
*
|
|
6367
|
-
* @returns {Promise
|
|
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
|
|
6368
6317
|
* @public
|
|
6369
6318
|
* @memberof Meeting
|
|
6370
6319
|
*/
|
|
6371
6320
|
|
|
6372
6321
|
}, {
|
|
6373
6322
|
key: "disableBNR",
|
|
6374
|
-
value: function () {
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
while (1) {
|
|
6379
|
-
switch (_context7.prev = _context7.next) {
|
|
6380
|
-
case 0:
|
|
6381
|
-
_loggerProxy.default.logger.info('Meeting:index#disableBNR. Disable BNR called');
|
|
6382
|
-
|
|
6383
|
-
isSuccess = false;
|
|
6384
|
-
_context7.prev = 2;
|
|
6385
|
-
|
|
6386
|
-
if (this.isBnrEnabled()) {
|
|
6387
|
-
_context7.next = 7;
|
|
6388
|
-
break;
|
|
6389
|
-
}
|
|
6390
|
-
|
|
6391
|
-
throw new Error('Can not disable as BNR is not enabled');
|
|
6392
|
-
|
|
6393
|
-
case 7:
|
|
6394
|
-
if (!(typeof this.mediaProperties === 'undefined' || typeof this.mediaProperties.audioTrack === 'undefined')) {
|
|
6395
|
-
_context7.next = 9;
|
|
6396
|
-
break;
|
|
6397
|
-
}
|
|
6398
|
-
|
|
6399
|
-
throw new Error("Meeting doesn't have an audioTrack attached");
|
|
6400
|
-
|
|
6401
|
-
case 9:
|
|
6402
|
-
audioTrack = _internalMediaCore.Media.Effects.BNR.disableBNR(this.mediaProperties.audioTrack);
|
|
6403
|
-
audioStream = _util2.default.createMediaStream([audioTrack]);
|
|
6404
|
-
|
|
6405
|
-
_loggerProxy.default.logger.info('Meeting:index#disableBNR. Raw media track obtained from WebRTC & sent to updateAudio');
|
|
6406
|
-
|
|
6407
|
-
this.bnrStatus = _constants.BNR_STATUS.SHOULD_DISABLE;
|
|
6408
|
-
_context7.next = 15;
|
|
6409
|
-
return this.updateAudio({
|
|
6410
|
-
sendAudio: true,
|
|
6411
|
-
receiveAudio: this.mediaProperties.mediaDirection.receiveAudio,
|
|
6412
|
-
stream: audioStream
|
|
6413
|
-
});
|
|
6414
|
-
|
|
6415
|
-
case 15:
|
|
6416
|
-
this.bnrStatus = _constants.BNR_STATUS.NOT_ENABLED;
|
|
6417
|
-
isSuccess = true;
|
|
6418
|
-
|
|
6419
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.DISABLE_BNR_SUCCESS);
|
|
6420
|
-
|
|
6421
|
-
_context7.next = 26;
|
|
6422
|
-
break;
|
|
6423
|
-
|
|
6424
|
-
case 20:
|
|
6425
|
-
_context7.prev = 20;
|
|
6426
|
-
_context7.t0 = _context7["catch"](2);
|
|
6427
|
-
this.bnrStatus = _constants.BNR_STATUS.ENABLED;
|
|
6428
|
-
|
|
6429
|
-
_loggerProxy.default.logger.error("Meeting:index#disableBNR. ".concat(_context7.t0));
|
|
6430
|
-
|
|
6431
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.DISABLE_BNR_FAILURE, {
|
|
6432
|
-
reason: _context7.t0.message,
|
|
6433
|
-
stack: _context7.t0.stack
|
|
6434
|
-
});
|
|
6435
|
-
|
|
6436
|
-
throw _context7.t0;
|
|
6437
|
-
|
|
6438
|
-
case 26:
|
|
6439
|
-
return _context7.abrupt("return", isSuccess);
|
|
6440
|
-
|
|
6441
|
-
case 27:
|
|
6442
|
-
case "end":
|
|
6443
|
-
return _context7.stop();
|
|
6444
|
-
}
|
|
6445
|
-
}
|
|
6446
|
-
}, _callee7, this, [[2, 20]]);
|
|
6447
|
-
}));
|
|
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
|
+
}
|
|
6448
6327
|
|
|
6449
|
-
|
|
6450
|
-
return
|
|
6328
|
+
if (!this.isBnrEnabled()) {
|
|
6329
|
+
return _promise.default.reject(new Error('Can not disable as BNR is not enabled'));
|
|
6451
6330
|
}
|
|
6452
6331
|
|
|
6453
|
-
|
|
6454
|
-
|
|
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
|
+
}
|
|
6455
6346
|
}]);
|
|
6456
6347
|
return Meeting;
|
|
6457
6348
|
}(_webexCore.StatelessWebexPlugin);
|