@webex/plugin-meetings 3.7.0 → 3.8.0-next.2

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 (198) hide show
  1. package/dist/annotation/index.js +17 -0
  2. package/dist/annotation/index.js.map +1 -1
  3. package/dist/breakouts/breakout.js +1 -1
  4. package/dist/breakouts/index.js +1 -1
  5. package/dist/common/errors/join-forbidden-error.js +52 -0
  6. package/dist/common/errors/join-forbidden-error.js.map +1 -0
  7. package/dist/common/errors/{webinar-registration-error.js → join-webinar-error.js} +12 -12
  8. package/dist/common/errors/join-webinar-error.js.map +1 -0
  9. package/dist/common/errors/multistream-not-supported-error.js +53 -0
  10. package/dist/common/errors/multistream-not-supported-error.js.map +1 -0
  11. package/dist/config.js +2 -1
  12. package/dist/config.js.map +1 -1
  13. package/dist/constants.js +68 -6
  14. package/dist/constants.js.map +1 -1
  15. package/dist/index.js +16 -11
  16. package/dist/index.js.map +1 -1
  17. package/dist/interpretation/index.js +1 -1
  18. package/dist/interpretation/siLanguage.js +1 -1
  19. package/dist/locus-info/index.js +14 -3
  20. package/dist/locus-info/index.js.map +1 -1
  21. package/dist/locus-info/selfUtils.js +35 -17
  22. package/dist/locus-info/selfUtils.js.map +1 -1
  23. package/dist/media/MediaConnectionAwaiter.js +1 -0
  24. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  25. package/dist/media/properties.js +30 -16
  26. package/dist/media/properties.js.map +1 -1
  27. package/dist/meeting/brbState.js +167 -0
  28. package/dist/meeting/brbState.js.map +1 -0
  29. package/dist/meeting/in-meeting-actions.js +13 -1
  30. package/dist/meeting/in-meeting-actions.js.map +1 -1
  31. package/dist/meeting/index.js +1335 -1052
  32. package/dist/meeting/index.js.map +1 -1
  33. package/dist/meeting/locusMediaRequest.js +11 -6
  34. package/dist/meeting/locusMediaRequest.js.map +1 -1
  35. package/dist/meeting/muteState.js +1 -6
  36. package/dist/meeting/muteState.js.map +1 -1
  37. package/dist/meeting/request.js +51 -29
  38. package/dist/meeting/request.js.map +1 -1
  39. package/dist/meeting/request.type.js.map +1 -1
  40. package/dist/meeting/util.js +103 -67
  41. package/dist/meeting/util.js.map +1 -1
  42. package/dist/meeting-info/meeting-info-v2.js +115 -45
  43. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  44. package/dist/meeting-info/utilv2.js +6 -2
  45. package/dist/meeting-info/utilv2.js.map +1 -1
  46. package/dist/meetings/index.js +107 -55
  47. package/dist/meetings/index.js.map +1 -1
  48. package/dist/meetings/meetings.types.js +2 -0
  49. package/dist/meetings/meetings.types.js.map +1 -1
  50. package/dist/meetings/util.js +1 -1
  51. package/dist/meetings/util.js.map +1 -1
  52. package/dist/member/index.js +9 -0
  53. package/dist/member/index.js.map +1 -1
  54. package/dist/member/types.js.map +1 -1
  55. package/dist/member/util.js +39 -28
  56. package/dist/member/util.js.map +1 -1
  57. package/dist/members/util.js +4 -2
  58. package/dist/members/util.js.map +1 -1
  59. package/dist/metrics/constants.js +6 -1
  60. package/dist/metrics/constants.js.map +1 -1
  61. package/dist/multistream/remoteMedia.js +30 -15
  62. package/dist/multistream/remoteMedia.js.map +1 -1
  63. package/dist/multistream/sendSlotManager.js +24 -0
  64. package/dist/multistream/sendSlotManager.js.map +1 -1
  65. package/dist/reachability/clusterReachability.js +12 -15
  66. package/dist/reachability/clusterReachability.js.map +1 -1
  67. package/dist/reachability/index.js +461 -136
  68. package/dist/reachability/index.js.map +1 -1
  69. package/dist/{rtcMetrics/constants.js → reachability/reachability.types.js} +1 -5
  70. package/dist/reachability/reachability.types.js.map +1 -0
  71. package/dist/reachability/request.js +21 -8
  72. package/dist/reachability/request.js.map +1 -1
  73. package/dist/recording-controller/enums.js +8 -4
  74. package/dist/recording-controller/enums.js.map +1 -1
  75. package/dist/recording-controller/index.js +18 -9
  76. package/dist/recording-controller/index.js.map +1 -1
  77. package/dist/recording-controller/util.js +13 -9
  78. package/dist/recording-controller/util.js.map +1 -1
  79. package/dist/roap/index.js +15 -15
  80. package/dist/roap/index.js.map +1 -1
  81. package/dist/roap/request.js +45 -79
  82. package/dist/roap/request.js.map +1 -1
  83. package/dist/roap/turnDiscovery.js +3 -6
  84. package/dist/roap/turnDiscovery.js.map +1 -1
  85. package/dist/types/annotation/index.d.ts +5 -0
  86. package/dist/types/common/errors/join-forbidden-error.d.ts +15 -0
  87. package/dist/types/common/errors/{webinar-registration-error.d.ts → join-webinar-error.d.ts} +2 -2
  88. package/dist/types/common/errors/multistream-not-supported-error.d.ts +17 -0
  89. package/dist/types/config.d.ts +1 -0
  90. package/dist/types/constants.d.ts +53 -1
  91. package/dist/types/index.d.ts +3 -3
  92. package/dist/types/locus-info/index.d.ts +2 -1
  93. package/dist/types/meeting/brbState.d.ts +54 -0
  94. package/dist/types/meeting/in-meeting-actions.d.ts +12 -0
  95. package/dist/types/meeting/index.d.ts +64 -14
  96. package/dist/types/meeting/locusMediaRequest.d.ts +6 -3
  97. package/dist/types/meeting/request.d.ts +14 -3
  98. package/dist/types/meeting/request.type.d.ts +6 -0
  99. package/dist/types/meeting/util.d.ts +3 -3
  100. package/dist/types/meeting-info/meeting-info-v2.d.ts +30 -5
  101. package/dist/types/meetings/index.d.ts +20 -2
  102. package/dist/types/meetings/meetings.types.d.ts +8 -0
  103. package/dist/types/member/index.d.ts +1 -0
  104. package/dist/types/member/types.d.ts +7 -0
  105. package/dist/types/members/util.d.ts +2 -0
  106. package/dist/types/metrics/constants.d.ts +6 -1
  107. package/dist/types/multistream/sendSlotManager.d.ts +8 -1
  108. package/dist/types/reachability/clusterReachability.d.ts +1 -10
  109. package/dist/types/reachability/index.d.ts +83 -36
  110. package/dist/types/reachability/reachability.types.d.ts +64 -0
  111. package/dist/types/reachability/request.d.ts +5 -1
  112. package/dist/types/recording-controller/enums.d.ts +5 -2
  113. package/dist/types/recording-controller/index.d.ts +1 -0
  114. package/dist/types/recording-controller/util.d.ts +2 -1
  115. package/dist/types/roap/request.d.ts +1 -13
  116. package/dist/webinar/index.js +390 -7
  117. package/dist/webinar/index.js.map +1 -1
  118. package/package.json +23 -22
  119. package/src/annotation/index.ts +16 -0
  120. package/src/common/errors/join-forbidden-error.ts +26 -0
  121. package/src/common/errors/join-webinar-error.ts +24 -0
  122. package/src/common/errors/multistream-not-supported-error.ts +30 -0
  123. package/src/config.ts +1 -0
  124. package/src/constants.ts +61 -3
  125. package/src/index.ts +5 -3
  126. package/src/locus-info/index.ts +20 -3
  127. package/src/locus-info/selfUtils.ts +24 -6
  128. package/src/media/MediaConnectionAwaiter.ts +2 -0
  129. package/src/media/properties.ts +34 -13
  130. package/src/meeting/brbState.ts +169 -0
  131. package/src/meeting/in-meeting-actions.ts +25 -0
  132. package/src/meeting/index.ts +451 -88
  133. package/src/meeting/locusMediaRequest.ts +11 -8
  134. package/src/meeting/muteState.ts +1 -6
  135. package/src/meeting/request.ts +30 -12
  136. package/src/meeting/request.type.ts +7 -0
  137. package/src/meeting/util.ts +32 -13
  138. package/src/meeting-info/meeting-info-v2.ts +83 -12
  139. package/src/meeting-info/utilv2.ts +17 -3
  140. package/src/meetings/index.ts +79 -20
  141. package/src/meetings/meetings.types.ts +10 -0
  142. package/src/meetings/util.ts +2 -1
  143. package/src/member/index.ts +9 -0
  144. package/src/member/types.ts +8 -0
  145. package/src/member/util.ts +34 -24
  146. package/src/members/util.ts +1 -0
  147. package/src/metrics/constants.ts +6 -1
  148. package/src/multistream/remoteMedia.ts +28 -15
  149. package/src/multistream/sendSlotManager.ts +31 -0
  150. package/src/reachability/clusterReachability.ts +5 -15
  151. package/src/reachability/index.ts +311 -75
  152. package/src/reachability/reachability.types.ts +85 -0
  153. package/src/reachability/request.ts +55 -31
  154. package/src/recording-controller/enums.ts +5 -2
  155. package/src/recording-controller/index.ts +17 -4
  156. package/src/recording-controller/util.ts +20 -5
  157. package/src/roap/index.ts +14 -13
  158. package/src/roap/request.ts +30 -44
  159. package/src/roap/turnDiscovery.ts +2 -4
  160. package/src/webinar/index.ts +235 -9
  161. package/test/unit/spec/annotation/index.ts +46 -1
  162. package/test/unit/spec/locus-info/index.js +292 -60
  163. package/test/unit/spec/locus-info/selfConstant.js +7 -0
  164. package/test/unit/spec/locus-info/selfUtils.js +101 -1
  165. package/test/unit/spec/media/properties.ts +15 -0
  166. package/test/unit/spec/meeting/brbState.ts +114 -0
  167. package/test/unit/spec/meeting/in-meeting-actions.ts +15 -1
  168. package/test/unit/spec/meeting/index.js +860 -110
  169. package/test/unit/spec/meeting/locusMediaRequest.ts +18 -11
  170. package/test/unit/spec/meeting/muteState.js +0 -24
  171. package/test/unit/spec/meeting/request.js +3 -26
  172. package/test/unit/spec/meeting/utils.js +73 -28
  173. package/test/unit/spec/meeting-info/meetinginfov2.js +46 -4
  174. package/test/unit/spec/meeting-info/utilv2.js +26 -0
  175. package/test/unit/spec/meetings/index.js +159 -18
  176. package/test/unit/spec/meetings/utils.js +10 -0
  177. package/test/unit/spec/member/util.js +52 -11
  178. package/test/unit/spec/members/utils.js +95 -0
  179. package/test/unit/spec/multistream/remoteMedia.ts +11 -7
  180. package/test/unit/spec/reachability/clusterReachability.ts +7 -0
  181. package/test/unit/spec/reachability/index.ts +383 -9
  182. package/test/unit/spec/reachability/request.js +48 -12
  183. package/test/unit/spec/recording-controller/index.js +61 -5
  184. package/test/unit/spec/recording-controller/util.js +39 -3
  185. package/test/unit/spec/roap/index.ts +48 -1
  186. package/test/unit/spec/roap/request.ts +51 -109
  187. package/test/unit/spec/roap/turnDiscovery.ts +202 -147
  188. package/test/unit/spec/webinar/index.ts +509 -0
  189. package/dist/common/errors/webinar-registration-error.js.map +0 -1
  190. package/dist/networkQualityMonitor/index.js +0 -227
  191. package/dist/networkQualityMonitor/index.js.map +0 -1
  192. package/dist/rtcMetrics/constants.js.map +0 -1
  193. package/dist/rtcMetrics/index.js +0 -197
  194. package/dist/rtcMetrics/index.js.map +0 -1
  195. package/dist/types/networkQualityMonitor/index.d.ts +0 -70
  196. package/dist/types/rtcMetrics/constants.d.ts +0 -4
  197. package/dist/types/rtcMetrics/index.d.ts +0 -71
  198. package/src/common/errors/webinar-registration-error.ts +0 -27
@@ -1,227 +0,0 @@
1
- "use strict";
2
-
3
- var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
5
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
- _Object$defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.default = void 0;
10
- var _freeze = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/freeze"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
13
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
15
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
16
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
17
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
- var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
19
- var _constants = require("../constants");
20
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
- /**
23
- * Meeting - network quality event
24
- * Emitted on each interval of retrieving stats Analyzer data
25
- * @event network:quality
26
- * @type {Object}
27
- * @property {string} mediaType {video|audio}
28
- * @property {number} networkQualityScore - value determined in determineUplinkNetworkQuality
29
- * @memberof NetworkQualityMonitor
30
- */
31
- /**
32
- * NetworkQualityMonitor class that will emit events based on detected quality
33
- *
34
- * @class NetworkQualityMonitor
35
- * @extends {EventsScope}
36
- */
37
- var NetworkQualityMonitor = exports.default = /*#__PURE__*/function (_EventsScope) {
38
- (0, _inherits2.default)(NetworkQualityMonitor, _EventsScope);
39
- var _super = _createSuper(NetworkQualityMonitor);
40
- /**
41
- * Creates a new instance of NetworkQualityMonitor
42
- * @constructor
43
- * @public
44
- * @param {Object} config
45
- * @property {Object} indicatorTypes - network properties used to evaluate network quality used as constants
46
- * @property {Object} frequencyTypes - frequency properties used as constants {uplink|send} {downlink|receive}
47
- * @property {number} networkQualityScore - 0|1 1 is acceptable 0 is bad/unknown
48
- * @property {Object} networkQualityStatus - hash object based on indicatorTypes and frequencyTypes
49
- * @property {string} mediaType - audio|video
50
- */
51
- function NetworkQualityMonitor(config) {
52
- var _this;
53
- (0, _classCallCheck2.default)(this, NetworkQualityMonitor);
54
- _this = _super.call(this);
55
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "config", void 0);
56
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "frequencyTypes", void 0);
57
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "indicatorTypes", void 0);
58
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaType", void 0);
59
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkQualityScore", void 0);
60
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "networkQualityStatus", void 0);
61
- _this.config = config;
62
- _this.indicatorTypes = (0, _freeze.default)({
63
- PACKETLOSS: 'packetLoss',
64
- LATENCY: 'latency',
65
- JITTER: 'jitter'
66
- });
67
- _this.frequencyTypes = (0, _freeze.default)({
68
- UPLINK: 'uplink',
69
- DOWNLINK: 'downlink'
70
- });
71
- _this.networkQualityScore = 1;
72
- _this.networkQualityStatus = (0, _defineProperty2.default)({}, _this.frequencyTypes.UPLINK, {});
73
- _this.mediaType = null;
74
- return _this;
75
- }
76
-
77
- /**
78
- * emits NETWORK_QUALITY event on meeting with payload of media type and uplinkNetworkQuality score
79
- *
80
- * @memberof NetworkQualityMonitor
81
- * @returns {void}
82
- */
83
- (0, _createClass2.default)(NetworkQualityMonitor, [{
84
- key: "emitNetworkQuality",
85
- value: function emitNetworkQuality() {
86
- this.emit({
87
- file: 'networkQualityMonitor',
88
- function: 'emitNetworkQuality'
89
- }, _constants.EVENT_TRIGGERS.NETWORK_QUALITY, {
90
- mediaType: this.mediaType,
91
- networkQualityScore: this.networkQualityScore
92
- });
93
- }
94
-
95
- /**
96
- * invokes emitNetworkQuality method resets values back to default
97
- * @returns {void}
98
- * @memberof NetworkQualityMonitor
99
- */
100
- }, {
101
- key: "updateNetworkQualityStatus",
102
- value: function updateNetworkQualityStatus() {
103
- this.emitNetworkQuality();
104
-
105
- // reset values
106
- this.networkQualityScore = 1;
107
- this.mediaType = null;
108
- }
109
-
110
- /**
111
- * filter data to determine uplink network quality, invoked on same interval as stats analyzer remote-inbout-rtp
112
- * @param {Object} configObj
113
- * @param {string} configObj.mediaType {audio|video}
114
- * @param {RTCStats} configObj.remoteRtpResults RTC stats remote obj
115
- * @param {Object} configObj.statsAnalyzerCurrentStats statsResults
116
- * @returns {void}
117
- * @public
118
- * @memberof NetworkQualityMonitor
119
- */
120
- }, {
121
- key: "determineUplinkNetworkQuality",
122
- value: function determineUplinkNetworkQuality(_ref) {
123
- var _this2 = this;
124
- var mediaType = _ref.mediaType,
125
- remoteRtpResults = _ref.remoteRtpResults,
126
- statsAnalyzerCurrentStats = _ref.statsAnalyzerCurrentStats;
127
- var roundTripTimeInMilliseconds = remoteRtpResults.roundTripTime * 1000;
128
- var jitterInMilliseconds = remoteRtpResults.jitter * 1000;
129
- var currentPacketLossRatio = statsAnalyzerCurrentStats[mediaType].send.currentPacketLossRatio;
130
- this.mediaType = mediaType;
131
- var _this$indicatorTypes = this.indicatorTypes,
132
- JITTER = _this$indicatorTypes.JITTER,
133
- PACKETLOSS = _this$indicatorTypes.PACKETLOSS,
134
- LATENCY = _this$indicatorTypes.LATENCY;
135
- var UPLINK = this.frequencyTypes.UPLINK;
136
-
137
- /**
138
- * determines if packetLoss ratio is over threshold set in config
139
- * sets networkQualityScore to 0 if over threshold
140
- * @returns {boolean}
141
- */
142
- var determinePacketLoss = function determinePacketLoss() {
143
- if (currentPacketLossRatio > _this2.config.videoPacketLossRatioThreshold) {
144
- _this2.networkQualityScore = 0;
145
- return false;
146
- }
147
- return true;
148
- };
149
-
150
- /**
151
- * determines if round trip time value is over threshold set in config
152
- * sets networkQualityScore to 0 if over threshold
153
- * @returns {boolean}
154
- */
155
- var determineLatency = function determineLatency() {
156
- if (roundTripTimeInMilliseconds > _this2.config.rttThreshold) {
157
- _this2.networkQualityScore = 0;
158
- return false;
159
- }
160
- return true;
161
- };
162
-
163
- /**
164
- * determines if jitter value is over threshold in config
165
- * sets networkQualityScore to 0 if over threshold
166
- * @returns {boolean}
167
- */
168
- var deterMineJitter = function deterMineJitter() {
169
- if (jitterInMilliseconds > _this2.config.jitterThreshold) {
170
- _this2.networkQualityScore = 0;
171
- return false;
172
- }
173
- return true;
174
- };
175
-
176
- /**
177
- * returns null if val is specifically undefined
178
- * @param {(number|undefined)} value
179
- * @returns {(number|null)}
180
- */
181
- var determineIfUndefined = function determineIfUndefined(value) {
182
- return typeof value === 'undefined' ? null : value;
183
- };
184
- if (!this.networkQualityStatus[UPLINK][mediaType]) {
185
- this.networkQualityStatus[UPLINK][mediaType] = {};
186
- }
187
-
188
- /**
189
- * Values for some browsers specifically Safari will be undefined we explicitly set to null
190
- * https://bugs.webkit.org/show_bug.cgi?id=206645
191
- * https://bugs.webkit.org/show_bug.cgi?id=212668
192
- */
193
- // PACKET LOSS
194
- this.networkQualityStatus[UPLINK][mediaType][PACKETLOSS] = {
195
- acceptable: determinePacketLoss(),
196
- value: determineIfUndefined(currentPacketLossRatio)
197
- };
198
-
199
- // LATENCY measured in Round trip time
200
- this.networkQualityStatus[UPLINK][mediaType][LATENCY] = {
201
- acceptable: determineLatency(),
202
- value: determineIfUndefined(remoteRtpResults.roundTripTime)
203
- };
204
-
205
- // JITTER
206
- this.networkQualityStatus[UPLINK][mediaType][JITTER] = {
207
- acceptable: deterMineJitter(),
208
- value: determineIfUndefined(remoteRtpResults.jitter)
209
- };
210
- this.updateNetworkQualityStatus();
211
- }
212
-
213
- /**
214
- * Get the current status of network quaility object - networkQualityStatus
215
- * @returns {Object}
216
- * @public
217
- */
218
- }, {
219
- key: "networkQualityStats",
220
- get: function get() {
221
- var UPLINK = this.frequencyTypes.UPLINK;
222
- return this.networkQualityStatus[UPLINK];
223
- }
224
- }]);
225
- return NetworkQualityMonitor;
226
- }(_eventsScope.default);
227
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_eventsScope","_interopRequireDefault","require","_constants","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","NetworkQualityMonitor","exports","_EventsScope","_inherits2","_super","config","_this","_classCallCheck2","_defineProperty2","_assertThisInitialized2","indicatorTypes","_freeze","PACKETLOSS","LATENCY","JITTER","frequencyTypes","UPLINK","DOWNLINK","networkQualityScore","networkQualityStatus","mediaType","_createClass2","key","value","emitNetworkQuality","emit","file","function","EVENT_TRIGGERS","NETWORK_QUALITY","updateNetworkQualityStatus","determineUplinkNetworkQuality","_ref","_this2","remoteRtpResults","statsAnalyzerCurrentStats","roundTripTimeInMilliseconds","roundTripTime","jitterInMilliseconds","jitter","currentPacketLossRatio","send","_this$indicatorTypes","determinePacketLoss","videoPacketLossRatioThreshold","determineLatency","rttThreshold","deterMineJitter","jitterThreshold","determineIfUndefined","acceptable","get","EventsScope"],"sources":["index.ts"],"sourcesContent":["import EventsScope from '../common/events/events-scope';\nimport {EVENT_TRIGGERS} from '../constants';\n\n/**\n * Meeting - network quality event\n * Emitted on each interval of retrieving stats Analyzer data\n * @event network:quality\n * @type {Object}\n * @property {string} mediaType {video|audio}\n * @property {number} networkQualityScore - value determined in determineUplinkNetworkQuality\n * @memberof NetworkQualityMonitor\n */\n/**\n * NetworkQualityMonitor class that will emit events based on detected quality\n *\n * @class NetworkQualityMonitor\n * @extends {EventsScope}\n */\nexport default class NetworkQualityMonitor extends EventsScope {\n config: any;\n frequencyTypes: any;\n indicatorTypes: any;\n mediaType: any;\n networkQualityScore: any;\n networkQualityStatus: any;\n\n /**\n * Creates a new instance of NetworkQualityMonitor\n * @constructor\n * @public\n * @param {Object} config\n * @property {Object} indicatorTypes - network properties used to evaluate network quality used as constants\n * @property {Object} frequencyTypes - frequency properties used as constants {uplink|send} {downlink|receive}\n * @property {number} networkQualityScore - 0|1 1 is acceptable 0 is bad/unknown\n * @property {Object} networkQualityStatus - hash object based on indicatorTypes and frequencyTypes\n * @property {string} mediaType - audio|video\n */\n constructor(config: any) {\n super();\n this.config = config;\n this.indicatorTypes = Object.freeze({\n PACKETLOSS: 'packetLoss',\n LATENCY: 'latency',\n JITTER: 'jitter',\n });\n this.frequencyTypes = Object.freeze({\n UPLINK: 'uplink',\n DOWNLINK: 'downlink',\n });\n this.networkQualityScore = 1;\n this.networkQualityStatus = {\n [this.frequencyTypes.UPLINK]: {},\n };\n this.mediaType = null;\n }\n\n /**\n * emits NETWORK_QUALITY event on meeting with payload of media type and uplinkNetworkQuality score\n *\n * @memberof NetworkQualityMonitor\n * @returns {void}\n */\n emitNetworkQuality() {\n this.emit(\n {\n file: 'networkQualityMonitor',\n function: 'emitNetworkQuality',\n },\n EVENT_TRIGGERS.NETWORK_QUALITY,\n {\n mediaType: this.mediaType,\n networkQualityScore: this.networkQualityScore,\n }\n );\n }\n\n /**\n * invokes emitNetworkQuality method resets values back to default\n * @returns {void}\n * @memberof NetworkQualityMonitor\n */\n updateNetworkQualityStatus() {\n this.emitNetworkQuality();\n\n // reset values\n this.networkQualityScore = 1;\n this.mediaType = null;\n }\n\n /**\n * filter data to determine uplink network quality, invoked on same interval as stats analyzer remote-inbout-rtp\n * @param {Object} configObj\n * @param {string} configObj.mediaType {audio|video}\n * @param {RTCStats} configObj.remoteRtpResults RTC stats remote obj\n * @param {Object} configObj.statsAnalyzerCurrentStats statsResults\n * @returns {void}\n * @public\n * @memberof NetworkQualityMonitor\n */\n public determineUplinkNetworkQuality({\n mediaType,\n remoteRtpResults,\n statsAnalyzerCurrentStats,\n }: {\n mediaType: string;\n remoteRtpResults: any;\n statsAnalyzerCurrentStats: object;\n }) {\n const roundTripTimeInMilliseconds = remoteRtpResults.roundTripTime * 1000;\n const jitterInMilliseconds = remoteRtpResults.jitter * 1000;\n const {currentPacketLossRatio} = statsAnalyzerCurrentStats[mediaType].send;\n\n this.mediaType = mediaType;\n\n const {JITTER, PACKETLOSS, LATENCY} = this.indicatorTypes;\n const {UPLINK} = this.frequencyTypes;\n\n /**\n * determines if packetLoss ratio is over threshold set in config\n * sets networkQualityScore to 0 if over threshold\n * @returns {boolean}\n */\n const determinePacketLoss = () => {\n if (currentPacketLossRatio > this.config.videoPacketLossRatioThreshold) {\n this.networkQualityScore = 0;\n\n return false;\n }\n\n return true;\n };\n\n /**\n * determines if round trip time value is over threshold set in config\n * sets networkQualityScore to 0 if over threshold\n * @returns {boolean}\n */\n const determineLatency = () => {\n if (roundTripTimeInMilliseconds > this.config.rttThreshold) {\n this.networkQualityScore = 0;\n\n return false;\n }\n\n return true;\n };\n\n /**\n * determines if jitter value is over threshold in config\n * sets networkQualityScore to 0 if over threshold\n * @returns {boolean}\n */\n const deterMineJitter = () => {\n if (jitterInMilliseconds > this.config.jitterThreshold) {\n this.networkQualityScore = 0;\n\n return false;\n }\n\n return true;\n };\n\n /**\n * returns null if val is specifically undefined\n * @param {(number|undefined)} value\n * @returns {(number|null)}\n */\n const determineIfUndefined = (value: number | undefined) =>\n typeof value === 'undefined' ? null : value;\n\n if (!this.networkQualityStatus[UPLINK][mediaType]) {\n this.networkQualityStatus[UPLINK][mediaType] = {};\n }\n\n /**\n * Values for some browsers specifically Safari will be undefined we explicitly set to null\n * https://bugs.webkit.org/show_bug.cgi?id=206645\n * https://bugs.webkit.org/show_bug.cgi?id=212668\n */\n // PACKET LOSS\n this.networkQualityStatus[UPLINK][mediaType][PACKETLOSS] = {\n acceptable: determinePacketLoss(),\n value: determineIfUndefined(currentPacketLossRatio),\n };\n\n // LATENCY measured in Round trip time\n this.networkQualityStatus[UPLINK][mediaType][LATENCY] = {\n acceptable: determineLatency(),\n value: determineIfUndefined(remoteRtpResults.roundTripTime),\n };\n\n // JITTER\n this.networkQualityStatus[UPLINK][mediaType][JITTER] = {\n acceptable: deterMineJitter(),\n value: determineIfUndefined(remoteRtpResults.jitter),\n };\n\n this.updateNetworkQualityStatus();\n }\n\n /**\n * Get the current status of network quaility object - networkQualityStatus\n * @returns {Object}\n * @public\n */\n get networkQualityStats() {\n const {UPLINK} = this.frequencyTypes;\n\n return this.networkQualityStatus[UPLINK];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAA4C,SAAAE,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAA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A0B;MACxB,IAAOnC,MAAM,GAAI,IAAI,CAACD,cAAc,CAA7BC,MAAM;MAEb,OAAO,IAAI,CAACG,oBAAoB,CAACH,MAAM,CAAC;IAC1C;EAAC;EAAA,OAAAhB,qBAAA;AAAA,EA/LgDoD,oBAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["RTC_METRICS","exports","default","APP_ID"],"sources":["constants.ts"],"sourcesContent":["const RTC_METRICS = {APP_ID: 'FFB51ED5-4319-4C55-8303-B1F2FCCDE231'};\n\nexport {RTC_METRICS as default};\n"],"mappings":";;;;;;;AAAA,IAAMA,WAAW,GAAAC,OAAA,CAAAC,OAAA,GAAG;EAACC,MAAM,EAAE;AAAsC,CAAC"}
@@ -1,197 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
5
- _Object$defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
13
- var _internalPluginMetrics = require("@webex/internal-plugin-metrics");
14
- var _uuid = _interopRequireDefault(require("uuid"));
15
- var _constants = _interopRequireDefault(require("./constants"));
16
- /* eslint-disable class-methods-use-this */
17
-
18
- var parseJsonPayload = function parseJsonPayload(payload) {
19
- try {
20
- if (payload && payload[0]) {
21
- return JSON.parse(payload[0]);
22
- }
23
- return null;
24
- } catch (_) {
25
- return null;
26
- }
27
- };
28
-
29
- /**
30
- * Rtc Metrics
31
- */
32
- var RtcMetrics = exports.default = /*#__PURE__*/function () {
33
- /**
34
- * Initialize the interval.
35
- *
36
- * @param {object} webex - The main `webex` object.
37
- * @param {string} meetingId - The meeting id.
38
- * @param {string} correlationId - The correlation id.
39
- */
40
- function RtcMetrics(webex, meetingId, correlationId) {
41
- (0, _classCallCheck2.default)(this, RtcMetrics);
42
- /**
43
- * Array of MetricData items to be sent to the metrics service.
44
- */
45
- (0, _defineProperty2.default)(this, "metricsQueue", []);
46
- (0, _defineProperty2.default)(this, "intervalId", void 0);
47
- (0, _defineProperty2.default)(this, "webex", void 0);
48
- (0, _defineProperty2.default)(this, "meetingId", void 0);
49
- (0, _defineProperty2.default)(this, "correlationId", void 0);
50
- (0, _defineProperty2.default)(this, "connectionId", void 0);
51
- (0, _defineProperty2.default)(this, "shouldSendMetricsOnNextStatsReport", void 0);
52
- // `window` is used to prevent typescript from returning a NodeJS.Timer.
53
- this.intervalId = window.setInterval(this.sendMetricsInQueue.bind(this), 30 * 1000);
54
- this.meetingId = meetingId;
55
- this.webex = webex;
56
- this.correlationId = correlationId;
57
- this.resetConnection();
58
- }
59
-
60
- /**
61
- * Check to see if the metrics queue has any items.
62
- *
63
- * @returns {void}
64
- */
65
- (0, _createClass2.default)(RtcMetrics, [{
66
- key: "sendMetricsInQueue",
67
- value: function sendMetricsInQueue() {
68
- if (this.metricsQueue.length) {
69
- this.sendMetrics();
70
- this.metricsQueue = [];
71
- }
72
- }
73
-
74
- /**
75
- * Forces sending metrics when we get the next stats-report
76
- *
77
- * This is useful for cases when something important happens that affects the media connection,
78
- * for example when we move from lobby into the meeting.
79
- *
80
- * @returns {void}
81
- */
82
- }, {
83
- key: "sendNextMetrics",
84
- value: function sendNextMetrics() {
85
- this.shouldSendMetricsOnNextStatsReport = true;
86
- }
87
-
88
- /**
89
- * Add metrics items to the metrics queue.
90
- *
91
- * @param {object} data - An object with a payload array of metrics items.
92
- *
93
- * @returns {void}
94
- */
95
- }, {
96
- key: "addMetrics",
97
- value: function addMetrics(data) {
98
- if (data.payload.length) {
99
- if (data.name === 'stats-report') {
100
- data.payload = data.payload.map(this.anonymizeIp);
101
- }
102
- this.metricsQueue.push(data);
103
- if (this.shouldSendMetricsOnNextStatsReport && data.name === 'stats-report') {
104
- // this is the first useful set of data (WCME gives it to us after 5s), send it out immediately
105
- // in case the user is unhappy and closes the browser early
106
- this.sendMetricsInQueue();
107
- this.shouldSendMetricsOnNextStatsReport = false;
108
- }
109
- try {
110
- // If a connection fails, send the rest of the metrics in queue and get a new connection id.
111
- var parsedPayload = parseJsonPayload(data.payload);
112
- if (data.name === 'onconnectionstatechange' && parsedPayload && parsedPayload.value === 'failed') {
113
- this.sendMetricsInQueue();
114
- this.resetConnection();
115
- }
116
- } catch (e) {
117
- console.error(e);
118
- }
119
- }
120
- }
121
-
122
- /**
123
- * Clear the metrics interval.
124
- *
125
- * @returns {void}
126
- */
127
- }, {
128
- key: "closeMetrics",
129
- value: function closeMetrics() {
130
- this.sendMetricsInQueue();
131
- clearInterval(this.intervalId);
132
- }
133
-
134
- /**
135
- * Anonymize IP addresses.
136
- *
137
- * @param {array} stats - An RTCStatsReport organized into an array of strings.
138
- * @returns {string}
139
- */
140
- }, {
141
- key: "anonymizeIp",
142
- value: function anonymizeIp(stats) {
143
- var data = JSON.parse(stats);
144
- // on local and remote candidates, anonymize the last 4 bits.
145
- if (data.type === 'local-candidate' || data.type === 'remote-candidate') {
146
- data.ip = _internalPluginMetrics.CallDiagnosticUtils.anonymizeIPAddress(data.ip) || undefined;
147
- data.address = _internalPluginMetrics.CallDiagnosticUtils.anonymizeIPAddress(data.address) || undefined;
148
- data.relatedAddress = _internalPluginMetrics.CallDiagnosticUtils.anonymizeIPAddress(data.relatedAddress) || undefined;
149
- }
150
- return (0, _stringify.default)(data);
151
- }
152
-
153
- /**
154
- * Set a new connection id.
155
- *
156
- * @returns {void}
157
- */
158
- }, {
159
- key: "resetConnection",
160
- value: function resetConnection() {
161
- this.connectionId = _uuid.default.v4();
162
- this.shouldSendMetricsOnNextStatsReport = true;
163
- }
164
-
165
- /**
166
- * Send metrics to the metrics service.
167
- *
168
- * @returns {void}
169
- */
170
- }, {
171
- key: "sendMetrics",
172
- value: function sendMetrics() {
173
- this.webex.request({
174
- method: 'POST',
175
- service: 'unifiedTelemetry',
176
- resource: 'metric/v2',
177
- headers: {
178
- type: 'webrtcMedia',
179
- appId: _constants.default.APP_ID
180
- },
181
- body: {
182
- metrics: [{
183
- type: 'webrtc',
184
- version: '1.1.0',
185
- userId: this.webex.internal.device.userId,
186
- meetingId: this.meetingId,
187
- correlationId: this.correlationId,
188
- connectionId: this.connectionId,
189
- data: this.metricsQueue
190
- }]
191
- }
192
- });
193
- }
194
- }]);
195
- return RtcMetrics;
196
- }();
197
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_internalPluginMetrics","require","_uuid","_interopRequireDefault","_constants","parseJsonPayload","payload","JSON","parse","_","RtcMetrics","exports","default","webex","meetingId","correlationId","_classCallCheck2","_defineProperty2","intervalId","window","setInterval","sendMetricsInQueue","bind","resetConnection","_createClass2","key","value","metricsQueue","length","sendMetrics","sendNextMetrics","shouldSendMetricsOnNextStatsReport","addMetrics","data","name","map","anonymizeIp","push","parsedPayload","e","console","error","closeMetrics","clearInterval","stats","type","ip","CallDiagnosticUtils","anonymizeIPAddress","undefined","address","relatedAddress","_stringify","connectionId","uuid","v4","request","method","service","resource","headers","appId","RTC_METRICS","APP_ID","body","metrics","version","userId","internal","device"],"sources":["index.ts"],"sourcesContent":["/* eslint-disable class-methods-use-this */\nimport {CallDiagnosticUtils} from '@webex/internal-plugin-metrics';\nimport uuid from 'uuid';\nimport RTC_METRICS from './constants';\n\nconst parseJsonPayload = (payload: any[]): any | null => {\n try {\n if (payload && payload[0]) {\n return JSON.parse(payload[0]);\n }\n\n return null;\n } catch (_) {\n return null;\n }\n};\n\n/**\n * Rtc Metrics\n */\nexport default class RtcMetrics {\n /**\n * Array of MetricData items to be sent to the metrics service.\n */\n metricsQueue = [];\n\n intervalId: number;\n\n webex: any;\n\n meetingId: string;\n\n correlationId: string;\n\n connectionId: string;\n\n shouldSendMetricsOnNextStatsReport: boolean;\n\n /**\n * Initialize the interval.\n *\n * @param {object} webex - The main `webex` object.\n * @param {string} meetingId - The meeting id.\n * @param {string} correlationId - The correlation id.\n */\n constructor(webex, meetingId, correlationId) {\n // `window` is used to prevent typescript from returning a NodeJS.Timer.\n this.intervalId = window.setInterval(this.sendMetricsInQueue.bind(this), 30 * 1000);\n this.meetingId = meetingId;\n this.webex = webex;\n this.correlationId = correlationId;\n this.resetConnection();\n }\n\n /**\n * Check to see if the metrics queue has any items.\n *\n * @returns {void}\n */\n public sendMetricsInQueue() {\n if (this.metricsQueue.length) {\n this.sendMetrics();\n this.metricsQueue = [];\n }\n }\n\n /**\n * Forces sending metrics when we get the next stats-report\n *\n * This is useful for cases when something important happens that affects the media connection,\n * for example when we move from lobby into the meeting.\n *\n * @returns {void}\n */\n public sendNextMetrics() {\n this.shouldSendMetricsOnNextStatsReport = true;\n }\n\n /**\n * Add metrics items to the metrics queue.\n *\n * @param {object} data - An object with a payload array of metrics items.\n *\n * @returns {void}\n */\n addMetrics(data) {\n if (data.payload.length) {\n if (data.name === 'stats-report') {\n data.payload = data.payload.map(this.anonymizeIp);\n }\n\n this.metricsQueue.push(data);\n\n if (this.shouldSendMetricsOnNextStatsReport && data.name === 'stats-report') {\n // this is the first useful set of data (WCME gives it to us after 5s), send it out immediately\n // in case the user is unhappy and closes the browser early\n this.sendMetricsInQueue();\n this.shouldSendMetricsOnNextStatsReport = false;\n }\n\n try {\n // If a connection fails, send the rest of the metrics in queue and get a new connection id.\n const parsedPayload = parseJsonPayload(data.payload);\n if (\n data.name === 'onconnectionstatechange' &&\n parsedPayload &&\n parsedPayload.value === 'failed'\n ) {\n this.sendMetricsInQueue();\n this.resetConnection();\n }\n } catch (e) {\n console.error(e);\n }\n }\n }\n\n /**\n * Clear the metrics interval.\n *\n * @returns {void}\n */\n closeMetrics() {\n this.sendMetricsInQueue();\n clearInterval(this.intervalId);\n }\n\n /**\n * Anonymize IP addresses.\n *\n * @param {array} stats - An RTCStatsReport organized into an array of strings.\n * @returns {string}\n */\n anonymizeIp(stats: string): string {\n const data = JSON.parse(stats);\n // on local and remote candidates, anonymize the last 4 bits.\n if (data.type === 'local-candidate' || data.type === 'remote-candidate') {\n data.ip = CallDiagnosticUtils.anonymizeIPAddress(data.ip) || undefined;\n data.address = CallDiagnosticUtils.anonymizeIPAddress(data.address) || undefined;\n data.relatedAddress =\n CallDiagnosticUtils.anonymizeIPAddress(data.relatedAddress) || undefined;\n }\n\n return JSON.stringify(data);\n }\n\n /**\n * Set a new connection id.\n *\n * @returns {void}\n */\n private resetConnection() {\n this.connectionId = uuid.v4();\n this.shouldSendMetricsOnNextStatsReport = true;\n }\n\n /**\n * Send metrics to the metrics service.\n *\n * @returns {void}\n */\n private sendMetrics() {\n this.webex.request({\n method: 'POST',\n service: 'unifiedTelemetry',\n resource: 'metric/v2',\n headers: {\n type: 'webrtcMedia',\n appId: RTC_METRICS.APP_ID,\n },\n body: {\n metrics: [\n {\n type: 'webrtc',\n version: '1.1.0',\n userId: this.webex.internal.device.userId,\n meetingId: this.meetingId,\n correlationId: this.correlationId,\n connectionId: this.connectionId,\n data: this.metricsQueue,\n },\n ],\n },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AAHA;;AAKA,IAAMI,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,OAAc,EAAiB;EACvD,IAAI;IACF,IAAIA,OAAO,IAAIA,OAAO,CAAC,CAAC,CAAC,EAAE;MACzB,OAAOC,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/B;IAEA,OAAO,IAAI;EACb,CAAC,CAAC,OAAOG,CAAC,EAAE;IACV,OAAO,IAAI;EACb;AACF,CAAC;;AAED;A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ACN;UACb,CAAC;QAEL;MACF,CAAC,CAAC;IACJ;EAAC;EAAA,OAAAjB,UAAA;AAAA"}
@@ -1,70 +0,0 @@
1
- import EventsScope from '../common/events/events-scope';
2
- /**
3
- * Meeting - network quality event
4
- * Emitted on each interval of retrieving stats Analyzer data
5
- * @event network:quality
6
- * @type {Object}
7
- * @property {string} mediaType {video|audio}
8
- * @property {number} networkQualityScore - value determined in determineUplinkNetworkQuality
9
- * @memberof NetworkQualityMonitor
10
- */
11
- /**
12
- * NetworkQualityMonitor class that will emit events based on detected quality
13
- *
14
- * @class NetworkQualityMonitor
15
- * @extends {EventsScope}
16
- */
17
- export default class NetworkQualityMonitor extends EventsScope {
18
- config: any;
19
- frequencyTypes: any;
20
- indicatorTypes: any;
21
- mediaType: any;
22
- networkQualityScore: any;
23
- networkQualityStatus: any;
24
- /**
25
- * Creates a new instance of NetworkQualityMonitor
26
- * @constructor
27
- * @public
28
- * @param {Object} config
29
- * @property {Object} indicatorTypes - network properties used to evaluate network quality used as constants
30
- * @property {Object} frequencyTypes - frequency properties used as constants {uplink|send} {downlink|receive}
31
- * @property {number} networkQualityScore - 0|1 1 is acceptable 0 is bad/unknown
32
- * @property {Object} networkQualityStatus - hash object based on indicatorTypes and frequencyTypes
33
- * @property {string} mediaType - audio|video
34
- */
35
- constructor(config: any);
36
- /**
37
- * emits NETWORK_QUALITY event on meeting with payload of media type and uplinkNetworkQuality score
38
- *
39
- * @memberof NetworkQualityMonitor
40
- * @returns {void}
41
- */
42
- emitNetworkQuality(): void;
43
- /**
44
- * invokes emitNetworkQuality method resets values back to default
45
- * @returns {void}
46
- * @memberof NetworkQualityMonitor
47
- */
48
- updateNetworkQualityStatus(): void;
49
- /**
50
- * filter data to determine uplink network quality, invoked on same interval as stats analyzer remote-inbout-rtp
51
- * @param {Object} configObj
52
- * @param {string} configObj.mediaType {audio|video}
53
- * @param {RTCStats} configObj.remoteRtpResults RTC stats remote obj
54
- * @param {Object} configObj.statsAnalyzerCurrentStats statsResults
55
- * @returns {void}
56
- * @public
57
- * @memberof NetworkQualityMonitor
58
- */
59
- determineUplinkNetworkQuality({ mediaType, remoteRtpResults, statsAnalyzerCurrentStats, }: {
60
- mediaType: string;
61
- remoteRtpResults: any;
62
- statsAnalyzerCurrentStats: object;
63
- }): void;
64
- /**
65
- * Get the current status of network quaility object - networkQualityStatus
66
- * @returns {Object}
67
- * @public
68
- */
69
- get networkQualityStats(): any;
70
- }
@@ -1,4 +0,0 @@
1
- declare const RTC_METRICS: {
2
- APP_ID: string;
3
- };
4
- export { RTC_METRICS as default };
@@ -1,71 +0,0 @@
1
- /**
2
- * Rtc Metrics
3
- */
4
- export default class RtcMetrics {
5
- /**
6
- * Array of MetricData items to be sent to the metrics service.
7
- */
8
- metricsQueue: any[];
9
- intervalId: number;
10
- webex: any;
11
- meetingId: string;
12
- correlationId: string;
13
- connectionId: string;
14
- shouldSendMetricsOnNextStatsReport: boolean;
15
- /**
16
- * Initialize the interval.
17
- *
18
- * @param {object} webex - The main `webex` object.
19
- * @param {string} meetingId - The meeting id.
20
- * @param {string} correlationId - The correlation id.
21
- */
22
- constructor(webex: any, meetingId: any, correlationId: any);
23
- /**
24
- * Check to see if the metrics queue has any items.
25
- *
26
- * @returns {void}
27
- */
28
- sendMetricsInQueue(): void;
29
- /**
30
- * Forces sending metrics when we get the next stats-report
31
- *
32
- * This is useful for cases when something important happens that affects the media connection,
33
- * for example when we move from lobby into the meeting.
34
- *
35
- * @returns {void}
36
- */
37
- sendNextMetrics(): void;
38
- /**
39
- * Add metrics items to the metrics queue.
40
- *
41
- * @param {object} data - An object with a payload array of metrics items.
42
- *
43
- * @returns {void}
44
- */
45
- addMetrics(data: any): void;
46
- /**
47
- * Clear the metrics interval.
48
- *
49
- * @returns {void}
50
- */
51
- closeMetrics(): void;
52
- /**
53
- * Anonymize IP addresses.
54
- *
55
- * @param {array} stats - An RTCStatsReport organized into an array of strings.
56
- * @returns {string}
57
- */
58
- anonymizeIp(stats: string): string;
59
- /**
60
- * Set a new connection id.
61
- *
62
- * @returns {void}
63
- */
64
- private resetConnection;
65
- /**
66
- * Send metrics to the metrics service.
67
- *
68
- * @returns {void}
69
- */
70
- private sendMetrics;
71
- }
@@ -1,27 +0,0 @@
1
- import {ERROR_DICTIONARY} from '../../constants';
2
-
3
- /**
4
- * Error occurred while the webinar required registration
5
- */
6
- export default class WebinarRegistrationError extends Error {
7
- code: number;
8
- error: any;
9
- sdkMessage: string;
10
-
11
- /**
12
- * @constructor
13
- * @param {String} [message]
14
- * @param {Object} [error]
15
- */
16
- constructor(
17
- message: string = ERROR_DICTIONARY.WebinarRegistrationError.MESSAGE,
18
- error: any = null
19
- ) {
20
- super(message);
21
- this.name = ERROR_DICTIONARY.WebinarRegistrationError.NAME;
22
- this.sdkMessage = ERROR_DICTIONARY.WebinarRegistrationError.MESSAGE;
23
- this.error = error;
24
- this.stack = error ? error.stack : new Error().stack;
25
- this.code = ERROR_DICTIONARY.WebinarRegistrationError.CODE;
26
- }
27
- }