@webex/plugin-meetings 3.8.1-next.15 → 3.8.1-next.16
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/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/meeting/brbState.js +12 -12
- package/dist/meeting/brbState.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +32 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/types/meeting/brbState.d.ts +0 -1
- package/dist/types/multistream/sendSlotManager.d.ts +16 -0
- package/dist/webinar/index.js +1 -1
- package/package.json +3 -3
- package/src/meeting/brbState.ts +8 -7
- package/src/multistream/sendSlotManager.ts +34 -2
- package/test/unit/spec/meeting/brbState.ts +11 -9
- package/test/unit/spec/multistream/sendSlotManager.ts +59 -0
package/dist/breakouts/index.js
CHANGED
@@ -1110,7 +1110,7 @@ var Breakouts = _webexCore.WebexPlugin.extend({
|
|
1110
1110
|
this.trigger(_constants.BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
|
1111
1111
|
}
|
1112
1112
|
},
|
1113
|
-
version: "3.8.1-next.
|
1113
|
+
version: "3.8.1-next.16"
|
1114
1114
|
});
|
1115
1115
|
var _default = exports.default = Breakouts;
|
1116
1116
|
//# sourceMappingURL=index.js.map
|
@@ -373,7 +373,7 @@ var SimultaneousInterpretation = _webexCore.WebexPlugin.extend({
|
|
373
373
|
throw error;
|
374
374
|
});
|
375
375
|
},
|
376
|
-
version: "3.8.1-next.
|
376
|
+
version: "3.8.1-next.16"
|
377
377
|
});
|
378
378
|
var _default = exports.default = SimultaneousInterpretation;
|
379
379
|
//# sourceMappingURL=index.js.map
|
@@ -18,7 +18,7 @@ var SILanguage = _webexCore.WebexPlugin.extend({
|
|
18
18
|
languageCode: 'number',
|
19
19
|
languageName: 'string'
|
20
20
|
},
|
21
|
-
version: "3.8.1-next.
|
21
|
+
version: "3.8.1-next.16"
|
22
22
|
});
|
23
23
|
var _default = exports.default = SILanguage;
|
24
24
|
//# sourceMappingURL=siLanguage.js.map
|
package/dist/meeting/brbState.js
CHANGED
@@ -56,8 +56,11 @@ var BrbState = exports.BrbState = /*#__PURE__*/function () {
|
|
56
56
|
(0, _createClass2.default)(BrbState, [{
|
57
57
|
key: "enable",
|
58
58
|
value: function enable(enabled, sendSlotManager) {
|
59
|
+
var _this = this;
|
59
60
|
this.state.client.enabled = enabled;
|
60
|
-
return this.applyClientStateToServer(sendSlotManager)
|
61
|
+
return this.applyClientStateToServer(sendSlotManager).finally(function () {
|
62
|
+
sendSlotManager.setSourceStateOverride(_internalMediaCore.MediaType.VideoMain, _this.state.client.enabled ? 'away' : null);
|
63
|
+
});
|
61
64
|
}
|
62
65
|
|
63
66
|
/**
|
@@ -69,7 +72,7 @@ var BrbState = exports.BrbState = /*#__PURE__*/function () {
|
|
69
72
|
}, {
|
70
73
|
key: "applyClientStateToServer",
|
71
74
|
value: function applyClientStateToServer(sendSlotManager) {
|
72
|
-
var
|
75
|
+
var _this2 = this;
|
73
76
|
if (this.state.syncToServerInProgress) {
|
74
77
|
_loggerProxy.default.logger.info("Meeting:brbState#applyClientStateToServer: request to server in progress, we need to wait for it to complete");
|
75
78
|
return _promise.default.resolve();
|
@@ -81,20 +84,20 @@ var BrbState = exports.BrbState = /*#__PURE__*/function () {
|
|
81
84
|
return _promise.default.resolve();
|
82
85
|
}
|
83
86
|
this.state.syncToServerInProgress = true;
|
84
|
-
return this.sendLocalBrbStateToServer(
|
85
|
-
|
87
|
+
return this.sendLocalBrbStateToServer().then(function () {
|
88
|
+
_this2.state.syncToServerInProgress = false;
|
86
89
|
|
87
90
|
// This is a workaround for the fact that the server does not send the brb state
|
88
91
|
// in the locus update when a user joins from multiple devices but not all devices are requested brb.
|
89
92
|
// In the future, this could be improved with a new brb locus update handler
|
90
93
|
// https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-655626
|
91
|
-
|
94
|
+
_this2.handleServerBrbUpdate(_this2.state.client.enabled);
|
92
95
|
_loggerProxy.default.logger.info("Meeting:brbState#applyClientStateToServer: sync with server completed");
|
93
96
|
|
94
97
|
// need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync
|
95
|
-
|
98
|
+
_this2.applyClientStateToServer(sendSlotManager);
|
96
99
|
}).catch(function (error) {
|
97
|
-
|
100
|
+
_this2.state.syncToServerInProgress = false;
|
98
101
|
_loggerProxy.default.logger.warn("Meeting:brbState#applyClientStateToServer: Error: ".concat(error));
|
99
102
|
return _promise.default.reject(error);
|
100
103
|
});
|
@@ -103,13 +106,12 @@ var BrbState = exports.BrbState = /*#__PURE__*/function () {
|
|
103
106
|
/**
|
104
107
|
* Send the local brb state to the server
|
105
108
|
*
|
106
|
-
* @param {SendSlotManager} sendSlotManager
|
107
109
|
* @returns {Promise}
|
108
110
|
*/
|
109
111
|
}, {
|
110
112
|
key: "sendLocalBrbStateToServer",
|
111
113
|
value: (function () {
|
112
|
-
var _sendLocalBrbStateToServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(
|
114
|
+
var _sendLocalBrbStateToServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
113
115
|
var enabled, errorMessage, error, _errorMessage, _error;
|
114
116
|
return _regenerator.default.wrap(function _callee$(_context) {
|
115
117
|
while (1) switch (_context.prev = _context.next) {
|
@@ -138,8 +140,6 @@ var BrbState = exports.BrbState = /*#__PURE__*/function () {
|
|
138
140
|
locusUrl: this.meeting.locusUrl,
|
139
141
|
deviceUrl: this.meeting.deviceUrl,
|
140
142
|
selfId: this.meeting.selfId
|
141
|
-
}).then(function () {
|
142
|
-
sendSlotManager.setSourceStateOverride(_internalMediaCore.MediaType.VideoMain, enabled ? 'away' : null);
|
143
143
|
}).catch(function (error) {
|
144
144
|
_loggerProxy.default.logger.error('Meeting:brbState#sendLocalBrbStateToServer: Error ', error);
|
145
145
|
return _promise.default.reject(error);
|
@@ -150,7 +150,7 @@ var BrbState = exports.BrbState = /*#__PURE__*/function () {
|
|
150
150
|
}
|
151
151
|
}, _callee, this);
|
152
152
|
}));
|
153
|
-
function sendLocalBrbStateToServer(
|
153
|
+
function sendLocalBrbStateToServer() {
|
154
154
|
return _sendLocalBrbStateToServer.apply(this, arguments);
|
155
155
|
}
|
156
156
|
return sendLocalBrbStateToServer;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_internalMediaCore","require","_loggerProxy","_interopRequireDefault","createBrbState","exports","meeting","enabled","LoggerProxy","logger","info","concat","id","brbState","BrbState","_classCallCheck2","default","_defineProperty2","state","client","server","syncToServerInProgress","_createClass2","key","value","enable","sendSlotManager","applyClientStateToServer","_this","_promise","resolve","remoteBrbRequiresSync","sendLocalBrbStateToServer","then","handleServerBrbUpdate","catch","error","warn","reject","_sendLocalBrbStateToServer","_asyncToGenerator2","_regenerator","mark","_callee","errorMessage","_errorMessage","_error","wrap","_callee$","_context","prev","next","isMultistream","Error","abrupt","mediaProperties","webrtcMediaConnection","meetingRequest","setBrb","locusUrl","deviceUrl","selfId","setSourceStateOverride","MediaType","VideoMain","stop","_x","apply","arguments"],"sources":["brbState.ts"],"sourcesContent":["import {MediaType} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport type Meeting from '.';\nimport SendSlotManager from '../multistream/sendSlotManager';\n\nexport const createBrbState = (meeting: Meeting, enabled: boolean) => {\n LoggerProxy.logger.info(\n `Meeting:brbState#createBrbState: creating BrbState for meeting id ${meeting?.id}`\n );\n\n const brbState = new BrbState(meeting, enabled);\n\n return brbState;\n};\n\n/** The purpose of this class is to manage the local and remote brb state\n * and make sure that the server state always matches the last requested state by the client.\n */\nexport class BrbState {\n state: {\n client: {\n enabled: boolean;\n };\n server: {\n enabled: boolean;\n };\n syncToServerInProgress: boolean;\n };\n\n meeting: Meeting;\n\n /**\n * Constructor\n *\n * @param {Meeting} meeting - the meeting object\n * @param {boolean} enabled - whether the client audio/video is enabled at all\n */\n constructor(meeting: Meeting, enabled: boolean) {\n this.meeting = meeting;\n this.state = {\n client: {\n enabled,\n },\n server: {\n enabled: false,\n },\n syncToServerInProgress: false,\n };\n }\n\n /**\n * Enables/disables brb\n *\n * @param {boolean} enabled\n * @param {SendSlotManager} sendSlotManager\n * @returns {Promise}\n */\n public enable(enabled: boolean, sendSlotManager: SendSlotManager) {\n this.state.client.enabled = enabled;\n\n return this.applyClientStateToServer(sendSlotManager);\n }\n\n /**\n * Updates the server local and remote brb values so that they match the current client desired state.\n *\n * @param {SendSlotManager} sendSlotManager\n * @returns {Promise}\n */\n private applyClientStateToServer(sendSlotManager: SendSlotManager) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: request to server in progress, we need to wait for it to complete`\n );\n\n return Promise.resolve();\n }\n\n const remoteBrbRequiresSync = this.state.client.enabled !== this.state.server.enabled;\n\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: remoteBrbRequiresSync: ${remoteBrbRequiresSync}`\n );\n\n if (!remoteBrbRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: client state already matching server state, nothing to do`\n );\n\n return Promise.resolve();\n }\n\n this.state.syncToServerInProgress = true;\n\n return this.sendLocalBrbStateToServer(sendSlotManager)\n .then(() => {\n this.state.syncToServerInProgress = false;\n\n // This is a workaround for the fact that the server does not send the brb state\n // in the locus update when a user joins from multiple devices but not all devices are requested brb.\n // In the future, this could be improved with a new brb locus update handler\n // https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-655626\n this.handleServerBrbUpdate(this.state.client.enabled);\n\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: sync with server completed`\n );\n\n // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync\n this.applyClientStateToServer(sendSlotManager);\n })\n .catch((error) => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.warn(`Meeting:brbState#applyClientStateToServer: Error: ${error}`);\n\n return Promise.reject(error);\n });\n }\n\n /**\n * Send the local brb state to the server\n *\n * @param {SendSlotManager} sendSlotManager\n * @returns {Promise}\n */\n private async sendLocalBrbStateToServer(sendSlotManager: SendSlotManager) {\n const {enabled} = this.state.client;\n\n if (!this.meeting.isMultistream) {\n const errorMessage = 'Meeting:brbState#sendLocalBrbStateToServer: Not a multistream meeting';\n const error = new Error(errorMessage);\n\n LoggerProxy.logger.error(error);\n\n return Promise.reject(error);\n }\n\n if (!this.meeting.mediaProperties.webrtcMediaConnection) {\n const errorMessage =\n 'Meeting:brbState#sendLocalBrbStateToServer: WebRTC media connection is not defined';\n const error = new Error(errorMessage);\n\n LoggerProxy.logger.error(error);\n\n return Promise.reject(error);\n }\n\n // this logic should be applied only to multistream meetings\n return this.meeting.meetingRequest\n .setBrb({\n enabled,\n locusUrl: this.meeting.locusUrl,\n deviceUrl: this.meeting.deviceUrl,\n selfId: this.meeting.selfId,\n })\n .then(() => {\n sendSlotManager.setSourceStateOverride(MediaType.VideoMain, enabled ? 'away' : null);\n })\n .catch((error) => {\n LoggerProxy.logger.error('Meeting:brbState#sendLocalBrbStateToServer: Error ', error);\n\n return Promise.reject(error);\n });\n }\n\n /**\n * This method should be called whenever the server brb state is changed\n *\n * @param {Boolean} [enabled] true if user has brb enabled, false otherwise\n * @returns {undefined}\n */\n public handleServerBrbUpdate(enabled?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:brbState#handleServerBrbUpdate: updating server brb to (${enabled})`\n );\n this.state.server.enabled = !!enabled;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIO,IAAMG,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAIE,OAAgB,EAAEC,OAAgB,EAAK;EACpEC,oBAAW,CAACC,MAAM,C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eAAe,CAACoC,sBAAsB,CAACC,4BAAS,CAACC,SAAS,EAAEzD,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;cACtF,CAAC,CAAC,CACD4B,KAAK,CAAC,UAACC,KAAK,EAAK;gBAChB5B,oBAAW,CAACC,MAAM,CAAC2B,KAAK,CAAC,oDAAoD,EAAEA,KAAK,CAAC;gBAErF,OAAOP,QAAA,CAAAb,OAAA,CAAQsB,MAAM,CAACF,KAAK,CAAC;cAC9B,CAAC,CAAC;YAAA;YAAA;cAAA,OAAAa,QAAA,CAAAgB,IAAA;UAAA;QAAA,GAAAtB,OAAA;MAAA,CACL;MAAA,SAAAX,0BAAAkC,EAAA;QAAA,OAAA3B,0BAAA,CAAA4B,KAAA,OAAAC,SAAA;MAAA;MAAA,OAAApC,yBAAA;IAAA;IAED;AACF;AACA;AACA;AACA;AACA;IALE;EAAA;IAAAT,GAAA;IAAAC,KAAA,EAMA,SAAAU,sBAA6B3B,OAAiB,EAAE;MAC9CC,oBAAW,CAACC,MAAM,CAACC,IAAI,oEAAAC,MAAA,CAC8CJ,OAAO,MAC5E,CAAC;MACD,IAAI,CAACW,KAAK,CAACE,MAAM,CAACb,OAAO,GAAG,CAAC,CAACA,OAAO;IACvC;EAAC;EAAA,OAAAO,QAAA;AAAA"}
|
1
|
+
{"version":3,"names":["_internalMediaCore","require","_loggerProxy","_interopRequireDefault","createBrbState","exports","meeting","enabled","LoggerProxy","logger","info","concat","id","brbState","BrbState","_classCallCheck2","default","_defineProperty2","state","client","server","syncToServerInProgress","_createClass2","key","value","enable","sendSlotManager","_this","applyClientStateToServer","finally","setSourceStateOverride","MediaType","VideoMain","_this2","_promise","resolve","remoteBrbRequiresSync","sendLocalBrbStateToServer","then","handleServerBrbUpdate","catch","error","warn","reject","_sendLocalBrbStateToServer","_asyncToGenerator2","_regenerator","mark","_callee","errorMessage","_errorMessage","_error","wrap","_callee$","_context","prev","next","isMultistream","Error","abrupt","mediaProperties","webrtcMediaConnection","meetingRequest","setBrb","locusUrl","deviceUrl","selfId","stop","apply","arguments"],"sources":["brbState.ts"],"sourcesContent":["import {MediaType} from '@webex/internal-media-core';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport type Meeting from '.';\nimport SendSlotManager from '../multistream/sendSlotManager';\n\nexport const createBrbState = (meeting: Meeting, enabled: boolean) => {\n LoggerProxy.logger.info(\n `Meeting:brbState#createBrbState: creating BrbState for meeting id ${meeting?.id}`\n );\n\n const brbState = new BrbState(meeting, enabled);\n\n return brbState;\n};\n\n/** The purpose of this class is to manage the local and remote brb state\n * and make sure that the server state always matches the last requested state by the client.\n */\nexport class BrbState {\n state: {\n client: {\n enabled: boolean;\n };\n server: {\n enabled: boolean;\n };\n syncToServerInProgress: boolean;\n };\n\n meeting: Meeting;\n\n /**\n * Constructor\n *\n * @param {Meeting} meeting - the meeting object\n * @param {boolean} enabled - whether the client audio/video is enabled at all\n */\n constructor(meeting: Meeting, enabled: boolean) {\n this.meeting = meeting;\n this.state = {\n client: {\n enabled,\n },\n server: {\n enabled: false,\n },\n syncToServerInProgress: false,\n };\n }\n\n /**\n * Enables/disables brb\n *\n * @param {boolean} enabled\n * @param {SendSlotManager} sendSlotManager\n * @returns {Promise}\n */\n public enable(enabled: boolean, sendSlotManager: SendSlotManager) {\n this.state.client.enabled = enabled;\n\n return this.applyClientStateToServer(sendSlotManager).finally(() => {\n sendSlotManager.setSourceStateOverride(\n MediaType.VideoMain,\n this.state.client.enabled ? 'away' : null\n );\n });\n }\n\n /**\n * Updates the server local and remote brb values so that they match the current client desired state.\n *\n * @param {SendSlotManager} sendSlotManager\n * @returns {Promise}\n */\n private applyClientStateToServer(sendSlotManager: SendSlotManager) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: request to server in progress, we need to wait for it to complete`\n );\n\n return Promise.resolve();\n }\n\n const remoteBrbRequiresSync = this.state.client.enabled !== this.state.server.enabled;\n\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: remoteBrbRequiresSync: ${remoteBrbRequiresSync}`\n );\n\n if (!remoteBrbRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: client state already matching server state, nothing to do`\n );\n\n return Promise.resolve();\n }\n\n this.state.syncToServerInProgress = true;\n\n return this.sendLocalBrbStateToServer()\n .then(() => {\n this.state.syncToServerInProgress = false;\n\n // This is a workaround for the fact that the server does not send the brb state\n // in the locus update when a user joins from multiple devices but not all devices are requested brb.\n // In the future, this could be improved with a new brb locus update handler\n // https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-655626\n this.handleServerBrbUpdate(this.state.client.enabled);\n\n LoggerProxy.logger.info(\n `Meeting:brbState#applyClientStateToServer: sync with server completed`\n );\n\n // need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync\n this.applyClientStateToServer(sendSlotManager);\n })\n .catch((error) => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.warn(`Meeting:brbState#applyClientStateToServer: Error: ${error}`);\n\n return Promise.reject(error);\n });\n }\n\n /**\n * Send the local brb state to the server\n *\n * @returns {Promise}\n */\n private async sendLocalBrbStateToServer() {\n const {enabled} = this.state.client;\n\n if (!this.meeting.isMultistream) {\n const errorMessage = 'Meeting:brbState#sendLocalBrbStateToServer: Not a multistream meeting';\n const error = new Error(errorMessage);\n\n LoggerProxy.logger.error(error);\n\n return Promise.reject(error);\n }\n\n if (!this.meeting.mediaProperties.webrtcMediaConnection) {\n const errorMessage =\n 'Meeting:brbState#sendLocalBrbStateToServer: WebRTC media connection is not defined';\n const error = new Error(errorMessage);\n\n LoggerProxy.logger.error(error);\n\n return Promise.reject(error);\n }\n\n // this logic should be applied only to multistream meetings\n return this.meeting.meetingRequest\n .setBrb({\n enabled,\n locusUrl: this.meeting.locusUrl,\n deviceUrl: this.meeting.deviceUrl,\n selfId: this.meeting.selfId,\n })\n .catch((error) => {\n LoggerProxy.logger.error('Meeting:brbState#sendLocalBrbStateToServer: Error ', error);\n\n return Promise.reject(error);\n });\n }\n\n /**\n * This method should be called whenever the server brb state is changed\n *\n * @param {Boolean} [enabled] true if user has brb enabled, false otherwise\n * @returns {undefined}\n */\n public handleServerBrbUpdate(enabled?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:brbState#handleServerBrbUpdate: updating server brb to (${enabled})`\n );\n this.state.server.enabled = !!enabled;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIO,IAAMG,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,SAAjBA,cAAcA,CAAIE,OAAgB,EAAEC,OAAgB,EAAK;EACpEC,oBAAW,CAACC,MAAM,CAACC,IAAI,sEAAAC,MAAA,CACgDL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM,EAAE,CAClF,CAAC;EAED,IAAMC,QAAQ,GAAG,IAAIC,QAAQ,CAACR,OAAO,EAAEC,OAAO,CAAC;EAE/C,OAAOM,QAAQ;AACjB,CAAC;;AAED;AACA;AACA;AAFA,IAGaC,QAAQ,GAAAT,OAAA,CAAAS,QAAA;EAanB;AACF;AACA;AACA;AACA;AACA;EACE,SAAAA,SAAYR,OAAgB,EAAEC,OAAgB,EAAE;IAAA,IAAAQ,gBAAA,CAAAC,OAAA,QAAAF,QAAA;IAAA,IAAAG,gBAAA,CAAAD,OAAA;IAAA,IAAAC,gBAAA,CAAAD,OAAA;IAC9C,IAAI,CAACV,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACY,KAAK,GAAG;MACXC,MAAM,EAAE;QACNZ,OAAO,EAAPA;MACF,CAAC;MACDa,MAAM,EAAE;QACNb,OAAO,EAAE;MACX,CAAC;MACDc,sBAAsB,EAAE;IAC1B,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE,IAAAC,aAAA,CAAAN,OAAA,EAAAF,QAAA;IAAAS,GAAA;IAAAC,KA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,MAAM,CAACb,OAAO,GAAG,CAAC,CAACA,OAAO;IACvC;EAAC;EAAA,OAAAO,QAAA;AAAA"}
|
@@ -13,11 +13,21 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
15
15
|
var _internalMediaCore = require("@webex/internal-media-core");
|
16
|
+
/**
|
17
|
+
* This class is used to manage the sendSlots for the given media types.
|
18
|
+
*/
|
16
19
|
var SendSlotManager = exports.default = /*#__PURE__*/function () {
|
20
|
+
/**
|
21
|
+
* Constructor for SendSlotManager
|
22
|
+
*
|
23
|
+
* @param {any} LoggerProxy is used to log the messages
|
24
|
+
* @constructor
|
25
|
+
*/
|
17
26
|
function SendSlotManager(LoggerProxy) {
|
18
27
|
(0, _classCallCheck2.default)(this, SendSlotManager);
|
19
28
|
(0, _defineProperty2.default)(this, "slots", new _map.default());
|
20
29
|
(0, _defineProperty2.default)(this, "LoggerProxy", void 0);
|
30
|
+
(0, _defineProperty2.default)(this, "sourceStateOverrides", new _map.default());
|
21
31
|
this.LoggerProxy = LoggerProxy;
|
22
32
|
}
|
23
33
|
|
@@ -87,18 +97,38 @@ var SendSlotManager = exports.default = /*#__PURE__*/function () {
|
|
87
97
|
key: "setSourceStateOverride",
|
88
98
|
value: function setSourceStateOverride(mediaType, state) {
|
89
99
|
if (mediaType !== _internalMediaCore.MediaType.VideoMain) {
|
90
|
-
throw new Error("
|
100
|
+
throw new Error("Invalid media type '".concat(mediaType, "'. Source state overrides are only applicable to ").concat(_internalMediaCore.MediaType.VideoMain, "."));
|
91
101
|
}
|
92
102
|
var slot = this.slots.get(mediaType);
|
93
103
|
if (!slot) {
|
94
104
|
throw new Error("Slot for ".concat(mediaType, " does not exist"));
|
95
105
|
}
|
106
|
+
var currentStateOverride = this.getSourceStateOverride(mediaType);
|
107
|
+
if (currentStateOverride === state) {
|
108
|
+
return;
|
109
|
+
}
|
96
110
|
if (state) {
|
97
111
|
slot.setSourceStateOverride(state);
|
112
|
+
this.sourceStateOverrides.set(mediaType, state);
|
98
113
|
} else {
|
99
114
|
slot.clearSourceStateOverride();
|
115
|
+
this.sourceStateOverrides.delete(mediaType);
|
116
|
+
}
|
117
|
+
this.LoggerProxy.logger.info("SendSlotManager->setSourceStateOverride#set source state override for ".concat(mediaType, " to ").concat(state));
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Gets the source state override for the given media type.
|
122
|
+
* @param {MediaType} mediaType - The type of media to get the source state override for.
|
123
|
+
* @returns {StreamState | null} - The current source state override or null if not set.
|
124
|
+
*/
|
125
|
+
}, {
|
126
|
+
key: "getSourceStateOverride",
|
127
|
+
value: function getSourceStateOverride(mediaType) {
|
128
|
+
if (mediaType !== _internalMediaCore.MediaType.VideoMain) {
|
129
|
+
throw new Error("Invalid media type '".concat(mediaType, "'. Source state overrides are only applicable to ").concat(_internalMediaCore.MediaType.VideoMain, "."));
|
100
130
|
}
|
101
|
-
this.
|
131
|
+
return this.sourceStateOverrides.get(mediaType) || null;
|
102
132
|
}
|
103
133
|
|
104
134
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_internalMediaCore","require","SendSlotManager","exports","default","LoggerProxy","_classCallCheck2","_defineProperty2","_map","_createClass2","key","value","createSlot","mediaConnection","mediaType","active","arguments","length","undefined","slots","has","Error","concat","slot","createSendSlot","set","logger","info","getSlot","get","setNamedMediaGroups","namedMediaGroups","MediaType","AudioMain","setSourceStateOverride","state","VideoMain","clearSourceStateOverride","_publishStream","_asyncToGenerator2","_regenerator","mark","_callee","stream","wrap","_callee$","_context","prev","next","publishStream","label","muted","stop","_x","_x2","apply","_unpublishStream","_callee2","_callee2$","_context2","unpublishStream","_x3","setActive","_setCodecParameters","_callee3","codecParameters","_callee3$","_context3","setCodecParameters","_x4","_x5","_deleteCodecParameters","_callee4","parameters","_callee4$","_context4","deleteCodecParameters","_x6","_x7","reset","clear"],"sources":["sendSlotManager.ts"],"sourcesContent":["import {\n SendSlot,\n MediaType,\n LocalStream,\n MultistreamRoapMediaConnection,\n NamedMediaGroup,\n StreamState,\n} from '@webex/internal-media-core';\n\nexport default class SendSlotManager {\n private readonly slots: Map<MediaType, SendSlot> = new Map();\n private readonly LoggerProxy: any;\n\n constructor(LoggerProxy: any) {\n this.LoggerProxy = LoggerProxy;\n }\n\n /**\n * This method is used to create a sendSlot for the given mediaType and returns the created sendSlot\n * @param {MultistreamRoapMediaConnection} mediaConnection MultistreamRoapMediaConnection for which a sendSlot needs to be created\n * @param {MediaType} mediaType MediaType for which a sendSlot needs to be created (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active This is optional boolean to set the active state of the sendSlot. Default is true\n * @returns {SendSlot} slot The created sendSlot\n */\n public createSlot(\n mediaConnection: MultistreamRoapMediaConnection,\n mediaType: MediaType,\n active = true\n ): SendSlot {\n if (this.slots.has(mediaType)) {\n throw new Error(`Slot for ${mediaType} already exists`);\n }\n\n const slot: SendSlot = mediaConnection.createSendSlot(mediaType, active);\n\n this.slots.set(mediaType, slot);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->createSlot#Created slot for ${mediaType} with active ${active}`\n );\n\n return slot;\n }\n\n /**\n * This method is used to retrieve the sendSlot for the given mediaType\n * @param {MediaType} mediaType of which the slot needs to be retrieved\n * @returns {SendSlot}\n */\n public getSlot(mediaType: MediaType): SendSlot {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n return slot;\n }\n\n /**\n * Allow users to specify 'namedMediaGroups' to indicate which named media group its audio should be sent to.\n * @param {MediaType} mediaType MediaType of the sendSlot to which the audio stream needs to be send to the media group\n * @param {[]}namedMediaGroups - Allow users to specify 'namedMediaGroups'.If the value of 'namedMediaGroups' is zero,\n * named media group will be canceled and the audio stream will be sent to the floor.\n * @returns {void}\n */\n public setNamedMediaGroups(mediaType: MediaType, namedMediaGroups: NamedMediaGroup[]) {\n if (mediaType !== MediaType.AudioMain) {\n throw new Error(\n `sendSlotManager cannot set named media group which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.setNamedMediaGroups(namedMediaGroups);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setNamedMediaGroups#set named media group ${namedMediaGroups}`\n );\n }\n\n /**\n * Sets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media (must be MediaType.VideoMain to apply source state changes).\n * @param {StreamState | null} state - The state to set or null to clear the override value.\n * @returns {void}\n */\n public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `sendSlotManager cannot set source state override which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n if (state) {\n slot.setSourceStateOverride(state);\n } else {\n slot.clearSourceStateOverride();\n }\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`\n );\n }\n\n /**\n * This method publishes the given stream to the sendSlot for the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {LocalStream} stream LocalStream to be published\n * @returns {Promise<void>}\n */\n public async publishStream(mediaType: MediaType, stream: LocalStream): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.publishStream(stream);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->publishStream#Published stream for ${mediaType} and stream with label ${stream.label} and muted ${stream.muted}`\n );\n }\n\n /**\n * This method unpublishes the stream from the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot from which a stream needs to be unpublished (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @returns {Promise<void>}\n */\n public async unpublishStream(mediaType: MediaType): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.unpublishStream();\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->unpublishStream#Unpublished stream for ${mediaType}`\n );\n }\n\n /**\n * This method is used to set the active state of the sendSlot for the given mediaType\n * @param {MediaType} mediaType The MediaType of the sendSlot for which the active state needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active The boolean to set the active state of the sendSlot. Default is true\n * @returns {void}\n */\n public setActive(mediaType: MediaType, active = true): void {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.active = active;\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setActive#Set active for ${mediaType} to ${active}`\n );\n }\n\n /**\n * This method is used to set the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Object} codecParameters\n * @returns {Promise<void>}\n */\n public async setCodecParameters(\n mediaType: MediaType,\n codecParameters: {\n [key: string]: string | undefined; // As per ts-sdp undefined is considered as a valid value to be used for codec parameters\n }\n ): Promise<void> {\n // These codec parameter changes underneath are SDP value changes that are taken care by WCME automatically. So no need for any change in streams from the web sdk side\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.setCodecParameters(codecParameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setCodecParameters#Set codec parameters for ${mediaType} to ${codecParameters}`\n );\n }\n\n /**\n * This method is used to delete the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Array<String>} parameters Array of keys of the codec parameters to be deleted\n * @returns {Promise<void>}\n */\n public async deleteCodecParameters(mediaType: MediaType, parameters: string[]): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.deleteCodecParameters(parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->deleteCodecParameters#Deleted the following codec parameters -> ${parameters} for ${mediaType}`\n );\n }\n\n /**\n * This method is used to reset the SendSlotsManager by deleting all the sendSlots\n * @returns {undefined}\n */\n public reset(): void {\n this.slots.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAOoC,IAEfC,eAAe,GAAAC,OAAA,CAAAC,OAAA;EAIlC,SAAAF,gBAAYG,WAAgB,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,eAAA;IAAA,IAAAK,gBAAA,CAAAH,OAAA,iBAHqB,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAI1D,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE,IAAAI,aAAA,CAAAL,OAAA,EAAAF,eAAA;IAAAQ,GAAA;IAAAC,KAAA,EAOA,SAAAC,WACEC,eAA+C,EAC/CC,SAAoB,EAEV;MAAA,IADVC,MAAM,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;MAEb,IAAI,IAAI,CAACG,KAAK,CAACC,GAAG,CAACN,SAAS,CAAC,EAAE;QAC7B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AC;YAAA;cAAA,OAAA6D,SAAA,CAAAvB,IAAA;UAAA;QAAA,GAAAoB,QAAA;MAAA,CACH;MAAA,SAAAI,sBAAAC,GAAA,EAAAC,GAAA;QAAA,OAAAP,sBAAA,CAAAhB,KAAA,OAAAvC,SAAA;MAAA;MAAA,OAAA4D,qBAAA;IAAA;IAED;AACF;AACA;AACA;IAHE;EAAA;IAAAlE,GAAA;IAAAC,KAAA,EAIA,SAAAoE,MAAA,EAAqB;MACnB,IAAI,CAAC5D,KAAK,CAAC6D,KAAK,CAAC,CAAC;IACpB;EAAC;EAAA,OAAA9E,eAAA;AAAA"}
|
1
|
+
{"version":3,"names":["_internalMediaCore","require","SendSlotManager","exports","default","LoggerProxy","_classCallCheck2","_defineProperty2","_map","_createClass2","key","value","createSlot","mediaConnection","mediaType","active","arguments","length","undefined","slots","has","Error","concat","slot","createSendSlot","set","logger","info","getSlot","get","setNamedMediaGroups","namedMediaGroups","MediaType","AudioMain","setSourceStateOverride","state","VideoMain","currentStateOverride","getSourceStateOverride","sourceStateOverrides","clearSourceStateOverride","delete","_publishStream","_asyncToGenerator2","_regenerator","mark","_callee","stream","wrap","_callee$","_context","prev","next","publishStream","label","muted","stop","_x","_x2","apply","_unpublishStream","_callee2","_callee2$","_context2","unpublishStream","_x3","setActive","_setCodecParameters","_callee3","codecParameters","_callee3$","_context3","setCodecParameters","_x4","_x5","_deleteCodecParameters","_callee4","parameters","_callee4$","_context4","deleteCodecParameters","_x6","_x7","reset","clear"],"sources":["sendSlotManager.ts"],"sourcesContent":["import {\n SendSlot,\n MediaType,\n LocalStream,\n MultistreamRoapMediaConnection,\n NamedMediaGroup,\n StreamState,\n} from '@webex/internal-media-core';\n\n/**\n * This class is used to manage the sendSlots for the given media types.\n */\nexport default class SendSlotManager {\n private readonly slots: Map<MediaType, SendSlot> = new Map();\n private readonly LoggerProxy: any;\n private readonly sourceStateOverrides: Map<MediaType, StreamState> = new Map();\n\n /**\n * Constructor for SendSlotManager\n *\n * @param {any} LoggerProxy is used to log the messages\n * @constructor\n */\n constructor(LoggerProxy: any) {\n this.LoggerProxy = LoggerProxy;\n }\n\n /**\n * This method is used to create a sendSlot for the given mediaType and returns the created sendSlot\n * @param {MultistreamRoapMediaConnection} mediaConnection MultistreamRoapMediaConnection for which a sendSlot needs to be created\n * @param {MediaType} mediaType MediaType for which a sendSlot needs to be created (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active This is optional boolean to set the active state of the sendSlot. Default is true\n * @returns {SendSlot} slot The created sendSlot\n */\n public createSlot(\n mediaConnection: MultistreamRoapMediaConnection,\n mediaType: MediaType,\n active = true\n ): SendSlot {\n if (this.slots.has(mediaType)) {\n throw new Error(`Slot for ${mediaType} already exists`);\n }\n\n const slot: SendSlot = mediaConnection.createSendSlot(mediaType, active);\n\n this.slots.set(mediaType, slot);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->createSlot#Created slot for ${mediaType} with active ${active}`\n );\n\n return slot;\n }\n\n /**\n * This method is used to retrieve the sendSlot for the given mediaType\n * @param {MediaType} mediaType of which the slot needs to be retrieved\n * @returns {SendSlot}\n */\n public getSlot(mediaType: MediaType): SendSlot {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n return slot;\n }\n\n /**\n * Allow users to specify 'namedMediaGroups' to indicate which named media group its audio should be sent to.\n * @param {MediaType} mediaType MediaType of the sendSlot to which the audio stream needs to be send to the media group\n * @param {[]}namedMediaGroups - Allow users to specify 'namedMediaGroups'.If the value of 'namedMediaGroups' is zero,\n * named media group will be canceled and the audio stream will be sent to the floor.\n * @returns {void}\n */\n public setNamedMediaGroups(mediaType: MediaType, namedMediaGroups: NamedMediaGroup[]) {\n if (mediaType !== MediaType.AudioMain) {\n throw new Error(\n `sendSlotManager cannot set named media group which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.setNamedMediaGroups(namedMediaGroups);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setNamedMediaGroups#set named media group ${namedMediaGroups}`\n );\n }\n\n /**\n * Sets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media (must be MediaType.VideoMain to apply source state changes).\n * @param {StreamState | null} state - The state to set or null to clear the override value.\n * @returns {void}\n */\n public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n const currentStateOverride = this.getSourceStateOverride(mediaType);\n if (currentStateOverride === state) {\n return;\n }\n\n if (state) {\n slot.setSourceStateOverride(state);\n this.sourceStateOverrides.set(mediaType, state);\n } else {\n slot.clearSourceStateOverride();\n this.sourceStateOverrides.delete(mediaType);\n }\n\n this.LoggerProxy.logger.info(\n `SendSlotManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`\n );\n }\n\n /**\n * Gets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media to get the source state override for.\n * @returns {StreamState | null} - The current source state override or null if not set.\n */\n private getSourceStateOverride(mediaType: MediaType): StreamState | null {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n return this.sourceStateOverrides.get(mediaType) || null;\n }\n\n /**\n * This method publishes the given stream to the sendSlot for the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {LocalStream} stream LocalStream to be published\n * @returns {Promise<void>}\n */\n public async publishStream(mediaType: MediaType, stream: LocalStream): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.publishStream(stream);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->publishStream#Published stream for ${mediaType} and stream with label ${stream.label} and muted ${stream.muted}`\n );\n }\n\n /**\n * This method unpublishes the stream from the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot from which a stream needs to be unpublished (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @returns {Promise<void>}\n */\n public async unpublishStream(mediaType: MediaType): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.unpublishStream();\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->unpublishStream#Unpublished stream for ${mediaType}`\n );\n }\n\n /**\n * This method is used to set the active state of the sendSlot for the given mediaType\n * @param {MediaType} mediaType The MediaType of the sendSlot for which the active state needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active The boolean to set the active state of the sendSlot. Default is true\n * @returns {void}\n */\n public setActive(mediaType: MediaType, active = true): void {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.active = active;\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setActive#Set active for ${mediaType} to ${active}`\n );\n }\n\n /**\n * This method is used to set the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Object} codecParameters\n * @returns {Promise<void>}\n */\n public async setCodecParameters(\n mediaType: MediaType,\n codecParameters: {\n [key: string]: string | undefined; // As per ts-sdp undefined is considered as a valid value to be used for codec parameters\n }\n ): Promise<void> {\n // These codec parameter changes underneath are SDP value changes that are taken care by WCME automatically. So no need for any change in streams from the web sdk side\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.setCodecParameters(codecParameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setCodecParameters#Set codec parameters for ${mediaType} to ${codecParameters}`\n );\n }\n\n /**\n * This method is used to delete the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Array<String>} parameters Array of keys of the codec parameters to be deleted\n * @returns {Promise<void>}\n */\n public async deleteCodecParameters(mediaType: MediaType, parameters: string[]): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.deleteCodecParameters(parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->deleteCodecParameters#Deleted the following codec parameters -> ${parameters} for ${mediaType}`\n );\n }\n\n /**\n * This method is used to reset the SendSlotsManager by deleting all the sendSlots\n * @returns {undefined}\n */\n public reset(): void {\n this.slots.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AASA;AACA;AACA;AAFA,IAGqBC,eAAe,GAAAC,OAAA,CAAAC,OAAA;EAKlC;AACF;AACA;AACA;AACA;AACA;EACE,SAAAF,gBAAYG,WAAgB,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,eAAA;IAAA,IAAAK,gBAAA,CAAAH,OAAA,iBAVqB,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAAA,IAAAG,gBAAA,CAAAH,OAAA,gCAES,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAS5E,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA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EAAqB;MACnB,IAAI,CAAChE,KAAK,CAACiE,KAAK,CAAC,CAAC;IACpB;EAAC;EAAA,OAAAlF,eAAA;AAAA"}
|
@@ -1,7 +1,17 @@
|
|
1
1
|
import { SendSlot, MediaType, LocalStream, MultistreamRoapMediaConnection, NamedMediaGroup, StreamState } from '@webex/internal-media-core';
|
2
|
+
/**
|
3
|
+
* This class is used to manage the sendSlots for the given media types.
|
4
|
+
*/
|
2
5
|
export default class SendSlotManager {
|
3
6
|
private readonly slots;
|
4
7
|
private readonly LoggerProxy;
|
8
|
+
private readonly sourceStateOverrides;
|
9
|
+
/**
|
10
|
+
* Constructor for SendSlotManager
|
11
|
+
*
|
12
|
+
* @param {any} LoggerProxy is used to log the messages
|
13
|
+
* @constructor
|
14
|
+
*/
|
5
15
|
constructor(LoggerProxy: any);
|
6
16
|
/**
|
7
17
|
* This method is used to create a sendSlot for the given mediaType and returns the created sendSlot
|
@@ -32,6 +42,12 @@ export default class SendSlotManager {
|
|
32
42
|
* @returns {void}
|
33
43
|
*/
|
34
44
|
setSourceStateOverride(mediaType: MediaType, state: StreamState | null): void;
|
45
|
+
/**
|
46
|
+
* Gets the source state override for the given media type.
|
47
|
+
* @param {MediaType} mediaType - The type of media to get the source state override for.
|
48
|
+
* @returns {StreamState | null} - The current source state override or null if not set.
|
49
|
+
*/
|
50
|
+
private getSourceStateOverride;
|
35
51
|
/**
|
36
52
|
* This method publishes the given stream to the sendSlot for the given mediaType
|
37
53
|
* @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)
|
package/dist/webinar/index.js
CHANGED
package/package.json
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
"@webex/eslint-config-legacy": "0.0.0",
|
44
44
|
"@webex/jest-config-legacy": "0.0.0",
|
45
45
|
"@webex/legacy-tools": "0.0.0",
|
46
|
-
"@webex/plugin-meetings": "3.8.1-next.
|
46
|
+
"@webex/plugin-meetings": "3.8.1-next.16",
|
47
47
|
"@webex/plugin-rooms": "3.8.1-next.2",
|
48
48
|
"@webex/test-helper-chai": "3.8.1-next.5",
|
49
49
|
"@webex/test-helper-mocha": "3.8.1-next.5",
|
@@ -71,7 +71,7 @@
|
|
71
71
|
"@webex/internal-plugin-metrics": "3.8.1-next.5",
|
72
72
|
"@webex/internal-plugin-support": "3.8.1-next.5",
|
73
73
|
"@webex/internal-plugin-user": "3.8.1-next.5",
|
74
|
-
"@webex/internal-plugin-voicea": "3.8.1-next.
|
74
|
+
"@webex/internal-plugin-voicea": "3.8.1-next.16",
|
75
75
|
"@webex/media-helpers": "3.8.1-next.7",
|
76
76
|
"@webex/plugin-people": "3.8.1-next.5",
|
77
77
|
"@webex/plugin-rooms": "3.8.1-next.2",
|
@@ -93,5 +93,5 @@
|
|
93
93
|
"//": [
|
94
94
|
"TODO: upgrade jwt-decode when moving to node 18"
|
95
95
|
],
|
96
|
-
"version": "3.8.1-next.
|
96
|
+
"version": "3.8.1-next.16"
|
97
97
|
}
|
package/src/meeting/brbState.ts
CHANGED
@@ -58,7 +58,12 @@ export class BrbState {
|
|
58
58
|
public enable(enabled: boolean, sendSlotManager: SendSlotManager) {
|
59
59
|
this.state.client.enabled = enabled;
|
60
60
|
|
61
|
-
return this.applyClientStateToServer(sendSlotManager)
|
61
|
+
return this.applyClientStateToServer(sendSlotManager).finally(() => {
|
62
|
+
sendSlotManager.setSourceStateOverride(
|
63
|
+
MediaType.VideoMain,
|
64
|
+
this.state.client.enabled ? 'away' : null
|
65
|
+
);
|
66
|
+
});
|
62
67
|
}
|
63
68
|
|
64
69
|
/**
|
@@ -92,7 +97,7 @@ export class BrbState {
|
|
92
97
|
|
93
98
|
this.state.syncToServerInProgress = true;
|
94
99
|
|
95
|
-
return this.sendLocalBrbStateToServer(
|
100
|
+
return this.sendLocalBrbStateToServer()
|
96
101
|
.then(() => {
|
97
102
|
this.state.syncToServerInProgress = false;
|
98
103
|
|
@@ -120,10 +125,9 @@ export class BrbState {
|
|
120
125
|
/**
|
121
126
|
* Send the local brb state to the server
|
122
127
|
*
|
123
|
-
* @param {SendSlotManager} sendSlotManager
|
124
128
|
* @returns {Promise}
|
125
129
|
*/
|
126
|
-
private async sendLocalBrbStateToServer(
|
130
|
+
private async sendLocalBrbStateToServer() {
|
127
131
|
const {enabled} = this.state.client;
|
128
132
|
|
129
133
|
if (!this.meeting.isMultistream) {
|
@@ -153,9 +157,6 @@ export class BrbState {
|
|
153
157
|
deviceUrl: this.meeting.deviceUrl,
|
154
158
|
selfId: this.meeting.selfId,
|
155
159
|
})
|
156
|
-
.then(() => {
|
157
|
-
sendSlotManager.setSourceStateOverride(MediaType.VideoMain, enabled ? 'away' : null);
|
158
|
-
})
|
159
160
|
.catch((error) => {
|
160
161
|
LoggerProxy.logger.error('Meeting:brbState#sendLocalBrbStateToServer: Error ', error);
|
161
162
|
|
@@ -7,10 +7,20 @@ import {
|
|
7
7
|
StreamState,
|
8
8
|
} from '@webex/internal-media-core';
|
9
9
|
|
10
|
+
/**
|
11
|
+
* This class is used to manage the sendSlots for the given media types.
|
12
|
+
*/
|
10
13
|
export default class SendSlotManager {
|
11
14
|
private readonly slots: Map<MediaType, SendSlot> = new Map();
|
12
15
|
private readonly LoggerProxy: any;
|
16
|
+
private readonly sourceStateOverrides: Map<MediaType, StreamState> = new Map();
|
13
17
|
|
18
|
+
/**
|
19
|
+
* Constructor for SendSlotManager
|
20
|
+
*
|
21
|
+
* @param {any} LoggerProxy is used to log the messages
|
22
|
+
* @constructor
|
23
|
+
*/
|
14
24
|
constructor(LoggerProxy: any) {
|
15
25
|
this.LoggerProxy = LoggerProxy;
|
16
26
|
}
|
@@ -93,7 +103,7 @@ export default class SendSlotManager {
|
|
93
103
|
public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {
|
94
104
|
if (mediaType !== MediaType.VideoMain) {
|
95
105
|
throw new Error(
|
96
|
-
`
|
106
|
+
`Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`
|
97
107
|
);
|
98
108
|
}
|
99
109
|
|
@@ -103,17 +113,39 @@ export default class SendSlotManager {
|
|
103
113
|
throw new Error(`Slot for ${mediaType} does not exist`);
|
104
114
|
}
|
105
115
|
|
116
|
+
const currentStateOverride = this.getSourceStateOverride(mediaType);
|
117
|
+
if (currentStateOverride === state) {
|
118
|
+
return;
|
119
|
+
}
|
120
|
+
|
106
121
|
if (state) {
|
107
122
|
slot.setSourceStateOverride(state);
|
123
|
+
this.sourceStateOverrides.set(mediaType, state);
|
108
124
|
} else {
|
109
125
|
slot.clearSourceStateOverride();
|
126
|
+
this.sourceStateOverrides.delete(mediaType);
|
110
127
|
}
|
111
128
|
|
112
129
|
this.LoggerProxy.logger.info(
|
113
|
-
`
|
130
|
+
`SendSlotManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`
|
114
131
|
);
|
115
132
|
}
|
116
133
|
|
134
|
+
/**
|
135
|
+
* Gets the source state override for the given media type.
|
136
|
+
* @param {MediaType} mediaType - The type of media to get the source state override for.
|
137
|
+
* @returns {StreamState | null} - The current source state override or null if not set.
|
138
|
+
*/
|
139
|
+
private getSourceStateOverride(mediaType: MediaType): StreamState | null {
|
140
|
+
if (mediaType !== MediaType.VideoMain) {
|
141
|
+
throw new Error(
|
142
|
+
`Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`
|
143
|
+
);
|
144
|
+
}
|
145
|
+
|
146
|
+
return this.sourceStateOverrides.get(mediaType) || null;
|
147
|
+
}
|
148
|
+
|
117
149
|
/**
|
118
150
|
* This method publishes the given stream to the sendSlot for the given mediaType
|
119
151
|
* @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)
|
@@ -3,12 +3,12 @@ import {assert, expect} from '@webex/test-helper-chai';
|
|
3
3
|
|
4
4
|
import testUtils from '../../../utils/testUtils';
|
5
5
|
import {BrbState, createBrbState} from '@webex/plugin-meetings/src/meeting/brbState';
|
6
|
-
import
|
6
|
+
import {MediaType} from '@webex/internal-media-core';
|
7
7
|
|
8
8
|
describe('plugin-meetings', () => {
|
9
9
|
let meeting: any;
|
10
10
|
let brbState: BrbState;
|
11
|
-
let setBrbStub: sinon.SinonStub;
|
11
|
+
let setBrbStub: sinon.SinonStub;
|
12
12
|
|
13
13
|
beforeEach(async () => {
|
14
14
|
meeting = {
|
@@ -23,7 +23,7 @@ describe('plugin-meetings', () => {
|
|
23
23
|
setSourceStateOverride: sinon.stub(),
|
24
24
|
},
|
25
25
|
meetingRequest: {
|
26
|
-
setBrb: () => {}
|
26
|
+
setBrb: () => {},
|
27
27
|
},
|
28
28
|
};
|
29
29
|
|
@@ -104,12 +104,12 @@ describe('plugin-meetings', () => {
|
|
104
104
|
assert.isTrue(meeting.meetingRequest.setBrb.calledOnce);
|
105
105
|
});
|
106
106
|
|
107
|
-
it('
|
107
|
+
it('updates source state override', async () => {
|
108
108
|
brbState.enable(true, meeting.sendSlotManager);
|
109
109
|
brbState.handleServerBrbUpdate(true);
|
110
110
|
await testUtils.flushPromises();
|
111
111
|
|
112
|
-
assert.isTrue(meeting.sendSlotManager.setSourceStateOverride.
|
112
|
+
assert.isTrue(meeting.sendSlotManager.setSourceStateOverride.called);
|
113
113
|
});
|
114
114
|
|
115
115
|
it('handles server update', async () => {
|
@@ -141,12 +141,14 @@ describe('plugin-meetings', () => {
|
|
141
141
|
it('should reject when sendLocalBrbStateToServer fails', async () => {
|
142
142
|
const error = new Error('send failed');
|
143
143
|
setBrbStub.rejects(error);
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
).to.be.rejectedWith(error);
|
144
|
+
|
145
|
+
const enablePromise = brbState.enable(true, meeting.sendSlotManager);
|
146
|
+
await expect(enablePromise).to.be.rejectedWith(error);
|
148
147
|
|
149
148
|
assert.isFalse(brbState.state.syncToServerInProgress);
|
149
|
+
assert.isTrue(
|
150
|
+
meeting.sendSlotManager.setSourceStateOverride.calledWith(MediaType.VideoMain, 'away')
|
151
|
+
);
|
150
152
|
});
|
151
153
|
});
|
152
154
|
});
|
@@ -272,4 +272,63 @@ describe('SendSlotsManager', () => {
|
|
272
272
|
expect(() => sendSlotsManager.getSlot(MediaType.VideoSlides)).to.throw();
|
273
273
|
});
|
274
274
|
});
|
275
|
+
|
276
|
+
describe('sourceStateOverride', () => {
|
277
|
+
let mediaConnection: MultistreamRoapMediaConnection;
|
278
|
+
beforeEach(() => {
|
279
|
+
mediaConnection = {
|
280
|
+
createSendSlot: sinon.stub().returns({
|
281
|
+
setSourceStateOverride: sinon.stub().resolves(),
|
282
|
+
clearSourceStateOverride: sinon.stub().resolves(),
|
283
|
+
}),
|
284
|
+
} as MultistreamRoapMediaConnection;
|
285
|
+
});
|
286
|
+
|
287
|
+
it(`can set source state override for ${MediaType.VideoMain}`, () => {
|
288
|
+
const slot: any = sendSlotsManager.createSlot(mediaConnection, MediaType.VideoMain);
|
289
|
+
|
290
|
+
const set = () => sendSlotsManager.setSourceStateOverride(MediaType.VideoMain, 'away');
|
291
|
+
|
292
|
+
expect(set).not.to.throw();
|
293
|
+
expect(slot.setSourceStateOverride.calledWith('away')).to.be.true;
|
294
|
+
});
|
295
|
+
|
296
|
+
[MediaType.VideoSlides, MediaType.AudioMain, MediaType.AudioSlides].forEach((mediaType) => {
|
297
|
+
it(`can't set source state override for ${mediaType}`, () => {
|
298
|
+
const slot: any = sendSlotsManager.createSlot(mediaConnection, mediaType);
|
299
|
+
|
300
|
+
const set = () => sendSlotsManager.setSourceStateOverride(mediaType, 'away');
|
301
|
+
|
302
|
+
expect(set).to.throw();
|
303
|
+
expect(slot.setSourceStateOverride.called).to.be.false;
|
304
|
+
});
|
305
|
+
});
|
306
|
+
|
307
|
+
it("can't set source state override for non-existing slot", () => {
|
308
|
+
const set = () => sendSlotsManager.setSourceStateOverride(MediaType.VideoMain, 'away');
|
309
|
+
expect(set).to.throw(`Slot for ${MediaType.VideoMain} does not exist`);
|
310
|
+
});
|
311
|
+
|
312
|
+
it('can clear source state override', () => {
|
313
|
+
const slot: any = sendSlotsManager.createSlot(mediaConnection, MediaType.VideoMain);
|
314
|
+
sendSlotsManager.setSourceStateOverride(MediaType.VideoMain, 'away');
|
315
|
+
|
316
|
+
expect(slot.setSourceStateOverride.calledWith('away')).to.be.true;
|
317
|
+
expect(slot.clearSourceStateOverride.called).to.be.false;
|
318
|
+
|
319
|
+
sendSlotsManager.setSourceStateOverride(MediaType.VideoMain, null);
|
320
|
+
expect(slot.clearSourceStateOverride.called).to.be.true;
|
321
|
+
});
|
322
|
+
|
323
|
+
it("won't set source state override if it didn't change", () => {
|
324
|
+
const slot: any = sendSlotsManager.createSlot(mediaConnection, MediaType.VideoMain);
|
325
|
+
sendSlotsManager.setSourceStateOverride(MediaType.VideoMain, 'away');
|
326
|
+
|
327
|
+
expect(slot.setSourceStateOverride.calledWith('away')).to.be.true;
|
328
|
+
slot.setSourceStateOverride.resetHistory();
|
329
|
+
|
330
|
+
sendSlotsManager.setSourceStateOverride(MediaType.VideoMain, 'away');
|
331
|
+
expect(slot.setSourceStateOverride.called).to.be.false;
|
332
|
+
});
|
333
|
+
});
|
275
334
|
});
|