@webex/plugin-meetings 3.8.1 → 3.9.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.
- package/README.md +26 -13
- package/dist/breakouts/breakout.js +1 -1
- package/dist/breakouts/index.js +1 -1
- package/dist/constants.js +32 -3
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/enums.js +1 -0
- package/dist/controls-options-manager/enums.js.map +1 -1
- package/dist/controls-options-manager/types.js.map +1 -1
- package/dist/controls-options-manager/util.js +26 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/interpretation/index.js +1 -1
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +11 -3
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +69 -85
- package/dist/locus-info/index.js.map +1 -1
- package/dist/media/index.js +2 -2
- package/dist/media/index.js.map +1 -1
- package/dist/meeting/brbState.js +17 -14
- package/dist/meeting/brbState.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +11 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +476 -284
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/request.js +19 -0
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/{rtcMetrics/constants.js → meeting/type.js} +1 -5
- package/dist/meeting/type.js.map +1 -0
- package/dist/meeting/util.js +68 -2
- package/dist/meeting/util.js.map +1 -1
- package/dist/meetings/index.js +35 -33
- package/dist/meetings/index.js.map +1 -1
- package/dist/members/index.js +11 -9
- package/dist/members/index.js.map +1 -1
- package/dist/members/request.js +3 -3
- package/dist/members/request.js.map +1 -1
- package/dist/members/util.js +18 -6
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +1 -0
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/mediaRequestManager.js +1 -1
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/remoteMedia.js +34 -5
- package/dist/multistream/remoteMedia.js.map +1 -1
- package/dist/multistream/remoteMediaGroup.js +42 -2
- package/dist/multistream/remoteMediaGroup.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +32 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/index.js +5 -10
- package/dist/reachability/index.js.map +1 -1
- package/dist/types/constants.d.ts +28 -0
- package/dist/types/controls-options-manager/enums.d.ts +2 -1
- package/dist/types/controls-options-manager/types.d.ts +4 -1
- package/dist/types/locus-info/index.d.ts +0 -9
- package/dist/types/meeting/brbState.d.ts +0 -1
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +47 -19
- package/dist/types/meeting/request.d.ts +9 -1
- package/dist/types/meeting/request.type.d.ts +74 -0
- package/dist/types/meeting/type.d.ts +9 -0
- package/dist/types/meeting/util.d.ts +3 -0
- package/dist/types/members/index.d.ts +10 -7
- package/dist/types/members/request.d.ts +1 -1
- package/dist/types/members/util.d.ts +7 -3
- package/dist/types/metrics/constants.d.ts +1 -0
- package/dist/types/multistream/remoteMedia.d.ts +20 -1
- package/dist/types/multistream/remoteMediaGroup.d.ts +11 -0
- package/dist/types/multistream/sendSlotManager.d.ts +16 -0
- package/dist/types/reachability/index.d.ts +2 -2
- package/dist/webinar/index.js +1 -1
- package/package.json +24 -25
- package/src/constants.ts +32 -2
- package/src/controls-options-manager/enums.ts +1 -0
- package/src/controls-options-manager/types.ts +6 -1
- package/src/controls-options-manager/util.ts +31 -0
- package/src/locus-info/controlsUtils.ts +15 -0
- package/src/locus-info/index.ts +89 -86
- package/src/media/index.ts +2 -2
- package/src/meeting/brbState.ts +13 -9
- package/src/meeting/in-meeting-actions.ts +21 -0
- package/src/meeting/index.ts +271 -71
- package/src/meeting/request.ts +16 -0
- package/src/meeting/request.type.ts +64 -0
- package/src/meeting/type.ts +9 -0
- package/src/meeting/util.ts +73 -2
- package/src/meetings/index.ts +3 -2
- package/src/members/index.ts +13 -10
- package/src/members/request.ts +2 -2
- package/src/members/util.ts +16 -4
- package/src/metrics/constants.ts +1 -0
- package/src/multistream/mediaRequestManager.ts +7 -7
- package/src/multistream/remoteMedia.ts +34 -4
- package/src/multistream/remoteMediaGroup.ts +37 -2
- package/src/multistream/sendSlotManager.ts +34 -2
- package/src/reachability/index.ts +5 -13
- package/test/unit/spec/controls-options-manager/util.js +58 -0
- package/test/unit/spec/locus-info/controlsUtils.js +52 -0
- package/test/unit/spec/locus-info/index.js +240 -82
- package/test/unit/spec/media/index.ts +107 -0
- package/test/unit/spec/meeting/brbState.ts +23 -4
- package/test/unit/spec/meeting/in-meeting-actions.ts +10 -0
- package/test/unit/spec/meeting/index.js +954 -85
- package/test/unit/spec/meeting/request.js +71 -0
- package/test/unit/spec/meeting/utils.js +122 -1
- package/test/unit/spec/meetings/index.js +2 -0
- package/test/unit/spec/members/index.js +68 -9
- package/test/unit/spec/members/request.js +2 -2
- package/test/unit/spec/members/utils.js +27 -7
- package/test/unit/spec/multistream/mediaRequestManager.ts +19 -6
- package/test/unit/spec/multistream/remoteMedia.ts +66 -2
- package/test/unit/spec/multistream/sendSlotManager.ts +59 -0
- package/test/unit/spec/reachability/index.ts +2 -6
- package/dist/annotation/annotation.types.d.ts +0 -42
- package/dist/annotation/constants.d.ts +0 -31
- package/dist/annotation/index.d.ts +0 -117
- package/dist/breakouts/breakout.d.ts +0 -8
- package/dist/breakouts/collection.d.ts +0 -5
- package/dist/breakouts/edit-lock-error.d.ts +0 -15
- package/dist/breakouts/events.d.ts +0 -8
- package/dist/breakouts/index.d.ts +0 -5
- package/dist/breakouts/request.d.ts +0 -22
- package/dist/breakouts/utils.d.ts +0 -15
- package/dist/common/browser-detection.d.ts +0 -9
- package/dist/common/collection.d.ts +0 -48
- package/dist/common/config.d.ts +0 -2
- package/dist/common/errors/captcha-error.d.ts +0 -15
- package/dist/common/errors/intent-to-join.d.ts +0 -16
- package/dist/common/errors/join-meeting.d.ts +0 -17
- package/dist/common/errors/media.d.ts +0 -15
- package/dist/common/errors/no-meeting-info.d.ts +0 -14
- package/dist/common/errors/parameter.d.ts +0 -15
- package/dist/common/errors/password-error.d.ts +0 -15
- package/dist/common/errors/permission.d.ts +0 -14
- package/dist/common/errors/reclaim-host-role-error.d.ts +0 -60
- package/dist/common/errors/reclaim-host-role-error.js +0 -158
- package/dist/common/errors/reclaim-host-role-error.js.map +0 -1
- package/dist/common/errors/reclaim-host-role-errors.d.ts +0 -60
- package/dist/common/errors/reconnection-in-progress.d.ts +0 -9
- package/dist/common/errors/reconnection-in-progress.js +0 -35
- package/dist/common/errors/reconnection-in-progress.js.map +0 -1
- package/dist/common/errors/reconnection.d.ts +0 -15
- package/dist/common/errors/stats.d.ts +0 -15
- package/dist/common/errors/webex-errors.d.ts +0 -81
- package/dist/common/errors/webex-meetings-error.d.ts +0 -20
- package/dist/common/events/events-scope.d.ts +0 -17
- package/dist/common/events/events.d.ts +0 -12
- package/dist/common/events/trigger-proxy.d.ts +0 -2
- package/dist/common/events/util.d.ts +0 -2
- package/dist/common/logs/logger-config.d.ts +0 -2
- package/dist/common/logs/logger-proxy.d.ts +0 -2
- package/dist/common/logs/request.d.ts +0 -34
- package/dist/common/queue.d.ts +0 -32
- package/dist/config.d.ts +0 -73
- package/dist/constants.d.ts +0 -952
- package/dist/controls-options-manager/constants.d.ts +0 -4
- package/dist/controls-options-manager/enums.d.ts +0 -5
- package/dist/controls-options-manager/index.d.ts +0 -120
- package/dist/controls-options-manager/types.d.ts +0 -43
- package/dist/controls-options-manager/util.d.ts +0 -7
- package/dist/index.d.ts +0 -4
- package/dist/interceptors/index.d.ts +0 -2
- package/dist/interceptors/locusRetry.d.ts +0 -27
- package/dist/interpretation/collection.d.ts +0 -5
- package/dist/interpretation/index.d.ts +0 -5
- package/dist/interpretation/siLanguage.d.ts +0 -5
- package/dist/locus-info/controlsUtils.d.ts +0 -2
- package/dist/locus-info/embeddedAppsUtils.d.ts +0 -2
- package/dist/locus-info/fullState.d.ts +0 -2
- package/dist/locus-info/hostUtils.d.ts +0 -2
- package/dist/locus-info/index.d.ts +0 -269
- package/dist/locus-info/infoUtils.d.ts +0 -2
- package/dist/locus-info/mediaSharesUtils.d.ts +0 -2
- package/dist/locus-info/parser.d.ts +0 -212
- package/dist/locus-info/selfUtils.d.ts +0 -2
- package/dist/media/index.d.ts +0 -32
- package/dist/media/properties.d.ts +0 -108
- package/dist/media/util.d.ts +0 -2
- package/dist/mediaQualityMetrics/config.d.ts +0 -233
- package/dist/mediaQualityMetrics/config.js +0 -513
- package/dist/mediaQualityMetrics/config.js.map +0 -1
- package/dist/meeting/effectsState.d.ts +0 -42
- package/dist/meeting/effectsState.js +0 -260
- package/dist/meeting/effectsState.js.map +0 -1
- package/dist/meeting/in-meeting-actions.d.ts +0 -79
- package/dist/meeting/index.d.ts +0 -1622
- package/dist/meeting/locusMediaRequest.d.ts +0 -74
- package/dist/meeting/muteState.d.ts +0 -116
- package/dist/meeting/request.d.ts +0 -257
- package/dist/meeting/request.type.d.ts +0 -11
- package/dist/meeting/state.d.ts +0 -9
- package/dist/meeting/util.d.ts +0 -2
- package/dist/meeting/voicea-meeting.d.ts +0 -16
- package/dist/meeting-info/collection.d.ts +0 -20
- package/dist/meeting-info/index.d.ts +0 -57
- package/dist/meeting-info/meeting-info-v2.d.ts +0 -93
- package/dist/meeting-info/request.d.ts +0 -22
- package/dist/meeting-info/util.d.ts +0 -2
- package/dist/meeting-info/utilv2.d.ts +0 -2
- package/dist/meetings/collection.d.ts +0 -23
- package/dist/meetings/index.d.ts +0 -296
- package/dist/meetings/meetings.types.d.ts +0 -4
- package/dist/meetings/request.d.ts +0 -27
- package/dist/meetings/util.d.ts +0 -18
- package/dist/member/index.d.ts +0 -148
- package/dist/member/member.types.d.ts +0 -11
- package/dist/member/member.types.js +0 -18
- package/dist/member/member.types.js.map +0 -1
- package/dist/member/types.d.ts +0 -32
- package/dist/member/util.d.ts +0 -2
- package/dist/members/collection.d.ts +0 -24
- package/dist/members/index.d.ts +0 -308
- package/dist/members/request.d.ts +0 -58
- package/dist/members/types.d.ts +0 -25
- package/dist/members/util.d.ts +0 -2
- package/dist/metrics/config.d.ts +0 -169
- package/dist/metrics/config.js +0 -289
- package/dist/metrics/config.js.map +0 -1
- package/dist/metrics/constants.d.ts +0 -59
- package/dist/metrics/index.d.ts +0 -152
- package/dist/multistream/mediaRequestManager.d.ts +0 -119
- package/dist/multistream/receiveSlot.d.ts +0 -68
- package/dist/multistream/receiveSlotManager.d.ts +0 -56
- package/dist/multistream/remoteMedia.d.ts +0 -72
- package/dist/multistream/remoteMediaGroup.d.ts +0 -49
- package/dist/multistream/remoteMediaManager.d.ts +0 -300
- package/dist/multistream/sendSlotManager.d.ts +0 -69
- package/dist/networkQualityMonitor/index.d.ts +0 -70
- package/dist/networkQualityMonitor/index.js +0 -226
- package/dist/networkQualityMonitor/index.js.map +0 -1
- package/dist/peer-connection-manager/index.d.ts +0 -6
- package/dist/peer-connection-manager/index.js +0 -671
- package/dist/peer-connection-manager/index.js.map +0 -1
- package/dist/peer-connection-manager/util.d.ts +0 -6
- package/dist/peer-connection-manager/util.js +0 -110
- package/dist/peer-connection-manager/util.js.map +0 -1
- package/dist/personal-meeting-room/index.d.ts +0 -47
- package/dist/personal-meeting-room/request.d.ts +0 -14
- package/dist/personal-meeting-room/util.d.ts +0 -2
- package/dist/reachability/clusterReachability.d.ts +0 -109
- package/dist/reachability/index.d.ts +0 -139
- package/dist/reachability/request.d.ts +0 -35
- package/dist/reachability/util.d.ts +0 -8
- package/dist/reactions/constants.d.ts +0 -3
- package/dist/reactions/reactions.d.ts +0 -4
- package/dist/reactions/reactions.type.d.ts +0 -32
- package/dist/reconnection-manager/index.d.ts +0 -112
- package/dist/recording-controller/enums.d.ts +0 -7
- package/dist/recording-controller/index.d.ts +0 -193
- package/dist/recording-controller/util.d.ts +0 -13
- package/dist/roap/collection.d.ts +0 -10
- package/dist/roap/collection.js +0 -63
- package/dist/roap/collection.js.map +0 -1
- package/dist/roap/handler.d.ts +0 -47
- package/dist/roap/handler.js +0 -279
- package/dist/roap/handler.js.map +0 -1
- package/dist/roap/index.d.ts +0 -116
- package/dist/roap/request.d.ts +0 -35
- package/dist/roap/state.d.ts +0 -9
- package/dist/roap/state.js +0 -127
- package/dist/roap/state.js.map +0 -1
- package/dist/roap/turnDiscovery.d.ts +0 -81
- package/dist/roap/util.d.ts +0 -2
- package/dist/roap/util.js +0 -76
- package/dist/roap/util.js.map +0 -1
- package/dist/rtcMetrics/constants.d.ts +0 -4
- package/dist/rtcMetrics/constants.js.map +0 -1
- package/dist/rtcMetrics/index.d.ts +0 -61
- package/dist/rtcMetrics/index.js +0 -197
- package/dist/rtcMetrics/index.js.map +0 -1
- package/dist/statsAnalyzer/global.d.ts +0 -118
- package/dist/statsAnalyzer/global.js +0 -127
- package/dist/statsAnalyzer/global.js.map +0 -1
- package/dist/statsAnalyzer/index.d.ts +0 -193
- package/dist/statsAnalyzer/index.js +0 -1019
- package/dist/statsAnalyzer/index.js.map +0 -1
- package/dist/statsAnalyzer/mqaUtil.d.ts +0 -22
- package/dist/statsAnalyzer/mqaUtil.js +0 -181
- package/dist/statsAnalyzer/mqaUtil.js.map +0 -1
- package/dist/transcription/index.d.ts +0 -64
- package/dist/types/common/errors/reconnection-in-progress.d.ts +0 -9
- package/dist/types/mediaQualityMetrics/config.d.ts +0 -241
- package/dist/types/networkQualityMonitor/index.d.ts +0 -70
- package/dist/types/rtcMetrics/constants.d.ts +0 -4
- package/dist/types/rtcMetrics/index.d.ts +0 -71
- package/dist/types/statsAnalyzer/global.d.ts +0 -36
- package/dist/types/statsAnalyzer/index.d.ts +0 -217
- package/dist/types/statsAnalyzer/mqaUtil.d.ts +0 -48
- package/dist/webinar/collection.d.ts +0 -16
- package/dist/webinar/index.d.ts +0 -5
@@ -1,671 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
4
|
-
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
5
|
-
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
6
|
-
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
7
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
8
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
9
|
-
_Object$defineProperty(exports, "__esModule", {
|
10
|
-
value: true
|
11
|
-
});
|
12
|
-
exports.default = void 0;
|
13
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
14
|
-
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
15
|
-
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/parse-int"));
|
16
|
-
var _window = _interopRequireDefault(require("global/window"));
|
17
|
-
var _sdpTransform = _interopRequireDefault(require("sdp-transform"));
|
18
|
-
var _metrics = _interopRequireDefault(require("../metrics"));
|
19
|
-
var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
|
20
|
-
var _config = _interopRequireDefault(require("../common/config"));
|
21
|
-
var _constants = require("../constants");
|
22
|
-
var _constants2 = _interopRequireDefault(require("../metrics/constants"));
|
23
|
-
var _config2 = require("../metrics/config");
|
24
|
-
var _media = _interopRequireDefault(require("../common/errors/media"));
|
25
|
-
var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
|
26
|
-
var _webexErrors = require("../common/errors/webex-errors");
|
27
|
-
var _browserDetection = _interopRequireDefault(require("../common/browser-detection"));
|
28
|
-
var _util = _interopRequireDefault(require("./util"));
|
29
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
30
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
31
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
32
|
-
var _BrowserDetection = (0, _browserDetection.default)(),
|
33
|
-
isBrowser = _BrowserDetection.isBrowser;
|
34
|
-
|
35
|
-
/**
|
36
|
-
* @export
|
37
|
-
* @public
|
38
|
-
*/
|
39
|
-
var pc = {};
|
40
|
-
|
41
|
-
/**
|
42
|
-
* munges the bandwidth limit into the sdp
|
43
|
-
* @param {String} sdpLines
|
44
|
-
* @param {Number} index
|
45
|
-
* @returns {String}
|
46
|
-
*/
|
47
|
-
var insertBandwidthLimit = function insertBandwidthLimit(sdpLines, index) {
|
48
|
-
// eslint-disable-next-line no-warning-comments
|
49
|
-
// TODO convert to sdp parser
|
50
|
-
var limit;
|
51
|
-
var periodicKeyFrame = '';
|
52
|
-
if (sdpLines[index].search(_constants.AUDIO) !== -1) {
|
53
|
-
limit = _config.default.meetings.bandwidth.audio;
|
54
|
-
} else {
|
55
|
-
limit = _config.default.meetings.bandwidth.video;
|
56
|
-
periodicKeyFrame = _constants.SDP.PERIODIC_KEYFRAME;
|
57
|
-
sdpLines.splice(index + 2, 0, periodicKeyFrame);
|
58
|
-
}
|
59
|
-
sdpLines.splice(index + 1, 0, "".concat(_constants.SDP.B_LINE, ":").concat(limit));
|
60
|
-
return sdpLines;
|
61
|
-
};
|
62
|
-
|
63
|
-
/**
|
64
|
-
* needed for calliope max-fs
|
65
|
-
* @param {String} sdp
|
66
|
-
* @param {String} [level=QUALITY_LEVELS.HIGH] quality level for max-fs
|
67
|
-
* @returns {String}
|
68
|
-
*/
|
69
|
-
var setRemoteVideoConstraints = function setRemoteVideoConstraints(sdp) {
|
70
|
-
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.QUALITY_LEVELS.HIGH;
|
71
|
-
var maxFs = _constants.REMOTE_VIDEO_CONSTRAINTS.MAX_FS[level];
|
72
|
-
if (!maxFs) {
|
73
|
-
throw new _parameter.default("setRemoteVideoConstraints: unable to set max framesize, value for level \"".concat(level, "\" is not defined"));
|
74
|
-
}
|
75
|
-
var modifiedSdp = _util.default.adjustH264Profile(sdp, maxFs);
|
76
|
-
return modifiedSdp;
|
77
|
-
};
|
78
|
-
var setStartBitrateOnRemoteSdp = function setStartBitrateOnRemoteSdp(sdp) {
|
79
|
-
if (_config.default.meetings.bandwidth.startBitrate) {
|
80
|
-
sdp = sdp.replace(/(\na=fmtp:(\d+).*profile-level-id=.*)/gi, "$1;x-google-start-bitrate=".concat(_config.default.meetings.bandwidth.startBitrate));
|
81
|
-
}
|
82
|
-
return sdp;
|
83
|
-
};
|
84
|
-
|
85
|
-
/**
|
86
|
-
* checks that sdp has h264 codec in it
|
87
|
-
* @param {String} sdp
|
88
|
-
* @returns {boolean}
|
89
|
-
*/
|
90
|
-
var checkH264Support = function checkH264Support(sdp) {
|
91
|
-
// eslint-disable-next-line no-warning-comments
|
92
|
-
// TODO convert to sdp parser to read rtp.codec
|
93
|
-
var videoPresent = sdp.match(/\nm=video.*/g);
|
94
|
-
var h264Present = sdp.match(/\na=rtpmap:\d+\sH264.*/g);
|
95
|
-
if (videoPresent) {
|
96
|
-
return !!h264Present;
|
97
|
-
}
|
98
|
-
return true;
|
99
|
-
};
|
100
|
-
|
101
|
-
/**
|
102
|
-
* validates the sdp, checks port, candidates, and ice info
|
103
|
-
* @param {String} sdp
|
104
|
-
* @returns {String}
|
105
|
-
*/
|
106
|
-
var isSdpInvalid = function isSdpInvalid(sdp) {
|
107
|
-
var parsedSdp = _sdpTransform.default.parse(sdp);
|
108
|
-
var _iterator = _createForOfIteratorHelper(parsedSdp.media),
|
109
|
-
_step;
|
110
|
-
try {
|
111
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
112
|
-
var _mediaLine$candidates;
|
113
|
-
var mediaLine = _step.value;
|
114
|
-
if (!mediaLine.candidates || ((_mediaLine$candidates = mediaLine.candidates) === null || _mediaLine$candidates === void 0 ? void 0 : _mediaLine$candidates.length) === 0) {
|
115
|
-
_loggerProxy.default.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Ice candidate never completed');
|
116
|
-
return 'iceCandidate: Ice gathering never completed';
|
117
|
-
}
|
118
|
-
if (_constants.SDP.BAD_MEDIA_PORTS.includes(mediaLine.port)) {
|
119
|
-
_loggerProxy.default.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: Found invalid port number for the ice candidate');
|
120
|
-
return 'iceCandidate: Found invalid port number for the ice candidate';
|
121
|
-
}
|
122
|
-
if (!mediaLine.icePwd || !mediaLine.iceUfrag) {
|
123
|
-
_loggerProxy.default.logger.error('PeerConnectionManager:index#isSdpInvalid --> iceCandidate: ice ufrag and password not found');
|
124
|
-
return 'iceCandidate: ice ufrag and password not found';
|
125
|
-
}
|
126
|
-
}
|
127
|
-
} catch (err) {
|
128
|
-
_iterator.e(err);
|
129
|
-
} finally {
|
130
|
-
_iterator.f();
|
131
|
-
}
|
132
|
-
return '';
|
133
|
-
};
|
134
|
-
|
135
|
-
/**
|
136
|
-
* munges the bandwidth into the sdp
|
137
|
-
* @param {String} sdp
|
138
|
-
* @returns {String}
|
139
|
-
*/
|
140
|
-
var limitBandwidth = function limitBandwidth(sdp) {
|
141
|
-
// TODO convert to sdp parser
|
142
|
-
var offerSdp = sdp;
|
143
|
-
var sdpLines = offerSdp.split(_constants.SDP.CARRIAGE_RETURN);
|
144
|
-
for (var i = 0; i < sdpLines.length; i += 1) {
|
145
|
-
if (sdpLines[i].search(_constants.SDP.M_LINE) !== -1) {
|
146
|
-
sdpLines = insertBandwidthLimit(sdpLines, i);
|
147
|
-
}
|
148
|
-
}
|
149
|
-
offerSdp = sdpLines.join(_constants.SDP.CARRIAGE_RETURN);
|
150
|
-
return offerSdp;
|
151
|
-
};
|
152
|
-
|
153
|
-
/**
|
154
|
-
* makes sure the screen pc sdp has content:slides for server
|
155
|
-
* @param {RTCPeerConnection} screenPc
|
156
|
-
* @returns {RTCPeerConnection}
|
157
|
-
*/
|
158
|
-
pc.setContentSlides = function (screenPc) {
|
159
|
-
if (screenPc && screenPc.sdp) {
|
160
|
-
screenPc.sdp += "".concat(_constants.SDP.A_CONTENT_SLIDES).concat(_constants.SDP.CARRIAGE_RETURN);
|
161
|
-
}
|
162
|
-
return screenPc;
|
163
|
-
};
|
164
|
-
|
165
|
-
/**
|
166
|
-
* handles ice trickling and establishes ICE connection onto peer connection object
|
167
|
-
* @param {Object} peerConnection
|
168
|
-
* @param {Object} options
|
169
|
-
* @param {String} options.remoteQualityLevel
|
170
|
-
* @returns {Promise.RTCPeerConnection}
|
171
|
-
*/
|
172
|
-
pc.iceCandidate = function (peerConnection, _ref) {
|
173
|
-
var remoteQualityLevel = _ref.remoteQualityLevel;
|
174
|
-
return new _promise.default(function (resolve, reject) {
|
175
|
-
var now = (0, _now.default)();
|
176
|
-
var doneGatheringIceCandidate = function doneGatheringIceCandidate() {
|
177
|
-
// @ts-ignore
|
178
|
-
var miliseconds = (0, _parseInt2.default)(Math.abs((0, _now.default)() - now), 4);
|
179
|
-
peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);
|
180
|
-
peerConnection.sdp = _util.default.convertCLineToIpv4(peerConnection.sdp);
|
181
|
-
peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);
|
182
|
-
var invalidSdpPresent = isSdpInvalid(peerConnection.sdp);
|
183
|
-
if (invalidSdpPresent) {
|
184
|
-
_loggerProxy.default.logger.error('PeerConnectionManager:index#iceCandidate --> SDP not valid after waiting.');
|
185
|
-
reject(new _webexErrors.InvalidSdpError(invalidSdpPresent));
|
186
|
-
}
|
187
|
-
_loggerProxy.default.logger.log("PeerConnectionManager:index#iceCandidate --> Time to gather ice candidate ".concat(miliseconds, " miliseconds"));
|
188
|
-
resolve();
|
189
|
-
};
|
190
|
-
|
191
|
-
// If ice has already been gathered
|
192
|
-
if (peerConnection.iceGatheringState === _constants.COMPLETE) {
|
193
|
-
doneGatheringIceCandidate();
|
194
|
-
}
|
195
|
-
peerConnection.onIceGatheringStateChange = function () {
|
196
|
-
if (peerConnection.iceGatheringState === _constants.COMPLETE) {
|
197
|
-
// @ts-ignore
|
198
|
-
doneGatheringIceCandidate(peerConnection);
|
199
|
-
}
|
200
|
-
if (peerConnection.iceGatheringState === _constants.GATHERING) {
|
201
|
-
_loggerProxy.default.logger.log('PeerConnectionManager:index#onIceGatheringStateChange --> Ice state changed to gathering');
|
202
|
-
}
|
203
|
-
};
|
204
|
-
peerConnection.onicecandidate = function (evt) {
|
205
|
-
if (evt.candidate === null) {
|
206
|
-
// @ts-ignore
|
207
|
-
doneGatheringIceCandidate(peerConnection);
|
208
|
-
} else {
|
209
|
-
var _evt$candidate, _evt$candidate2, _evt$candidate3, _evt$candidate4;
|
210
|
-
_loggerProxy.default.logger.log("PeerConnectionManager:index#onicecandidate --> Candidate ".concat((_evt$candidate = evt.candidate) === null || _evt$candidate === void 0 ? void 0 : _evt$candidate.type, " ").concat((_evt$candidate2 = evt.candidate) === null || _evt$candidate2 === void 0 ? void 0 : _evt$candidate2.protocol, " ").concat((_evt$candidate3 = evt.candidate) === null || _evt$candidate3 === void 0 ? void 0 : _evt$candidate3.address, ":").concat((_evt$candidate4 = evt.candidate) === null || _evt$candidate4 === void 0 ? void 0 : _evt$candidate4.port));
|
211
|
-
}
|
212
|
-
};
|
213
|
-
peerConnection.onicecandidateerror = function (event) {
|
214
|
-
// we can often get ICE candidate errors (for example when failing to communicate with a TURN server)
|
215
|
-
// they don't mean that the whole ICE connection will fail, so it's OK to ignore them
|
216
|
-
_loggerProxy.default.logger.error('PeerConnectionManager:index#onicecandidateerror --> ignoring ice error:', event);
|
217
|
-
};
|
218
|
-
});
|
219
|
-
};
|
220
|
-
|
221
|
-
/**
|
222
|
-
* swapping tracks
|
223
|
-
* @param {Object} peerConnection
|
224
|
-
* @param {Object} track
|
225
|
-
* @returns {undefined}
|
226
|
-
*/
|
227
|
-
pc.replaceTrack = function (peerConnection, track) {
|
228
|
-
try {
|
229
|
-
var senders = peerConnection.getSenders();
|
230
|
-
if (senders.length > 0) {
|
231
|
-
senders.forEach(function (sender) {
|
232
|
-
if (sender.track && sender.track.kind === track.kind) {
|
233
|
-
sender.replaceTrack(track);
|
234
|
-
}
|
235
|
-
});
|
236
|
-
}
|
237
|
-
} catch (err) {
|
238
|
-
_loggerProxy.default.logger.error("PeerConnectionManager:index#replaceTrack --> Error replacing track, ".concat(err));
|
239
|
-
}
|
240
|
-
};
|
241
|
-
|
242
|
-
/**
|
243
|
-
* adding streams to peerConnection
|
244
|
-
* @param {Object} peerConnection
|
245
|
-
* @param {Object} stream
|
246
|
-
* @returns {undefined}
|
247
|
-
*/
|
248
|
-
pc.addStream = function (peerConnection, stream) {
|
249
|
-
try {
|
250
|
-
if (stream && !isBrowser('edge')) {
|
251
|
-
var tracksPresent = peerConnection.getSenders && peerConnection.getSenders().find(function (sender) {
|
252
|
-
return sender.track != null;
|
253
|
-
});
|
254
|
-
if (tracksPresent) {
|
255
|
-
stream.getTracks().forEach(function (track) {
|
256
|
-
pc.replaceTrack(peerConnection, track);
|
257
|
-
});
|
258
|
-
return;
|
259
|
-
}
|
260
|
-
stream.getTracks().forEach(function (track) {
|
261
|
-
peerConnection.addTrack(track, stream);
|
262
|
-
});
|
263
|
-
// // TODO : may come back disable addTracks for chrome they are moving back to addStream
|
264
|
-
// // https://bugs.chromium.org/p/chromium/issues/detail?id=764414
|
265
|
-
// // https://bugs.chromium.org/p/chromium/issues/detail?id=738918#c7
|
266
|
-
// peerConnection.addStream(stream);
|
267
|
-
} else if (isBrowser('edge')) {
|
268
|
-
peerConnection.addStream(stream);
|
269
|
-
}
|
270
|
-
} catch (err) {
|
271
|
-
_loggerProxy.default.logger.error("PeerConnectionManager:index#addStream --> Error adding stream, error: ".concat(_config2.error));
|
272
|
-
}
|
273
|
-
};
|
274
|
-
|
275
|
-
/**
|
276
|
-
* setting the remote description
|
277
|
-
* @param {Object} peerConnection
|
278
|
-
* @param {String} typeStr
|
279
|
-
* @param {String} remoteSdp
|
280
|
-
* @param {String} meetingId
|
281
|
-
* @returns {undefined}
|
282
|
-
*/
|
283
|
-
pc.setRemoteSessionDetails = function (peerConnection, typeStr, remoteSdp, meetingId) {
|
284
|
-
_loggerProxy.default.logger.log("PeerConnectionManager:index#setRemoteSessionDetails --> Setting the remote description type: ".concat(typeStr, "State: ").concat(peerConnection.signalingState));
|
285
|
-
var sdp = remoteSdp;
|
286
|
-
|
287
|
-
// making sure that the remoteDescription is only set when there is a answer for offer
|
288
|
-
// or there is a offer from the server
|
289
|
-
|
290
|
-
if (!sdp) {
|
291
|
-
_metrics.default.postEvent({
|
292
|
-
event: _config2.eventType.REMOTE_SDP_RECEIVED,
|
293
|
-
meetingId: meetingId,
|
294
|
-
data: {
|
295
|
-
canProceed: false,
|
296
|
-
errors: [_metrics.default.generateErrorPayload(2001, true, _config2.error.name.MEDIA_ENGINE, 'missing remoteSdp')]
|
297
|
-
}
|
298
|
-
});
|
299
|
-
}
|
300
|
-
if (peerConnection.signalingState === _constants.SDP.HAVE_LOCAL_OFFER || peerConnection.signalingState === _constants.SDP.STABLE && typeStr === _constants.SDP.OFFER) {
|
301
|
-
sdp = setStartBitrateOnRemoteSdp(sdp);
|
302
|
-
if (!peerConnection.enableExtmap) {
|
303
|
-
sdp = sdp.replace(/\na=extmap.*/g, '');
|
304
|
-
}
|
305
|
-
|
306
|
-
// remove any xtls candidates
|
307
|
-
sdp = sdp.replace(/^a=candidate:.*xTLS.*\r\n/gim, '');
|
308
|
-
return peerConnection.setRemoteDescription(new _window.default.RTCSessionDescription({
|
309
|
-
type: typeStr,
|
310
|
-
sdp: sdp
|
311
|
-
})).then(function () {
|
312
|
-
if (peerConnection.signalingState === _constants.SDP.STABLE) {
|
313
|
-
_metrics.default.postEvent({
|
314
|
-
event: _config2.eventType.REMOTE_SDP_RECEIVED,
|
315
|
-
meetingId: meetingId
|
316
|
-
});
|
317
|
-
}
|
318
|
-
})
|
319
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
320
|
-
.catch(function (error) {
|
321
|
-
_loggerProxy.default.logger.error("Peer-connection-manager:index#setRemoteDescription --> ".concat(error, " missing remotesdp"));
|
322
|
-
var metricName = _constants2.default.PEERCONNECTION_FAILURE;
|
323
|
-
var data = {
|
324
|
-
correlation_id: meetingId,
|
325
|
-
reason: error.message,
|
326
|
-
stack: error.stack
|
327
|
-
};
|
328
|
-
var metadata = {
|
329
|
-
type: error.name
|
330
|
-
};
|
331
|
-
_metrics.default.sendBehavioralMetric(metricName, data, metadata);
|
332
|
-
return _metrics.default.postEvent({
|
333
|
-
event: _config2.eventType.REMOTE_SDP_RECEIVED,
|
334
|
-
meetingId: meetingId,
|
335
|
-
data: {
|
336
|
-
canProceed: false,
|
337
|
-
errors: [_metrics.default.generateErrorPayload(2001, true, error.name.MEDIA_ENGINE, 'missing remoteSdp')]
|
338
|
-
}
|
339
|
-
});
|
340
|
-
});
|
341
|
-
}
|
342
|
-
return _promise.default.reject(new _media.default('PeerConnection in wrong state'));
|
343
|
-
};
|
344
|
-
|
345
|
-
/**
|
346
|
-
* Create offer with a valid parameter
|
347
|
-
* @param {Object} peerConnection
|
348
|
-
* @param {Object} meetingProperties
|
349
|
-
* @param {string} meetingProperties.meetingId
|
350
|
-
* @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
|
351
|
-
* @param {string} meetingProperties.enableRtx
|
352
|
-
* @param {string} meetingProperties.enableExtmap
|
353
|
-
* @returns {RTCPeerConnection}
|
354
|
-
*/
|
355
|
-
pc.createOffer = function (peerConnection, _ref2) {
|
356
|
-
var meetingId = _ref2.meetingId,
|
357
|
-
remoteQualityLevel = _ref2.remoteQualityLevel,
|
358
|
-
enableRtx = _ref2.enableRtx,
|
359
|
-
enableExtmap = _ref2.enableExtmap;
|
360
|
-
_loggerProxy.default.logger.log('PeerConnectionManager:index#createOffer --> creating a new offer');
|
361
|
-
|
362
|
-
// saving the extMap State to use in setRemoteDescription
|
363
|
-
|
364
|
-
peerConnection.enableExtmap = enableExtmap;
|
365
|
-
return peerConnection.createOffer().then(function (description) {
|
366
|
-
// bug https://bugs.chromium.org/p/chromium/issues/detail?id=1020642
|
367
|
-
// chrome currently generates RTX line irrespective of whether the server side supports it
|
368
|
-
// we are removing apt as well because its associated with rtx line
|
369
|
-
|
370
|
-
if (!enableRtx) {
|
371
|
-
description.sdp = description.sdp.replace(/\r\na=rtpmap:\d+ rtx\/\d+/g, '');
|
372
|
-
description.sdp = description.sdp.replace(/\r\na=fmtp:\d+ apt=\d+/g, '');
|
373
|
-
}
|
374
|
-
return peerConnection.setLocalDescription(description);
|
375
|
-
}).then(function () {
|
376
|
-
return pc.iceCandidate(peerConnection, {
|
377
|
-
remoteQualityLevel: remoteQualityLevel
|
378
|
-
});
|
379
|
-
}).then(function () {
|
380
|
-
if (!checkH264Support(peerConnection.sdp)) {
|
381
|
-
throw new _media.default('openH264 is downloading please Wait. Upload logs if not working on second try');
|
382
|
-
}
|
383
|
-
if (!enableExtmap) {
|
384
|
-
peerConnection.sdp = peerConnection.sdp.replace(/\na=extmap.*/g, '');
|
385
|
-
}
|
386
|
-
pc.setContentSlides(peerConnection);
|
387
|
-
_metrics.default.postEvent({
|
388
|
-
event: _config2.eventType.LOCAL_SDP_GENERATED,
|
389
|
-
meetingId: meetingId
|
390
|
-
});
|
391
|
-
return peerConnection;
|
392
|
-
})
|
393
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
394
|
-
.catch(function (error) {
|
395
|
-
_loggerProxy.default.logger.error("Peer-connection-manager:index#createOffer --> ".concat(error));
|
396
|
-
if (error instanceof _webexErrors.InvalidSdpError) {
|
397
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.INVALID_ICE_CANDIDATE, {
|
398
|
-
correlation_id: meetingId,
|
399
|
-
code: error.code,
|
400
|
-
reason: error.message
|
401
|
-
});
|
402
|
-
} else {
|
403
|
-
var metricName = _constants2.default.PEERCONNECTION_FAILURE;
|
404
|
-
var data = {
|
405
|
-
correlation_id: meetingId,
|
406
|
-
reason: error.message,
|
407
|
-
stack: error.stack
|
408
|
-
};
|
409
|
-
var metadata = {
|
410
|
-
type: error.name
|
411
|
-
};
|
412
|
-
_metrics.default.sendBehavioralMetric(metricName, data, metadata);
|
413
|
-
}
|
414
|
-
_metrics.default.postEvent({
|
415
|
-
event: _config2.eventType.LOCAL_SDP_GENERATED,
|
416
|
-
meetingId: meetingId,
|
417
|
-
data: {
|
418
|
-
canProceed: false,
|
419
|
-
errors: [
|
420
|
-
// @ts-ignore
|
421
|
-
_metrics.default.generateErrorPayload(2001, true, error.name.MEDIA_ENGINE)]
|
422
|
-
}
|
423
|
-
});
|
424
|
-
pc.close(peerConnection);
|
425
|
-
throw error;
|
426
|
-
});
|
427
|
-
};
|
428
|
-
|
429
|
-
/**
|
430
|
-
* rollBack local description in peerconnection
|
431
|
-
* @param {Object} peerConnection
|
432
|
-
* @returns {Promise.RTCPeerConnection}
|
433
|
-
*/
|
434
|
-
pc.rollBackLocalDescription = function (peerConnection) {
|
435
|
-
return peerConnection
|
436
|
-
// @ts-ignore
|
437
|
-
.setLocalDescription(new RTCSessionDescription({
|
438
|
-
type: _constants.SDP.ROLLBACK
|
439
|
-
})).then(function () {
|
440
|
-
return peerConnection;
|
441
|
-
}).catch(function (err) {
|
442
|
-
_loggerProxy.default.logger.error("Peer-connection-manager:index#setLocalDescription --> ".concat(err, " "));
|
443
|
-
|
444
|
-
// @ts-ignore
|
445
|
-
return _promise.default.error(err);
|
446
|
-
});
|
447
|
-
};
|
448
|
-
|
449
|
-
/**
|
450
|
-
* @param {Object} params {
|
451
|
-
* @param {Boolean} params.offerToReceiveAudio
|
452
|
-
* @param {Boolean} params.offerToReceiveVideo
|
453
|
-
* @param {string} params.offerSdp
|
454
|
-
* @param {MediaStream} params.stream
|
455
|
-
* @param {Object} meetingProperties
|
456
|
-
* @param {string} meetingProperties.meetingId
|
457
|
-
* @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
|
458
|
-
* @returns {Promise.<Array>} [MediaSDP, ScreenSDP]
|
459
|
-
*/
|
460
|
-
pc.updatePeerConnection = function (params, _ref3) {
|
461
|
-
var meetingId = _ref3.meetingId,
|
462
|
-
remoteQualityLevel = _ref3.remoteQualityLevel;
|
463
|
-
_loggerProxy.default.logger.log("PeerConnectionManager:index#updatePeerConnection --> updating the peerConnection with params: ".concat(params));
|
464
|
-
var peerConnection = params.peerConnection,
|
465
|
-
offerSdp = params.offerSdp;
|
466
|
-
return pc.createAnswer({
|
467
|
-
peerConnection: peerConnection,
|
468
|
-
offerSdp: offerSdp[0]
|
469
|
-
}, {
|
470
|
-
meetingId: meetingId,
|
471
|
-
remoteQualityLevel: remoteQualityLevel
|
472
|
-
}).then(function (peerconnection) {
|
473
|
-
// The content slides should also be set when we are sending inactive
|
474
|
-
pc.setContentSlides(peerconnection);
|
475
|
-
return _promise.default.resolve([peerconnection.sdp]);
|
476
|
-
});
|
477
|
-
};
|
478
|
-
|
479
|
-
/**
|
480
|
-
* @param {Object} params
|
481
|
-
* @param {Object} params.peerConnection
|
482
|
-
* @param {Object} params.sdpConstraints
|
483
|
-
* @param {Object} meetingProperties
|
484
|
-
* @param {string} meetingProperties.meetingId
|
485
|
-
* @param {string} meetingProperties.remoteQualityLevel LOW|MEDIUM|HIGH
|
486
|
-
* @returns {RTCPeerConnection} peerConnection
|
487
|
-
*/
|
488
|
-
pc.createAnswer = function (params, _ref4) {
|
489
|
-
var meetingId = _ref4.meetingId,
|
490
|
-
remoteQualityLevel = _ref4.remoteQualityLevel;
|
491
|
-
var peerConnection = params.peerConnection;
|
492
|
-
|
493
|
-
// TODO: Some times to many mercury event comes at the same time
|
494
|
-
// Need to maintain state of peerconnection
|
495
|
-
if (peerConnection.signalingState === _constants.SDP.HAVE_REMOTE_OFFER) {
|
496
|
-
return _promise.default.resolve(peerConnection);
|
497
|
-
}
|
498
|
-
return pc.setRemoteSessionDetails(peerConnection, _constants.OFFER, params.offerSdp, meetingId).then(function () {
|
499
|
-
return peerConnection.createAnswer(params.sdpConstraints);
|
500
|
-
}).then(function (answer) {
|
501
|
-
return peerConnection.setLocalDescription(answer);
|
502
|
-
}).then(function () {
|
503
|
-
return pc.iceCandidate(peerConnection, {
|
504
|
-
remoteQualityLevel: remoteQualityLevel
|
505
|
-
});
|
506
|
-
}).then(function () {
|
507
|
-
peerConnection.sdp = limitBandwidth(peerConnection.localDescription.sdp);
|
508
|
-
peerConnection.sdp = _util.default.convertCLineToIpv4(peerConnection.sdp);
|
509
|
-
peerConnection.sdp = setRemoteVideoConstraints(peerConnection.sdp, remoteQualityLevel);
|
510
|
-
if (!checkH264Support(peerConnection.sdp)) {
|
511
|
-
throw new _media.default('openH264 is downloading please Wait. Upload logs if not working on second try');
|
512
|
-
}
|
513
|
-
return peerConnection;
|
514
|
-
})
|
515
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow
|
516
|
-
.catch(function (error) {
|
517
|
-
if (error instanceof _webexErrors.InvalidSdpError) {
|
518
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.INVALID_ICE_CANDIDATE, {
|
519
|
-
correlation_id: meetingId
|
520
|
-
});
|
521
|
-
} else {
|
522
|
-
var metricName = _constants2.default.PEERCONNECTION_FAILURE;
|
523
|
-
var data = {
|
524
|
-
correlation_id: meetingId,
|
525
|
-
reason: error.message,
|
526
|
-
stack: error.stack
|
527
|
-
};
|
528
|
-
var metadata = {
|
529
|
-
type: error.name
|
530
|
-
};
|
531
|
-
_metrics.default.sendBehavioralMetric(metricName, data, metadata);
|
532
|
-
}
|
533
|
-
_loggerProxy.default.logger.error("PeerConnectionManager:index#setRemoteSessionDetails --> Error creating remote session, error: ".concat(error));
|
534
|
-
});
|
535
|
-
};
|
536
|
-
|
537
|
-
/**
|
538
|
-
* shut down the peer connection
|
539
|
-
* @param {Object} peerConnection
|
540
|
-
* @returns {undefined}
|
541
|
-
*/
|
542
|
-
pc.close = function (peerConnection) {
|
543
|
-
// peerConnection.close() fails on firefox on network changes and gives a Dom exception
|
544
|
-
// To avoid this we have added a try catch block.
|
545
|
-
// Please refer to https://bugzilla.mozilla.org/show_bug.cgi?id=1274407 for more information
|
546
|
-
_loggerProxy.default.logger.log('PeerConnectionManager:index#close --> pc: close() -> attempting to close the peer connection');
|
547
|
-
if (peerConnection && peerConnection.connectionState === _constants.PEER_CONNECTION_STATE.CLOSED) {
|
548
|
-
_loggerProxy.default.logger.log('PeerConnectionManager:index#close --> pc: close() -> connection already closed');
|
549
|
-
return _promise.default.resolve();
|
550
|
-
}
|
551
|
-
_loggerProxy.default.logger.log('PeerConnectionManager:index#close --> pc: close() -> closing the mediaPeerConnection');
|
552
|
-
return _promise.default.resolve().then(function () {
|
553
|
-
if (peerConnection && peerConnection.close) {
|
554
|
-
peerConnection.close();
|
555
|
-
}
|
556
|
-
});
|
557
|
-
};
|
558
|
-
pc.setPeerConnectionEvents = function (meeting) {
|
559
|
-
// In case ICE fail
|
560
|
-
var peerConnection = meeting.mediaProperties.peerConnection;
|
561
|
-
var connectionFailed = function connectionFailed() {
|
562
|
-
if (meeting.reconnectionManager.iceState.resolve) {
|
563
|
-
// DISCONNECTED state triggers first then it goes to FAILED STATE
|
564
|
-
// sometimes the failed state can happen before 10 seconds (Which is the timer for the reconnect for ice disconnect)
|
565
|
-
meeting.reconnectionManager.iceState.resolve();
|
566
|
-
}
|
567
|
-
meeting.reconnect({
|
568
|
-
networkDisconnect: true
|
569
|
-
});
|
570
|
-
_metrics.default.postEvent({
|
571
|
-
event: _config2.eventType.ICE_END,
|
572
|
-
meeting: meeting,
|
573
|
-
data: {
|
574
|
-
canProceed: false,
|
575
|
-
errors: [
|
576
|
-
// @ts-ignore
|
577
|
-
_metrics.default.generateErrorPayload(2004, false, _config2.error.name.MEDIA_ENGINE)]
|
578
|
-
}
|
579
|
-
});
|
580
|
-
meeting.uploadLogs({
|
581
|
-
file: 'peer-connection-manager/index',
|
582
|
-
function: 'connectionFailed'
|
583
|
-
});
|
584
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_FAILURE, {
|
585
|
-
correlation_id: meeting.correlationId,
|
586
|
-
locus_id: meeting.locusId
|
587
|
-
});
|
588
|
-
};
|
589
|
-
peerConnection.oniceconnectionstatechange = function () {
|
590
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHANGE.');
|
591
|
-
switch (peerConnection.iceConnectionState) {
|
592
|
-
case _constants.ICE_STATE.CHECKING:
|
593
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CHECKING.');
|
594
|
-
_metrics.default.postEvent({
|
595
|
-
event: _config2.eventType.ICE_START,
|
596
|
-
meeting: meeting
|
597
|
-
});
|
598
|
-
break;
|
599
|
-
case _constants.ICE_STATE.COMPLETED:
|
600
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE COMPLETED.');
|
601
|
-
break;
|
602
|
-
case _constants.ICE_STATE.CONNECTED:
|
603
|
-
// Ice connection state goes to connected when both client and server sends STUN packets and
|
604
|
-
// Established connected between them. Firefox does not trigger COMPLETED and only trigger CONNECTED
|
605
|
-
_metrics.default.postEvent({
|
606
|
-
event: _config2.eventType.ICE_END,
|
607
|
-
meeting: meeting
|
608
|
-
});
|
609
|
-
_metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_SUCCESS, {
|
610
|
-
correlation_id: meeting.correlationId,
|
611
|
-
locus_id: meeting.locusId
|
612
|
-
});
|
613
|
-
meeting.setNetworkStatus(_constants.NETWORK_STATUS.CONNECTED);
|
614
|
-
meeting.reconnectionManager.iceReconnected();
|
615
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CONNECTED.');
|
616
|
-
break;
|
617
|
-
case _constants.ICE_STATE.CLOSED:
|
618
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE CLOSED.');
|
619
|
-
break;
|
620
|
-
case _constants.ICE_STATE.DISCONNECTED:
|
621
|
-
meeting.setNetworkStatus(_constants.NETWORK_STATUS.DISCONNECTED);
|
622
|
-
meeting.reconnectionManager.waitForIceReconnect().catch(function () {
|
623
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED. Automatic Reconnection Timed Out.');
|
624
|
-
connectionFailed();
|
625
|
-
});
|
626
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE DISCONNECTED.');
|
627
|
-
break;
|
628
|
-
case _constants.ICE_STATE.FAILED:
|
629
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> ICE STATE FAILED.');
|
630
|
-
// notify of ice failure
|
631
|
-
// Ice failure is the only indicator currently for identifying the actual connection drop
|
632
|
-
// Firefox takes sometime 10-15 seconds to go to failed state
|
633
|
-
connectionFailed();
|
634
|
-
break;
|
635
|
-
default:
|
636
|
-
break;
|
637
|
-
}
|
638
|
-
};
|
639
|
-
peerConnection.onconnectionstatechange = function () {
|
640
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CHANGE.');
|
641
|
-
switch (peerConnection.connectionState) {
|
642
|
-
case _constants.CONNECTION_STATE.NEW:
|
643
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE NEW.');
|
644
|
-
break;
|
645
|
-
case _constants.CONNECTION_STATE.CONNECTING:
|
646
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTING.');
|
647
|
-
break;
|
648
|
-
case _constants.CONNECTION_STATE.CONNECTED:
|
649
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CONNECTED.');
|
650
|
-
break;
|
651
|
-
case _constants.CONNECTION_STATE.CLOSED:
|
652
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE CLOSED.');
|
653
|
-
break;
|
654
|
-
case _constants.CONNECTION_STATE.DISCONNECTED:
|
655
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE DISCONNECTED.');
|
656
|
-
break;
|
657
|
-
case _constants.CONNECTION_STATE.FAILED:
|
658
|
-
_loggerProxy.default.logger.info('PeerConnectionManager:index#setPeerConnectionEvents --> CONNECTION STATE FAILED.');
|
659
|
-
// Special case happens only on chrome where there is no ICE FAILED event
|
660
|
-
// only CONNECTION FAILED event gets triggered
|
661
|
-
|
662
|
-
connectionFailed();
|
663
|
-
break;
|
664
|
-
default:
|
665
|
-
break;
|
666
|
-
}
|
667
|
-
};
|
668
|
-
};
|
669
|
-
var _default = pc;
|
670
|
-
exports.default = _default;
|
671
|
-
//# sourceMappingURL=index.js.map
|