@webex/plugin-meetings 3.0.0-beta.31 → 3.0.0-beta.310
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/README.md +46 -8
- package/dist/annotation/annotation.types.js +7 -0
- package/dist/annotation/annotation.types.js.map +1 -0
- package/dist/annotation/constants.js +49 -0
- package/dist/annotation/constants.js.map +1 -0
- package/dist/annotation/index.js +342 -0
- package/dist/annotation/index.js.map +1 -0
- package/dist/breakouts/breakout.js +94 -15
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/edit-lock-error.js +52 -0
- package/dist/breakouts/edit-lock-error.js.map +1 -0
- package/dist/breakouts/events.js +45 -0
- package/dist/breakouts/events.js.map +1 -0
- package/dist/breakouts/index.js +709 -35
- package/dist/breakouts/index.js.map +1 -1
- package/dist/breakouts/utils.js +45 -1
- package/dist/breakouts/utils.js.map +1 -1
- package/dist/common/errors/no-meeting-info.js +51 -0
- package/dist/common/errors/no-meeting-info.js.map +1 -0
- package/dist/common/errors/reclaim-host-role-errors.js +158 -0
- package/dist/common/errors/reclaim-host-role-errors.js.map +1 -0
- package/dist/common/errors/webex-errors.js +48 -7
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/common/logs/logger-proxy.js +1 -1
- package/dist/common/logs/logger-proxy.js.map +1 -1
- package/dist/common/logs/request.js +5 -1
- package/dist/common/logs/request.js.map +1 -1
- package/dist/common/queue.js +24 -9
- package/dist/common/queue.js.map +1 -1
- package/dist/config.js +5 -11
- package/dist/config.js.map +1 -1
- package/dist/constants.js +233 -29
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/enums.js +14 -2
- package/dist/controls-options-manager/enums.js.map +1 -1
- package/dist/controls-options-manager/index.js +109 -15
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/types.js +7 -0
- package/dist/controls-options-manager/types.js.map +1 -0
- package/dist/controls-options-manager/util.js +309 -18
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/index.js +112 -1
- package/dist/index.js.map +1 -1
- package/dist/interpretation/collection.js +23 -0
- package/dist/interpretation/collection.js.map +1 -0
- package/dist/interpretation/index.js +366 -0
- package/dist/interpretation/index.js.map +1 -0
- package/dist/interpretation/siLanguage.js +25 -0
- package/dist/interpretation/siLanguage.js.map +1 -0
- package/dist/locus-info/controlsUtils.js +91 -2
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +383 -62
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +7 -1
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/mediaSharesUtils.js +57 -1
- package/dist/locus-info/mediaSharesUtils.js.map +1 -1
- package/dist/locus-info/parser.js +249 -72
- package/dist/locus-info/parser.js.map +1 -1
- package/dist/locus-info/selfUtils.js +89 -14
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/media/index.js +61 -116
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +73 -124
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +82 -2
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +3777 -2929
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +292 -0
- package/dist/meeting/locusMediaRequest.js.map +1 -0
- package/dist/meeting/muteState.js +230 -124
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +260 -196
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/util.js +601 -417
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/index.js +73 -7
- package/dist/meeting-info/index.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +192 -51
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meeting-info/util.js +1 -1
- package/dist/meeting-info/util.js.map +1 -1
- package/dist/meeting-info/utilv2.js +36 -36
- package/dist/meeting-info/utilv2.js.map +1 -1
- package/dist/meetings/collection.js +39 -0
- package/dist/meetings/collection.js.map +1 -1
- package/dist/meetings/index.js +415 -115
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +7 -0
- package/dist/meetings/meetings.types.js.map +1 -0
- package/dist/meetings/request.js +2 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +72 -6
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +58 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js +25 -0
- package/dist/member/types.js.map +1 -0
- package/dist/member/util.js +132 -25
- package/dist/member/util.js.map +1 -1
- package/dist/members/collection.js +10 -0
- package/dist/members/collection.js.map +1 -1
- package/dist/members/index.js +102 -6
- package/dist/members/index.js.map +1 -1
- package/dist/members/request.js +106 -38
- package/dist/members/request.js.map +1 -1
- package/dist/members/types.js +15 -0
- package/dist/members/types.js.map +1 -0
- package/dist/members/util.js +326 -232
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +13 -5
- package/dist/metrics/constants.js.map +1 -1
- package/dist/metrics/index.js +1 -468
- package/dist/metrics/index.js.map +1 -1
- package/dist/multistream/mediaRequestManager.js +238 -49
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +29 -16
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/receiveSlotManager.js +39 -36
- package/dist/multistream/receiveSlotManager.js.map +1 -1
- package/dist/multistream/remoteMedia.js +44 -18
- package/dist/multistream/remoteMedia.js.map +1 -1
- package/dist/multistream/remoteMediaGroup.js +60 -3
- package/dist/multistream/remoteMediaGroup.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +209 -59
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +233 -0
- package/dist/multistream/sendSlotManager.js.map +1 -0
- package/dist/reachability/index.js +225 -59
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/request.js +17 -8
- package/dist/reachability/request.js.map +1 -1
- package/dist/reconnection-manager/index.js +201 -156
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/recording-controller/index.js +21 -2
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/recording-controller/util.js +9 -8
- package/dist/recording-controller/util.js.map +1 -1
- package/dist/roap/index.js +62 -32
- package/dist/roap/index.js.map +1 -1
- package/dist/roap/request.js +112 -97
- package/dist/roap/request.js.map +1 -1
- package/dist/roap/turnDiscovery.js +95 -36
- package/dist/roap/turnDiscovery.js.map +1 -1
- package/dist/rtcMetrics/constants.js +12 -0
- package/dist/rtcMetrics/constants.js.map +1 -0
- package/dist/rtcMetrics/index.js +117 -0
- package/dist/rtcMetrics/index.js.map +1 -0
- package/dist/statsAnalyzer/index.js +86 -78
- package/dist/statsAnalyzer/index.js.map +1 -1
- package/dist/statsAnalyzer/mqaUtil.js +11 -10
- package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
- package/dist/types/annotation/annotation.types.d.ts +42 -0
- package/dist/types/annotation/constants.d.ts +31 -0
- package/dist/types/annotation/index.d.ts +117 -0
- package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
- package/dist/types/breakouts/events.d.ts +8 -0
- package/dist/types/breakouts/utils.d.ts +14 -0
- package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
- package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
- package/dist/types/common/errors/webex-errors.d.ts +25 -1
- package/dist/types/common/logs/request.d.ts +2 -0
- package/dist/types/common/queue.d.ts +9 -7
- package/dist/types/config.d.ts +1 -7
- package/dist/types/constants.d.ts +194 -24
- package/dist/types/controls-options-manager/enums.d.ts +11 -1
- package/dist/types/controls-options-manager/index.d.ts +17 -1
- package/dist/types/controls-options-manager/types.d.ts +43 -0
- package/dist/types/controls-options-manager/util.d.ts +1 -7
- package/dist/types/index.d.ts +6 -4
- package/dist/types/interpretation/collection.d.ts +5 -0
- package/dist/types/interpretation/index.d.ts +5 -0
- package/dist/types/interpretation/siLanguage.d.ts +5 -0
- package/dist/types/locus-info/index.d.ts +57 -4
- package/dist/types/locus-info/parser.d.ts +67 -6
- package/dist/types/media/index.d.ts +2 -0
- package/dist/types/media/properties.d.ts +34 -48
- package/dist/types/meeting/in-meeting-actions.d.ts +82 -2
- package/dist/types/meeting/index.d.ts +463 -510
- package/dist/types/meeting/locusMediaRequest.d.ts +74 -0
- package/dist/types/meeting/muteState.d.ts +99 -23
- package/dist/types/meeting/request.d.ts +72 -43
- package/dist/types/meeting/util.d.ts +101 -1
- package/dist/types/meeting-info/index.d.ts +13 -1
- package/dist/types/meeting-info/meeting-info-v2.d.ts +31 -1
- package/dist/types/meetings/collection.d.ts +17 -0
- package/dist/types/meetings/index.d.ts +98 -20
- package/dist/types/meetings/meetings.types.d.ts +4 -0
- package/dist/types/member/index.d.ts +14 -0
- package/dist/types/member/types.d.ts +32 -0
- package/dist/types/members/collection.d.ts +5 -0
- package/dist/types/members/index.d.ts +35 -2
- package/dist/types/members/request.d.ts +73 -9
- package/dist/types/members/types.d.ts +25 -0
- package/dist/types/members/util.d.ts +214 -1
- package/dist/types/metrics/constants.d.ts +12 -4
- package/dist/types/metrics/index.d.ts +4 -119
- package/dist/types/multistream/mediaRequestManager.d.ts +73 -5
- package/dist/types/multistream/receiveSlot.d.ts +13 -11
- package/dist/types/multistream/receiveSlotManager.d.ts +14 -4
- package/dist/types/multistream/remoteMedia.d.ts +8 -29
- package/dist/types/multistream/remoteMediaGroup.d.ts +0 -9
- package/dist/types/multistream/remoteMediaManager.d.ts +46 -2
- package/dist/types/multistream/sendSlotManager.d.ts +61 -0
- package/dist/types/reachability/index.d.ts +61 -7
- package/dist/types/reachability/request.d.ts +7 -3
- package/dist/types/reconnection-manager/index.d.ts +9 -0
- package/dist/types/recording-controller/index.d.ts +15 -1
- package/dist/types/recording-controller/util.d.ts +5 -4
- package/dist/types/roap/index.d.ts +2 -1
- package/dist/types/roap/request.d.ts +15 -11
- package/dist/types/roap/turnDiscovery.d.ts +21 -3
- package/dist/types/rtcMetrics/constants.d.ts +4 -0
- package/dist/types/rtcMetrics/index.d.ts +47 -0
- package/dist/types/statsAnalyzer/index.d.ts +7 -1
- package/dist/types/webinar/collection.d.ts +16 -0
- package/dist/types/webinar/index.d.ts +5 -0
- package/dist/webinar/collection.js +44 -0
- package/dist/webinar/collection.js.map +1 -0
- package/dist/webinar/index.js +69 -0
- package/dist/webinar/index.js.map +1 -0
- package/package.json +23 -20
- package/src/annotation/annotation.types.ts +50 -0
- package/src/annotation/constants.ts +36 -0
- package/src/annotation/index.ts +328 -0
- package/src/breakouts/README.md +42 -12
- package/src/breakouts/breakout.ts +67 -9
- package/src/breakouts/edit-lock-error.ts +25 -0
- package/src/breakouts/events.ts +56 -0
- package/src/breakouts/index.ts +592 -20
- package/src/breakouts/utils.ts +42 -0
- package/src/common/errors/no-meeting-info.ts +24 -0
- package/src/common/errors/reclaim-host-role-errors.ts +134 -0
- package/src/common/errors/webex-errors.ts +44 -2
- package/src/common/logs/logger-proxy.ts +1 -1
- package/src/common/logs/request.ts +5 -1
- package/src/common/queue.ts +22 -8
- package/src/config.ts +4 -10
- package/src/constants.ts +221 -19
- package/src/controls-options-manager/enums.ts +12 -0
- package/src/controls-options-manager/index.ts +116 -21
- package/src/controls-options-manager/types.ts +59 -0
- package/src/controls-options-manager/util.ts +294 -14
- package/src/index.ts +40 -0
- package/src/interpretation/README.md +60 -0
- package/src/interpretation/collection.ts +19 -0
- package/src/interpretation/index.ts +332 -0
- package/src/interpretation/siLanguage.ts +18 -0
- package/src/locus-info/controlsUtils.ts +108 -0
- package/src/locus-info/index.ts +413 -59
- package/src/locus-info/infoUtils.ts +10 -2
- package/src/locus-info/mediaSharesUtils.ts +64 -0
- package/src/locus-info/parser.ts +258 -47
- package/src/locus-info/selfUtils.ts +81 -5
- package/src/media/index.ts +102 -122
- package/src/media/properties.ts +87 -110
- package/src/meeting/in-meeting-actions.ts +163 -3
- package/src/meeting/index.ts +3132 -2541
- package/src/meeting/locusMediaRequest.ts +313 -0
- package/src/meeting/muteState.ts +229 -131
- package/src/meeting/request.ts +177 -121
- package/src/meeting/util.ts +588 -394
- package/src/meeting-info/index.ts +81 -8
- package/src/meeting-info/meeting-info-v2.ts +170 -14
- package/src/meeting-info/util.ts +1 -1
- package/src/meeting-info/utilv2.ts +23 -23
- package/src/meetings/collection.ts +33 -0
- package/src/meetings/index.ts +445 -123
- package/src/meetings/meetings.types.ts +12 -0
- package/src/meetings/request.ts +2 -0
- package/src/meetings/util.ts +80 -11
- package/src/member/index.ts +58 -0
- package/src/member/types.ts +38 -0
- package/src/member/util.ts +141 -25
- package/src/members/collection.ts +8 -0
- package/src/members/index.ts +134 -8
- package/src/members/request.ts +97 -17
- package/src/members/types.ts +29 -0
- package/src/members/util.ts +333 -240
- package/src/metrics/constants.ts +12 -4
- package/src/metrics/index.ts +1 -490
- package/src/multistream/mediaRequestManager.ts +289 -79
- package/src/multistream/receiveSlot.ts +31 -17
- package/src/multistream/receiveSlotManager.ts +34 -24
- package/src/multistream/remoteMedia.ts +27 -2
- package/src/multistream/remoteMediaGroup.ts +59 -0
- package/src/multistream/remoteMediaManager.ts +148 -30
- package/src/multistream/sendSlotManager.ts +170 -0
- package/src/reachability/index.ts +228 -37
- package/src/reachability/request.ts +17 -8
- package/src/reconnection-manager/index.ts +83 -56
- package/src/recording-controller/index.ts +20 -3
- package/src/recording-controller/util.ts +26 -9
- package/src/roap/index.ts +63 -32
- package/src/roap/request.ts +100 -104
- package/src/roap/turnDiscovery.ts +48 -26
- package/src/rtcMetrics/constants.ts +3 -0
- package/src/rtcMetrics/index.ts +100 -0
- package/src/statsAnalyzer/index.ts +105 -91
- package/src/statsAnalyzer/mqaUtil.ts +13 -14
- package/src/webinar/collection.ts +31 -0
- package/src/webinar/index.ts +62 -0
- package/test/integration/spec/converged-space-meetings.js +60 -3
- package/test/integration/spec/journey.js +320 -261
- package/test/integration/spec/space-meeting.js +76 -3
- package/test/unit/spec/annotation/index.ts +418 -0
- package/test/unit/spec/breakouts/breakout.ts +118 -28
- package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
- package/test/unit/spec/breakouts/events.ts +89 -0
- package/test/unit/spec/breakouts/index.ts +1395 -69
- package/test/unit/spec/breakouts/utils.js +52 -1
- package/test/unit/spec/common/queue.js +31 -2
- package/test/unit/spec/controls-options-manager/index.js +163 -0
- package/test/unit/spec/controls-options-manager/util.js +576 -60
- package/test/unit/spec/fixture/locus.js +1 -0
- package/test/unit/spec/interpretation/collection.ts +15 -0
- package/test/unit/spec/interpretation/index.ts +589 -0
- package/test/unit/spec/interpretation/siLanguage.ts +28 -0
- package/test/unit/spec/locus-info/controlsUtils.js +316 -43
- package/test/unit/spec/locus-info/index.js +1304 -33
- package/test/unit/spec/locus-info/infoUtils.js +37 -15
- package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
- package/test/unit/spec/locus-info/mediaSharesUtils.ts +32 -0
- package/test/unit/spec/locus-info/parser.js +116 -35
- package/test/unit/spec/locus-info/selfConstant.js +27 -4
- package/test/unit/spec/locus-info/selfUtils.js +208 -17
- package/test/unit/spec/media/index.ts +104 -37
- package/test/unit/spec/media/properties.ts +2 -2
- package/test/unit/spec/meeting/in-meeting-actions.ts +81 -3
- package/test/unit/spec/meeting/index.js +5216 -1956
- package/test/unit/spec/meeting/locusMediaRequest.ts +442 -0
- package/test/unit/spec/meeting/muteState.js +408 -208
- package/test/unit/spec/meeting/request.js +483 -49
- package/test/unit/spec/meeting/utils.js +679 -64
- package/test/unit/spec/meeting-info/index.js +300 -0
- package/test/unit/spec/meeting-info/meetinginfov2.js +526 -5
- package/test/unit/spec/meeting-info/utilv2.js +21 -0
- package/test/unit/spec/meetings/collection.js +26 -0
- package/test/unit/spec/meetings/index.js +1011 -205
- package/test/unit/spec/meetings/utils.js +202 -2
- package/test/unit/spec/member/index.js +61 -6
- package/test/unit/spec/member/util.js +510 -34
- package/test/unit/spec/members/index.js +432 -1
- package/test/unit/spec/members/request.js +206 -27
- package/test/unit/spec/members/utils.js +210 -0
- package/test/unit/spec/metrics/index.js +1 -50
- package/test/unit/spec/multistream/mediaRequestManager.ts +803 -162
- package/test/unit/spec/multistream/receiveSlot.ts +28 -20
- package/test/unit/spec/multistream/receiveSlotManager.ts +32 -30
- package/test/unit/spec/multistream/remoteMedia.ts +30 -0
- package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
- package/test/unit/spec/multistream/remoteMediaManager.ts +326 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +242 -0
- package/test/unit/spec/reachability/index.ts +549 -9
- package/test/unit/spec/reachability/request.js +68 -0
- package/test/unit/spec/reconnection-manager/index.js +85 -9
- package/test/unit/spec/recording-controller/index.js +294 -218
- package/test/unit/spec/recording-controller/util.js +223 -96
- package/test/unit/spec/roap/index.ts +178 -64
- package/test/unit/spec/roap/request.ts +203 -85
- package/test/unit/spec/roap/turnDiscovery.ts +82 -36
- package/test/unit/spec/rtcMetrics/index.ts +73 -0
- package/test/unit/spec/stats-analyzer/index.js +136 -2
- package/test/unit/spec/webinar/collection.ts +13 -0
- package/test/unit/spec/webinar/index.ts +60 -0
- package/test/utils/integrationTestUtils.js +46 -0
- package/test/utils/testUtils.js +0 -52
- package/dist/meeting/effectsState.js +0 -262
- package/dist/meeting/effectsState.js.map +0 -1
- package/dist/metrics/config.js +0 -299
- package/dist/metrics/config.js.map +0 -1
- package/dist/types/meeting/effectsState.d.ts +0 -42
- package/dist/types/metrics/config.d.ts +0 -178
- package/src/index.js +0 -16
- package/src/meeting/effectsState.ts +0 -211
- package/src/metrics/config.ts +0 -495
- package/test/unit/spec/meeting/effectsState.js +0 -285
|
@@ -5,37 +5,30 @@ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequ
|
|
|
5
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.createMuteState = void 0;
|
|
8
|
+
exports.createMuteState = exports.MuteState = void 0;
|
|
9
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
13
13
|
var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
|
|
14
14
|
var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
|
|
15
|
-
var _permission = _interopRequireDefault(require("../common/errors/permission"));
|
|
16
|
-
var _media = _interopRequireDefault(require("../media"));
|
|
17
15
|
var _util = _interopRequireDefault(require("./util"));
|
|
18
16
|
var _constants = require("../constants");
|
|
19
|
-
/* Certain aspects of server interaction for video muting are not implemented as we currently don't support remote muting of video.
|
|
20
|
-
If we ever need to support it, search for REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION string to find the places that need updating
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
17
|
// eslint-disable-next-line import/prefer-default-export
|
|
24
|
-
var createMuteState = function createMuteState(type, meeting,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
if (type === _constants.VIDEO && !mediaDirection.sendVideo) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
18
|
+
var createMuteState = function createMuteState(type, meeting, enabled) {
|
|
19
|
+
// todo: remove the meeting argument (SPARK-399695)
|
|
20
|
+
|
|
31
21
|
_loggerProxy.default.logger.info("Meeting:muteState#createMuteState --> ".concat(type, ": creating MuteState for meeting id ").concat(meeting === null || meeting === void 0 ? void 0 : meeting.id));
|
|
32
|
-
|
|
22
|
+
var muteState = new MuteState(type, meeting, enabled);
|
|
23
|
+
return muteState;
|
|
33
24
|
};
|
|
34
25
|
|
|
35
26
|
/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches
|
|
36
27
|
the last requested state by the client.
|
|
37
28
|
|
|
38
29
|
More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#
|
|
30
|
+
|
|
31
|
+
This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called
|
|
39
32
|
*/
|
|
40
33
|
exports.createMuteState = createMuteState;
|
|
41
34
|
var MuteState = /*#__PURE__*/function () {
|
|
@@ -44,84 +37,156 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
44
37
|
*
|
|
45
38
|
* @param {String} type - audio or video
|
|
46
39
|
* @param {Object} meeting - the meeting object (used for reading current remote mute status)
|
|
40
|
+
* @param {boolean} enabled - whether the client audio/video is enabled at all
|
|
47
41
|
*/
|
|
48
|
-
function MuteState(type, meeting) {
|
|
42
|
+
function MuteState(type, meeting, enabled) {
|
|
43
|
+
var _meeting$remoteVideoM, _meeting$unmuteVideoA;
|
|
49
44
|
(0, _classCallCheck2.default)(this, MuteState);
|
|
50
|
-
(0, _defineProperty2.default)(this, "pendingPromiseReject", void 0);
|
|
51
|
-
(0, _defineProperty2.default)(this, "pendingPromiseResolve", void 0);
|
|
52
45
|
(0, _defineProperty2.default)(this, "state", void 0);
|
|
53
46
|
(0, _defineProperty2.default)(this, "type", void 0);
|
|
47
|
+
(0, _defineProperty2.default)(this, "ignoreMuteStateChange", void 0);
|
|
54
48
|
if (type !== _constants.AUDIO && type !== _constants.VIDEO) {
|
|
55
49
|
throw new _parameter.default('Mute state is designed for handling audio or video only');
|
|
56
50
|
}
|
|
57
51
|
this.type = type;
|
|
52
|
+
this.ignoreMuteStateChange = false;
|
|
58
53
|
this.state = {
|
|
59
54
|
client: {
|
|
60
|
-
|
|
55
|
+
enabled: enabled,
|
|
56
|
+
localMute: true
|
|
61
57
|
},
|
|
62
58
|
server: {
|
|
63
|
-
localMute:
|
|
64
|
-
//
|
|
65
|
-
remoteMute: type === _constants.AUDIO ? meeting.remoteMuted : false,
|
|
66
|
-
unmuteAllowed: type === _constants.AUDIO ? meeting.unmuteAllowed : true
|
|
59
|
+
localMute: true,
|
|
60
|
+
// because remoteVideoMuted and unmuteVideoAllowed are updated seperately, they might be undefined
|
|
61
|
+
remoteMute: type === _constants.AUDIO ? meeting.remoteMuted : (_meeting$remoteVideoM = meeting.remoteVideoMuted) !== null && _meeting$remoteVideoM !== void 0 ? _meeting$remoteVideoM : false,
|
|
62
|
+
unmuteAllowed: type === _constants.AUDIO ? meeting.unmuteAllowed : (_meeting$unmuteVideoA = meeting.unmuteVideoAllowed) !== null && _meeting$unmuteVideoA !== void 0 ? _meeting$unmuteVideoA : true
|
|
67
63
|
},
|
|
68
64
|
syncToServerInProgress: false
|
|
69
65
|
};
|
|
70
|
-
// these 2 hold the resolve, reject methods for the promise we returned to the client in last handleClientRequest() call
|
|
71
|
-
this.pendingPromiseResolve = null;
|
|
72
|
-
this.pendingPromiseReject = null;
|
|
73
66
|
}
|
|
74
67
|
|
|
75
68
|
/**
|
|
76
|
-
*
|
|
77
|
-
* at the point that this request becomese superseded by another client request.
|
|
69
|
+
* Starts the mute state machine. Needs to be called after a new MuteState instance is created.
|
|
78
70
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* the server state will match the last requested state from the client.
|
|
82
|
-
*
|
|
83
|
-
* @public
|
|
84
|
-
* @memberof MuteState
|
|
85
|
-
* @param {Object} [meeting] the meeting object
|
|
86
|
-
* @param {Boolean} [mute] true for muting, false for unmuting request
|
|
87
|
-
* @returns {Promise}
|
|
71
|
+
* @param {Object} meeting - the meeting object
|
|
72
|
+
* @returns {void}
|
|
88
73
|
*/
|
|
89
74
|
(0, _createClass2.default)(MuteState, [{
|
|
90
|
-
key: "
|
|
91
|
-
value: function
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
key: "init",
|
|
76
|
+
value: function init(meeting) {
|
|
77
|
+
var _meeting$mediaPropert, _meeting$mediaPropert2;
|
|
78
|
+
this.applyUnmuteAllowedToStream(meeting);
|
|
79
|
+
|
|
80
|
+
// if we are remotely muted, we need to apply that to the local stream now (mute on-entry)
|
|
81
|
+
if (this.state.server.remoteMute) {
|
|
82
|
+
this.muteLocalStream(meeting, this.state.server.remoteMute, 'remotelyMuted');
|
|
96
83
|
}
|
|
84
|
+
var initialMute = this.type === _constants.AUDIO ? (_meeting$mediaPropert = meeting.mediaProperties.audioStream) === null || _meeting$mediaPropert === void 0 ? void 0 : _meeting$mediaPropert.muted : (_meeting$mediaPropert2 = meeting.mediaProperties.videoStream) === null || _meeting$mediaPropert2 === void 0 ? void 0 : _meeting$mediaPropert2.muted;
|
|
85
|
+
_loggerProxy.default.logger.info("Meeting:muteState#init --> ".concat(this.type, ": local stream initial mute state: ").concat(initialMute));
|
|
86
|
+
if (initialMute !== undefined) {
|
|
87
|
+
this.state.client.localMute = initialMute;
|
|
88
|
+
} else {
|
|
89
|
+
// there is no stream, so it's like we are locally muted
|
|
90
|
+
// (this is important especially for transcoded meetings, in which the SDP m-line direction always stays "sendrecv")
|
|
91
|
+
this.state.client.localMute = true;
|
|
92
|
+
}
|
|
93
|
+
this.applyClientStateToServer(meeting);
|
|
94
|
+
}
|
|
97
95
|
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
/**
|
|
97
|
+
* This method needs to be called whenever the local audio/video stream has changed.
|
|
98
|
+
* It reapplies the remote mute state onto the new stream and also reads the current
|
|
99
|
+
* local mute state from the stream and updates the internal state machine and sends
|
|
100
|
+
* any required requests to the server.
|
|
101
|
+
*
|
|
102
|
+
* @param {Object} meeting - the meeting object
|
|
103
|
+
* @returns {void}
|
|
104
|
+
*/
|
|
105
|
+
}, {
|
|
106
|
+
key: "handleLocalStreamChange",
|
|
107
|
+
value: function handleLocalStreamChange(meeting) {
|
|
108
|
+
return this.init(meeting);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Enables/disables audio/video
|
|
113
|
+
*
|
|
114
|
+
* @param {Object} meeting - the meeting object
|
|
115
|
+
* @param {boolean} enable
|
|
116
|
+
* @returns {void}
|
|
117
|
+
*/
|
|
118
|
+
}, {
|
|
119
|
+
key: "enable",
|
|
120
|
+
value: function enable(meeting, _enable) {
|
|
121
|
+
this.state.client.enabled = _enable;
|
|
122
|
+
this.applyClientStateToServer(meeting);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Mutes/unmutes local stream
|
|
127
|
+
*
|
|
128
|
+
* @param {Object} meeting - the meeting object
|
|
129
|
+
* @param {Boolean} mute - true to mute the stream, false to unmute it
|
|
130
|
+
* @param {ServerMuteReason} reason - reason for muting/unmuting
|
|
131
|
+
* @returns {void}
|
|
132
|
+
*/
|
|
133
|
+
}, {
|
|
134
|
+
key: "muteLocalStream",
|
|
135
|
+
value: function muteLocalStream(meeting, mute, reason) {
|
|
136
|
+
this.ignoreMuteStateChange = true;
|
|
137
|
+
if (this.type === _constants.AUDIO) {
|
|
138
|
+
var _meeting$mediaPropert3;
|
|
139
|
+
(_meeting$mediaPropert3 = meeting.mediaProperties.audioStream) === null || _meeting$mediaPropert3 === void 0 ? void 0 : _meeting$mediaPropert3.setServerMuted(mute, reason);
|
|
140
|
+
} else {
|
|
141
|
+
var _meeting$mediaPropert4;
|
|
142
|
+
(_meeting$mediaPropert4 = meeting.mediaProperties.videoStream) === null || _meeting$mediaPropert4 === void 0 ? void 0 : _meeting$mediaPropert4.setServerMuted(mute, reason);
|
|
143
|
+
}
|
|
144
|
+
this.ignoreMuteStateChange = false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* This method should be called when the local stream mute state is changed
|
|
149
|
+
* @public
|
|
150
|
+
* @memberof MuteState
|
|
151
|
+
* @param {Object} [meeting] the meeting object
|
|
152
|
+
* @param {Boolean} [mute] true for muting, false for unmuting request
|
|
153
|
+
* @returns {void}
|
|
154
|
+
*/
|
|
155
|
+
}, {
|
|
156
|
+
key: "handleLocalStreamMuteStateChange",
|
|
157
|
+
value: function handleLocalStreamMuteStateChange(meeting, mute) {
|
|
158
|
+
if (this.ignoreMuteStateChange) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
_loggerProxy.default.logger.info("Meeting:muteState#handleLocalStreamMuteStateChange --> ".concat(this.type, ": local stream new mute state: ").concat(mute));
|
|
100
162
|
this.state.client.localMute = mute;
|
|
101
|
-
this.
|
|
102
|
-
return new _promise.default(function (resolve, reject) {
|
|
103
|
-
if (_this.pendingPromiseResolve) {
|
|
104
|
-
// resolve the last promise we returned to the client as the client has issued a new request that has superseded the previous one
|
|
105
|
-
_this.pendingPromiseResolve();
|
|
106
|
-
}
|
|
107
|
-
_this.pendingPromiseResolve = resolve;
|
|
108
|
-
_this.pendingPromiseReject = reject;
|
|
109
|
-
_this.applyClientStateToServer(meeting);
|
|
110
|
-
});
|
|
163
|
+
this.applyClientStateToServer(meeting);
|
|
111
164
|
}
|
|
112
165
|
|
|
113
166
|
/**
|
|
114
|
-
* Applies the current mute state to the local
|
|
167
|
+
* Applies the current mute state to the local stream (by enabling or disabling it accordingly)
|
|
115
168
|
*
|
|
116
169
|
* @public
|
|
117
170
|
* @param {Object} [meeting] the meeting object
|
|
171
|
+
* @param {ServerMuteReason} reason - reason why we're applying our client state to the local stream
|
|
118
172
|
* @memberof MuteState
|
|
119
173
|
* @returns {void}
|
|
120
174
|
*/
|
|
121
175
|
}, {
|
|
122
176
|
key: "applyClientStateLocally",
|
|
123
|
-
value: function applyClientStateLocally(meeting) {
|
|
124
|
-
|
|
177
|
+
value: function applyClientStateLocally(meeting, reason) {
|
|
178
|
+
this.muteLocalStream(meeting, this.state.client.localMute, reason);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Returns true if client is locally muted - it takes into account not just the client local mute state,
|
|
182
|
+
* but also whether audio/video is enabled at all
|
|
183
|
+
*
|
|
184
|
+
* @returns {boolean}
|
|
185
|
+
*/
|
|
186
|
+
}, {
|
|
187
|
+
key: "getClientLocalMuteState",
|
|
188
|
+
value: function getClientLocalMuteState() {
|
|
189
|
+
return this.state.client.enabled ? this.state.client.localMute : true;
|
|
125
190
|
}
|
|
126
191
|
|
|
127
192
|
/**
|
|
@@ -135,22 +200,18 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
135
200
|
}, {
|
|
136
201
|
key: "applyClientStateToServer",
|
|
137
202
|
value: function applyClientStateToServer(meeting) {
|
|
138
|
-
var
|
|
203
|
+
var _this = this;
|
|
139
204
|
if (this.state.syncToServerInProgress) {
|
|
140
205
|
_loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": request to server in progress, we need to wait for it to complete"));
|
|
141
206
|
return;
|
|
142
207
|
}
|
|
143
|
-
var
|
|
144
|
-
var
|
|
145
|
-
|
|
208
|
+
var localMuteState = this.getClientLocalMuteState();
|
|
209
|
+
var localMuteRequiresSync = localMuteState !== this.state.server.localMute;
|
|
210
|
+
var remoteMuteRequiresSync = !localMuteState && this.state.server.remoteMute;
|
|
211
|
+
_loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": localMuteRequiresSync: ").concat(localMuteRequiresSync, " (").concat(localMuteState, " ?= ").concat(this.state.server.localMute, ")"));
|
|
146
212
|
_loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": remoteMuteRequiresSync: ").concat(remoteMuteRequiresSync));
|
|
147
213
|
if (!localMuteRequiresSync && !remoteMuteRequiresSync) {
|
|
148
214
|
_loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(this.type, ": client state already matching server state, nothing to do"));
|
|
149
|
-
if (this.pendingPromiseResolve) {
|
|
150
|
-
this.pendingPromiseResolve();
|
|
151
|
-
}
|
|
152
|
-
this.pendingPromiseResolve = null;
|
|
153
|
-
this.pendingPromiseReject = null;
|
|
154
215
|
return;
|
|
155
216
|
}
|
|
156
217
|
this.state.syncToServerInProgress = true;
|
|
@@ -160,21 +221,18 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
160
221
|
localMuteSyncPromise.then(function () {
|
|
161
222
|
return (
|
|
162
223
|
// then follow it up with remote mute sync
|
|
163
|
-
remoteMuteRequiresSync ?
|
|
224
|
+
remoteMuteRequiresSync ? _this.sendRemoteMuteRequestToServer(meeting) : _promise.default.resolve()
|
|
164
225
|
);
|
|
165
226
|
}).then(function () {
|
|
166
|
-
|
|
167
|
-
_loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(
|
|
227
|
+
_this.state.syncToServerInProgress = false;
|
|
228
|
+
_loggerProxy.default.logger.info("Meeting:muteState#applyClientStateToServer --> ".concat(_this.type, ": sync with server completed"));
|
|
168
229
|
|
|
169
230
|
// need to check if a new sync is required, because this.state.client may have changed while we were doing the current sync
|
|
170
|
-
|
|
231
|
+
_this.applyClientStateToServer(meeting);
|
|
171
232
|
}).catch(function (e) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
_this2.pendingPromiseResolve = null;
|
|
177
|
-
_this2.pendingPromiseReject = null;
|
|
233
|
+
_this.state.syncToServerInProgress = false;
|
|
234
|
+
_loggerProxy.default.logger.warn("Meeting:muteState#applyClientStateToServer --> ".concat(_this.type, ": error: ").concat(e));
|
|
235
|
+
_this.applyServerMuteToLocalStream(meeting, 'clientRequestFailed');
|
|
178
236
|
});
|
|
179
237
|
}
|
|
180
238
|
|
|
@@ -189,19 +247,19 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
189
247
|
}, {
|
|
190
248
|
key: "sendLocalMuteRequestToServer",
|
|
191
249
|
value: function sendLocalMuteRequestToServer(meeting) {
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var audioMuted = this.type === _constants.AUDIO ? this.state.client.localMute : (_meeting$audio = meeting.audio) === null || _meeting$audio === void 0 ? void 0 : _meeting$audio.state.client.localMute;
|
|
196
|
-
var videoMuted = this.type === _constants.VIDEO ? this.state.client.localMute : (_meeting$video = meeting.video) === null || _meeting$video === void 0 ? void 0 : _meeting$video.state.client.localMute;
|
|
250
|
+
var _this2 = this;
|
|
251
|
+
var audioMuted = this.type === _constants.AUDIO ? this.getClientLocalMuteState() : undefined;
|
|
252
|
+
var videoMuted = this.type === _constants.VIDEO ? this.getClientLocalMuteState() : undefined;
|
|
197
253
|
_loggerProxy.default.logger.info("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(this.type, ": sending local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") to server"));
|
|
198
|
-
return _util.default.remoteUpdateAudioVideo(audioMuted, videoMuted
|
|
199
|
-
_loggerProxy.default.logger.info("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(
|
|
200
|
-
|
|
201
|
-
|
|
254
|
+
return _util.default.remoteUpdateAudioVideo(meeting, audioMuted, videoMuted).then(function (locus) {
|
|
255
|
+
_loggerProxy.default.logger.info("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(_this2.type, ": local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") applied to server"));
|
|
256
|
+
_this2.state.server.localMute = _this2.type === _constants.AUDIO ? audioMuted : videoMuted;
|
|
257
|
+
if (locus) {
|
|
258
|
+
meeting.locusInfo.handleLocusDelta(locus, meeting);
|
|
259
|
+
}
|
|
202
260
|
return locus;
|
|
203
261
|
}).catch(function (remoteUpdateError) {
|
|
204
|
-
_loggerProxy.default.logger.warn("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(
|
|
262
|
+
_loggerProxy.default.logger.warn("Meeting:muteState#sendLocalMuteRequestToServer --> ".concat(_this2.type, ": failed to apply local mute (audio=").concat(audioMuted, ", video=").concat(videoMuted, ") to server: ").concat(remoteUpdateError));
|
|
205
263
|
return _promise.default.reject(remoteUpdateError);
|
|
206
264
|
});
|
|
207
265
|
}
|
|
@@ -217,22 +275,48 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
217
275
|
}, {
|
|
218
276
|
key: "sendRemoteMuteRequestToServer",
|
|
219
277
|
value: function sendRemoteMuteRequestToServer(meeting) {
|
|
220
|
-
var
|
|
278
|
+
var _this3 = this;
|
|
279
|
+
var remoteMute = this.getClientLocalMuteState();
|
|
280
|
+
_loggerProxy.default.logger.info("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(this.type, ": sending remote mute:").concat(remoteMute, " to server"));
|
|
281
|
+
return meeting.members.muteMember(meeting.members.selfId, remoteMute, this.type === _constants.AUDIO).then(function () {
|
|
282
|
+
_loggerProxy.default.logger.info("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this3.type, ": remote mute:").concat(remoteMute, " applied to server"));
|
|
283
|
+
_this3.state.server.remoteMute = remoteMute;
|
|
284
|
+
}).catch(function (remoteUpdateError) {
|
|
285
|
+
_loggerProxy.default.logger.warn("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this3.type, ": failed to apply remote mute ").concat(remoteMute, " to server: ").concat(remoteUpdateError));
|
|
286
|
+
return _promise.default.reject(remoteUpdateError);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Sets the mute state of the local stream according to what server thinks is our state
|
|
291
|
+
* @param {Object} meeting - the meeting object
|
|
292
|
+
* @param {ServerMuteReason} serverMuteReason - reason why we're applying server mute to the local stream
|
|
293
|
+
* @returns {void}
|
|
294
|
+
*/
|
|
295
|
+
}, {
|
|
296
|
+
key: "applyServerMuteToLocalStream",
|
|
297
|
+
value: function applyServerMuteToLocalStream(meeting, serverMuteReason) {
|
|
298
|
+
var muted = this.state.server.localMute || this.state.server.remoteMute;
|
|
299
|
+
|
|
300
|
+
// update the local stream mute state, but not this.state.client.localMute
|
|
301
|
+
this.muteLocalStream(meeting, muted, serverMuteReason);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** Applies the current value for unmute allowed to the underlying stream
|
|
305
|
+
*
|
|
306
|
+
* @param {Meeting} meeting
|
|
307
|
+
* @returns {void}
|
|
308
|
+
*/
|
|
309
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
310
|
+
}, {
|
|
311
|
+
key: "applyUnmuteAllowedToStream",
|
|
312
|
+
value: function applyUnmuteAllowedToStream(meeting) {
|
|
221
313
|
if (this.type === _constants.AUDIO) {
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}).catch(function (remoteUpdateError) {
|
|
228
|
-
_loggerProxy.default.logger.warn("Meeting:muteState#sendRemoteMuteRequestToServer --> ".concat(_this4.type, ": failed to apply remote mute ").concat(remoteMute, " to server: ").concat(remoteUpdateError));
|
|
229
|
-
return _promise.default.reject(remoteUpdateError);
|
|
230
|
-
});
|
|
314
|
+
var _meeting$mediaPropert5;
|
|
315
|
+
(_meeting$mediaPropert5 = meeting.mediaProperties.audioStream) === null || _meeting$mediaPropert5 === void 0 ? void 0 : _meeting$mediaPropert5.setUnmuteAllowed(this.state.server.unmuteAllowed);
|
|
316
|
+
} else {
|
|
317
|
+
var _meeting$mediaPropert6;
|
|
318
|
+
(_meeting$mediaPropert6 = meeting.mediaProperties.videoStream) === null || _meeting$mediaPropert6 === void 0 ? void 0 : _meeting$mediaPropert6.setUnmuteAllowed(this.state.server.unmuteAllowed);
|
|
231
319
|
}
|
|
232
|
-
|
|
233
|
-
// for now we don't need to support remote muting of video (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)
|
|
234
|
-
this.state.server.remoteMute = this.state.client.localMute;
|
|
235
|
-
return _promise.default.resolve();
|
|
236
320
|
}
|
|
237
321
|
|
|
238
322
|
/**
|
|
@@ -240,16 +324,23 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
240
324
|
*
|
|
241
325
|
* @public
|
|
242
326
|
* @memberof MuteState
|
|
327
|
+
* @param {Meeting} meeting
|
|
243
328
|
* @param {Boolean} [muted] true if user is remotely muted, false otherwise
|
|
244
329
|
* @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when "hard mute" feature is used)
|
|
245
330
|
* @returns {undefined}
|
|
246
331
|
*/
|
|
247
332
|
}, {
|
|
248
333
|
key: "handleServerRemoteMuteUpdate",
|
|
249
|
-
value: function handleServerRemoteMuteUpdate(muted, unmuteAllowed) {
|
|
334
|
+
value: function handleServerRemoteMuteUpdate(meeting, muted, unmuteAllowed) {
|
|
250
335
|
_loggerProxy.default.logger.info("Meeting:muteState#handleServerRemoteMuteUpdate --> ".concat(this.type, ": updating server remoteMute to (").concat(muted, ")"));
|
|
251
|
-
|
|
252
|
-
|
|
336
|
+
if (unmuteAllowed !== undefined) {
|
|
337
|
+
this.state.server.unmuteAllowed = unmuteAllowed;
|
|
338
|
+
this.applyUnmuteAllowedToStream(meeting);
|
|
339
|
+
}
|
|
340
|
+
if (muted !== undefined) {
|
|
341
|
+
this.state.server.remoteMute = muted;
|
|
342
|
+
this.applyServerMuteToLocalStream(meeting, 'remotelyMuted');
|
|
343
|
+
}
|
|
253
344
|
}
|
|
254
345
|
|
|
255
346
|
/**
|
|
@@ -263,20 +354,22 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
263
354
|
}, {
|
|
264
355
|
key: "handleServerLocalUnmuteRequired",
|
|
265
356
|
value: function handleServerLocalUnmuteRequired(meeting) {
|
|
266
|
-
|
|
357
|
+
if (!this.state.client.enabled) {
|
|
358
|
+
_loggerProxy.default.logger.warn("Meeting:muteState#handleServerLocalUnmuteRequired --> ".concat(this.type, ": localAudioUnmuteRequired received while ").concat(this.type, " is disabled -> local unmute will not result in ").concat(this.type, " being sent"));
|
|
359
|
+
} else {
|
|
360
|
+
_loggerProxy.default.logger.info("Meeting:muteState#handleServerLocalUnmuteRequired --> ".concat(this.type, ": localAudioUnmuteRequired received -> doing local unmute"));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// todo: I'm seeing "you can now unmute yourself " popup when this happens - but same thing happens on web.w.c so we can ignore for now
|
|
267
364
|
this.state.server.remoteMute = false;
|
|
268
365
|
this.state.client.localMute = false;
|
|
269
|
-
|
|
270
|
-
this.pendingPromiseReject(new Error('Server requested local unmute - this overrides any client request in progress'));
|
|
271
|
-
this.pendingPromiseResolve = null;
|
|
272
|
-
this.pendingPromiseReject = null;
|
|
273
|
-
}
|
|
274
|
-
this.applyClientStateLocally(meeting);
|
|
366
|
+
this.applyClientStateLocally(meeting, 'localUnmuteRequired');
|
|
275
367
|
this.applyClientStateToServer(meeting);
|
|
276
368
|
}
|
|
277
369
|
|
|
278
370
|
/**
|
|
279
|
-
* Returns true if the user is locally or remotely muted
|
|
371
|
+
* Returns true if the user is locally or remotely muted.
|
|
372
|
+
* It only checks the mute status, ignoring the fact whether audio/video is enabled.
|
|
280
373
|
*
|
|
281
374
|
* @public
|
|
282
375
|
* @memberof MuteState
|
|
@@ -289,32 +382,45 @@ var MuteState = /*#__PURE__*/function () {
|
|
|
289
382
|
}
|
|
290
383
|
|
|
291
384
|
/**
|
|
292
|
-
* Returns true if the user is
|
|
385
|
+
* Returns true if the user is remotely muted
|
|
293
386
|
*
|
|
294
387
|
* @public
|
|
295
388
|
* @memberof MuteState
|
|
296
389
|
* @returns {Boolean}
|
|
297
390
|
*/
|
|
298
391
|
}, {
|
|
299
|
-
key: "
|
|
300
|
-
value: function
|
|
301
|
-
return this.state.
|
|
392
|
+
key: "isRemotelyMuted",
|
|
393
|
+
value: function isRemotelyMuted() {
|
|
394
|
+
return this.state.server.remoteMute;
|
|
302
395
|
}
|
|
303
396
|
|
|
304
|
-
|
|
397
|
+
/**
|
|
398
|
+
* Returns true if unmute is allowed
|
|
399
|
+
*
|
|
400
|
+
* @public
|
|
401
|
+
* @memberof MuteState
|
|
402
|
+
* @returns {Boolean}
|
|
403
|
+
*/
|
|
305
404
|
}, {
|
|
306
|
-
key: "
|
|
307
|
-
|
|
308
|
-
return this.
|
|
405
|
+
key: "isUnmuteAllowed",
|
|
406
|
+
value: function isUnmuteAllowed() {
|
|
407
|
+
return this.state.server.unmuteAllowed;
|
|
309
408
|
}
|
|
310
409
|
|
|
311
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Returns true if the user is locally muted or audio/video is disabled
|
|
412
|
+
*
|
|
413
|
+
* @public
|
|
414
|
+
* @memberof MuteState
|
|
415
|
+
* @returns {Boolean}
|
|
416
|
+
*/
|
|
312
417
|
}, {
|
|
313
|
-
key: "
|
|
314
|
-
|
|
315
|
-
return this.
|
|
418
|
+
key: "isLocallyMuted",
|
|
419
|
+
value: function isLocallyMuted() {
|
|
420
|
+
return this.getClientLocalMuteState();
|
|
316
421
|
}
|
|
317
422
|
}]);
|
|
318
423
|
return MuteState;
|
|
319
424
|
}();
|
|
425
|
+
exports.MuteState = MuteState;
|
|
320
426
|
//# sourceMappingURL=muteState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createMuteState","type","meeting","mediaDirection","AUDIO","sendAudio","VIDEO","sendVideo","LoggerProxy","logger","info","id","MuteState","ParameterError","state","client","localMute","server","remoteMute","remoteMuted","unmuteAllowed","syncToServerInProgress","pendingPromiseResolve","pendingPromiseReject","mute","reject","PermissionError","applyClientStateLocally","resolve","applyClientStateToServer","Media","setLocalTrack","mediaProperties","audioTrack","videoTrack","localMuteRequiresSync","remoteMuteRequiresSync","localMuteSyncPromise","sendLocalMuteRequestToServer","then","sendRemoteMuteRequestToServer","catch","e","audioMuted","audio","videoMuted","video","MeetingUtil","remoteUpdateAudioVideo","locus","locusInfo","onFullLocus","remoteUpdateError","warn","members","muteMember","selfId","muted","Error","isMuted","isSelf"],"sources":["muteState.ts"],"sourcesContent":["import LoggerProxy from '../common/logs/logger-proxy';\nimport ParameterError from '../common/errors/parameter';\nimport PermissionError from '../common/errors/permission';\nimport Media from '../media';\nimport MeetingUtil from './util';\nimport {AUDIO, VIDEO} from '../constants';\n\n/* Certain aspects of server interaction for video muting are not implemented as we currently don't support remote muting of video.\n If we ever need to support it, search for REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION string to find the places that need updating\n*/\n\n// eslint-disable-next-line import/prefer-default-export\nexport const createMuteState = (type, meeting, mediaDirection) => {\n if (type === AUDIO && !mediaDirection.sendAudio) {\n return null;\n }\n if (type === VIDEO && !mediaDirection.sendVideo) {\n return null;\n }\n\n LoggerProxy.logger.info(\n `Meeting:muteState#createMuteState --> ${type}: creating MuteState for meeting id ${meeting?.id}`\n );\n\n return new MuteState(type, meeting);\n};\n\n/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches\n the last requested state by the client.\n\n More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#\n*/\nclass MuteState {\n pendingPromiseReject: any;\n pendingPromiseResolve: any;\n state: any;\n type: any;\n\n /**\n * Constructor\n *\n * @param {String} type - audio or video\n * @param {Object} meeting - the meeting object (used for reading current remote mute status)\n */\n constructor(type: string, meeting: any) {\n if (type !== AUDIO && type !== VIDEO) {\n throw new ParameterError('Mute state is designed for handling audio or video only');\n }\n this.type = type;\n this.state = {\n client: {\n localMute: false,\n },\n server: {\n localMute: false,\n // initial values available only for audio (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)\n remoteMute: type === AUDIO ? meeting.remoteMuted : false,\n unmuteAllowed: type === AUDIO ? meeting.unmuteAllowed : true,\n },\n syncToServerInProgress: 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 * Handles mute/unmute request from the client/user. Returns a promise that's resolved once the server update is completed or\n * at the point that this request becomese superseded by another client request.\n *\n * The client doesn't have to wait for the returned promise to resolve before calling handleClientRequest() again. If\n * handleClientRequest() is called again before the previous one resolved, the MuteState class will make sure that eventually\n * the server state will match the last requested state from the client.\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [mute] true for muting, false for unmuting request\n * @returns {Promise}\n */\n public handleClientRequest(meeting?: object, mute?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleClientRequest --> ${this.type}: user requesting new mute state: ${mute}`\n );\n\n if (!mute && !this.state.server.unmuteAllowed) {\n return Promise.reject(\n new PermissionError('User is not allowed to unmute self (hard mute feature is being used)')\n );\n }\n\n // we don't check if we're already in the same state, because even if we were, we would still have to apply the mute state locally,\n // because the client may have changed the audio/vidoe tracks\n this.state.client.localMute = mute;\n this.applyClientStateLocally(meeting);\n\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 this.applyClientStateToServer(meeting);\n });\n }\n\n /**\n * Applies the current mute state to the local track (by enabling or disabling it accordingly)\n *\n * @public\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n public applyClientStateLocally(meeting?: any) {\n Media.setLocalTrack(\n !this.state.client.localMute,\n this.type === AUDIO ? meeting.mediaProperties.audioTrack : meeting.mediaProperties.videoTrack\n );\n }\n\n /**\n * Updates the server local and remote mute values so that they match the current client desired state.\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n private applyClientStateToServer(meeting?: object) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: request to server in progress, we need to wait for it to complete`\n );\n\n return;\n }\n\n const localMuteRequiresSync = this.state.client.localMute !== this.state.server.localMute;\n const remoteMuteRequiresSync = !this.state.client.localMute && this.state.server.remoteMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: localMuteRequiresSync: ${localMuteRequiresSync} (${this.state.client.localMute} ?= ${this.state.server.localMute})`\n );\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: remoteMuteRequiresSync: ${remoteMuteRequiresSync}`\n );\n\n if (!localMuteRequiresSync && !remoteMuteRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: client state already matching server state, nothing to do`\n );\n\n if (this.pendingPromiseResolve) {\n this.pendingPromiseResolve();\n }\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n\n return;\n }\n\n this.state.syncToServerInProgress = true;\n\n // first sync local mute with server\n const localMuteSyncPromise = localMuteRequiresSync\n ? this.sendLocalMuteRequestToServer(meeting)\n : Promise.resolve();\n\n localMuteSyncPromise\n .then(() =>\n // then follow it up with remote mute sync\n remoteMuteRequiresSync ? this.sendRemoteMuteRequestToServer(meeting) : Promise.resolve()\n )\n .then(() => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: 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(meeting);\n })\n .catch((e) => {\n this.state.syncToServerInProgress = false;\n\n if (this.pendingPromiseReject) {\n this.pendingPromiseReject(e);\n }\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n });\n }\n\n /**\n * Sets the local mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendLocalMuteRequestToServer(meeting?: any) {\n const audioMuted =\n this.type === AUDIO ? this.state.client.localMute : meeting.audio?.state.client.localMute;\n const videoMuted =\n this.type === VIDEO ? this.state.client.localMute : meeting.video?.state.client.localMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: sending local mute (audio=${audioMuted}, video=${videoMuted}) to server`\n );\n\n return MeetingUtil.remoteUpdateAudioVideo(audioMuted, videoMuted, meeting)\n .then((locus) => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: local mute (audio=${audioMuted}, video=${videoMuted}) applied to server`\n );\n\n this.state.server.localMute = this.type === AUDIO ? audioMuted : videoMuted;\n\n meeting.locusInfo.onFullLocus(locus);\n\n return locus;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: failed to apply local mute (audio=${audioMuted}, video=${videoMuted}) to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /**\n * Sets the remote mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendRemoteMuteRequestToServer(meeting?: any) {\n if (this.type === AUDIO) {\n const remoteMute = this.state.client.localMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: sending remote mute:${remoteMute} to server`\n );\n\n return meeting.members\n .muteMember(meeting.members.selfId, remoteMute)\n .then(() => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: remote mute:${remoteMute} applied to server`\n );\n\n this.state.server.remoteMute = remoteMute;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: failed to apply remote mute ${remoteMute} to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n // for now we don't need to support remote muting of video (REMOTE_MUTE_VIDEO_MISSING_IMPLEMENTATION)\n this.state.server.remoteMute = this.state.client.localMute;\n\n return Promise.resolve();\n }\n\n /**\n * This method should be called whenever the server remote mute state is changed\n *\n * @public\n * @memberof MuteState\n * @param {Boolean} [muted] true if user is remotely muted, false otherwise\n * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when \"hard mute\" feature is used)\n * @returns {undefined}\n */\n public handleServerRemoteMuteUpdate(muted?: boolean, unmuteAllowed?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerRemoteMuteUpdate --> ${this.type}: updating server remoteMute to (${muted})`\n );\n this.state.server.remoteMute = muted;\n this.state.server.unmuteAllowed = unmuteAllowed;\n }\n\n /**\n * This method should be called whenever we receive from the server a requirement to locally unmute\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @returns {undefined}\n */\n public handleServerLocalUnmuteRequired(meeting?: object) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received -> doing local unmute`\n );\n\n this.state.server.remoteMute = false;\n this.state.client.localMute = false;\n\n if (this.pendingPromiseReject) {\n this.pendingPromiseReject(\n new Error('Server requested local unmute - this overrides any client request in progress')\n );\n this.pendingPromiseResolve = null;\n this.pendingPromiseReject = null;\n }\n\n this.applyClientStateLocally(meeting);\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Returns true if the user is locally or remotely muted\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isMuted() {\n return (\n this.state.client.localMute || this.state.server.localMute || this.state.server.remoteMute\n );\n }\n\n /**\n * Returns true if the user is muted as a result of the client request (and not remotely muted)\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isSelf() {\n return this.state.client.localMute && !this.state.server.remoteMute;\n }\n\n // defined for backwards compatibility with the old AudioStateMachine/VideoStateMachine classes\n get muted() {\n return this.isMuted();\n }\n\n // defined for backwards compatibility with the old AudioStateMachine/VideoStateMachine classes\n get self() {\n return this.isSelf();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;AAEA;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,IAAI,EAAEC,OAAO,EAAEC,cAAc,EAAK;EAChE,IAAIF,IAAI,KAAKG,gBAAK,IAAI,CAACD,cAAc,CAACE,SAAS,EAAE;IAC/C,OAAO,IAAI;EACb;EACA,IAAIJ,IAAI,KAAKK,gBAAK,IAAI,CAACH,cAAc,CAACI,SAAS,EAAE;IAC/C,OAAO,IAAI;EACb;EAEAC,oBAAW,CAACC,MAAM,CAACC,IAAI,iDACoBT,IAAI,iDAAuCC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAES,EAA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IAAA,KACA,eAAW;MACT,OAAO,IAAI,CAACC,MAAM,EAAE;IACtB;EAAC;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"names":["createMuteState","type","meeting","enabled","LoggerProxy","logger","info","id","muteState","MuteState","AUDIO","VIDEO","ParameterError","ignoreMuteStateChange","state","client","localMute","server","remoteMute","remoteMuted","remoteVideoMuted","unmuteAllowed","unmuteVideoAllowed","syncToServerInProgress","applyUnmuteAllowedToStream","muteLocalStream","initialMute","mediaProperties","audioStream","muted","videoStream","undefined","applyClientStateToServer","init","enable","mute","reason","setServerMuted","localMuteState","getClientLocalMuteState","localMuteRequiresSync","remoteMuteRequiresSync","localMuteSyncPromise","sendLocalMuteRequestToServer","resolve","then","sendRemoteMuteRequestToServer","catch","e","warn","applyServerMuteToLocalStream","audioMuted","videoMuted","MeetingUtil","remoteUpdateAudioVideo","locus","locusInfo","handleLocusDelta","remoteUpdateError","reject","members","muteMember","selfId","serverMuteReason","setUnmuteAllowed","applyClientStateLocally"],"sources":["muteState.ts"],"sourcesContent":["import {ServerMuteReason} from '@webex/media-helpers';\nimport LoggerProxy from '../common/logs/logger-proxy';\nimport ParameterError from '../common/errors/parameter';\nimport MeetingUtil from './util';\nimport {AUDIO, VIDEO} from '../constants';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const createMuteState = (type, meeting, enabled: boolean) => {\n // todo: remove the meeting argument (SPARK-399695)\n\n LoggerProxy.logger.info(\n `Meeting:muteState#createMuteState --> ${type}: creating MuteState for meeting id ${meeting?.id}`\n );\n\n const muteState = new MuteState(type, meeting, enabled);\n\n return muteState;\n};\n\n/** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches\n the last requested state by the client.\n\n More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#\n\n This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called\n*/\nexport class MuteState {\n state: {\n client: {\n enabled: boolean; // indicates if audio/video is enabled at all or not\n localMute: boolean;\n };\n server: {localMute: boolean; remoteMute: boolean; unmuteAllowed: boolean};\n syncToServerInProgress: boolean;\n };\n\n type: any;\n ignoreMuteStateChange: boolean;\n\n /**\n * Constructor\n *\n * @param {String} type - audio or video\n * @param {Object} meeting - the meeting object (used for reading current remote mute status)\n * @param {boolean} enabled - whether the client audio/video is enabled at all\n */\n constructor(type: string, meeting: any, enabled: boolean) {\n if (type !== AUDIO && type !== VIDEO) {\n throw new ParameterError('Mute state is designed for handling audio or video only');\n }\n this.type = type;\n this.ignoreMuteStateChange = false;\n this.state = {\n client: {\n enabled,\n localMute: true,\n },\n server: {\n localMute: true,\n // because remoteVideoMuted and unmuteVideoAllowed are updated seperately, they might be undefined\n remoteMute: type === AUDIO ? meeting.remoteMuted : meeting.remoteVideoMuted ?? false,\n unmuteAllowed: type === AUDIO ? meeting.unmuteAllowed : meeting.unmuteVideoAllowed ?? true,\n },\n syncToServerInProgress: false,\n };\n }\n\n /**\n * Starts the mute state machine. Needs to be called after a new MuteState instance is created.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public init(meeting: any) {\n this.applyUnmuteAllowedToStream(meeting);\n\n // if we are remotely muted, we need to apply that to the local stream now (mute on-entry)\n if (this.state.server.remoteMute) {\n this.muteLocalStream(meeting, this.state.server.remoteMute, 'remotelyMuted');\n }\n\n const initialMute =\n this.type === AUDIO\n ? meeting.mediaProperties.audioStream?.muted\n : meeting.mediaProperties.videoStream?.muted;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#init --> ${this.type}: local stream initial mute state: ${initialMute}`\n );\n\n if (initialMute !== undefined) {\n this.state.client.localMute = initialMute;\n } else {\n // there is no stream, so it's like we are locally muted\n // (this is important especially for transcoded meetings, in which the SDP m-line direction always stays \"sendrecv\")\n this.state.client.localMute = true;\n }\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * This method needs to be called whenever the local audio/video stream has changed.\n * It reapplies the remote mute state onto the new stream and also reads the current\n * local mute state from the stream and updates the internal state machine and sends\n * any required requests to the server.\n *\n * @param {Object} meeting - the meeting object\n * @returns {void}\n */\n public handleLocalStreamChange(meeting: any) {\n return this.init(meeting);\n }\n\n /**\n * Enables/disables audio/video\n *\n * @param {Object} meeting - the meeting object\n * @param {boolean} enable\n * @returns {void}\n */\n public enable(meeting: any, enable: boolean) {\n this.state.client.enabled = enable;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Mutes/unmutes local stream\n *\n * @param {Object} meeting - the meeting object\n * @param {Boolean} mute - true to mute the stream, false to unmute it\n * @param {ServerMuteReason} reason - reason for muting/unmuting\n * @returns {void}\n */\n private muteLocalStream(meeting: any, mute: boolean, reason: ServerMuteReason) {\n this.ignoreMuteStateChange = true;\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioStream?.setServerMuted(mute, reason);\n } else {\n meeting.mediaProperties.videoStream?.setServerMuted(mute, reason);\n }\n this.ignoreMuteStateChange = false;\n }\n\n /**\n * This method should be called when the local stream mute state is changed\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @param {Boolean} [mute] true for muting, false for unmuting request\n * @returns {void}\n */\n public handleLocalStreamMuteStateChange(meeting?: object, mute?: boolean) {\n if (this.ignoreMuteStateChange) {\n return;\n }\n LoggerProxy.logger.info(\n `Meeting:muteState#handleLocalStreamMuteStateChange --> ${this.type}: local stream new mute state: ${mute}`\n );\n\n this.state.client.localMute = mute;\n\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Applies the current mute state to the local stream (by enabling or disabling it accordingly)\n *\n * @public\n * @param {Object} [meeting] the meeting object\n * @param {ServerMuteReason} reason - reason why we're applying our client state to the local stream\n * @memberof MuteState\n * @returns {void}\n */\n public applyClientStateLocally(meeting?: any, reason?: ServerMuteReason) {\n this.muteLocalStream(meeting, this.state.client.localMute, reason);\n }\n\n /** Returns true if client is locally muted - it takes into account not just the client local mute state,\n * but also whether audio/video is enabled at all\n *\n * @returns {boolean}\n */\n private getClientLocalMuteState() {\n return this.state.client.enabled ? this.state.client.localMute : true;\n }\n\n /**\n * Updates the server local and remote mute values so that they match the current client desired state.\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {void}\n */\n private applyClientStateToServer(meeting?: any) {\n if (this.state.syncToServerInProgress) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: request to server in progress, we need to wait for it to complete`\n );\n\n return;\n }\n\n const localMuteState = this.getClientLocalMuteState();\n const localMuteRequiresSync = localMuteState !== this.state.server.localMute;\n const remoteMuteRequiresSync = !localMuteState && this.state.server.remoteMute;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: localMuteRequiresSync: ${localMuteRequiresSync} (${localMuteState} ?= ${this.state.server.localMute})`\n );\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: remoteMuteRequiresSync: ${remoteMuteRequiresSync}`\n );\n\n if (!localMuteRequiresSync && !remoteMuteRequiresSync) {\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: client state already matching server state, nothing to do`\n );\n\n return;\n }\n\n this.state.syncToServerInProgress = true;\n\n // first sync local mute with server\n const localMuteSyncPromise = localMuteRequiresSync\n ? this.sendLocalMuteRequestToServer(meeting)\n : Promise.resolve();\n\n localMuteSyncPromise\n .then(() =>\n // then follow it up with remote mute sync\n remoteMuteRequiresSync ? this.sendRemoteMuteRequestToServer(meeting) : Promise.resolve()\n )\n .then(() => {\n this.state.syncToServerInProgress = false;\n LoggerProxy.logger.info(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: 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(meeting);\n })\n .catch((e) => {\n this.state.syncToServerInProgress = false;\n\n LoggerProxy.logger.warn(\n `Meeting:muteState#applyClientStateToServer --> ${this.type}: error: ${e}`\n );\n\n this.applyServerMuteToLocalStream(meeting, 'clientRequestFailed');\n });\n }\n\n /**\n * Sets the local mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendLocalMuteRequestToServer(meeting?: any) {\n const audioMuted = this.type === AUDIO ? this.getClientLocalMuteState() : undefined;\n const videoMuted = this.type === VIDEO ? this.getClientLocalMuteState() : undefined;\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: sending local mute (audio=${audioMuted}, video=${videoMuted}) to server`\n );\n\n return MeetingUtil.remoteUpdateAudioVideo(meeting, audioMuted, videoMuted)\n .then((locus) => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: local mute (audio=${audioMuted}, video=${videoMuted}) applied to server`\n );\n\n this.state.server.localMute = this.type === AUDIO ? audioMuted : videoMuted;\n\n if (locus) {\n meeting.locusInfo.handleLocusDelta(locus, meeting);\n }\n\n return locus;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendLocalMuteRequestToServer --> ${this.type}: failed to apply local mute (audio=${audioMuted}, video=${videoMuted}) to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /**\n * Sets the remote mute value in the server\n *\n * @private\n * @param {Object} [meeting] the meeting object\n * @memberof MuteState\n * @returns {Promise}\n */\n private sendRemoteMuteRequestToServer(meeting?: any) {\n const remoteMute = this.getClientLocalMuteState();\n\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: sending remote mute:${remoteMute} to server`\n );\n\n return meeting.members\n .muteMember(meeting.members.selfId, remoteMute, this.type === AUDIO)\n .then(() => {\n LoggerProxy.logger.info(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: remote mute:${remoteMute} applied to server`\n );\n\n this.state.server.remoteMute = remoteMute;\n })\n .catch((remoteUpdateError) => {\n LoggerProxy.logger.warn(\n `Meeting:muteState#sendRemoteMuteRequestToServer --> ${this.type}: failed to apply remote mute ${remoteMute} to server: ${remoteUpdateError}`\n );\n\n return Promise.reject(remoteUpdateError);\n });\n }\n\n /** Sets the mute state of the local stream according to what server thinks is our state\n * @param {Object} meeting - the meeting object\n * @param {ServerMuteReason} serverMuteReason - reason why we're applying server mute to the local stream\n * @returns {void}\n */\n private applyServerMuteToLocalStream(meeting: any, serverMuteReason: ServerMuteReason) {\n const muted = this.state.server.localMute || this.state.server.remoteMute;\n\n // update the local stream mute state, but not this.state.client.localMute\n this.muteLocalStream(meeting, muted, serverMuteReason);\n }\n\n /** Applies the current value for unmute allowed to the underlying stream\n *\n * @param {Meeting} meeting\n * @returns {void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n private applyUnmuteAllowedToStream(meeting: any) {\n if (this.type === AUDIO) {\n meeting.mediaProperties.audioStream?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n } else {\n meeting.mediaProperties.videoStream?.setUnmuteAllowed(this.state.server.unmuteAllowed);\n }\n }\n\n /**\n * This method should be called whenever the server remote mute state is changed\n *\n * @public\n * @memberof MuteState\n * @param {Meeting} meeting\n * @param {Boolean} [muted] true if user is remotely muted, false otherwise\n * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when \"hard mute\" feature is used)\n * @returns {undefined}\n */\n public handleServerRemoteMuteUpdate(meeting: any, muted?: boolean, unmuteAllowed?: boolean) {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerRemoteMuteUpdate --> ${this.type}: updating server remoteMute to (${muted})`\n );\n if (unmuteAllowed !== undefined) {\n this.state.server.unmuteAllowed = unmuteAllowed;\n this.applyUnmuteAllowedToStream(meeting);\n }\n if (muted !== undefined) {\n this.state.server.remoteMute = muted;\n this.applyServerMuteToLocalStream(meeting, 'remotelyMuted');\n }\n }\n\n /**\n * This method should be called whenever we receive from the server a requirement to locally unmute\n *\n * @public\n * @memberof MuteState\n * @param {Object} [meeting] the meeting object\n * @returns {undefined}\n */\n public handleServerLocalUnmuteRequired(meeting?: object) {\n if (!this.state.client.enabled) {\n LoggerProxy.logger.warn(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received while ${this.type} is disabled -> local unmute will not result in ${this.type} being sent`\n );\n } else {\n LoggerProxy.logger.info(\n `Meeting:muteState#handleServerLocalUnmuteRequired --> ${this.type}: localAudioUnmuteRequired received -> doing local unmute`\n );\n }\n\n // todo: I'm seeing \"you can now unmute yourself \" popup when this happens - but same thing happens on web.w.c so we can ignore for now\n this.state.server.remoteMute = false;\n this.state.client.localMute = false;\n\n this.applyClientStateLocally(meeting, 'localUnmuteRequired');\n this.applyClientStateToServer(meeting);\n }\n\n /**\n * Returns true if the user is locally or remotely muted.\n * It only checks the mute status, ignoring the fact whether audio/video is enabled.\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isMuted() {\n return (\n this.state.client.localMute || this.state.server.localMute || this.state.server.remoteMute\n );\n }\n\n /**\n * Returns true if the user is remotely muted\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isRemotelyMuted() {\n return this.state.server.remoteMute;\n }\n\n /**\n * Returns true if unmute is allowed\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isUnmuteAllowed() {\n return this.state.server.unmuteAllowed;\n }\n\n /**\n * Returns true if the user is locally muted or audio/video is disabled\n *\n * @public\n * @memberof MuteState\n * @returns {Boolean}\n */\n public isLocallyMuted() {\n return this.getClientLocalMuteState();\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA;AACA;AACA;AACA;AAEA;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAe,CAAIC,IAAI,EAAEC,OAAO,EAAEC,OAAgB,EAAK;EAClE;;EAEAC,oBAAW,CAACC,MAAM,CAACC,IAAI,iDACoBL,IAAI,iDAAuCC,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,EAAE,EAChG;EAED,IAAMC,SAAS,GAAG,IAAIC,SAAS,CAAC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