@webex/plugin-meetings 3.0.0-bnr.5 → 3.0.0-stream-classes.1

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 (303) hide show
  1. package/README.md +46 -8
  2. package/dist/annotation/annotation.types.js +7 -0
  3. package/dist/annotation/annotation.types.js.map +1 -0
  4. package/dist/annotation/constants.js +49 -0
  5. package/dist/annotation/constants.js.map +1 -0
  6. package/dist/annotation/index.js +342 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +70 -32
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/events.js +45 -0
  11. package/dist/breakouts/events.js.map +1 -0
  12. package/dist/breakouts/index.js +422 -217
  13. package/dist/breakouts/index.js.map +1 -1
  14. package/dist/breakouts/utils.js +12 -1
  15. package/dist/breakouts/utils.js.map +1 -1
  16. package/dist/common/errors/webex-errors.js +3 -2
  17. package/dist/common/errors/webex-errors.js.map +1 -1
  18. package/dist/common/logs/logger-proxy.js +1 -1
  19. package/dist/common/logs/logger-proxy.js.map +1 -1
  20. package/dist/common/logs/request.d.ts +1 -1
  21. package/dist/common/queue.js +24 -9
  22. package/dist/common/queue.js.map +1 -1
  23. package/dist/config.js +1 -7
  24. package/dist/config.js.map +1 -1
  25. package/dist/constants.js +118 -24
  26. package/dist/constants.js.map +1 -1
  27. package/dist/controls-options-manager/enums.js +2 -0
  28. package/dist/controls-options-manager/enums.js.map +1 -1
  29. package/dist/controls-options-manager/index.js +19 -14
  30. package/dist/controls-options-manager/index.js.map +1 -1
  31. package/dist/controls-options-manager/types.js.map +1 -1
  32. package/dist/controls-options-manager/util.js +80 -11
  33. package/dist/controls-options-manager/util.js.map +1 -1
  34. package/dist/index.js +62 -20
  35. package/dist/index.js.map +1 -1
  36. package/dist/interpretation/collection.js +23 -0
  37. package/dist/interpretation/collection.js.map +1 -0
  38. package/dist/interpretation/index.js +366 -0
  39. package/dist/interpretation/index.js.map +1 -0
  40. package/dist/interpretation/siLanguage.js +25 -0
  41. package/dist/interpretation/siLanguage.js.map +1 -0
  42. package/dist/locus-info/controlsUtils.js +71 -1
  43. package/dist/locus-info/controlsUtils.js.map +1 -1
  44. package/dist/locus-info/index.js +305 -57
  45. package/dist/locus-info/index.js.map +1 -1
  46. package/dist/locus-info/infoUtils.js +7 -1
  47. package/dist/locus-info/infoUtils.js.map +1 -1
  48. package/dist/locus-info/mediaSharesUtils.js +43 -1
  49. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  50. package/dist/locus-info/parser.js +219 -63
  51. package/dist/locus-info/parser.js.map +1 -1
  52. package/dist/locus-info/selfUtils.js +44 -22
  53. package/dist/locus-info/selfUtils.js.map +1 -1
  54. package/dist/media/index.js +57 -104
  55. package/dist/media/index.js.map +1 -1
  56. package/dist/media/properties.js +60 -121
  57. package/dist/media/properties.js.map +1 -1
  58. package/dist/meeting/in-meeting-actions.js +61 -3
  59. package/dist/meeting/in-meeting-actions.js.map +1 -1
  60. package/dist/meeting/index.js +2530 -2534
  61. package/dist/meeting/index.js.map +1 -1
  62. package/dist/meeting/locusMediaRequest.js +292 -0
  63. package/dist/meeting/locusMediaRequest.js.map +1 -0
  64. package/dist/meeting/muteState.js +125 -205
  65. package/dist/meeting/muteState.js.map +1 -1
  66. package/dist/meeting/request.js +150 -150
  67. package/dist/meeting/request.js.map +1 -1
  68. package/dist/meeting/util.js +568 -438
  69. package/dist/meeting/util.js.map +1 -1
  70. package/dist/meeting-info/index.js +48 -7
  71. package/dist/meeting-info/index.js.map +1 -1
  72. package/dist/meeting-info/meeting-info-v2.js +94 -38
  73. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  74. package/dist/meeting-info/utilv2.js +4 -2
  75. package/dist/meeting-info/utilv2.js.map +1 -1
  76. package/dist/meetings/index.d.ts +0 -2
  77. package/dist/meetings/index.js +260 -85
  78. package/dist/meetings/index.js.map +1 -1
  79. package/dist/meetings/meetings.types.js +7 -0
  80. package/dist/meetings/meetings.types.js.map +1 -0
  81. package/dist/meetings/util.js +42 -7
  82. package/dist/meetings/util.js.map +1 -1
  83. package/dist/member/index.d.ts +2 -0
  84. package/dist/member/index.js +26 -0
  85. package/dist/member/index.js.map +1 -1
  86. package/dist/member/member.types.d.ts +11 -0
  87. package/dist/member/member.types.js +18 -0
  88. package/dist/member/member.types.js.map +1 -0
  89. package/dist/member/types.js +11 -1
  90. package/dist/member/types.js.map +1 -1
  91. package/dist/member/util.js +60 -23
  92. package/dist/member/util.js.map +1 -1
  93. package/dist/members/index.js +4 -1
  94. package/dist/members/index.js.map +1 -1
  95. package/dist/members/request.js +75 -45
  96. package/dist/members/request.js.map +1 -1
  97. package/dist/members/util.js +308 -317
  98. package/dist/members/util.js.map +1 -1
  99. package/dist/metrics/config.js +1 -3
  100. package/dist/metrics/config.js.map +1 -1
  101. package/dist/metrics/constants.js +1 -0
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/metrics/index.d.ts +1 -1
  104. package/dist/metrics/index.js +1 -451
  105. package/dist/metrics/index.js.map +1 -1
  106. package/dist/multistream/mediaRequestManager.js +136 -40
  107. package/dist/multistream/mediaRequestManager.js.map +1 -1
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/receiveSlotManager.js +4 -4
  110. package/dist/multistream/receiveSlotManager.js.map +1 -1
  111. package/dist/multistream/remoteMedia.js.map +1 -1
  112. package/dist/multistream/remoteMediaGroup.js +60 -3
  113. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  114. package/dist/multistream/remoteMediaManager.js +36 -0
  115. package/dist/multistream/remoteMediaManager.js.map +1 -1
  116. package/dist/multistream/sendSlotManager.js +233 -0
  117. package/dist/multistream/sendSlotManager.js.map +1 -0
  118. package/dist/reachability/index.js +18 -3
  119. package/dist/reachability/index.js.map +1 -1
  120. package/dist/reachability/request.js +5 -3
  121. package/dist/reachability/request.js.map +1 -1
  122. package/dist/reconnection-manager/index.js +181 -153
  123. package/dist/reconnection-manager/index.js.map +1 -1
  124. package/dist/recording-controller/index.js +21 -2
  125. package/dist/recording-controller/index.js.map +1 -1
  126. package/dist/recording-controller/util.js +9 -8
  127. package/dist/recording-controller/util.js.map +1 -1
  128. package/dist/roap/index.js +25 -32
  129. package/dist/roap/index.js.map +1 -1
  130. package/dist/roap/request.js +42 -51
  131. package/dist/roap/request.js.map +1 -1
  132. package/dist/roap/turnDiscovery.js +97 -38
  133. package/dist/roap/turnDiscovery.js.map +1 -1
  134. package/dist/rtcMetrics/constants.js +12 -0
  135. package/dist/rtcMetrics/constants.js.map +1 -0
  136. package/dist/rtcMetrics/index.js +117 -0
  137. package/dist/rtcMetrics/index.js.map +1 -0
  138. package/dist/statsAnalyzer/index.js +0 -1
  139. package/dist/statsAnalyzer/index.js.map +1 -1
  140. package/dist/types/annotation/annotation.types.d.ts +43 -0
  141. package/dist/types/annotation/constants.d.ts +31 -0
  142. package/dist/types/annotation/index.d.ts +124 -0
  143. package/dist/types/breakouts/events.d.ts +2 -0
  144. package/dist/types/breakouts/utils.d.ts +7 -0
  145. package/dist/types/common/errors/webex-errors.d.ts +1 -1
  146. package/dist/types/config.d.ts +0 -6
  147. package/dist/types/constants.d.ts +51 -21
  148. package/dist/types/controls-options-manager/enums.d.ts +2 -0
  149. package/dist/types/controls-options-manager/index.d.ts +1 -1
  150. package/dist/types/controls-options-manager/types.d.ts +7 -1
  151. package/dist/types/index.d.ts +1 -1
  152. package/dist/types/interpretation/collection.d.ts +5 -0
  153. package/dist/types/interpretation/index.d.ts +5 -0
  154. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  155. package/dist/types/locus-info/index.d.ts +39 -1
  156. package/dist/types/media/index.d.ts +2 -0
  157. package/dist/types/media/properties.d.ts +16 -38
  158. package/dist/types/meeting/in-meeting-actions.d.ts +46 -2
  159. package/dist/types/meeting/index.d.ts +179 -379
  160. package/dist/types/meeting/locusMediaRequest.d.ts +70 -0
  161. package/dist/types/meeting/muteState.d.ts +39 -40
  162. package/dist/types/meeting/request.d.ts +25 -26
  163. package/dist/types/meeting/util.d.ts +74 -1
  164. package/dist/types/meeting-info/meeting-info-v2.d.ts +14 -3
  165. package/dist/types/meetings/index.d.ts +49 -1
  166. package/dist/types/meetings/meetings.types.d.ts +4 -0
  167. package/dist/types/member/index.d.ts +2 -0
  168. package/dist/types/members/request.d.ts +56 -11
  169. package/dist/types/members/util.d.ts +209 -1
  170. package/dist/types/metrics/config.d.ts +26 -2
  171. package/dist/types/metrics/constants.d.ts +1 -0
  172. package/dist/types/metrics/index.d.ts +17 -0
  173. package/dist/types/multistream/mediaRequestManager.d.ts +27 -10
  174. package/dist/types/multistream/receiveSlot.d.ts +3 -3
  175. package/dist/types/multistream/remoteMedia.d.ts +2 -2
  176. package/dist/types/multistream/remoteMediaManager.d.ts +14 -0
  177. package/dist/types/roap/request.d.ts +6 -8
  178. package/dist/types/roap/turnDiscovery.d.ts +18 -1
  179. package/package.json +21 -20
  180. package/src/annotation/annotation.types.ts +50 -0
  181. package/src/annotation/constants.ts +36 -0
  182. package/src/annotation/index.ts +328 -0
  183. package/src/breakouts/README.md +3 -2
  184. package/src/breakouts/breakout.ts +62 -27
  185. package/src/breakouts/events.ts +56 -0
  186. package/src/breakouts/index.ts +244 -64
  187. package/src/breakouts/utils.ts +13 -0
  188. package/src/common/errors/webex-errors.ts +6 -2
  189. package/src/common/logs/logger-proxy.ts +1 -1
  190. package/src/common/queue.ts +22 -8
  191. package/src/config.ts +0 -6
  192. package/src/constants.ts +111 -19
  193. package/src/controls-options-manager/enums.ts +2 -0
  194. package/src/controls-options-manager/index.ts +13 -10
  195. package/src/controls-options-manager/types.ts +10 -0
  196. package/src/controls-options-manager/util.ts +82 -11
  197. package/src/index.ts +18 -11
  198. package/src/interpretation/README.md +60 -0
  199. package/src/interpretation/collection.ts +19 -0
  200. package/src/interpretation/index.ts +332 -0
  201. package/src/interpretation/siLanguage.ts +18 -0
  202. package/src/locus-info/controlsUtils.ts +81 -0
  203. package/src/locus-info/index.ts +318 -57
  204. package/src/locus-info/infoUtils.ts +10 -2
  205. package/src/locus-info/mediaSharesUtils.ts +48 -0
  206. package/src/locus-info/parser.ts +224 -39
  207. package/src/locus-info/selfUtils.ts +32 -20
  208. package/src/media/index.ts +94 -108
  209. package/src/media/properties.ts +69 -109
  210. package/src/meeting/in-meeting-actions.ts +120 -4
  211. package/src/meeting/index.ts +1967 -2120
  212. package/src/meeting/locusMediaRequest.ts +314 -0
  213. package/src/meeting/muteState.ts +119 -194
  214. package/src/meeting/request.ts +122 -115
  215. package/src/meeting/util.ts +549 -413
  216. package/src/meeting-info/index.ts +54 -8
  217. package/src/meeting-info/meeting-info-v2.ts +89 -24
  218. package/src/meeting-info/utilv2.ts +6 -2
  219. package/src/meetings/index.ts +247 -87
  220. package/src/meetings/meetings.types.ts +12 -0
  221. package/src/meetings/util.ts +47 -12
  222. package/src/member/index.ts +28 -1
  223. package/src/member/types.ts +14 -0
  224. package/src/member/util.ts +75 -26
  225. package/src/members/index.ts +7 -1
  226. package/src/members/request.ts +61 -21
  227. package/src/members/util.ts +316 -326
  228. package/src/metrics/constants.ts +1 -0
  229. package/src/metrics/index.ts +1 -474
  230. package/src/multistream/mediaRequestManager.ts +183 -67
  231. package/src/multistream/receiveSlot.ts +4 -4
  232. package/src/multistream/receiveSlotManager.ts +4 -4
  233. package/src/multistream/remoteMedia.ts +2 -2
  234. package/src/multistream/remoteMediaGroup.ts +59 -0
  235. package/src/multistream/remoteMediaManager.ts +33 -0
  236. package/src/multistream/sendSlotManager.ts +170 -0
  237. package/src/reachability/index.ts +15 -4
  238. package/src/reachability/request.ts +7 -3
  239. package/src/reconnection-manager/index.ts +36 -29
  240. package/src/recording-controller/index.ts +20 -3
  241. package/src/recording-controller/util.ts +26 -9
  242. package/src/roap/index.ts +25 -30
  243. package/src/roap/request.ts +44 -51
  244. package/src/roap/turnDiscovery.ts +51 -25
  245. package/src/rtcMetrics/constants.ts +3 -0
  246. package/src/rtcMetrics/index.ts +100 -0
  247. package/src/statsAnalyzer/index.ts +0 -1
  248. package/test/integration/spec/converged-space-meetings.js +60 -3
  249. package/test/integration/spec/journey.js +336 -259
  250. package/test/integration/spec/space-meeting.js +76 -3
  251. package/test/unit/spec/annotation/index.ts +418 -0
  252. package/test/unit/spec/breakouts/breakout.ts +85 -26
  253. package/test/unit/spec/breakouts/events.ts +89 -0
  254. package/test/unit/spec/breakouts/index.ts +636 -98
  255. package/test/unit/spec/breakouts/utils.js +19 -1
  256. package/test/unit/spec/common/queue.js +31 -2
  257. package/test/unit/spec/controls-options-manager/index.js +8 -1
  258. package/test/unit/spec/controls-options-manager/util.js +576 -397
  259. package/test/unit/spec/fixture/locus.js +1 -0
  260. package/test/unit/spec/interpretation/collection.ts +15 -0
  261. package/test/unit/spec/interpretation/index.ts +589 -0
  262. package/test/unit/spec/interpretation/siLanguage.ts +28 -0
  263. package/test/unit/spec/locus-info/controlsUtils.js +195 -1
  264. package/test/unit/spec/locus-info/index.js +950 -45
  265. package/test/unit/spec/locus-info/infoUtils.js +37 -15
  266. package/test/unit/spec/locus-info/mediaSharesUtils.ts +22 -0
  267. package/test/unit/spec/locus-info/parser.js +62 -22
  268. package/test/unit/spec/locus-info/selfConstant.js +19 -0
  269. package/test/unit/spec/locus-info/selfUtils.js +131 -26
  270. package/test/unit/spec/media/index.ts +82 -79
  271. package/test/unit/spec/meeting/in-meeting-actions.ts +60 -2
  272. package/test/unit/spec/meeting/index.js +3208 -1734
  273. package/test/unit/spec/meeting/locusMediaRequest.ts +443 -0
  274. package/test/unit/spec/meeting/muteState.js +328 -417
  275. package/test/unit/spec/meeting/request.js +393 -48
  276. package/test/unit/spec/meeting/utils.js +552 -76
  277. package/test/unit/spec/meeting-info/index.js +181 -0
  278. package/test/unit/spec/meeting-info/meetinginfov2.js +258 -20
  279. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  280. package/test/unit/spec/meetings/index.js +631 -145
  281. package/test/unit/spec/meetings/utils.js +164 -9
  282. package/test/unit/spec/member/index.js +44 -14
  283. package/test/unit/spec/member/util.js +296 -155
  284. package/test/unit/spec/members/index.js +23 -3
  285. package/test/unit/spec/members/request.js +167 -35
  286. package/test/unit/spec/metrics/index.js +1 -50
  287. package/test/unit/spec/multistream/mediaRequestManager.ts +366 -8
  288. package/test/unit/spec/multistream/receiveSlot.ts +1 -1
  289. package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
  290. package/test/unit/spec/multistream/remoteMediaManager.ts +123 -0
  291. package/test/unit/spec/multistream/sendSlotManager.ts +242 -0
  292. package/test/unit/spec/reachability/index.ts +66 -5
  293. package/test/unit/spec/reachability/request.js +3 -1
  294. package/test/unit/spec/reconnection-manager/index.js +55 -5
  295. package/test/unit/spec/recording-controller/index.js +294 -218
  296. package/test/unit/spec/recording-controller/util.js +223 -96
  297. package/test/unit/spec/roap/index.ts +21 -48
  298. package/test/unit/spec/roap/request.ts +74 -60
  299. package/test/unit/spec/roap/turnDiscovery.ts +30 -6
  300. package/test/unit/spec/rtcMetrics/index.ts +68 -0
  301. package/test/utils/integrationTestUtils.js +46 -0
  302. package/test/utils/testUtils.js +0 -60
  303. package/src/metrics/config.ts +0 -487
@@ -3,17 +3,29 @@
3
3
  */
4
4
  /* globals navigator */
5
5
 
6
- import {RoapMediaConnection, MultistreamRoapMediaConnection} from '@webex/internal-media-core';
7
- import {LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack} from '@webex/media-helpers';
6
+ import {
7
+ RoapMediaConnection,
8
+ MultistreamRoapMediaConnection,
9
+ type MultistreamConnectionConfig,
10
+ } from '@webex/internal-media-core';
11
+ import {
12
+ LocalStream,
13
+ LocalCameraStream,
14
+ LocalDisplayStream,
15
+ LocalSystemAudioStream,
16
+ LocalMicrophoneStream,
17
+ } from '@webex/media-helpers';
8
18
  import LoggerProxy from '../common/logs/logger-proxy';
9
- import {AUDIO_INPUT, VIDEO_INPUT, MEDIA_TRACK_CONSTRAINT} from '../constants';
19
+ import {MEDIA_TRACK_CONSTRAINT} from '../constants';
10
20
  import Config from '../config';
11
21
  import StaticConfig from '../common/config';
12
- import MediaError from '../common/errors/media';
13
22
  import BrowserDetection from '../common/browser-detection';
23
+ import RtcMetrics from '../rtcMetrics';
14
24
 
15
25
  const {isBrowser} = BrowserDetection();
16
26
 
27
+ export type BundlePolicy = MultistreamConnectionConfig['bundlePolicy'];
28
+
17
29
  /**
18
30
  * MediaDirection
19
31
  * @typedef {Object} MediaDirection
@@ -44,29 +56,6 @@ const {isBrowser} = BrowserDetection();
44
56
  */
45
57
  const Media: any = {};
46
58
 
47
- /**
48
- * format the media array for send
49
- * @param {String} mediaId
50
- * @param {Boolean} audioMuted
51
- * @param {Boolean} videoMuted
52
- * @returns {Array} medias
53
- */
54
- Media.generateLocalMedias = (mediaId: string, audioMuted: boolean, videoMuted: boolean) => {
55
- if (mediaId) {
56
- return [
57
- {
58
- localSdp: JSON.stringify({
59
- audioMuted,
60
- videoMuted,
61
- }),
62
- mediaId,
63
- },
64
- ];
65
- }
66
-
67
- return [];
68
- };
69
-
70
59
  /**
71
60
  * make a browser call to get the media
72
61
  * @param {SendOptions} options
@@ -94,23 +83,46 @@ Media.getLocalMedia = (options: any, config: object) => {
94
83
  return Promise.resolve(undefined);
95
84
  };
96
85
 
86
+ Media.getDirection = (forceSendRecv: boolean, receive: boolean, send: boolean) => {
87
+ if (!receive && !send) {
88
+ return 'inactive';
89
+ }
90
+
91
+ if (forceSendRecv || (receive && send)) {
92
+ return 'sendrecv';
93
+ }
94
+
95
+ if (receive) {
96
+ return 'recvonly';
97
+ }
98
+
99
+ return 'sendonly';
100
+ };
101
+
97
102
  /**
98
103
  * creates a webrtc media connection with provided tracks and mediaDirection configuration
99
104
  *
100
105
  * @param {boolean} isMultistream
101
106
  * @param {string} debugId string useful for debugging (will appear in media connection logs)
107
+ * @param {object} webex main `webex` object.
108
+ * @param {string} meetingId id for the meeting using this connection
109
+ * @param {string} correlationId id used in requests to correlate to this session
102
110
  * @param {Object} options
103
111
  * @param {Object} [options.mediaProperties] contains mediaDirection and local tracks:
104
- * audioTrack, videoTrack and shareTrack
112
+ * audioTrack, videoTrack, shareVideoTrack, and shareAudioTrack
105
113
  * @param {string} [options.remoteQualityLevel] LOW|MEDIUM|HIGH applicable only to non-multistream connections
106
114
  * @param {boolean} [options.enableRtx] applicable only to non-multistream connections
107
115
  * @param {boolean} [options.enableExtmap] applicable only to non-multistream connections
108
116
  * @param {Object} [options.turnServerInfo]
117
+ * @param {BundlePolicy} [options.bundlePolicy]
109
118
  * @returns {RoapMediaConnection | MultistreamRoapMediaConnection}
110
119
  */
111
120
  Media.createMediaConnection = (
112
121
  isMultistream: boolean,
113
122
  debugId: string,
123
+ webex: object,
124
+ meetingId: string,
125
+ correlationId: string,
114
126
  options: {
115
127
  mediaProperties: {
116
128
  mediaDirection?: {
@@ -121,9 +133,10 @@ Media.createMediaConnection = (
121
133
  sendVideo: boolean;
122
134
  sendShare: boolean;
123
135
  };
124
- audioTrack?: LocalMicrophoneTrack;
125
- videoTrack?: LocalCameraTrack;
126
- shareTrack?: LocalDisplayTrack;
136
+ audioStream?: LocalMicrophoneStream;
137
+ videoStream?: LocalCameraStream;
138
+ shareVideoStream?: LocalDisplayStream;
139
+ shareAudioStream?: LocalSystemAudioStream;
127
140
  };
128
141
  remoteQualityLevel?: 'LOW' | 'MEDIUM' | 'HIGH';
129
142
  enableRtx?: boolean;
@@ -133,9 +146,17 @@ Media.createMediaConnection = (
133
146
  username: string;
134
147
  password: string;
135
148
  };
149
+ bundlePolicy?: BundlePolicy;
136
150
  }
137
151
  ) => {
138
- const {mediaProperties, remoteQualityLevel, enableRtx, enableExtmap, turnServerInfo} = options;
152
+ const {
153
+ mediaProperties,
154
+ remoteQualityLevel,
155
+ enableRtx,
156
+ enableExtmap,
157
+ turnServerInfo,
158
+ bundlePolicy,
159
+ } = options;
139
160
 
140
161
  const iceServers = [];
141
162
 
@@ -148,15 +169,21 @@ Media.createMediaConnection = (
148
169
  }
149
170
 
150
171
  if (isMultistream) {
172
+ const config: MultistreamConnectionConfig = {
173
+ iceServers,
174
+ };
175
+
176
+ if (bundlePolicy) {
177
+ config.bundlePolicy = bundlePolicy;
178
+ }
179
+
180
+ const rtcMetrics = new RtcMetrics(webex, meetingId, correlationId);
181
+
151
182
  return new MultistreamRoapMediaConnection(
152
- {
153
- iceServers,
154
- enableMainAudio:
155
- mediaProperties.mediaDirection?.sendAudio || mediaProperties.mediaDirection?.receiveAudio,
156
- enableMainVideo:
157
- mediaProperties.mediaDirection?.sendVideo || mediaProperties.mediaDirection?.receiveVideo,
158
- },
159
- debugId
183
+ config,
184
+ meetingId,
185
+ (data) => rtcMetrics.addMetrics(data),
186
+ () => rtcMetrics.closeMetrics()
160
187
  );
161
188
  }
162
189
 
@@ -164,7 +191,8 @@ Media.createMediaConnection = (
164
191
  throw new Error('mediaProperties have to be provided for non-multistream media connections');
165
192
  }
166
193
 
167
- const {mediaDirection, audioTrack, videoTrack, shareTrack} = mediaProperties;
194
+ const {mediaDirection, audioStream, videoStream, shareVideoStream, shareAudioStream} =
195
+ mediaProperties;
168
196
 
169
197
  return new RoapMediaConnection(
170
198
  {
@@ -185,17 +213,23 @@ Media.createMediaConnection = (
185
213
  },
186
214
  },
187
215
  {
188
- send: {
189
- audio: audioTrack?.underlyingTrack,
190
- video: videoTrack?.underlyingTrack,
191
- screenShareVideo: shareTrack?.underlyingTrack,
192
- },
193
- receive: {
194
- audio: mediaDirection.receiveAudio,
195
- video: mediaDirection.receiveVideo,
196
- screenShareVideo: mediaDirection.receiveShare,
197
- remoteQualityLevel,
216
+ // TODO: RoapMediaConnection is not ready to use stream classes yet, so we pass the raw MediaStreamTrack for now SPARK-460530
217
+ localTracks: {
218
+ audio: audioStream?.outputTrack,
219
+ video: videoStream?.outputTrack,
220
+ screenShareVideo: shareVideoStream?.outputTrack,
221
+ screenShareAudio: shareAudioStream?.outputTrack, // TODO: add type for screenShareAudio in internal-media-core SPARK-446923
222
+ } as unknown,
223
+ direction: {
224
+ audio: Media.getDirection(true, mediaDirection.receiveAudio, mediaDirection.sendAudio),
225
+ video: Media.getDirection(true, mediaDirection.receiveVideo, mediaDirection.sendVideo),
226
+ screenShareVideo: Media.getDirection(
227
+ false,
228
+ mediaDirection.receiveShare,
229
+ mediaDirection.sendShare
230
+ ),
198
231
  },
232
+ remoteQualityLevel,
199
233
  },
200
234
  debugId
201
235
  );
@@ -340,52 +374,6 @@ Media.getMedia = (audio: any | boolean, video: any | boolean, config: any) => {
340
374
  });
341
375
  };
342
376
 
343
- /**
344
- * Checks if the machine has at least one audio or video device (Dont use this for screen share)
345
- * @param {object} [options]
346
- * {
347
- * sendAudio: true/false,
348
- * sendVideo: true/false
349
- * }
350
- * @returns {Object} {
351
- * sendAudio: true/false,
352
- * sendVideo: true/false
353
- *}
354
- */
355
- Media.getSupportedDevice = ({sendAudio, sendVideo}: {sendAudio: boolean; sendVideo: boolean}) =>
356
- Promise.resolve().then(() => {
357
- if (!navigator.mediaDevices || navigator.mediaDevices.enumerateDevices === undefined) {
358
- return {
359
- sendAudio: false,
360
- sendVideo: false,
361
- };
362
- }
363
-
364
- return navigator.mediaDevices.enumerateDevices().then((devices) => {
365
- const supported = {
366
- audio: devices.filter((device) => device.kind === AUDIO_INPUT).length > 0,
367
- video: devices.filter((device) => device.kind === VIDEO_INPUT).length > 0,
368
- };
369
-
370
- return {
371
- sendAudio: supported.audio && sendAudio,
372
- sendVideo: supported.video && sendVideo,
373
- };
374
- });
375
- });
376
-
377
- /**
378
- * proxy to browser navigator.mediaDevices.enumerateDevices()
379
- * @returns {Promise}
380
- */
381
- Media.getDevices = () => {
382
- if (navigator && navigator.mediaDevices && navigator.mediaDevices.enumerateDevices) {
383
- return navigator.mediaDevices.enumerateDevices();
384
- }
385
-
386
- return Promise.reject(new MediaError('enumerateDevices not supported.'));
387
- };
388
-
389
377
  /**
390
378
  *
391
379
  * Toggle a specific stream
@@ -396,23 +384,21 @@ Media.toggleStream = () => {};
396
384
 
397
385
  /**
398
386
  * Stop input stream
399
- * @param {MediaTrack} track A media stream
387
+ * @param {LocalStream} stream A local stream
400
388
  * @returns {null}
401
389
  */
402
- Media.stopTracks = (track: any) => {
403
- if (!track) {
390
+ Media.stopStream = (stream: LocalStream) => {
391
+ if (!stream) {
404
392
  return Promise.resolve();
405
393
  }
406
394
 
407
395
  return Promise.resolve().then(() => {
408
- if (track && track.stop) {
409
- try {
410
- track.stop();
411
- } catch (e) {
412
- LoggerProxy.logger.error(
413
- `Media:index#stopTracks --> Unable to stop the track with state ${track.readyState}, error: ${e}`
414
- );
415
- }
396
+ try {
397
+ stream.stop();
398
+ } catch (e) {
399
+ LoggerProxy.logger.error(
400
+ `Media:index#stopStream --> Unable to stop the stream with ready state of the output track => ${stream.outputTrack.readyState} & input track => ${stream.inputTrack.readyState}, error: ${e}`
401
+ );
416
402
  }
417
403
  });
418
404
  };
@@ -1,43 +1,65 @@
1
1
  import {ConnectionState, Event} from '@webex/internal-media-core';
2
2
 
3
- import {LocalCameraTrack, LocalMicrophoneTrack, LocalDisplayTrack} from '@webex/media-helpers';
3
+ import {
4
+ LocalCameraStream,
5
+ LocalMicrophoneStream,
6
+ LocalDisplayStream,
7
+ LocalSystemAudioStream,
8
+ RemoteStream,
9
+ } from '@webex/media-helpers';
4
10
 
5
11
  import {MEETINGS, PC_BAIL_TIMEOUT, QUALITY_LEVELS} from '../constants';
6
12
  import LoggerProxy from '../common/logs/logger-proxy';
7
13
 
14
+ export type MediaDirection = {
15
+ sendAudio: boolean;
16
+ sendVideo: boolean;
17
+ sendShare: boolean;
18
+ receiveAudio: boolean;
19
+ receiveVideo: boolean;
20
+ receiveShare: boolean;
21
+ };
22
+
8
23
  /**
9
24
  * @class MediaProperties
10
25
  */
11
26
  export default class MediaProperties {
12
- audioTrack: LocalMicrophoneTrack | null;
13
- localQualityLevel: any;
14
- mediaDirection: any;
27
+ audioStream?: LocalMicrophoneStream;
28
+ mediaDirection: MediaDirection;
15
29
  mediaSettings: any;
16
30
  webrtcMediaConnection: any;
17
- remoteAudioTrack: any;
31
+ remoteAudioStream: RemoteStream;
18
32
  remoteQualityLevel: any;
19
- remoteShare: any;
20
- remoteVideoTrack: any;
21
- shareTrack: LocalDisplayTrack | null;
33
+ remoteShareStream: RemoteStream;
34
+ remoteVideoStream: RemoteStream;
35
+ shareVideoStream?: LocalDisplayStream;
36
+ shareAudioStream?: LocalSystemAudioStream;
22
37
  videoDeviceId: any;
23
- videoTrack: LocalCameraTrack | null;
38
+ videoStream?: LocalCameraStream;
24
39
  namespace = MEETINGS;
25
40
 
26
41
  /**
27
42
  * @param {Object} [options] -- to auto construct
28
43
  * @returns {MediaProperties}
29
44
  */
30
- constructor(options: any = {}) {
45
+ constructor() {
31
46
  this.webrtcMediaConnection = null;
32
- this.mediaDirection = options.mediaDirection;
33
- this.videoTrack = options.videoTrack || null;
34
- this.audioTrack = options.audioTrack || null;
35
- this.shareTrack = options.shareTrack || null;
36
- this.remoteShare = options.remoteShare;
37
- this.remoteAudioTrack = options.remoteAudioTrack;
38
- this.remoteVideoTrack = options.remoteVideoTrack;
39
- this.localQualityLevel = options.localQualityLevel || QUALITY_LEVELS['720p'];
40
- this.remoteQualityLevel = options.remoteQualityLevel || QUALITY_LEVELS.HIGH;
47
+ this.mediaDirection = {
48
+ receiveAudio: false,
49
+ receiveVideo: false,
50
+ receiveShare: false,
51
+ sendAudio: false,
52
+ sendVideo: false,
53
+ sendShare: false,
54
+ };
55
+ this.videoStream = null;
56
+ this.audioStream = null;
57
+ this.shareVideoStream = null;
58
+ this.shareAudioStream = null;
59
+ this.remoteShareStream = undefined;
60
+ this.remoteAudioStream = undefined;
61
+ this.remoteVideoStream = undefined;
62
+ this.remoteQualityLevel = QUALITY_LEVELS.HIGH;
41
63
  this.mediaSettings = {};
42
64
  this.videoDeviceId = null;
43
65
  }
@@ -62,46 +84,46 @@ export default class MediaProperties {
62
84
  this.webrtcMediaConnection = mediaPeerConnection;
63
85
  }
64
86
 
65
- setLocalVideoTrack(videoTrack: LocalCameraTrack | null) {
66
- this.videoTrack = videoTrack;
87
+ setLocalVideoStream(videoStream?: LocalCameraStream) {
88
+ this.videoStream = videoStream;
67
89
  }
68
90
 
69
- setLocalAudioTrack(audioTrack: LocalMicrophoneTrack | null) {
70
- this.audioTrack = audioTrack;
91
+ setLocalAudioStream(audioStream?: LocalMicrophoneStream) {
92
+ this.audioStream = audioStream;
71
93
  }
72
94
 
73
- setLocalQualityLevel(localQualityLevel) {
74
- this.localQualityLevel = localQualityLevel;
95
+ setLocalShareVideoStream(shareVideoStream?: LocalDisplayStream) {
96
+ this.shareVideoStream = shareVideoStream;
75
97
  }
76
98
 
77
- setLocalShareTrack(shareTrack: LocalDisplayTrack | null) {
78
- this.shareTrack = shareTrack;
99
+ setLocalShareAudioStream(shareAudioStream?: LocalSystemAudioStream) {
100
+ this.shareAudioStream = shareAudioStream;
79
101
  }
80
102
 
81
103
  setRemoteQualityLevel(remoteQualityLevel) {
82
104
  this.remoteQualityLevel = remoteQualityLevel;
83
105
  }
84
106
 
85
- setRemoteShare(remoteShare) {
86
- this.remoteShare = remoteShare;
107
+ setRemoteShareStream(remoteShareStream: RemoteStream) {
108
+ this.remoteShareStream = remoteShareStream;
87
109
  }
88
110
 
89
111
  /**
90
- * Sets the remote audio track
91
- * @param {MediaTrack} remoteAudioTrack MediaTrack to save
112
+ * Sets the remote audio stream
113
+ * @param {RemoteStream} remoteAudioStream RemoteStream to save
92
114
  * @returns {void}
93
115
  */
94
- setRemoteAudioTrack(remoteAudioTrack: any) {
95
- this.remoteAudioTrack = remoteAudioTrack;
116
+ setRemoteAudioStream(remoteAudioStream: RemoteStream) {
117
+ this.remoteAudioStream = remoteAudioStream;
96
118
  }
97
119
 
98
120
  /**
99
- * Sets the remote video track
100
- * @param {MediaTrack} remoteVideoTrack MediaTrack to save
121
+ * Sets the remote video stream
122
+ * @param {RemoteStream} remoteVideoStream RemoteStream to save
101
123
  * @returns {void}
102
124
  */
103
- setRemoteVideoTrack(remoteVideoTrack: any) {
104
- this.remoteVideoTrack = remoteVideoTrack;
125
+ setRemoteVideoStream(remoteVideoStream: RemoteStream) {
126
+ this.remoteVideoStream = remoteVideoStream;
105
127
  }
106
128
 
107
129
  /**
@@ -117,96 +139,34 @@ export default class MediaProperties {
117
139
  this.webrtcMediaConnection = null;
118
140
  }
119
141
 
120
- unsetLocalVideoTrack() {
121
- this.videoTrack = null;
122
- }
123
-
124
- unsetLocalShareTrack() {
125
- this.shareTrack = null;
126
- }
127
-
128
- unsetLocalAudioTrack() {
129
- this.audioTrack = null;
130
- }
131
-
132
- /**
133
- * Removes remote stream from class instance
134
- * @deprecated after v1.89.3
135
- * @returns {void}
136
- */
137
- unsetRemoteStream() {
138
- LoggerProxy.logger.warn(
139
- 'Media:properties#unsetRemoteStream --> [DEPRECATION WARNING]: unsetRemoteStream has been deprecated after v1.89.3 (use unsetRemoteTracks instead)'
140
- );
141
- // unsets audio and video only
142
- this.unsetRemoteMedia();
143
- }
144
-
145
142
  /**
146
143
  * Removes both remote audio and video from class instance
147
144
  * @returns {void}
148
145
  */
149
146
  unsetRemoteMedia() {
150
- this.remoteAudioTrack = null;
151
- this.remoteVideoTrack = null;
152
- }
153
-
154
- unsetRemoteShare() {
155
- this.remoteShare = null;
147
+ this.remoteAudioStream = null;
148
+ this.remoteVideoStream = null;
156
149
  }
157
150
 
158
- unsetLocalVideoTracks() {
159
- this.unsetLocalVideoTrack();
160
- this.unsetLocalShareTrack();
151
+ unsetRemoteShareStream() {
152
+ this.remoteShareStream = null;
161
153
  }
162
154
 
163
155
  /**
164
- * Removes remote stream and remote share from class instance
165
- * @deprecated after v1.89.3
156
+ * Unsets all remote streams
166
157
  * @returns {void}
167
158
  */
168
159
  unsetRemoteStreams() {
169
- LoggerProxy.logger.warn(
170
- 'Media:properties#unsetRemoteStreams --> [DEPRECATION WARNING]: unsetRemoteStreams has been deprecated after v1.89.3 (use unsetRemoteTracks instead)'
171
- );
172
- this.unsetRemoteStream();
173
- this.unsetRemoteShare();
174
- }
175
-
176
- /**
177
- * Unsets all remote tracks
178
- * @returns {void}
179
- */
180
- unsetRemoteTracks() {
181
160
  this.unsetRemoteMedia();
182
- this.unsetRemoteShare();
183
- }
184
-
185
- unsetShareStreams() {
186
- this.unsetLocalShareTrack();
187
- this.unsetRemoteShare();
161
+ this.unsetRemoteShareStream();
188
162
  }
189
163
 
190
164
  /**
191
- * Removes both local and remote video stream from class instance
192
- * @deprecated after v1.89.3
193
- * @returns {void}
194
- */
195
- unsetMediaStreams() {
196
- LoggerProxy.logger.warn(
197
- 'Media:properties#unsetMediaStreams --> [DEPRECATION WARNING]: unsetMediaStreams has been deprecated after v1.89.3 (use unsetMediaTracks instead)'
198
- );
199
- this.unsetLocalVideoTrack();
200
- this.unsetRemoteStream();
201
- }
202
-
203
- /**
204
- * Removes both local and remote video stream from class instance
205
- * @returns {void}
165
+ * Returns if we have at least one local share stream or not.
166
+ * @returns {Boolean}
206
167
  */
207
- unsetMediaTracks() {
208
- this.unsetLocalVideoTrack();
209
- this.unsetRemoteMedia();
168
+ hasLocalShareStream() {
169
+ return !!(this.shareAudioStream || this.shareVideoStream);
210
170
  }
211
171
 
212
172
  /**