@webex/plugin-meetings 3.0.0-beta.1 → 3.0.0-beta.11

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 (281) hide show
  1. package/dist/common/browser-detection.js.map +1 -1
  2. package/dist/common/collection.js.map +1 -1
  3. package/dist/common/config.js.map +1 -1
  4. package/dist/common/errors/captcha-error.js +7 -0
  5. package/dist/common/errors/captcha-error.js.map +1 -1
  6. package/dist/common/errors/intent-to-join.js +8 -0
  7. package/dist/common/errors/intent-to-join.js.map +1 -1
  8. package/dist/common/errors/join-meeting.js +8 -0
  9. package/dist/common/errors/join-meeting.js.map +1 -1
  10. package/dist/common/errors/media.js +7 -0
  11. package/dist/common/errors/media.js.map +1 -1
  12. package/dist/common/errors/parameter.js.map +1 -1
  13. package/dist/common/errors/password-error.js +7 -0
  14. package/dist/common/errors/password-error.js.map +1 -1
  15. package/dist/common/errors/permission.js +7 -0
  16. package/dist/common/errors/permission.js.map +1 -1
  17. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  18. package/dist/common/errors/reconnection.js +7 -0
  19. package/dist/common/errors/reconnection.js.map +1 -1
  20. package/dist/common/errors/stats.js +7 -0
  21. package/dist/common/errors/stats.js.map +1 -1
  22. package/dist/common/errors/webex-errors.js +5 -29
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/errors/webex-meetings-error.js +5 -2
  25. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  26. package/dist/common/events/events-scope.js.map +1 -1
  27. package/dist/common/events/events.js.map +1 -1
  28. package/dist/common/events/trigger-proxy.js.map +1 -1
  29. package/dist/common/events/util.js.map +1 -1
  30. package/dist/common/logs/logger-config.js.map +1 -1
  31. package/dist/common/logs/logger-proxy.js.map +1 -1
  32. package/dist/common/logs/request.js +3 -0
  33. package/dist/common/logs/request.js.map +1 -1
  34. package/dist/common/queue.js.map +1 -1
  35. package/dist/config.js +1 -0
  36. package/dist/config.js.map +1 -1
  37. package/dist/constants.js +15 -74
  38. package/dist/constants.js.map +1 -1
  39. package/dist/locus-info/controlsUtils.js.map +1 -1
  40. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  41. package/dist/locus-info/fullState.js.map +1 -1
  42. package/dist/locus-info/hostUtils.js.map +1 -1
  43. package/dist/locus-info/index.js +43 -5
  44. package/dist/locus-info/index.js.map +1 -1
  45. package/dist/locus-info/infoUtils.js +4 -0
  46. package/dist/locus-info/infoUtils.js.map +1 -1
  47. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  48. package/dist/locus-info/parser.js +12 -3
  49. package/dist/locus-info/parser.js.map +1 -1
  50. package/dist/locus-info/selfUtils.js.map +1 -1
  51. package/dist/media/index.js +71 -210
  52. package/dist/media/index.js.map +1 -1
  53. package/dist/media/internal-media-core-wrapper.js +22 -0
  54. package/dist/media/internal-media-core-wrapper.js.map +1 -0
  55. package/dist/media/properties.js +32 -25
  56. package/dist/media/properties.js.map +1 -1
  57. package/dist/media/util.js +0 -27
  58. package/dist/media/util.js.map +1 -1
  59. package/dist/mediaQualityMetrics/config.js.map +1 -1
  60. package/dist/meeting/effectsState.js +8 -1
  61. package/dist/meeting/effectsState.js.map +1 -1
  62. package/dist/meeting/index.js +1146 -602
  63. package/dist/meeting/index.js.map +1 -1
  64. package/dist/meeting/muteState.js +6 -0
  65. package/dist/meeting/muteState.js.map +1 -1
  66. package/dist/meeting/request.js +83 -24
  67. package/dist/meeting/request.js.map +1 -1
  68. package/dist/meeting/state.js.map +1 -1
  69. package/dist/meeting/util.js +5 -44
  70. package/dist/meeting/util.js.map +1 -1
  71. package/dist/meeting-info/collection.js +4 -1
  72. package/dist/meeting-info/collection.js.map +1 -1
  73. package/dist/meeting-info/index.js +5 -0
  74. package/dist/meeting-info/index.js.map +1 -1
  75. package/dist/meeting-info/meeting-info-v2.js +14 -2
  76. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  77. package/dist/meeting-info/request.js +3 -0
  78. package/dist/meeting-info/request.js.map +1 -1
  79. package/dist/meeting-info/util.js.map +1 -1
  80. package/dist/meeting-info/utilv2.js.map +1 -1
  81. package/dist/meetings/collection.js +4 -1
  82. package/dist/meetings/collection.js.map +1 -1
  83. package/dist/meetings/index.js +136 -25
  84. package/dist/meetings/index.js.map +1 -1
  85. package/dist/meetings/request.js +4 -0
  86. package/dist/meetings/request.js.map +1 -1
  87. package/dist/meetings/util.js +24 -1
  88. package/dist/meetings/util.js.map +1 -1
  89. package/dist/member/index.js +30 -7
  90. package/dist/member/index.js.map +1 -1
  91. package/dist/member/util.js +2 -1
  92. package/dist/member/util.js.map +1 -1
  93. package/dist/members/collection.js +1 -0
  94. package/dist/members/collection.js.map +1 -1
  95. package/dist/members/index.js +82 -1
  96. package/dist/members/index.js.map +1 -1
  97. package/dist/members/request.js +19 -9
  98. package/dist/members/request.js.map +1 -1
  99. package/dist/members/util.js.map +1 -1
  100. package/dist/metrics/config.js.map +1 -1
  101. package/dist/metrics/constants.js.map +1 -1
  102. package/dist/metrics/index.js +8 -0
  103. package/dist/metrics/index.js.map +1 -1
  104. package/dist/multistream/mediaRequestManager.js +133 -0
  105. package/dist/multistream/mediaRequestManager.js.map +1 -0
  106. package/dist/multistream/multistreamMedia.js +116 -0
  107. package/dist/multistream/multistreamMedia.js.map +1 -0
  108. package/dist/multistream/receiveSlot.js +209 -0
  109. package/dist/multistream/receiveSlot.js.map +1 -0
  110. package/dist/multistream/receiveSlotManager.js +195 -0
  111. package/dist/multistream/receiveSlotManager.js.map +1 -0
  112. package/dist/multistream/remoteMedia.js +289 -0
  113. package/dist/multistream/remoteMedia.js.map +1 -0
  114. package/dist/multistream/remoteMediaGroup.js +243 -0
  115. package/dist/multistream/remoteMediaGroup.js.map +1 -0
  116. package/dist/multistream/remoteMediaManager.js +1113 -0
  117. package/dist/multistream/remoteMediaManager.js.map +1 -0
  118. package/dist/networkQualityMonitor/index.js +10 -2
  119. package/dist/networkQualityMonitor/index.js.map +1 -1
  120. package/dist/personal-meeting-room/index.js +11 -0
  121. package/dist/personal-meeting-room/index.js.map +1 -1
  122. package/dist/personal-meeting-room/request.js +2 -1
  123. package/dist/personal-meeting-room/request.js.map +1 -1
  124. package/dist/personal-meeting-room/util.js.map +1 -1
  125. package/dist/reachability/index.js +17 -7
  126. package/dist/reachability/index.js.map +1 -1
  127. package/dist/reachability/request.js +1 -0
  128. package/dist/reachability/request.js.map +1 -1
  129. package/dist/reactions/reactions.js +111 -0
  130. package/dist/reactions/reactions.js.map +1 -0
  131. package/dist/reactions/reactions.type.js +40 -0
  132. package/dist/reactions/reactions.type.js.map +1 -0
  133. package/dist/reconnection-manager/index.js +130 -132
  134. package/dist/reconnection-manager/index.js.map +1 -1
  135. package/dist/roap/index.js +58 -231
  136. package/dist/roap/index.js.map +1 -1
  137. package/dist/roap/request.js +7 -116
  138. package/dist/roap/request.js.map +1 -1
  139. package/dist/roap/turnDiscovery.js +20 -6
  140. package/dist/roap/turnDiscovery.js.map +1 -1
  141. package/dist/statsAnalyzer/global.js +2 -0
  142. package/dist/statsAnalyzer/global.js.map +1 -1
  143. package/dist/statsAnalyzer/index.js +58 -37
  144. package/dist/statsAnalyzer/index.js.map +1 -1
  145. package/dist/statsAnalyzer/mqaUtil.js +9 -3
  146. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  147. package/dist/transcription/index.js +10 -3
  148. package/dist/transcription/index.js.map +1 -1
  149. package/package.json +21 -20
  150. package/src/common/{browser-detection.js → browser-detection.ts} +1 -1
  151. package/src/common/collection.ts +6 -6
  152. package/src/common/{config.js → config.ts} +1 -1
  153. package/src/common/errors/{captcha-error.js → captcha-error.ts} +5 -1
  154. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +6 -1
  155. package/src/common/errors/{join-meeting.js → join-meeting.ts} +6 -1
  156. package/src/common/errors/{media.js → media.ts} +5 -1
  157. package/src/common/errors/parameter.ts +3 -2
  158. package/src/common/errors/{password-error.js → password-error.ts} +5 -1
  159. package/src/common/errors/{permission.js → permission.ts} +5 -1
  160. package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
  161. package/src/common/errors/{reconnection.js → reconnection.ts} +5 -1
  162. package/src/common/errors/{stats.js → stats.ts} +5 -1
  163. package/src/common/errors/{webex-errors.js → webex-errors.ts} +1 -20
  164. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +3 -1
  165. package/src/common/events/{events-scope.js → events-scope.ts} +1 -1
  166. package/src/common/events/{events.js → events.ts} +0 -0
  167. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +1 -2
  168. package/src/common/events/{util.js → util.ts} +1 -1
  169. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  170. package/src/common/logs/{logger-proxy.js → logger-proxy.ts} +1 -1
  171. package/src/common/logs/{request.js → request.ts} +12 -2
  172. package/src/common/queue.ts +1 -2
  173. package/src/{config.js → config.ts} +2 -0
  174. package/src/constants.ts +139 -179
  175. package/src/locus-info/{controlsUtils.js → controlsUtils.ts} +4 -4
  176. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  177. package/src/locus-info/{fullState.js → fullState.ts} +1 -1
  178. package/src/locus-info/{hostUtils.js → hostUtils.ts} +5 -5
  179. package/src/locus-info/{index.js → index.ts} +67 -32
  180. package/src/locus-info/{infoUtils.js → infoUtils.ts} +7 -4
  181. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +13 -13
  182. package/src/locus-info/{parser.js → parser.ts} +22 -12
  183. package/src/locus-info/{selfUtils.js → selfUtils.ts} +17 -19
  184. package/src/media/{index.js → index.ts} +130 -205
  185. package/src/media/internal-media-core-wrapper.ts +9 -0
  186. package/src/media/{properties.js → properties.ts} +35 -29
  187. package/src/media/util.ts +16 -0
  188. package/src/mediaQualityMetrics/{config.js → config.ts} +1 -1
  189. package/src/meeting/{effectsState.js → effectsState.ts} +12 -6
  190. package/src/meeting/{index.js → index.ts} +993 -474
  191. package/src/meeting/{muteState.js → muteState.ts} +16 -11
  192. package/src/meeting/{request.js → request.ts} +148 -36
  193. package/src/meeting/{state.js → state.ts} +6 -6
  194. package/src/meeting/{util.js → util.ts} +9 -51
  195. package/src/meeting-info/{collection.js → collection.ts} +4 -1
  196. package/src/meeting-info/{index.js → index.ts} +10 -6
  197. package/src/meeting-info/{meeting-info-v2.js → meeting-info-v2.ts} +28 -10
  198. package/src/meeting-info/{request.js → request.ts} +6 -2
  199. package/src/meeting-info/{util.js → util.ts} +6 -5
  200. package/src/meeting-info/{utilv2.js → utilv2.ts} +8 -7
  201. package/src/meetings/{collection.js → collection.ts} +5 -2
  202. package/src/meetings/{index.js → index.ts} +118 -22
  203. package/src/meetings/{request.js → request.ts} +6 -1
  204. package/src/meetings/{util.js → util.ts} +28 -5
  205. package/src/member/{index.js → index.ts} +46 -15
  206. package/src/member/{util.js → util.ts} +17 -16
  207. package/src/members/{collection.js → collection.ts} +2 -1
  208. package/src/members/{index.js → index.ts} +94 -26
  209. package/src/members/{request.js → request.ts} +16 -5
  210. package/src/members/{util.js → util.ts} +7 -7
  211. package/src/metrics/{config.js → config.ts} +0 -2
  212. package/src/metrics/{constants.js → constants.ts} +0 -0
  213. package/src/metrics/{index.js → index.ts} +27 -8
  214. package/src/multistream/mediaRequestManager.ts +166 -0
  215. package/src/multistream/multistreamMedia.ts +92 -0
  216. package/src/multistream/receiveSlot.ts +141 -0
  217. package/src/multistream/receiveSlotManager.ts +142 -0
  218. package/src/multistream/remoteMedia.ts +228 -0
  219. package/src/multistream/remoteMediaGroup.ts +224 -0
  220. package/src/multistream/remoteMediaManager.ts +911 -0
  221. package/src/networkQualityMonitor/{index.js → index.ts} +18 -3
  222. package/src/personal-meeting-room/{index.js → index.ts} +17 -4
  223. package/src/personal-meeting-room/{request.js → request.ts} +3 -1
  224. package/src/personal-meeting-room/{util.js → util.ts} +1 -1
  225. package/src/reachability/{index.js → index.ts} +28 -17
  226. package/src/reachability/request.ts +4 -2
  227. package/src/reactions/reactions.ts +104 -0
  228. package/src/reactions/reactions.type.ts +36 -0
  229. package/src/reconnection-manager/{index.js → index.ts} +81 -65
  230. package/src/roap/index.ts +229 -0
  231. package/src/roap/{request.js → request.ts} +15 -74
  232. package/src/roap/turnDiscovery.ts +26 -11
  233. package/src/statsAnalyzer/{global.js → global.ts} +2 -0
  234. package/src/statsAnalyzer/{index.js → index.ts} +66 -61
  235. package/src/statsAnalyzer/{mqaUtil.js → mqaUtil.ts} +6 -1
  236. package/src/transcription/{index.js → index.ts} +16 -11
  237. package/test/integration/spec/journey.js +1 -1
  238. package/test/integration/spec/space-meeting.js +1 -2
  239. package/test/unit/spec/locus-info/infoUtils.js +17 -1
  240. package/test/unit/spec/media/index.ts +207 -0
  241. package/test/unit/spec/media/properties.ts +73 -82
  242. package/test/unit/spec/meeting/effectsState.js +1 -3
  243. package/test/unit/spec/meeting/index.js +672 -245
  244. package/test/unit/spec/meeting/muteState.js +7 -0
  245. package/test/unit/spec/meeting/request.js +25 -1
  246. package/test/unit/spec/meeting/utils.js +63 -2
  247. package/test/unit/spec/meetings/index.js +0 -4
  248. package/test/unit/spec/members/index.js +164 -2
  249. package/test/unit/spec/multistream/mediaRequestManager.ts +515 -0
  250. package/test/unit/spec/multistream/receiveSlot.ts +104 -0
  251. package/test/unit/spec/multistream/receiveSlotManager.ts +173 -0
  252. package/test/unit/spec/multistream/remoteMedia.ts +225 -0
  253. package/test/unit/spec/multistream/remoteMediaGroup.ts +396 -0
  254. package/test/unit/spec/multistream/remoteMediaManager.ts +1309 -0
  255. package/test/unit/spec/reconnection-manager/index.js +68 -2
  256. package/test/unit/spec/roap/index.ts +63 -35
  257. package/test/unit/spec/stats-analyzer/index.js +19 -22
  258. package/dist/peer-connection-manager/index.js +0 -794
  259. package/dist/peer-connection-manager/index.js.map +0 -1
  260. package/dist/peer-connection-manager/util.js +0 -124
  261. package/dist/peer-connection-manager/util.js.map +0 -1
  262. package/dist/roap/collection.js +0 -73
  263. package/dist/roap/collection.js.map +0 -1
  264. package/dist/roap/handler.js +0 -337
  265. package/dist/roap/handler.js.map +0 -1
  266. package/dist/roap/state.js +0 -164
  267. package/dist/roap/state.js.map +0 -1
  268. package/dist/roap/util.js +0 -102
  269. package/dist/roap/util.js.map +0 -1
  270. package/src/media/util.js +0 -38
  271. package/src/peer-connection-manager/index.js +0 -723
  272. package/src/peer-connection-manager/util.ts +0 -117
  273. package/src/roap/collection.js +0 -63
  274. package/src/roap/handler.js +0 -252
  275. package/src/roap/index.js +0 -380
  276. package/src/roap/state.js +0 -149
  277. package/src/roap/util.js +0 -93
  278. package/test/unit/spec/peerconnection-manager/index.js +0 -188
  279. package/test/unit/spec/peerconnection-manager/utils.js +0 -48
  280. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
  281. package/test/unit/spec/roap/util.js +0 -30
@@ -7,15 +7,15 @@ import LoggerProxy from '../common/logs/logger-proxy';
7
7
  import {
8
8
  AUDIO_INPUT,
9
9
  VIDEO_INPUT,
10
- PEER_CONNECTION_STATE,
11
- MEDIA_TRACK_CONSTRAINT
10
+ MEDIA_TRACK_CONSTRAINT,
12
11
  } from '../constants';
13
12
  import Config from '../config';
14
- import PeerConnectionManager from '../peer-connection-manager';
15
- import ReconnectionError from '../common/errors/reconnection';
13
+ import StaticConfig from '../common/config';
16
14
  import MediaError from '../common/errors/media';
17
15
  import BrowserDetection from '../common/browser-detection';
18
16
 
17
+ import {RoapMediaConnection, MultistreamRoapMediaConnection} from './internal-media-core-wrapper';
18
+
19
19
  const {isBrowser} = BrowserDetection();
20
20
 
21
21
  /**
@@ -46,7 +46,7 @@ const {isBrowser} = BrowserDetection();
46
46
  * Handles the quirks of each browser.
47
47
  * Extends and enhances adapter.js, i.e., the "media" file from the web client.
48
48
  */
49
- const Media = {};
49
+ const Media: any = {};
50
50
 
51
51
  /**
52
52
  * @param {boolean} enabled
@@ -54,7 +54,7 @@ const Media = {};
54
54
  * @returns {Boolean}
55
55
  * @public
56
56
  */
57
- Media.setLocalTrack = (enabled, track) => {
57
+ Media.setLocalTrack = (enabled: boolean, track: MediaStreamTrack) => {
58
58
  if (track) {
59
59
  track.enabled = enabled;
60
60
 
@@ -64,32 +64,6 @@ Media.setLocalTrack = (enabled, track) => {
64
64
  return false;
65
65
  };
66
66
 
67
- /**
68
- * @param {RTCPeerConnection} peerConnection
69
- * @param {Object} meetingProperties
70
- * @param {string} meetingProperties.meetingId
71
- * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
72
- * @returns {Promise}
73
- */
74
- Media.reconnectMedia = (peerConnection, {
75
- meetingId,
76
- remoteQualityLevel,
77
- enableRtx,
78
- enableExtmap
79
- }) => {
80
- if (peerConnection.connectionState === PEER_CONNECTION_STATE.CLOSED ||
81
- peerConnection.connectionState === PEER_CONNECTION_STATE.FAILED) {
82
- return Promise.reject(new ReconnectionError('Reinitiate peerconnection'));
83
- }
84
-
85
- return PeerConnectionManager.createOffer(peerConnection, {
86
- meetingId,
87
- remoteQualityLevel,
88
- enableRtx,
89
- enableExtmap
90
- });
91
- };
92
-
93
67
  /**
94
68
  * format the media array for send
95
69
  * @param {String} mediaId
@@ -97,7 +71,7 @@ Media.reconnectMedia = (peerConnection, {
97
71
  * @param {Boolean} videoMuted
98
72
  * @returns {Array} medias
99
73
  */
100
- Media.generateLocalMedias = (mediaId, audioMuted, videoMuted) => {
74
+ Media.generateLocalMedias = (mediaId: string, audioMuted: boolean, videoMuted: boolean) => {
101
75
  if (mediaId) {
102
76
  return [
103
77
  {
@@ -119,7 +93,7 @@ Media.generateLocalMedias = (mediaId, audioMuted, videoMuted) => {
119
93
  * @param {Object} config SDK Configuration for meetings plugin
120
94
  * @returns {Promise}
121
95
  */
122
- Media.getLocalMedia = (options, config) => {
96
+ Media.getLocalMedia = (options: any, config: object) => {
123
97
  const {
124
98
  sendAudio, sendVideo, sendShare, sharePreferences, isSharing
125
99
  } = options;
@@ -141,186 +115,110 @@ Media.getLocalMedia = (options, config) => {
141
115
 
142
116
  return Promise.resolve(undefined);
143
117
  };
118
+
144
119
  /**
145
- * Returns the direction and tracks
146
- * @param {string} trackType type of track (audio/video)
147
- * @param {object} track tracks passed
148
- * @param {boolean} receiveTracks do you want to receive tracks from the remote side
149
- * @returns {Object} returns direction tracks to be added in transceiver
120
+ * creates a webrtc media connection with provided tracks and mediaDirection configuration
121
+ *
122
+ * @param {boolean} isMultistream
123
+ * @param {string} debugId string useful for debugging (will appear in media connection logs)
124
+ * @param {Object} options
125
+ * @param {Object} [options.mediaProperties] only applicable to non-multistream connections, contains mediaDirection and local tracks:
126
+ * audioTrack, videoTrack and shareTrack
127
+ * @param {string} [options.remoteQualityLevel] LOW|MEDIUM|HIGH applicable only to non-multistream connections
128
+ * @param {boolean} [options.enableRtx] applicable only to non-multistream connections
129
+ * @param {boolean} [options.enableExtmap] applicable only to non-multistream connections
130
+ * @param {Object} [options.turnServerInfo]
131
+ * @returns {RoapMediaConnection}
150
132
  */
151
- Media.checkTracks = (trackType, track, receiveTracks) => {
152
- const getDirection = (sendTracks, receiveTracks) => {
153
- if (sendTracks && receiveTracks) {
154
- return 'sendrecv';
155
- } if (sendTracks && !receiveTracks) {
156
- return 'sendonly';
157
- } if (!sendTracks && receiveTracks) {
158
- return 'recvonly';
133
+ Media.createMediaConnection = (
134
+ isMultistream: boolean,
135
+ debugId: string,
136
+ options: {
137
+ mediaProperties?: {
138
+ mediaDirection?: {
139
+ receiveAudio: boolean,
140
+ receiveVideo: boolean,
141
+ receiveShare: boolean,
142
+ },
143
+ audioTrack?: MediaStreamTrack,
144
+ videoTrack?: MediaStreamTrack,
145
+ shareTrack?: MediaStreamTrack
146
+ },
147
+ remoteQualityLevel?: 'LOW'|'MEDIUM'|'HIGH',
148
+ enableRtx?: boolean,
149
+ enableExtmap?: boolean,
150
+ turnServerInfo?: {
151
+ url: string,
152
+ username: string,
153
+ password: string
159
154
  }
160
-
161
- return 'inactive';
162
- };
163
-
164
- if (track) {
165
- return {track, direction: getDirection(!!track, receiveTracks)};
166
155
  }
167
-
168
- return {track: trackType, direction: getDirection(!!track, receiveTracks)};
169
- };
170
- /**
171
- * creates peerconnection and attaches streams
172
- * @param {MediaDirection} mediaProperties
173
- * @param {Object} meetingProperties
174
- * @param {string} meetingProperties.meetingId
175
- * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
176
- * @returns {Array} [peerConnection, ]
177
- */
178
- Media.attachMedia = (mediaProperties, {
179
- meetingId,
180
- remoteQualityLevel,
181
- enableRtx,
182
- enableExtmap
183
- }) => {
156
+ ) => {
184
157
  const {
185
- mediaDirection,
186
- audioTrack,
187
- videoTrack,
188
- shareTrack,
189
- peerConnection
190
- } = mediaProperties;
191
-
192
- let result = null;
193
-
194
- // Add Transceiver for audio
195
- result = Media.checkTracks('audio', mediaDirection.sendAudio && audioTrack, mediaDirection.receiveAudio);
196
- peerConnection.audioTransceiver = peerConnection.addTransceiver(result.track, {direction: result.direction});
158
+ mediaProperties,
159
+ remoteQualityLevel,
160
+ enableRtx,
161
+ enableExtmap,
162
+ turnServerInfo
163
+ } = options;
197
164
 
198
- // Add Transceiver for video
199
- result = Media.checkTracks('video', mediaDirection.sendVideo && videoTrack, mediaDirection.receiveVideo);
200
- peerConnection.videoTransceiver = peerConnection.addTransceiver(result.track, {direction: result.direction});
165
+ const iceServers = [];
201
166
 
202
- // Add Transceiver for share
203
- result = Media.checkTracks('video', mediaDirection.sendShare && shareTrack, mediaDirection.receiveShare);
204
- peerConnection.shareTransceiver = peerConnection.addTransceiver(result.track, {direction: result.direction});
167
+ if (turnServerInfo) {
168
+ iceServers.push({
169
+ urls: turnServerInfo.url,
170
+ username: turnServerInfo.username || '',
171
+ credential: turnServerInfo.password || ''
172
+ });
173
+ }
205
174
 
206
- peerConnection.onnegotiationneeded = (event) => {
207
- LoggerProxy.logger.info(`Media:index#attachMedia --> onnegotiationneeded#PeerConnection: ${event}`);
208
- };
175
+ if (isMultistream) {
176
+ return new MultistreamRoapMediaConnection({
177
+ iceServers,
178
+ }, debugId);
179
+ }
209
180
 
210
- return PeerConnectionManager.createOffer(peerConnection, {
211
- meetingId,
212
- remoteQualityLevel,
213
- enableRtx,
214
- enableExtmap
215
- });
216
- };
181
+ if (!mediaProperties) {
182
+ throw new Error('mediaProperties have to be provided for non-multistream media connections');
183
+ }
217
184
 
218
- /**
219
- * updates all the media streams and creates a new media offer
220
- * @param {MediaDirection} mediaProperties
221
- * @param {Object} meetingProperties
222
- * @param {string} meetingProperties.meetingId
223
- * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
224
- * @returns {Promise}
225
- */
226
- Media.updateMedia = (mediaProperties, {
227
- meetingId,
228
- remoteQualityLevel,
229
- enableRtx,
230
- enableExtmap
231
- }) => {
232
185
  const {
233
186
  mediaDirection,
234
187
  audioTrack,
235
188
  videoTrack,
236
- shareTrack,
237
- peerConnection
189
+ shareTrack
238
190
  } = mediaProperties;
239
191
 
240
- // update audio transceiver
241
- Media.setTrackOnTransceiver(peerConnection.audioTransceiver, {
242
- type: 'audio',
243
- track: audioTrack,
244
- sendTrack: mediaDirection.sendAudio && audioTrack,
245
- receiveTrack: mediaDirection.receiveAudio
246
- });
247
192
 
248
- // update video transceiver
249
- Media.setTrackOnTransceiver(peerConnection.videoTransceiver, {
250
- type: 'video',
251
- track: videoTrack,
252
- sendTrack: mediaDirection.sendVideo && videoTrack,
253
- receiveTrack: mediaDirection.receiveVideo
254
- });
255
-
256
- // update content transceiver
257
- Media.setTrackOnTransceiver(peerConnection.shareTransceiver, {
258
- type: 'video',
259
- track: shareTrack,
260
- sendTrack: mediaDirection.sendShare && shareTrack,
261
- receiveTrack: mediaDirection.receiveShare
262
- });
263
- peerConnection.onnegotiationneeded = (event) => {
264
- LoggerProxy.logger.info(`Media:index#updateMedia --> onnegotiationneeded#PeerConnection: ${event}`);
265
- };
266
-
267
- return PeerConnectionManager.createOffer(peerConnection, {
268
- meetingId,
269
- remoteQualityLevel,
270
- enableRtx,
271
- enableExtmap
272
- });
273
- };
274
-
275
- /**
276
- * @param {RTCRtpTransceiver} transceiver
277
- * @param {Object} options
278
- * @param {MediaStreamTrack} options.track
279
- * @returns {undefined}
280
- */
281
- Media.setTrackOnTransceiver = (transceiver, options) => {
282
- const {
283
- type, track, sendTrack, receiveTrack
284
- } = options;
285
-
286
- try {
287
- const result = Media.checkTracks(type, sendTrack && track, receiveTrack);
288
-
289
- transceiver.direction = result.direction;
290
- if (options.track) {
291
- transceiver.sender.replaceTrack(track);
193
+ return new RoapMediaConnection({
194
+ iceServers,
195
+ skipInactiveTransceivers: false,
196
+ requireH264: true,
197
+ sdpMunging: {
198
+ convertPort9to0: false,
199
+ addContentSlides: true,
200
+ bandwidthLimits: {
201
+ audio: StaticConfig.meetings.bandwidth.audio,
202
+ video: StaticConfig.meetings.bandwidth.video,
203
+ },
204
+ startBitrate: StaticConfig.meetings.bandwidth.startBitrate,
205
+ periodicKeyframes: 20, // it's always been hardcoded in SDK so for now keeping it that way
206
+ disableExtmap: !enableExtmap,
207
+ disableRtx: !enableRtx, // see https://bugs.chromium.org/p/chromium/issues/detail?id=1020642 why we might want to remove RTX from SDP
292
208
  }
293
- }
294
- catch (e) {
295
- LoggerProxy.logger.error(`Media:index#setTrackOnTransceiver --> ${e}`);
296
- throw e;
297
- }
298
- };
299
-
300
- /**
301
- * creates a new offer
302
- * @param {Object} meetingProperties
303
- * @param {string} meetingProperties.meetingId
304
- * @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
305
- * @param {RTCPeerConnection} peerConnection
306
- * @param {RTCRtpTransceiver} transceiver
307
- * @param {Object} options see #Media.setTrackOnTransceiver
308
- * @returns {Promise}
309
- */
310
- Media.updateTransceiver = ({
311
- meetingId,
312
- remoteQualityLevel,
313
- enableRtx,
314
- enableExtmap
315
- }, peerConnection, transceiver, options) => {
316
- Media.setTrackOnTransceiver(transceiver, options);
317
-
318
- return PeerConnectionManager.createOffer(peerConnection, {
319
- meetingId,
320
- remoteQualityLevel,
321
- enableRtx,
322
- enableExtmap
323
- });
209
+ }, {
210
+ send: {
211
+ audio: audioTrack,
212
+ video: videoTrack,
213
+ screenShareVideo: shareTrack
214
+ },
215
+ receive: {
216
+ audio: mediaDirection.receiveAudio,
217
+ video: mediaDirection.receiveVideo,
218
+ screenShareVideo: mediaDirection.receiveShare,
219
+ remoteQualityLevel
220
+ }
221
+ }, debugId);
324
222
  };
325
223
 
326
224
  /**
@@ -335,7 +233,17 @@ Media.updateTransceiver = ({
335
233
  * @param {Object} config SDK Configuration for meetings plugin
336
234
  * @returns {Promise.<MediaStream>}
337
235
  */
338
- Media.getDisplayMedia = (options, config = {}) => {
236
+ Media.getDisplayMedia = (
237
+ options: {
238
+ sendAudio: boolean;
239
+ sendShare: boolean;
240
+ sharePreferences: {
241
+ shareConstraints: MediaTrackConstraints;
242
+ highFrameRate: any;
243
+ };
244
+ },
245
+ config: any = {}
246
+ ) => {
339
247
  // SDK screen share resolution settings from Webex.init
340
248
  const customResolution = config.screenResolution || {};
341
249
  // user defined screen share frame rate
@@ -352,7 +260,7 @@ Media.getDisplayMedia = (options, config = {}) => {
352
260
  aspectRatio
353
261
  } = Config.meetings;
354
262
 
355
- let shareConstraints = {
263
+ let shareConstraints: any = {
356
264
  cursor: MEDIA_TRACK_CONSTRAINT.CURSOR.AWLAYS,
357
265
  aspectRatio
358
266
  };
@@ -388,7 +296,7 @@ Media.getDisplayMedia = (options, config = {}) => {
388
296
 
389
297
 
390
298
  if (isBrowser('firefox')) {
391
- const mediaConfig = {
299
+ const mediaConfig: any = {
392
300
  audio: options.sendAudio,
393
301
  video: options.sendShare
394
302
  };
@@ -408,7 +316,7 @@ Media.getDisplayMedia = (options, config = {}) => {
408
316
  });
409
317
  }
410
318
 
411
- const getDisplayMediaParams = {video: options.sendShare ? shareConstraints : false};
319
+ const getDisplayMediaParams: any = {video: options.sendShare ? shareConstraints : false};
412
320
 
413
321
  // safari doesn't support sending screen share audio
414
322
  // https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia
@@ -426,7 +334,7 @@ Media.getDisplayMedia = (options, config = {}) => {
426
334
  * @param {Object} config SDK Configuration for meetings plugin
427
335
  * @returns {Object} {streams}
428
336
  */
429
- Media.getMedia = (audio, video, config) => {
337
+ Media.getMedia = (audio: any | boolean, video: any | boolean, config: any) => {
430
338
  const defaultWidth = {ideal: config.resolution.idealWidth, max: config.resolution.maxWidth};
431
339
  const defaultHeight = {ideal: config.resolution.idealHeight, max: config.resolution.maxHeight};
432
340
  const mediaConfig = {
@@ -471,7 +379,7 @@ Media.getMedia = (audio, video, config) => {
471
379
  * sendVideo: true/false
472
380
  *}
473
381
  */
474
- Media.getSupportedDevice = ({sendAudio, sendVideo}) =>
382
+ Media.getSupportedDevice = ({ sendAudio, sendVideo }: { sendAudio: boolean; sendVideo: boolean }) =>
475
383
  Promise.resolve().then(() => {
476
384
  if (!navigator.mediaDevices || navigator.mediaDevices.enumerateDevices === undefined) {
477
385
  return {
@@ -518,7 +426,7 @@ Media.toggleStream = () => {};
518
426
  * @param {MediaTrack} track A media stream
519
427
  * @returns {null}
520
428
  */
521
- Media.stopTracks = (track) => {
429
+ Media.stopTracks = (track: any) => {
522
430
  if (!track) {
523
431
  return Promise.resolve();
524
432
  }
@@ -542,7 +450,7 @@ Media.stopTracks = (track) => {
542
450
  * @returns {null}
543
451
  * @deprecated after v1.89.3
544
452
  */
545
- Media.stopStream = (stream) => {
453
+ Media.stopStream = (stream: any) => {
546
454
  LoggerProxy.logger.warn('Media:index#stopStream --> [DEPRECATION WARNING]: stopStream has been deprecated after v1.89.3');
547
455
  if (!stream) {
548
456
  return Promise.resolve();
@@ -581,7 +489,24 @@ Media.stopStream = (stream) => {
581
489
  * @param {Object} config SDK Config
582
490
  * @returns {Array} [localStream, shareStream]
583
491
  */
584
- Media.getUserMedia = (mediaSetting, audioVideo, sharePreferences, config) => Media.getLocalMedia({
492
+ Media.getUserMedia = (
493
+ mediaSetting: {
494
+ sendAudio: object;
495
+ sendVideo: object;
496
+ sendShare: object;
497
+ isSharing: object;
498
+ },
499
+ audioVideo: {
500
+ audio: object;
501
+ video: object;
502
+ },
503
+ sharePreferences: {
504
+ shareConstraints: object;
505
+ highFrameRate: boolean;
506
+ },
507
+ config: object
508
+ ) =>
509
+ Media.getLocalMedia({
585
510
  sendAudio: mediaSetting.sendAudio ? audioVideo.audio || mediaSetting.sendAudio : false,
586
511
  sendVideo: mediaSetting.sendVideo ? audioVideo.video || mediaSetting.sendVideo : false
587
512
  }, config).then((localStream) => Media.getLocalMedia({
@@ -0,0 +1,9 @@
1
+ import {MediaConnection as MC} from '@webex/internal-media-core';
2
+
3
+ /* We have this wrapper just because otherwise it's impossible to mock
4
+ * RoapMediaConnection and MultistreamRoapMediaConnection constructors in unit tests,
5
+ * because they are exported by @webex/internal-media-core as non-writable, non-configurable
6
+ * properties of MediaConnection and sinon doesn't allow spying on them or stubbing them.
7
+ */
8
+ export const RoapMediaConnection = MC.RoapMediaConnection;
9
+ export const MultistreamRoapMediaConnection = MC.MultistreamRoapMediaConnection;
@@ -1,25 +1,36 @@
1
+ import {MediaConnection as MC} from '@webex/internal-media-core';
2
+
1
3
  import {
2
- ICE_STATE,
3
4
  MEETINGS,
4
5
  PC_BAIL_TIMEOUT,
5
6
  QUALITY_LEVELS
6
7
  } from '../constants';
7
8
  import LoggerProxy from '../common/logs/logger-proxy';
8
9
 
9
- import MediaUtil from './util';
10
-
11
10
  /**
12
11
  * @class MediaProperties
13
12
  */
14
13
  export default class MediaProperties {
14
+ audioTrack: any;
15
+ localQualityLevel: any;
16
+ mediaDirection: any;
17
+ mediaSettings: any;
18
+ webrtcMediaConnection: any;
19
+ remoteAudioTrack: any;
20
+ remoteQualityLevel: any;
21
+ remoteShare: any;
22
+ remoteVideoTrack: any;
23
+ shareTrack: any;
24
+ videoDeviceId: any;
25
+ videoTrack: any;
15
26
  namespace = MEETINGS;
16
27
 
17
28
  /**
18
29
  * @param {Object} [options] -- to auto construct
19
30
  * @returns {MediaProperties}
20
31
  */
21
- constructor(options = {}) {
22
- this.peerConnection = MediaUtil.createPeerConnection();
32
+ constructor(options: any = {}) {
33
+ this.webrtcMediaConnection = null;
23
34
  this.mediaDirection = options.mediaDirection;
24
35
  this.videoTrack = options.videoTrack;
25
36
  this.audioTrack = options.audioTrack;
@@ -49,8 +60,8 @@ export default class MediaProperties {
49
60
  this.mediaSettings[type] = values;
50
61
  }
51
62
 
52
- setMediaPeerConnection(peerConnection) {
53
- this.peerConnection = peerConnection;
63
+ setMediaPeerConnection(mediaPeerConnection) {
64
+ this.webrtcMediaConnection = mediaPeerConnection;
54
65
  }
55
66
 
56
67
  setLocalVideoTrack(videoTrack) {
@@ -82,7 +93,7 @@ export default class MediaProperties {
82
93
  * @param {MediaTrack} remoteAudioTrack MediaTrack to save
83
94
  * @returns {void}
84
95
  */
85
- setRemoteAudioTrack(remoteAudioTrack) {
96
+ setRemoteAudioTrack(remoteAudioTrack: any) {
86
97
  this.remoteAudioTrack = remoteAudioTrack;
87
98
  }
88
99
 
@@ -91,7 +102,7 @@ export default class MediaProperties {
91
102
  * @param {MediaTrack} remoteVideoTrack MediaTrack to save
92
103
  * @returns {void}
93
104
  */
94
- setRemoteVideoTrack(remoteVideoTrack) {
105
+ setRemoteVideoTrack(remoteVideoTrack: any) {
95
106
  this.remoteVideoTrack = remoteVideoTrack;
96
107
  }
97
108
 
@@ -100,16 +111,12 @@ export default class MediaProperties {
100
111
  * @param {string} deviceId Preferred video input device
101
112
  * @returns {void}
102
113
  */
103
- setVideoDeviceId(deviceId) {
114
+ setVideoDeviceId(deviceId: string) {
104
115
  this.videoDeviceId = deviceId;
105
116
  }
106
117
 
107
118
  unsetPeerConnection() {
108
- this.peerConnection = null;
109
- }
110
-
111
- reInitiatePeerconnection(turnServerInfo) {
112
- this.peerConnection = MediaUtil.createPeerConnection(turnServerInfo);
119
+ this.webrtcMediaConnection = null;
113
120
  }
114
121
 
115
122
  unsetLocalVideoTrack() {
@@ -199,39 +206,38 @@ export default class MediaProperties {
199
206
  }
200
207
 
201
208
  /**
202
- * Waits until ice connection is established
209
+ * Waits for the webrtc media connection to be connected.
203
210
  *
204
211
  * @returns {Promise<void>}
205
212
  */
206
- waitForIceConnectedState() {
207
- const isIceConnected = () => (
208
- this.peerConnection.iceConnectionState === ICE_STATE.CONNECTED ||
209
- this.peerConnection.iceConnectionState === ICE_STATE.COMPLETED
213
+ waitForMediaConnectionConnected() {
214
+ const isConnected = () => (
215
+ this.webrtcMediaConnection.getConnectionState() === MC.ConnectionState.Connected
210
216
  );
211
217
 
212
- if (isIceConnected()) {
218
+ if (isConnected()) {
213
219
  return Promise.resolve();
214
220
  }
215
221
 
216
222
  return new Promise((resolve, reject) => {
217
223
  let timer;
218
224
 
219
- const iceListener = () => {
220
- LoggerProxy.logger.log(`Media:properties#waitForIceConnectedState --> ice state: ${this.peerConnection.iceConnectionState}, conn state: ${this.peerConnection.connectionState}`);
225
+ const connectionStateListener = () => {
226
+ LoggerProxy.logger.log(`Media:properties#waitForMediaConnectionConnected --> connection state: ${this.webrtcMediaConnection.getConnectionState()}`);
221
227
 
222
- if (isIceConnected()) {
228
+ if (isConnected()) {
223
229
  clearTimeout(timer);
224
- this.peerConnection.removeEventListener('iceconnectionstatechange', iceListener);
230
+ this.webrtcMediaConnection.off(MC.Event.CONNECTION_STATE_CHANGED, connectionStateListener);
225
231
  resolve();
226
232
  }
227
233
  };
228
234
 
229
235
  timer = setTimeout(() => {
230
- this.peerConnection.removeEventListener('iceconnectionstatechange', iceListener);
236
+ this.webrtcMediaConnection.off(MC.Event.CONNECTION_STATE_CHANGED, connectionStateListener);
231
237
  reject();
232
238
  }, PC_BAIL_TIMEOUT);
233
239
 
234
- this.peerConnection.addEventListener('iceconnectionstatechange', iceListener);
240
+ this.webrtcMediaConnection.on(MC.Event.CONNECTION_STATE_CHANGED, connectionStateListener);
235
241
  });
236
242
  }
237
243
 
@@ -242,13 +248,13 @@ export default class MediaProperties {
242
248
  */
243
249
  async getCurrentConnectionType() {
244
250
  // we can only get the connection type after ICE connection has been established
245
- await this.waitForIceConnectedState();
251
+ await this.waitForMediaConnectionConnected();
246
252
 
247
253
  const allStatsReports = [];
248
254
 
249
255
  try {
250
256
  // eslint-disable-next-line no-await-in-loop
251
- const statsResult = await this.peerConnection.getStats();
257
+ const statsResult = await this.webrtcMediaConnection.getStats();
252
258
 
253
259
  statsResult.forEach((report) => allStatsReports.push(report));
254
260
  }
@@ -0,0 +1,16 @@
1
+ /* globals MediaStream */
2
+
3
+ import LoggerProxy from '../common/logs/logger-proxy';
4
+
5
+ const MediaUtil: any = {};
6
+
7
+ MediaUtil.createMediaStream = (tracks) => {
8
+ if (!tracks) {
9
+ LoggerProxy.logger.error('Media:util#createMediaStream --> Tracks don\'t exist');
10
+ }
11
+ const filtredTracks = tracks.filter((element) => !!element);
12
+
13
+ return new MediaStream(filtredTracks);
14
+ };
15
+
16
+ export default MediaUtil;
@@ -1,4 +1,3 @@
1
-
2
1
  export default {
3
2
  intervals: [
4
3
  {
@@ -380,3 +379,4 @@ export default {
380
379
  }
381
380
  ]
382
381
  };
382
+