@webex/plugin-meetings 3.1.0-next.9 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/annotation/annotation.types.d.ts +42 -0
  2. package/dist/annotation/constants.d.ts +31 -0
  3. package/dist/annotation/index.d.ts +117 -0
  4. package/dist/breakouts/breakout.d.ts +8 -0
  5. package/dist/breakouts/breakout.js +1 -1
  6. package/dist/breakouts/collection.d.ts +5 -0
  7. package/dist/breakouts/edit-lock-error.d.ts +15 -0
  8. package/dist/breakouts/events.d.ts +8 -0
  9. package/dist/breakouts/index.d.ts +5 -0
  10. package/dist/breakouts/index.js +1 -1
  11. package/dist/breakouts/request.d.ts +22 -0
  12. package/dist/breakouts/utils.d.ts +15 -0
  13. package/dist/common/browser-detection.d.ts +9 -0
  14. package/dist/common/collection.d.ts +48 -0
  15. package/dist/common/config.d.ts +2 -0
  16. package/dist/common/errors/captcha-error.d.ts +15 -0
  17. package/dist/common/errors/intent-to-join.d.ts +16 -0
  18. package/dist/common/errors/join-meeting.d.ts +17 -0
  19. package/dist/common/errors/media.d.ts +15 -0
  20. package/dist/common/errors/no-meeting-info.d.ts +14 -0
  21. package/dist/common/errors/parameter.d.ts +15 -0
  22. package/dist/common/errors/password-error.d.ts +15 -0
  23. package/dist/common/errors/permission.d.ts +14 -0
  24. package/dist/common/errors/reclaim-host-role-errors.d.ts +60 -0
  25. package/dist/common/errors/reconnection-in-progress.d.ts +9 -0
  26. package/dist/common/errors/reconnection-in-progress.js +34 -0
  27. package/dist/common/errors/reconnection-in-progress.js.map +1 -0
  28. package/dist/common/errors/reconnection.d.ts +15 -0
  29. package/dist/common/errors/stats.d.ts +15 -0
  30. package/dist/common/errors/webex-errors.d.ts +93 -0
  31. package/dist/common/errors/webex-meetings-error.d.ts +20 -0
  32. package/dist/common/events/events-scope.d.ts +17 -0
  33. package/dist/common/events/events.d.ts +12 -0
  34. package/dist/common/events/trigger-proxy.d.ts +2 -0
  35. package/dist/common/events/util.d.ts +2 -0
  36. package/dist/common/logs/logger-config.d.ts +2 -0
  37. package/dist/common/logs/logger-proxy.d.ts +2 -0
  38. package/dist/common/logs/request.d.ts +36 -0
  39. package/dist/common/queue.d.ts +34 -0
  40. package/dist/config.d.ts +73 -0
  41. package/dist/constants.d.ts +1088 -0
  42. package/dist/constants.js +6 -3
  43. package/dist/constants.js.map +1 -1
  44. package/dist/controls-options-manager/constants.d.ts +4 -0
  45. package/dist/controls-options-manager/enums.d.ts +15 -0
  46. package/dist/controls-options-manager/index.d.ts +136 -0
  47. package/dist/controls-options-manager/types.d.ts +43 -0
  48. package/dist/controls-options-manager/util.d.ts +1 -0
  49. package/dist/index.d.ts +7 -0
  50. package/dist/interceptors/index.d.ts +2 -0
  51. package/dist/interceptors/locusRetry.d.ts +27 -0
  52. package/dist/interpretation/collection.d.ts +5 -0
  53. package/dist/interpretation/index.d.ts +5 -0
  54. package/dist/interpretation/index.js +1 -1
  55. package/dist/interpretation/siLanguage.d.ts +5 -0
  56. package/dist/interpretation/siLanguage.js +1 -1
  57. package/dist/locus-info/controlsUtils.d.ts +2 -0
  58. package/dist/locus-info/embeddedAppsUtils.d.ts +2 -0
  59. package/dist/locus-info/fullState.d.ts +2 -0
  60. package/dist/locus-info/hostUtils.d.ts +2 -0
  61. package/dist/locus-info/index.d.ts +322 -0
  62. package/dist/locus-info/infoUtils.d.ts +2 -0
  63. package/dist/locus-info/mediaSharesUtils.d.ts +2 -0
  64. package/dist/locus-info/parser.d.ts +272 -0
  65. package/dist/locus-info/selfUtils.d.ts +2 -0
  66. package/dist/media/MediaConnectionAwaiter.d.ts +61 -0
  67. package/dist/media/index.d.ts +34 -0
  68. package/dist/media/properties.d.ts +93 -0
  69. package/dist/media/util.d.ts +2 -0
  70. package/dist/mediaQualityMetrics/config.d.ts +241 -0
  71. package/dist/mediaQualityMetrics/config.js +10 -10
  72. package/dist/mediaQualityMetrics/config.js.map +1 -1
  73. package/dist/meeting/in-meeting-actions.d.ts +167 -0
  74. package/dist/meeting/index.d.ts +1825 -0
  75. package/dist/meeting/index.js +112 -64
  76. package/dist/meeting/index.js.map +1 -1
  77. package/dist/meeting/locusMediaRequest.d.ts +74 -0
  78. package/dist/meeting/locusMediaRequest.js +27 -0
  79. package/dist/meeting/locusMediaRequest.js.map +1 -1
  80. package/dist/meeting/muteState.d.ts +178 -0
  81. package/dist/meeting/request.d.ts +295 -0
  82. package/dist/meeting/request.type.d.ts +11 -0
  83. package/dist/meeting/state.d.ts +9 -0
  84. package/dist/meeting/util.d.ts +119 -0
  85. package/dist/meeting/util.js +0 -16
  86. package/dist/meeting/util.js.map +1 -1
  87. package/dist/meeting/voicea-meeting.d.ts +16 -0
  88. package/dist/meeting/voicea-meeting.js +37 -49
  89. package/dist/meeting/voicea-meeting.js.map +1 -1
  90. package/dist/meeting-info/collection.d.ts +20 -0
  91. package/dist/meeting-info/index.d.ts +69 -0
  92. package/dist/meeting-info/meeting-info-v2.d.ts +123 -0
  93. package/dist/meeting-info/request.d.ts +22 -0
  94. package/dist/meeting-info/util.d.ts +2 -0
  95. package/dist/meeting-info/utilv2.d.ts +2 -0
  96. package/dist/meetings/collection.d.ts +40 -0
  97. package/dist/meetings/index.d.ts +398 -0
  98. package/dist/meetings/index.js +12 -28
  99. package/dist/meetings/index.js.map +1 -1
  100. package/dist/meetings/meetings.types.d.ts +4 -0
  101. package/dist/meetings/request.d.ts +27 -0
  102. package/dist/meetings/util.d.ts +18 -0
  103. package/dist/member/index.d.ts +160 -0
  104. package/dist/member/types.d.ts +32 -0
  105. package/dist/member/util.d.ts +2 -0
  106. package/dist/members/collection.d.ts +29 -0
  107. package/dist/members/index.d.ts +353 -0
  108. package/dist/members/request.d.ts +114 -0
  109. package/dist/members/types.d.ts +25 -0
  110. package/dist/members/util.d.ts +215 -0
  111. package/dist/metrics/constants.d.ts +70 -0
  112. package/dist/metrics/index.d.ts +45 -0
  113. package/dist/multistream/mediaRequestManager.d.ts +119 -0
  114. package/dist/multistream/receiveSlot.d.ts +68 -0
  115. package/dist/multistream/receiveSlotManager.d.ts +56 -0
  116. package/dist/multistream/remoteMedia.d.ts +72 -0
  117. package/dist/multistream/remoteMediaGroup.d.ts +49 -0
  118. package/dist/multistream/remoteMediaManager.d.ts +300 -0
  119. package/dist/multistream/sendSlotManager.d.ts +69 -0
  120. package/dist/networkQualityMonitor/index.d.ts +70 -0
  121. package/dist/personal-meeting-room/index.d.ts +47 -0
  122. package/dist/personal-meeting-room/request.d.ts +14 -0
  123. package/dist/personal-meeting-room/util.d.ts +2 -0
  124. package/dist/reachability/clusterReachability.d.ts +110 -0
  125. package/dist/reachability/index.d.ts +109 -0
  126. package/dist/reachability/index.js +88 -9
  127. package/dist/reachability/index.js.map +1 -1
  128. package/dist/reachability/request.d.ts +39 -0
  129. package/dist/reachability/util.d.ts +15 -0
  130. package/dist/reactions/constants.d.ts +3 -0
  131. package/dist/reactions/reactions.d.ts +4 -0
  132. package/dist/reactions/reactions.type.d.ts +52 -0
  133. package/dist/reconnection-manager/index.d.ts +136 -0
  134. package/dist/recording-controller/enums.d.ts +7 -0
  135. package/dist/recording-controller/index.d.ts +207 -0
  136. package/dist/recording-controller/util.d.ts +14 -0
  137. package/dist/roap/index.d.ts +86 -0
  138. package/dist/roap/request.d.ts +39 -0
  139. package/dist/roap/request.js +3 -27
  140. package/dist/roap/request.js.map +1 -1
  141. package/dist/roap/turnDiscovery.d.ts +155 -0
  142. package/dist/rtcMetrics/constants.d.ts +4 -0
  143. package/dist/rtcMetrics/index.d.ts +61 -0
  144. package/dist/statsAnalyzer/global.d.ts +36 -0
  145. package/dist/statsAnalyzer/index.d.ts +217 -0
  146. package/dist/statsAnalyzer/index.js +4 -2
  147. package/dist/statsAnalyzer/index.js.map +1 -1
  148. package/dist/statsAnalyzer/mqaUtil.d.ts +48 -0
  149. package/dist/statsAnalyzer/mqaUtil.js +14 -0
  150. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  151. package/dist/transcription/index.d.ts +64 -0
  152. package/dist/types/constants.d.ts +3 -1
  153. package/dist/types/mediaQualityMetrics/config.d.ts +8 -2
  154. package/dist/types/meeting/index.d.ts +10 -1
  155. package/dist/types/meeting/locusMediaRequest.d.ts +1 -0
  156. package/dist/types/meeting/voicea-meeting.d.ts +3 -2
  157. package/dist/types/meetings/index.d.ts +1 -16
  158. package/dist/types/reachability/index.d.ts +11 -0
  159. package/dist/webinar/collection.d.ts +16 -0
  160. package/dist/webinar/index.d.ts +5 -0
  161. package/dist/webinar/index.js +1 -1
  162. package/package.json +21 -21
  163. package/src/constants.ts +3 -2
  164. package/src/mediaQualityMetrics/config.ts +13 -7
  165. package/src/meeting/index.ts +73 -30
  166. package/src/meeting/locusMediaRequest.ts +31 -0
  167. package/src/meeting/util.ts +1 -16
  168. package/src/meeting/voicea-meeting.ts +44 -46
  169. package/src/meetings/index.ts +15 -27
  170. package/src/reachability/index.ts +60 -0
  171. package/src/roap/request.ts +1 -24
  172. package/src/statsAnalyzer/index.ts +6 -3
  173. package/src/statsAnalyzer/mqaUtil.ts +18 -0
  174. package/test/unit/spec/meeting/index.js +70 -33
  175. package/test/unit/spec/meeting/locusMediaRequest.ts +49 -0
  176. package/test/unit/spec/meeting/utils.js +0 -10
  177. package/test/unit/spec/meeting/voicea-meeting.ts +5 -14
  178. package/test/unit/spec/meetings/index.js +59 -17
  179. package/test/unit/spec/reachability/index.ts +266 -0
  180. package/test/unit/spec/roap/request.ts +0 -37
  181. package/test/unit/spec/stats-analyzer/index.js +89 -8
@@ -0,0 +1,74 @@
1
+ import { WebexPlugin } from '@webex/webex-core';
2
+ import { IP_VERSION } from '../constants';
3
+ export type MediaRequestType = 'RoapMessage' | 'LocalMute';
4
+ export type RequestResult = any;
5
+ export type RoapRequest = {
6
+ type: 'RoapMessage';
7
+ selfUrl: string;
8
+ mediaId: string;
9
+ roapMessage: any;
10
+ reachability: any;
11
+ sequence?: any;
12
+ joinCookie: any;
13
+ ipVersion?: IP_VERSION;
14
+ };
15
+ export type LocalMuteRequest = {
16
+ type: 'LocalMute';
17
+ selfUrl: string;
18
+ mediaId: string;
19
+ sequence?: any;
20
+ muteOptions: {
21
+ audioMuted?: boolean;
22
+ videoMuted?: boolean;
23
+ };
24
+ };
25
+ export type Request = RoapRequest | LocalMuteRequest;
26
+ export type Config = {
27
+ device: {
28
+ url: string;
29
+ deviceType: string;
30
+ countryCode?: string;
31
+ regionCode?: string;
32
+ };
33
+ correlationId: string;
34
+ preferTranscoding: boolean;
35
+ };
36
+ /**
37
+ * This class manages all /media API requests to Locus. Every call to that
38
+ * Locus API has to go through this class.
39
+ */
40
+ export declare class LocusMediaRequest extends WebexPlugin {
41
+ private config;
42
+ private latestAudioMuted?;
43
+ private latestVideoMuted?;
44
+ private isRequestInProgress;
45
+ private queuedRequests;
46
+ private confluenceState;
47
+ /**
48
+ * Constructor
49
+ */
50
+ constructor(config: Config, options: any);
51
+ /**
52
+ * Add a request to the internal queue.
53
+ */
54
+ private addToQueue;
55
+ /**
56
+ * Takes the next request from the queue and executes it. Once that
57
+ * request is completed, the next one will be taken from the queue
58
+ * and executed and this is repeated until the queue is empty.
59
+ */
60
+ private executeNextQueuedRequest;
61
+ /**
62
+ * Returns latest requested audio and video mute values. If they have never been
63
+ * requested, we assume audio/video to be muted.
64
+ */
65
+ private getLatestMuteState;
66
+ /**
67
+ * Prepares the uri and body for the media request to be sent to Locus
68
+ */
69
+ private sendHttpRequest;
70
+ /**
71
+ * Sends a media request to Locus
72
+ */
73
+ send(request: Request): Promise<RequestResult>;
74
+ }
@@ -218,6 +218,14 @@ var LocusMediaRequest = exports.LocusMediaRequest = /*#__PURE__*/function (_Webe
218
218
  localMedias.roapMessage = request.roapMessage;
219
219
  localMedias.reachability = request.reachability;
220
220
  body.clientMediaPreferences.joinCookie = request.joinCookie;
221
+
222
+ // @ts-ignore
223
+ this.webex.internal.newMetrics.submitClientEvent({
224
+ name: 'client.locus.media.request',
225
+ options: {
226
+ meetingId: this.config.meetingId
227
+ }
228
+ });
221
229
  break;
222
230
  }
223
231
  if (request.sequence) {
@@ -242,11 +250,30 @@ var LocusMediaRequest = exports.LocusMediaRequest = /*#__PURE__*/function (_Webe
242
250
  if (isRequestAffectingConfluenceState(request)) {
243
251
  _this4.confluenceState = 'created';
244
252
  }
253
+ if (request.type === 'RoapMessage') {
254
+ // @ts-ignore
255
+ _this4.webex.internal.newMetrics.submitClientEvent({
256
+ name: 'client.locus.media.response',
257
+ options: {
258
+ meetingId: _this4.config.meetingId
259
+ }
260
+ });
261
+ }
245
262
  return result;
246
263
  }).catch(function (e) {
247
264
  if (isRequestAffectingConfluenceState(request) && _this4.confluenceState === 'creation in progress') {
248
265
  _this4.confluenceState = 'not created';
249
266
  }
267
+ if (request.type === 'RoapMessage') {
268
+ // @ts-ignore
269
+ _this4.webex.internal.newMetrics.submitClientEvent({
270
+ name: 'client.locus.media.response',
271
+ options: {
272
+ meetingId: _this4.config.meetingId,
273
+ rawError: e
274
+ }
275
+ });
276
+ }
250
277
  throw e;
251
278
  });
252
279
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_lodash","require","_common","_webexCore","_constants","_loggerProxy","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","InternalRequestInfo","request","pendingPromise","sendRequestFn","_classCallCheck2","_defineProperty2","pendingPromises","_createClass2","key","value","getPendingPromises","addPendingPromises","_this$pendingPromises","push","_toConsumableArray2","execute","_this","then","forEach","d","resolve","catch","reject","isRequestAffectingConfluenceState","type","roapMessage","messageType","ROAP","ROAP_TYPES","OFFER","LocusMediaRequest","exports","_WebexPlugin","_inherits2","_super","config","options","_this2","_assertThisInitialized2","isRequestInProgress","queuedRequests","confluenceState","addToQueue","info","length","filter","r","executeNextQueuedRequest","_this3","nextRequest","shift","getLatestMuteState","audioMuted","latestAudioMuted","undefined","videoMuted","latestVideoMuted","sendHttpRequest","_this4","uri","concat","selfUrl","MEDIA","_this$getLatestMuteSt","body","device","correlationId","clientMediaPreferences","preferTranscoding","ipver","ipVersion","localMedias","respOnlySdp","usingResource","reachability","joinCookie","sequence","localSdp","_stringify","mediaId","LoggerProxy","logger","method","HTTP_VERBS","PUT","send","_this5","_request$muteOptions","muteOptions","_promise","Defer","newRequest","bind","defer","promise","WebexPlugin"],"sources":["locusMediaRequest.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {defer} from 'lodash';\nimport {Defer} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\nimport {MEDIA, HTTP_VERBS, ROAP, IP_VERSION} from '../constants';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nexport type MediaRequestType = 'RoapMessage' | 'LocalMute';\nexport type RequestResult = any;\n\nexport type RoapRequest = {\n type: 'RoapMessage';\n selfUrl: string;\n mediaId: string;\n roapMessage: any;\n reachability: any;\n sequence?: any;\n joinCookie: any; // any, because this is opaque to the client, we pass whatever object we got from one backend component (Orpheus) to the other (Locus)\n ipVersion?: IP_VERSION;\n};\n\nexport type LocalMuteRequest = {\n type: 'LocalMute';\n selfUrl: string;\n mediaId: string;\n sequence?: any;\n muteOptions: {\n audioMuted?: boolean;\n videoMuted?: boolean;\n };\n};\n\nexport type Request = RoapRequest | LocalMuteRequest;\n\n/** Class representing a single /media request being sent to Locus */\nclass InternalRequestInfo {\n public readonly request: Request;\n private pendingPromises: Defer[];\n private sendRequestFn: (request: Request) => Promise<RequestResult>;\n\n /** Constructor */\n constructor(\n request: Request,\n pendingPromise: Defer,\n sendRequestFn: (request: Request) => Promise<RequestResult>\n ) {\n this.request = request;\n this.pendingPromises = [pendingPromise];\n this.sendRequestFn = sendRequestFn;\n }\n\n /**\n * Returns the list of pending promises associated with this request\n */\n public getPendingPromises() {\n return this.pendingPromises;\n }\n\n /**\n * Adds promises to the list of pending promises associated with this request\n */\n public addPendingPromises(pendingPromises: Defer[]) {\n this.pendingPromises.push(...pendingPromises);\n }\n\n /**\n * Executes the request. Returned promise is resolved once the request\n * is completed (no matter if it succeeded or failed).\n */\n public execute(): Promise<void> {\n return this.sendRequestFn(this.request)\n .then((result) => {\n // resolve all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.resolve(result));\n })\n .catch((e) => {\n // reject all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.reject(e));\n });\n }\n}\n\nexport type Config = {\n device: {\n url: string;\n deviceType: string;\n countryCode?: string;\n regionCode?: string;\n };\n correlationId: string;\n preferTranscoding: boolean;\n};\n\n/**\n * Returns true if the request is triggering confluence creation in the server\n */\nfunction isRequestAffectingConfluenceState(request: Request): boolean {\n return (\n request.type === 'RoapMessage' && request.roapMessage.messageType === ROAP.ROAP_TYPES.OFFER\n );\n}\n\n/**\n * This class manages all /media API requests to Locus. Every call to that\n * Locus API has to go through this class.\n */\nexport class LocusMediaRequest extends WebexPlugin {\n private config: Config;\n private latestAudioMuted?: boolean;\n private latestVideoMuted?: boolean;\n private isRequestInProgress: boolean;\n private queuedRequests: InternalRequestInfo[];\n private confluenceState: 'not created' | 'creation in progress' | 'created';\n /**\n * Constructor\n */\n constructor(config: Config, options: any) {\n super({}, options);\n this.isRequestInProgress = false;\n this.queuedRequests = [];\n this.config = config;\n this.confluenceState = 'not created';\n }\n\n /**\n * Add a request to the internal queue.\n */\n private addToQueue(info: InternalRequestInfo) {\n if (info.request.type === 'LocalMute' && this.queuedRequests.length > 0) {\n // We don't need additional local mute requests in the queue.\n // We only need at most 1 local mute or 1 roap request, because\n // roap requests also include mute state, so whatever request\n // is sent out, it will send the latest local mute state.\n // We only need to store the pendingPromises so that they get resolved\n // when the roap request is sent out.\n this.queuedRequests[0].addPendingPromises(info.getPendingPromises());\n\n return;\n }\n\n if (info.request.type === 'RoapMessage' && this.queuedRequests.length > 0) {\n // remove any LocalMute requests from the queue, because this Roap message\n // will also update the mute status in Locus, so they are redundant\n this.queuedRequests = this.queuedRequests.filter((r) => {\n if (r.request.type === 'LocalMute') {\n // we need to keep the pending promises from the local mute request\n // that we're removing from the queue\n info.addPendingPromises(r.getPendingPromises());\n\n return false;\n }\n\n return true;\n });\n }\n\n this.queuedRequests.push(info);\n }\n\n /**\n * Takes the next request from the queue and executes it. Once that\n * request is completed, the next one will be taken from the queue\n * and executed and this is repeated until the queue is empty.\n */\n private executeNextQueuedRequest(): void {\n if (this.isRequestInProgress) {\n return;\n }\n\n const nextRequest = this.queuedRequests.shift();\n\n if (nextRequest) {\n this.isRequestInProgress = true;\n nextRequest.execute().then(() => {\n this.isRequestInProgress = false;\n this.executeNextQueuedRequest();\n });\n }\n }\n\n /**\n * Returns latest requested audio and video mute values. If they have never been\n * requested, we assume audio/video to be muted.\n */\n private getLatestMuteState() {\n const audioMuted = this.latestAudioMuted !== undefined ? this.latestAudioMuted : true;\n const videoMuted = this.latestVideoMuted !== undefined ? this.latestVideoMuted : true;\n\n return {audioMuted, videoMuted};\n }\n\n /**\n * Prepares the uri and body for the media request to be sent to Locus\n */\n private sendHttpRequest(request: Request) {\n const uri = `${request.selfUrl}/${MEDIA}`;\n\n const {audioMuted, videoMuted} = this.getLatestMuteState();\n\n // first setup things common to all requests\n const body: any = {\n device: this.config.device,\n correlationId: this.config.correlationId,\n clientMediaPreferences: {\n preferTranscoding: this.config.preferTranscoding,\n ipver: request.type === 'RoapMessage' ? request.ipVersion : undefined,\n },\n };\n\n const localMedias: any = {\n audioMuted,\n videoMuted,\n };\n\n // now add things specific to request type\n switch (request.type) {\n case 'LocalMute':\n body.respOnlySdp = true;\n body.usingResource = null;\n break;\n\n case 'RoapMessage':\n localMedias.roapMessage = request.roapMessage;\n localMedias.reachability = request.reachability;\n body.clientMediaPreferences.joinCookie = request.joinCookie;\n break;\n }\n\n if (request.sequence) {\n body.sequence = request.sequence;\n }\n\n body.localMedias = [\n {\n localSdp: JSON.stringify(localMedias), // this part must be JSON stringified, Locus requires this\n mediaId: request.mediaId,\n },\n ];\n\n LoggerProxy.logger.info(\n `Meeting:LocusMediaRequest#sendHttpRequest --> ${request.type} audioMuted=${audioMuted} videoMuted=${videoMuted}`\n );\n\n if (isRequestAffectingConfluenceState(request) && this.confluenceState === 'not created') {\n this.confluenceState = 'creation in progress';\n }\n\n // @ts-ignore\n return this.request({\n method: HTTP_VERBS.PUT,\n uri,\n body,\n })\n .then((result) => {\n if (isRequestAffectingConfluenceState(request)) {\n this.confluenceState = 'created';\n }\n\n return result;\n })\n .catch((e) => {\n if (\n isRequestAffectingConfluenceState(request) &&\n this.confluenceState === 'creation in progress'\n ) {\n this.confluenceState = 'not created';\n }\n throw e;\n });\n }\n\n /**\n * Sends a media request to Locus\n */\n public send(request: Request): Promise<RequestResult> {\n if (request.type === 'LocalMute') {\n const {audioMuted, videoMuted} = request.muteOptions;\n\n if (audioMuted !== undefined) {\n this.latestAudioMuted = audioMuted;\n }\n if (videoMuted !== undefined) {\n this.latestVideoMuted = videoMuted;\n }\n\n if (this.confluenceState === 'not created') {\n // if there is no confluence, there is no point sending out local mute request\n // as it will fail so we just store the latest audio/video muted values\n // and resolve immediately, so that higher layer (MuteState class) doesn't get blocked\n // and can call us again if user mutes/unmutes again before confluence is created\n LoggerProxy.logger.info(\n 'Meeting:LocusMediaRequest#send --> called with LocalMute request before confluence creation'\n );\n\n return Promise.resolve({});\n }\n }\n\n const pendingPromise = new Defer();\n\n const newRequest = new InternalRequestInfo(\n request,\n pendingPromise,\n this.sendHttpRequest.bind(this)\n );\n\n this.addToQueue(newRequest);\n\n defer(() => this.executeNextQueuedRequest());\n\n return pendingPromise.promise;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAsD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E,SAAS,EAAE;UAC5B,IAAI,CAACD,gBAAgB,GAAGD,UAAU;QACpC;QACA,IAAIG,UAAU,KAAKD,SAAS,EAAE;UAC5B,IAAI,CAACE,gBAAgB,GAAGD,UAAU;QACpC;QAEA,IAAI,IAAI,CAACd,eAAe,KAAK,aAAa,EAAE;UAC1C;UACA;UACA;UACA;UACAuC,oBAAW,CAACC,MAAM,CAACtC,IAAI,CACrB,6FACF,CAAC;UAED,OAAO8C,QAAA,CAAAzG,OAAA,CAAQoC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5B;MACF;MAEA,IAAMlB,cAAc,GAAG,IAAIwF,aAAK,CAAC,CAAC;MAElC,IAAMC,UAAU,GAAG,IAAI3F,mBAAmB,CACxCC,OAAO,EACPC,cAAc,EACd,IAAI,CAACuD,eAAe,CAACmC,IAAI,CAAC,IAAI,CAChC,CAAC;MAED,IAAI,CAAClD,UAAU,CAACiD,UAAU,CAAC;MAE3B,IAAAE,aAAK,EAAC;QAAA,OAAMP,MAAI,CAACvC,wBAAwB,CAAC,CAAC;MAAA,EAAC;MAE5C,OAAO7C,cAAc,CAAC4F,OAAO;IAC/B;EAAC;EAAA,OAAAhE,iBAAA;AAAA,EA7MoCiE,sBAAW"}
1
+ {"version":3,"names":["_lodash","require","_common","_webexCore","_constants","_loggerProxy","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","InternalRequestInfo","request","pendingPromise","sendRequestFn","_classCallCheck2","_defineProperty2","pendingPromises","_createClass2","key","value","getPendingPromises","addPendingPromises","_this$pendingPromises","push","_toConsumableArray2","execute","_this","then","forEach","d","resolve","catch","reject","isRequestAffectingConfluenceState","type","roapMessage","messageType","ROAP","ROAP_TYPES","OFFER","LocusMediaRequest","exports","_WebexPlugin","_inherits2","_super","config","options","_this2","_assertThisInitialized2","isRequestInProgress","queuedRequests","confluenceState","addToQueue","info","length","filter","r","executeNextQueuedRequest","_this3","nextRequest","shift","getLatestMuteState","audioMuted","latestAudioMuted","undefined","videoMuted","latestVideoMuted","sendHttpRequest","_this4","uri","concat","selfUrl","MEDIA","_this$getLatestMuteSt","body","device","correlationId","clientMediaPreferences","preferTranscoding","ipver","ipVersion","localMedias","respOnlySdp","usingResource","reachability","joinCookie","webex","internal","newMetrics","submitClientEvent","name","meetingId","sequence","localSdp","_stringify","mediaId","LoggerProxy","logger","method","HTTP_VERBS","PUT","rawError","send","_this5","_request$muteOptions","muteOptions","_promise","Defer","newRequest","bind","defer","promise","WebexPlugin"],"sources":["locusMediaRequest.ts"],"sourcesContent":["/* eslint-disable valid-jsdoc */\nimport {defer} from 'lodash';\nimport {Defer} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\nimport {MEDIA, HTTP_VERBS, ROAP, IP_VERSION} from '../constants';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nexport type MediaRequestType = 'RoapMessage' | 'LocalMute';\nexport type RequestResult = any;\n\nexport type RoapRequest = {\n type: 'RoapMessage';\n selfUrl: string;\n mediaId: string;\n roapMessage: any;\n reachability: any;\n sequence?: any;\n joinCookie: any; // any, because this is opaque to the client, we pass whatever object we got from one backend component (Orpheus) to the other (Locus)\n ipVersion?: IP_VERSION;\n};\n\nexport type LocalMuteRequest = {\n type: 'LocalMute';\n selfUrl: string;\n mediaId: string;\n sequence?: any;\n muteOptions: {\n audioMuted?: boolean;\n videoMuted?: boolean;\n };\n};\n\nexport type Request = RoapRequest | LocalMuteRequest;\n\n/** Class representing a single /media request being sent to Locus */\nclass InternalRequestInfo {\n public readonly request: Request;\n private pendingPromises: Defer[];\n private sendRequestFn: (request: Request) => Promise<RequestResult>;\n\n /** Constructor */\n constructor(\n request: Request,\n pendingPromise: Defer,\n sendRequestFn: (request: Request) => Promise<RequestResult>\n ) {\n this.request = request;\n this.pendingPromises = [pendingPromise];\n this.sendRequestFn = sendRequestFn;\n }\n\n /**\n * Returns the list of pending promises associated with this request\n */\n public getPendingPromises() {\n return this.pendingPromises;\n }\n\n /**\n * Adds promises to the list of pending promises associated with this request\n */\n public addPendingPromises(pendingPromises: Defer[]) {\n this.pendingPromises.push(...pendingPromises);\n }\n\n /**\n * Executes the request. Returned promise is resolved once the request\n * is completed (no matter if it succeeded or failed).\n */\n public execute(): Promise<void> {\n return this.sendRequestFn(this.request)\n .then((result) => {\n // resolve all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.resolve(result));\n })\n .catch((e) => {\n // reject all the pending promises associated with this request\n this.pendingPromises.forEach((d) => d.reject(e));\n });\n }\n}\n\nexport type Config = {\n device: {\n url: string;\n deviceType: string;\n countryCode?: string;\n regionCode?: string;\n };\n correlationId: string;\n meetingId: string;\n preferTranscoding: boolean;\n};\n\n/**\n * Returns true if the request is triggering confluence creation in the server\n */\nfunction isRequestAffectingConfluenceState(request: Request): boolean {\n return (\n request.type === 'RoapMessage' && request.roapMessage.messageType === ROAP.ROAP_TYPES.OFFER\n );\n}\n\n/**\n * This class manages all /media API requests to Locus. Every call to that\n * Locus API has to go through this class.\n */\nexport class LocusMediaRequest extends WebexPlugin {\n private config: Config;\n private latestAudioMuted?: boolean;\n private latestVideoMuted?: boolean;\n private isRequestInProgress: boolean;\n private queuedRequests: InternalRequestInfo[];\n private confluenceState: 'not created' | 'creation in progress' | 'created';\n /**\n * Constructor\n */\n constructor(config: Config, options: any) {\n super({}, options);\n this.isRequestInProgress = false;\n this.queuedRequests = [];\n this.config = config;\n this.confluenceState = 'not created';\n }\n\n /**\n * Add a request to the internal queue.\n */\n private addToQueue(info: InternalRequestInfo) {\n if (info.request.type === 'LocalMute' && this.queuedRequests.length > 0) {\n // We don't need additional local mute requests in the queue.\n // We only need at most 1 local mute or 1 roap request, because\n // roap requests also include mute state, so whatever request\n // is sent out, it will send the latest local mute state.\n // We only need to store the pendingPromises so that they get resolved\n // when the roap request is sent out.\n this.queuedRequests[0].addPendingPromises(info.getPendingPromises());\n\n return;\n }\n\n if (info.request.type === 'RoapMessage' && this.queuedRequests.length > 0) {\n // remove any LocalMute requests from the queue, because this Roap message\n // will also update the mute status in Locus, so they are redundant\n this.queuedRequests = this.queuedRequests.filter((r) => {\n if (r.request.type === 'LocalMute') {\n // we need to keep the pending promises from the local mute request\n // that we're removing from the queue\n info.addPendingPromises(r.getPendingPromises());\n\n return false;\n }\n\n return true;\n });\n }\n\n this.queuedRequests.push(info);\n }\n\n /**\n * Takes the next request from the queue and executes it. Once that\n * request is completed, the next one will be taken from the queue\n * and executed and this is repeated until the queue is empty.\n */\n private executeNextQueuedRequest(): void {\n if (this.isRequestInProgress) {\n return;\n }\n\n const nextRequest = this.queuedRequests.shift();\n\n if (nextRequest) {\n this.isRequestInProgress = true;\n nextRequest.execute().then(() => {\n this.isRequestInProgress = false;\n this.executeNextQueuedRequest();\n });\n }\n }\n\n /**\n * Returns latest requested audio and video mute values. If they have never been\n * requested, we assume audio/video to be muted.\n */\n private getLatestMuteState() {\n const audioMuted = this.latestAudioMuted !== undefined ? this.latestAudioMuted : true;\n const videoMuted = this.latestVideoMuted !== undefined ? this.latestVideoMuted : true;\n\n return {audioMuted, videoMuted};\n }\n\n /**\n * Prepares the uri and body for the media request to be sent to Locus\n */\n private sendHttpRequest(request: Request) {\n const uri = `${request.selfUrl}/${MEDIA}`;\n\n const {audioMuted, videoMuted} = this.getLatestMuteState();\n\n // first setup things common to all requests\n const body: any = {\n device: this.config.device,\n correlationId: this.config.correlationId,\n clientMediaPreferences: {\n preferTranscoding: this.config.preferTranscoding,\n ipver: request.type === 'RoapMessage' ? request.ipVersion : undefined,\n },\n };\n\n const localMedias: any = {\n audioMuted,\n videoMuted,\n };\n\n // now add things specific to request type\n switch (request.type) {\n case 'LocalMute':\n body.respOnlySdp = true;\n body.usingResource = null;\n break;\n\n case 'RoapMessage':\n localMedias.roapMessage = request.roapMessage;\n localMedias.reachability = request.reachability;\n body.clientMediaPreferences.joinCookie = request.joinCookie;\n\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.request',\n options: {\n meetingId: this.config.meetingId,\n },\n });\n break;\n }\n\n if (request.sequence) {\n body.sequence = request.sequence;\n }\n\n body.localMedias = [\n {\n localSdp: JSON.stringify(localMedias), // this part must be JSON stringified, Locus requires this\n mediaId: request.mediaId,\n },\n ];\n\n LoggerProxy.logger.info(\n `Meeting:LocusMediaRequest#sendHttpRequest --> ${request.type} audioMuted=${audioMuted} videoMuted=${videoMuted}`\n );\n\n if (isRequestAffectingConfluenceState(request) && this.confluenceState === 'not created') {\n this.confluenceState = 'creation in progress';\n }\n\n // @ts-ignore\n return this.request({\n method: HTTP_VERBS.PUT,\n uri,\n body,\n })\n .then((result) => {\n if (isRequestAffectingConfluenceState(request)) {\n this.confluenceState = 'created';\n }\n\n if (request.type === 'RoapMessage') {\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.response',\n options: {\n meetingId: this.config.meetingId,\n },\n });\n }\n\n return result;\n })\n .catch((e) => {\n if (\n isRequestAffectingConfluenceState(request) &&\n this.confluenceState === 'creation in progress'\n ) {\n this.confluenceState = 'not created';\n }\n\n if (request.type === 'RoapMessage') {\n // @ts-ignore\n this.webex.internal.newMetrics.submitClientEvent({\n name: 'client.locus.media.response',\n options: {\n meetingId: this.config.meetingId,\n rawError: e,\n },\n });\n }\n\n throw e;\n });\n }\n\n /**\n * Sends a media request to Locus\n */\n public send(request: Request): Promise<RequestResult> {\n if (request.type === 'LocalMute') {\n const {audioMuted, videoMuted} = request.muteOptions;\n\n if (audioMuted !== undefined) {\n this.latestAudioMuted = audioMuted;\n }\n if (videoMuted !== undefined) {\n this.latestVideoMuted = videoMuted;\n }\n\n if (this.confluenceState === 'not created') {\n // if there is no confluence, there is no point sending out local mute request\n // as it will fail so we just store the latest audio/video muted values\n // and resolve immediately, so that higher layer (MuteState class) doesn't get blocked\n // and can call us again if user mutes/unmutes again before confluence is created\n LoggerProxy.logger.info(\n 'Meeting:LocusMediaRequest#send --> called with LocalMute request before confluence creation'\n );\n\n return Promise.resolve({});\n }\n }\n\n const pendingPromise = new Defer();\n\n const newRequest = new InternalRequestInfo(\n request,\n pendingPromise,\n this.sendHttpRequest.bind(this)\n );\n\n this.addToQueue(newRequest);\n\n defer(() => this.executeNextQueuedRequest());\n\n return pendingPromise.promise;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAsD,SAAAM,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA,sBALtD;AAkCA;AAAA,IACMC,mBAAmB;EAKvB;EACA,SAAAA,oBACEC,OAAgB,EAChBC,cAAqB,EACrBC,aAA2D,EAC3D;IAAA,IAAAC,gBAAA,CAAApB,OAAA,QAAAgB,mBAAA;IAAA,IAAAK,gBAAA,CAAArB,OAAA;IAA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AE;UAC5B,IAAI,CAACD,gBAAgB,GAAGD,UAAU;QACpC;QACA,IAAIG,UAAU,KAAKD,SAAS,EAAE;UAC5B,IAAI,CAACE,gBAAgB,GAAGD,UAAU;QACpC;QAEA,IAAI,IAAI,CAACd,eAAe,KAAK,aAAa,EAAE;UAC1C;UACA;UACA;UACA;UACA6C,oBAAW,CAACC,MAAM,CAAC5C,IAAI,CACrB,6FACF,CAAC;UAED,OAAOqD,QAAA,CAAAhH,OAAA,CAAQoC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5B;MACF;MAEA,IAAMlB,cAAc,GAAG,IAAI+F,aAAK,CAAC,CAAC;MAElC,IAAMC,UAAU,GAAG,IAAIlG,mBAAmB,CACxCC,OAAO,EACPC,cAAc,EACd,IAAI,CAACuD,eAAe,CAAC0C,IAAI,CAAC,IAAI,CAChC,CAAC;MAED,IAAI,CAACzD,UAAU,CAACwD,UAAU,CAAC;MAE3B,IAAAE,aAAK,EAAC;QAAA,OAAMP,MAAI,CAAC9C,wBAAwB,CAAC,CAAC;MAAA,EAAC;MAE5C,OAAO7C,cAAc,CAACmG,OAAO;IAC/B;EAAC;EAAA,OAAAvE,iBAAA;AAAA,EA3OoCwE,sBAAW"}
@@ -0,0 +1,178 @@
1
+ import { ServerMuteReason } from '@webex/media-helpers';
2
+ export declare const createMuteState: (type: any, meeting: any, enabled: boolean) => MuteState;
3
+ /** The purpose of this class is to manage the local and remote mute state and make sure that the server state always matches
4
+ the last requested state by the client.
5
+
6
+ More info about Locus muting API: https://sqbu-github.cisco.com/pages/WebExSquared/locus/guides/mute.html#
7
+
8
+ This class is exported only for unit tests. It should never be instantiated directly with new MuteState(), instead createMuteState() should be called
9
+ */
10
+ export declare class MuteState {
11
+ state: {
12
+ client: {
13
+ enabled: boolean;
14
+ localMute: boolean;
15
+ };
16
+ server: {
17
+ localMute: boolean;
18
+ remoteMute: boolean;
19
+ unmuteAllowed: boolean;
20
+ };
21
+ syncToServerInProgress: boolean;
22
+ };
23
+ type: any;
24
+ ignoreMuteStateChange: boolean;
25
+ /**
26
+ * Constructor
27
+ *
28
+ * @param {String} type - audio or video
29
+ * @param {Object} meeting - the meeting object (used for reading current remote mute status)
30
+ * @param {boolean} enabled - whether the client audio/video is enabled at all
31
+ */
32
+ constructor(type: string, meeting: any, enabled: boolean);
33
+ /**
34
+ * Starts the mute state machine. Needs to be called after a new MuteState instance is created.
35
+ *
36
+ * @param {Object} meeting - the meeting object
37
+ * @returns {void}
38
+ */
39
+ init(meeting: any): void;
40
+ /**
41
+ * This method needs to be called whenever the local audio/video stream has changed.
42
+ * It reapplies the remote mute state onto the new stream and also reads the current
43
+ * local mute state from the stream and updates the internal state machine and sends
44
+ * any required requests to the server.
45
+ *
46
+ * @param {Object} meeting - the meeting object
47
+ * @returns {void}
48
+ */
49
+ handleLocalStreamChange(meeting: any): void;
50
+ /**
51
+ * Enables/disables audio/video
52
+ *
53
+ * @param {Object} meeting - the meeting object
54
+ * @param {boolean} enable
55
+ * @returns {void}
56
+ */
57
+ enable(meeting: any, enable: boolean): void;
58
+ /**
59
+ * Mutes/unmutes local stream
60
+ *
61
+ * @param {Object} meeting - the meeting object
62
+ * @param {Boolean} mute - true to mute the stream, false to unmute it
63
+ * @param {ServerMuteReason} reason - reason for muting/unmuting
64
+ * @returns {void}
65
+ */
66
+ private muteLocalStream;
67
+ /**
68
+ * This method should be called when the local stream mute state is changed
69
+ * @public
70
+ * @memberof MuteState
71
+ * @param {Object} [meeting] the meeting object
72
+ * @param {Boolean} [mute] true for muting, false for unmuting request
73
+ * @returns {void}
74
+ */
75
+ handleLocalStreamMuteStateChange(meeting?: any): void;
76
+ /**
77
+ * Applies the current mute state to the local stream (by enabling or disabling it accordingly)
78
+ *
79
+ * @public
80
+ * @param {Object} [meeting] the meeting object
81
+ * @param {ServerMuteReason} reason - reason why we're applying our client state to the local stream
82
+ * @memberof MuteState
83
+ * @returns {void}
84
+ */
85
+ applyClientStateLocally(meeting?: any, reason?: ServerMuteReason): void;
86
+ /** Returns true if client is locally muted - it takes into account not just the client local mute state,
87
+ * but also whether audio/video is enabled at all
88
+ *
89
+ * @returns {boolean}
90
+ */
91
+ private getClientLocalMuteState;
92
+ /**
93
+ * Updates the server local and remote mute values so that they match the current client desired state.
94
+ *
95
+ * @private
96
+ * @param {Object} [meeting] the meeting object
97
+ * @memberof MuteState
98
+ * @returns {void}
99
+ */
100
+ private applyClientStateToServer;
101
+ /**
102
+ * Sets the local mute value in the server
103
+ *
104
+ * @private
105
+ * @param {Object} [meeting] the meeting object
106
+ * @memberof MuteState
107
+ * @returns {Promise}
108
+ */
109
+ private sendLocalMuteRequestToServer;
110
+ /**
111
+ * Sets the remote mute value in the server
112
+ *
113
+ * @private
114
+ * @param {Object} [meeting] the meeting object
115
+ * @memberof MuteState
116
+ * @returns {Promise}
117
+ */
118
+ private sendRemoteMuteRequestToServer;
119
+ /** Applies the current value for unmute allowed to the underlying stream
120
+ *
121
+ * @param {Meeting} meeting
122
+ * @returns {void}
123
+ */
124
+ private applyUnmuteAllowedToStream;
125
+ /**
126
+ * This method should be called whenever the server remote mute state is changed
127
+ *
128
+ * @public
129
+ * @memberof MuteState
130
+ * @param {Meeting} meeting
131
+ * @param {Boolean} [muted] true if user is remotely muted, false otherwise
132
+ * @param {Boolean} [unmuteAllowed] indicates if user is allowed to unmute self (false when "hard mute" feature is used)
133
+ * @returns {undefined}
134
+ */
135
+ handleServerRemoteMuteUpdate(meeting: any, muted?: boolean, unmuteAllowed?: boolean): void;
136
+ /**
137
+ * This method should be called whenever we receive from the server a requirement to locally unmute
138
+ *
139
+ * @public
140
+ * @memberof MuteState
141
+ * @param {Object} [meeting] the meeting object
142
+ * @returns {undefined}
143
+ */
144
+ handleServerLocalUnmuteRequired(meeting?: any): void;
145
+ /**
146
+ * Returns true if the user is locally or remotely muted.
147
+ * It only checks the mute status, ignoring the fact whether audio/video is enabled.
148
+ *
149
+ * @public
150
+ * @memberof MuteState
151
+ * @returns {Boolean}
152
+ */
153
+ isMuted(): boolean;
154
+ /**
155
+ * Returns true if the user is remotely muted
156
+ *
157
+ * @public
158
+ * @memberof MuteState
159
+ * @returns {Boolean}
160
+ */
161
+ isRemotelyMuted(): boolean;
162
+ /**
163
+ * Returns true if unmute is allowed
164
+ *
165
+ * @public
166
+ * @memberof MuteState
167
+ * @returns {Boolean}
168
+ */
169
+ isUnmuteAllowed(): boolean;
170
+ /**
171
+ * Returns true if the user is locally muted or audio/video is disabled
172
+ *
173
+ * @public
174
+ * @memberof MuteState
175
+ * @returns {Boolean}
176
+ */
177
+ isLocallyMuted(): boolean;
178
+ }