@webex/plugin-meetings 3.0.0 → 3.1.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 (138) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/config.d.ts +1 -0
  4. package/dist/config.js +2 -1
  5. package/dist/config.js.map +1 -1
  6. package/dist/constants.d.ts +5 -4
  7. package/dist/constants.js +8 -4
  8. package/dist/constants.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +6 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/interpretation/index.js +16 -2
  13. package/dist/interpretation/index.js.map +1 -1
  14. package/dist/interpretation/siLanguage.js +1 -1
  15. package/dist/locus-info/mediaSharesUtils.js +15 -1
  16. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  17. package/dist/locus-info/selfUtils.js +5 -0
  18. package/dist/locus-info/selfUtils.js.map +1 -1
  19. package/dist/media/MediaConnectionAwaiter.d.ts +61 -0
  20. package/dist/media/MediaConnectionAwaiter.js +163 -0
  21. package/dist/media/MediaConnectionAwaiter.js.map +1 -0
  22. package/dist/media/index.js +4 -1
  23. package/dist/media/index.js.map +1 -1
  24. package/dist/media/properties.js +4 -24
  25. package/dist/media/properties.js.map +1 -1
  26. package/dist/meeting/index.d.ts +26 -7
  27. package/dist/meeting/index.js +893 -677
  28. package/dist/meeting/index.js.map +1 -1
  29. package/dist/meeting/muteState.d.ts +2 -8
  30. package/dist/meeting/muteState.js +37 -25
  31. package/dist/meeting/muteState.js.map +1 -1
  32. package/dist/meeting/request.d.ts +3 -0
  33. package/dist/meeting/request.js +32 -23
  34. package/dist/meeting/request.js.map +1 -1
  35. package/dist/meeting/util.js +1 -0
  36. package/dist/meeting/util.js.map +1 -1
  37. package/dist/meeting-info/utilv2.js +4 -1
  38. package/dist/meeting-info/utilv2.js.map +1 -1
  39. package/dist/meetings/index.d.ts +8 -0
  40. package/dist/meetings/index.js +20 -0
  41. package/dist/meetings/index.js.map +1 -1
  42. package/dist/multistream/mediaRequestManager.d.ts +2 -1
  43. package/dist/multistream/mediaRequestManager.js +1 -1
  44. package/dist/multistream/mediaRequestManager.js.map +1 -1
  45. package/dist/multistream/remoteMediaGroup.d.ts +2 -0
  46. package/dist/multistream/remoteMediaGroup.js +16 -2
  47. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  48. package/dist/multistream/remoteMediaManager.d.ts +15 -0
  49. package/dist/multistream/remoteMediaManager.js +179 -65
  50. package/dist/multistream/remoteMediaManager.js.map +1 -1
  51. package/dist/multistream/sendSlotManager.d.ts +9 -1
  52. package/dist/multistream/sendSlotManager.js +22 -0
  53. package/dist/multistream/sendSlotManager.js.map +1 -1
  54. package/dist/reachability/clusterReachability.d.ts +1 -0
  55. package/dist/reachability/clusterReachability.js +29 -15
  56. package/dist/reachability/clusterReachability.js.map +1 -1
  57. package/dist/reachability/index.d.ts +4 -0
  58. package/dist/reachability/index.js +18 -2
  59. package/dist/reachability/index.js.map +1 -1
  60. package/dist/reachability/request.js +12 -10
  61. package/dist/reachability/request.js.map +1 -1
  62. package/dist/reachability/util.d.ts +7 -0
  63. package/dist/reachability/util.js +19 -0
  64. package/dist/reachability/util.js.map +1 -1
  65. package/dist/reconnection-manager/index.js +2 -1
  66. package/dist/reconnection-manager/index.js.map +1 -1
  67. package/dist/roap/index.d.ts +10 -2
  68. package/dist/roap/index.js +15 -0
  69. package/dist/roap/index.js.map +1 -1
  70. package/dist/roap/request.js +3 -3
  71. package/dist/roap/request.js.map +1 -1
  72. package/dist/roap/turnDiscovery.d.ts +64 -17
  73. package/dist/roap/turnDiscovery.js +307 -126
  74. package/dist/roap/turnDiscovery.js.map +1 -1
  75. package/dist/statsAnalyzer/index.js +53 -30
  76. package/dist/statsAnalyzer/index.js.map +1 -1
  77. package/dist/webinar/index.js +1 -1
  78. package/package.json +22 -22
  79. package/src/config.ts +1 -0
  80. package/src/constants.ts +7 -3
  81. package/src/index.ts +1 -0
  82. package/src/interpretation/index.ts +18 -1
  83. package/src/locus-info/mediaSharesUtils.ts +16 -0
  84. package/src/locus-info/selfUtils.ts +5 -0
  85. package/src/media/MediaConnectionAwaiter.ts +174 -0
  86. package/src/media/index.ts +3 -1
  87. package/src/media/properties.ts +6 -31
  88. package/src/meeting/index.ts +321 -106
  89. package/src/meeting/muteState.ts +34 -20
  90. package/src/meeting/request.ts +18 -2
  91. package/src/meeting/util.ts +1 -0
  92. package/src/meeting-info/utilv2.ts +2 -1
  93. package/src/meetings/index.ts +18 -0
  94. package/src/multistream/mediaRequestManager.ts +4 -1
  95. package/src/multistream/remoteMediaGroup.ts +19 -0
  96. package/src/multistream/remoteMediaManager.ts +101 -16
  97. package/src/multistream/sendSlotManager.ts +28 -0
  98. package/src/reachability/clusterReachability.ts +20 -5
  99. package/src/reachability/index.ts +24 -1
  100. package/src/reachability/request.ts +15 -11
  101. package/src/reachability/util.ts +21 -0
  102. package/src/reconnection-manager/index.ts +1 -1
  103. package/src/roap/index.ts +25 -3
  104. package/src/roap/request.ts +3 -3
  105. package/src/roap/turnDiscovery.ts +244 -78
  106. package/src/statsAnalyzer/index.ts +63 -27
  107. package/test/integration/spec/journey.js +14 -14
  108. package/test/integration/spec/space-meeting.js +1 -1
  109. package/test/unit/spec/interpretation/index.ts +39 -3
  110. package/test/unit/spec/locus-info/index.js +28 -19
  111. package/test/unit/spec/locus-info/mediaSharesUtils.ts +9 -0
  112. package/test/unit/spec/locus-info/selfUtils.js +42 -12
  113. package/test/unit/spec/media/MediaConnectionAwaiter.ts +344 -0
  114. package/test/unit/spec/media/index.ts +89 -78
  115. package/test/unit/spec/media/properties.ts +16 -70
  116. package/test/unit/spec/meeting/index.js +638 -139
  117. package/test/unit/spec/meeting/muteState.js +219 -67
  118. package/test/unit/spec/meeting/request.js +21 -0
  119. package/test/unit/spec/meeting/utils.js +6 -1
  120. package/test/unit/spec/meeting-info/utilv2.js +6 -0
  121. package/test/unit/spec/meetings/index.js +40 -20
  122. package/test/unit/spec/multistream/mediaRequestManager.ts +20 -2
  123. package/test/unit/spec/multistream/remoteMediaGroup.ts +79 -1
  124. package/test/unit/spec/multistream/remoteMediaManager.ts +199 -1
  125. package/test/unit/spec/multistream/sendSlotManager.ts +50 -18
  126. package/test/unit/spec/reachability/clusterReachability.ts +86 -22
  127. package/test/unit/spec/reachability/index.ts +197 -60
  128. package/test/unit/spec/reachability/request.js +15 -7
  129. package/test/unit/spec/reachability/util.ts +32 -2
  130. package/test/unit/spec/reconnection-manager/index.js +28 -0
  131. package/test/unit/spec/roap/index.ts +61 -6
  132. package/test/unit/spec/roap/turnDiscovery.ts +298 -16
  133. package/test/unit/spec/stats-analyzer/index.js +179 -0
  134. package/dist/member/member.types.d.ts +0 -11
  135. package/dist/member/member.types.js +0 -17
  136. package/dist/member/member.types.js.map +0 -1
  137. package/src/member/member.types.ts +0 -13
  138. /package/test/unit/spec/locus-info/{lib/selfConstant.js → selfConstant.js} +0 -0
@@ -121,14 +121,31 @@ const SimultaneousInterpretation = WebexPlugin.extend({
121
121
  * Update self's interpretation information (self is interpreter)
122
122
  * @param {Object} interpretation
123
123
  * @param {String} selfParticipantId
124
- * @returns {void}
124
+ * @returns {bool} is target language changed
125
125
  */
126
126
  updateSelfInterpretation({interpretation, selfParticipantId}) {
127
+ const preTargetLanguage = this.targetLanguage;
127
128
  const {originalLanguage, sourceLanguage, order, isActive, targetLanguage, receiveLanguage} =
128
129
  interpretation || {};
129
130
  this.set({originalLanguage, sourceLanguage, order, isActive, targetLanguage, receiveLanguage});
130
131
  this.set('selfParticipantId', selfParticipantId);
132
+ this.set('selfIsInterpreter', !!targetLanguage);
133
+
134
+ return !!(preTargetLanguage !== targetLanguage);
131
135
  },
136
+
137
+ /**
138
+ * Get the language code of the interpreter target language
139
+ * @returns {number}
140
+ */
141
+ getTargetLanguageCode() {
142
+ if (this.selfIsInterpreter) {
143
+ return this.siLanguages.get(this.targetLanguage)?.languageCode;
144
+ }
145
+
146
+ return 0;
147
+ },
148
+
132
149
  /**
133
150
  * query interpretation languages
134
151
  * @returns {Promise}
@@ -17,6 +17,7 @@ MediaSharesUtils.parse = (mediaShares: object) => {
17
17
  url: MediaSharesUtils.getContentUrl(mediaShares),
18
18
  shareInstanceId: MediaSharesUtils.getShareInstanceId(mediaShares),
19
19
  deviceUrlSharing: MediaSharesUtils.getContentBeneficiaryDeviceUrl(mediaShares),
20
+ resourceType: MediaSharesUtils.getContentResourceType(mediaShares),
20
21
  },
21
22
  whiteboard: {
22
23
  beneficiaryId: MediaSharesUtils.getWhiteboardBeneficiaryId(mediaShares),
@@ -159,6 +160,21 @@ MediaSharesUtils.getContentAnnotation = (mediaShares: object) => {
159
160
  return extractContent.annotation;
160
161
  };
161
162
 
163
+ /**
164
+ * get live resourceType is sharing from media shares (content)
165
+ * @param {Object} mediaShares
166
+ * @returns {Object}
167
+ */
168
+ MediaSharesUtils.getContentResourceType = (mediaShares: object) => {
169
+ const extractContent = MediaSharesUtils.extractContent(mediaShares);
170
+
171
+ if (!extractContent || !extractContent.resourceType) {
172
+ return undefined;
173
+ }
174
+
175
+ return extractContent.resourceType;
176
+ };
177
+
162
178
  /**
163
179
  * get url is sharing from media shares (content)
164
180
  * @param {Object} mediaShares
@@ -428,6 +428,11 @@ SelfUtils.mutedByOthersChanged = (oldSelf, changedSelf) => {
428
428
  return false;
429
429
  }
430
430
 
431
+ // there is no need to trigger user update if no one muted user
432
+ if (changedSelf.selfIdentity === changedSelf.modifiedBy) {
433
+ return false;
434
+ }
435
+
431
436
  return (
432
437
  changedSelf.remoteMuted !== null &&
433
438
  (oldSelf.remoteMuted !== changedSelf.remoteMuted ||
@@ -0,0 +1,174 @@
1
+ import {Defer} from '@webex/common';
2
+ import {ConnectionState, Event} from '@webex/internal-media-core';
3
+ import LoggerProxy from '../common/logs/logger-proxy';
4
+ import {ICE_AND_DTLS_CONNECTION_TIMEOUT} from '../constants';
5
+
6
+ export interface MediaConnectionAwaiterProps {
7
+ webrtcMediaConnection: any;
8
+ }
9
+
10
+ /**
11
+ * @class MediaConnectionAwaiter
12
+ */
13
+ export default class MediaConnectionAwaiter {
14
+ private webrtcMediaConnection: any;
15
+ private timer: any;
16
+ private defer: Defer;
17
+ private retried: boolean;
18
+ private onTimeoutCallback: () => void;
19
+ private connectionStateCallback: () => void;
20
+ private iceGatheringStateCallback: () => void;
21
+
22
+ /**
23
+ * @param {MediaConnectionAwaiterProps} mediaConnectionAwaiterProps
24
+ */
25
+ constructor({webrtcMediaConnection}: MediaConnectionAwaiterProps) {
26
+ this.webrtcMediaConnection = webrtcMediaConnection;
27
+ this.defer = new Defer();
28
+ this.retried = false;
29
+ this.onTimeoutCallback = this.onTimeout.bind(this);
30
+ this.connectionStateCallback = this.connectionStateListenerCallback.bind(this);
31
+ this.iceGatheringStateCallback = this.iceGatheringStateListenerCallback.bind(this);
32
+ }
33
+
34
+ /**
35
+ * Returns true if the connection is connected, false otherwise.
36
+ *
37
+ * @returns {boolean}
38
+ */
39
+ private isConnected(): boolean {
40
+ return this.webrtcMediaConnection.getConnectionState() === ConnectionState.Connected;
41
+ }
42
+
43
+ /**
44
+ * Returns true if the ICE Gathering is completed, false otherwise.
45
+ *
46
+ * @returns {boolean}
47
+ */
48
+ private isIceGatheringCompleted(): boolean {
49
+ return this.webrtcMediaConnection.getIceGatheringState() === 'complete';
50
+ }
51
+
52
+ /**
53
+ * Clears the callbacks.
54
+ *
55
+ * @returns {void}
56
+ */
57
+ private clearCallbacks(): void {
58
+ this.webrtcMediaConnection.off(
59
+ Event.ICE_GATHERING_STATE_CHANGED,
60
+ this.iceGatheringStateCallback
61
+ );
62
+ this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, this.connectionStateCallback);
63
+ }
64
+
65
+ /**
66
+ * Listener for connection state change.
67
+ *
68
+ * @returns {void}
69
+ */
70
+ connectionStateListenerCallback(): void {
71
+ LoggerProxy.logger.log(
72
+ `Media:MediaConnectionAwaiter#connectionStateListenerCallback --> connection state: ${this.webrtcMediaConnection.getConnectionState()}`
73
+ );
74
+
75
+ if (!this.isConnected()) {
76
+ return;
77
+ }
78
+
79
+ clearTimeout(this.timer);
80
+
81
+ this.clearCallbacks();
82
+
83
+ this.defer.resolve();
84
+ }
85
+
86
+ /**
87
+ * Listener for ICE gathering state change.
88
+ *
89
+ * @returns {void}
90
+ */
91
+ iceGatheringStateListenerCallback(): void {
92
+ const iceGatheringState = this.webrtcMediaConnection.getIceGatheringState();
93
+
94
+ LoggerProxy.logger.log(
95
+ `Media:MediaConnectionAwaiter#iceGatheringStateListenerCallback --> ICE gathering state change -> ${iceGatheringState}`
96
+ );
97
+
98
+ if (!this.isIceGatheringCompleted()) {
99
+ return;
100
+ }
101
+
102
+ if (this.isConnected()) {
103
+ return;
104
+ }
105
+
106
+ clearTimeout(this.timer);
107
+
108
+ this.timer = setTimeout(this.onTimeoutCallback, ICE_AND_DTLS_CONNECTION_TIMEOUT);
109
+ }
110
+
111
+ /**
112
+ * Function called when the timeout is reached.
113
+ *
114
+ * @returns {void}
115
+ */
116
+ onTimeout(): void {
117
+ if (this.isConnected()) {
118
+ this.clearCallbacks();
119
+
120
+ this.defer.resolve();
121
+
122
+ return;
123
+ }
124
+
125
+ if (!this.isIceGatheringCompleted()) {
126
+ if (!this.retried) {
127
+ LoggerProxy.logger.warn(
128
+ 'Media:MediaConnectionAwaiter#onTimeout --> ICE gathering did not complete within the timeout for the first time, retrying once'
129
+ );
130
+
131
+ // retry once if ICE gathering is not completed
132
+ this.retried = true;
133
+ clearTimeout(this.timer);
134
+ this.timer = setTimeout(this.onTimeoutCallback, ICE_AND_DTLS_CONNECTION_TIMEOUT);
135
+
136
+ return;
137
+ }
138
+
139
+ LoggerProxy.logger.warn(
140
+ 'Media:MediaConnectionAwaiter#onTimeout --> ICE gathering did not complete within the timeout for the second time, rejecting'
141
+ );
142
+ } else {
143
+ LoggerProxy.logger.warn(
144
+ 'Media:MediaConnectionAwaiter#onTimeout --> ICE gathering completed, but connection state is not connected, rejecting'
145
+ );
146
+ }
147
+
148
+ this.clearCallbacks();
149
+
150
+ this.defer.reject();
151
+ }
152
+
153
+ /**
154
+ * Waits for the webrtc media connection to be connected.
155
+ *
156
+ * @returns {Promise}
157
+ */
158
+ waitForMediaConnectionConnected(): Promise<void> {
159
+ if (this.isConnected()) {
160
+ return Promise.resolve();
161
+ }
162
+
163
+ this.webrtcMediaConnection.on(Event.CONNECTION_STATE_CHANGED, this.connectionStateCallback);
164
+
165
+ this.webrtcMediaConnection.on(
166
+ Event.ICE_GATHERING_STATE_CHANGED,
167
+ this.iceGatheringStateCallback
168
+ );
169
+
170
+ this.timer = setTimeout(this.onTimeoutCallback, ICE_AND_DTLS_CONNECTION_TIMEOUT);
171
+
172
+ return this.defer.promise;
173
+ }
174
+ }
@@ -160,7 +160,9 @@ Media.createMediaConnection = (
160
160
 
161
161
  const iceServers = [];
162
162
 
163
- if (turnServerInfo) {
163
+ // we might not have any TURN server if TURN discovery failed or wasn't done or
164
+ // we might get an empty TURN url if we land on a video mesh node
165
+ if (turnServerInfo?.url) {
164
166
  iceServers.push({
165
167
  urls: turnServerInfo.url,
166
168
  username: turnServerInfo.username || '',
@@ -1,5 +1,3 @@
1
- import {ConnectionState, Event} from '@webex/internal-media-core';
2
-
3
1
  import {
4
2
  LocalCameraStream,
5
3
  LocalMicrophoneStream,
@@ -8,8 +6,9 @@ import {
8
6
  RemoteStream,
9
7
  } from '@webex/media-helpers';
10
8
 
11
- import {MEETINGS, ICE_AND_DTLS_CONNECTION_TIMEOUT, QUALITY_LEVELS} from '../constants';
9
+ import {MEETINGS, QUALITY_LEVELS} from '../constants';
12
10
  import LoggerProxy from '../common/logs/logger-proxy';
11
+ import MediaConnectionAwaiter from './MediaConnectionAwaiter';
13
12
 
14
13
  export type MediaDirection = {
15
14
  sendAudio: boolean;
@@ -175,35 +174,11 @@ export default class MediaProperties {
175
174
  * @returns {Promise<void>}
176
175
  */
177
176
  waitForMediaConnectionConnected(): Promise<void> {
178
- const isConnected = () =>
179
- this.webrtcMediaConnection.getConnectionState() === ConnectionState.Connected;
180
-
181
- if (isConnected()) {
182
- return Promise.resolve();
183
- }
184
-
185
- return new Promise<void>((resolve, reject) => {
186
- let timer;
187
-
188
- const connectionStateListener = () => {
189
- LoggerProxy.logger.log(
190
- `Media:properties#waitForMediaConnectionConnected --> connection state: ${this.webrtcMediaConnection.getConnectionState()}`
191
- );
192
-
193
- if (isConnected()) {
194
- clearTimeout(timer);
195
- this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, connectionStateListener);
196
- resolve();
197
- }
198
- };
199
-
200
- timer = setTimeout(() => {
201
- this.webrtcMediaConnection.off(Event.CONNECTION_STATE_CHANGED, connectionStateListener);
202
- reject();
203
- }, ICE_AND_DTLS_CONNECTION_TIMEOUT);
204
-
205
- this.webrtcMediaConnection.on(Event.CONNECTION_STATE_CHANGED, connectionStateListener);
177
+ const mediaConnectionAwaiter = new MediaConnectionAwaiter({
178
+ webrtcMediaConnection: this.webrtcMediaConnection,
206
179
  });
180
+
181
+ return mediaConnectionAwaiter.waitForMediaConnectionConnected();
207
182
  }
208
183
 
209
184
  /**