sip-connector 14.1.0 → 14.1.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SipConnector-BHvTGgmw.js +1352 -0
- package/dist/SipConnector-ChW25Tx9.cjs +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +328 -327
- package/dist/index.cjs +1 -1
- package/dist/index.js +280 -270
- package/dist/src/SipConnector.d.ts +235 -0
- package/dist/{SipConnectorFacade → src/SipConnectorFacade}/SipConnectorFacade.d.ts +7 -7
- package/dist/{__fixtures__ → src/__fixtures__}/BaseSession.mock.d.ts +22 -34
- package/dist/{__fixtures__ → src/__fixtures__}/RTCPeerConnectionMock.d.ts +15 -15
- package/dist/{__fixtures__ → src/__fixtures__}/RTCRtpSenderMock.d.ts +2 -2
- package/dist/{__fixtures__ → src/__fixtures__}/RTCSessionMock.d.ts +34 -38
- package/dist/{__fixtures__ → src/__fixtures__}/UA.mock.d.ts +25 -44
- package/dist/{__fixtures__ → src/__fixtures__}/channelsNotify.d.ts +2 -2
- package/dist/{__fixtures__ → src/__fixtures__}/jssip.mock.d.ts +1 -1
- package/dist/{__fixtures__ → src/__fixtures__}/participantNotify.d.ts +2 -2
- package/dist/{tools → src/tools}/index.d.ts +2 -2
- package/dist/{tools → src/tools}/sendDTMFAccumulated.d.ts +2 -2
- package/dist/{types.d.ts → src/types.d.ts} +2 -1
- package/dist/src/videoSendingBalancer/scaleBitrate.d.ts +2 -0
- package/package.json +27 -26
- package/dist/SipConnector-BPIL3yLc.js +0 -1343
- package/dist/SipConnector-BUbfMgHs.cjs +0 -1
- package/dist/SipConnector.d.ts +0 -315
- package/dist/utils.d.ts +0 -4
- package/dist/videoSendingBalancer/scaleBitrate.d.ts +0 -2
- /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/channels.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/index.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/utils.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{causes.d.ts → src/causes.d.ts} +0 -0
- /package/dist/{constants.d.ts → src/constants.d.ts} +0 -0
- /package/dist/{doMock.d.ts → src/doMock.d.ts} +0 -0
- /package/dist/{eventNames.d.ts → src/eventNames.d.ts} +0 -0
- /package/dist/{getExtraHeadersRemoteAddress.d.ts → src/getExtraHeadersRemoteAddress.d.ts} +0 -0
- /package/dist/{headers.d.ts → src/headers.d.ts} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/index.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/connectToServer.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/processRequest.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/getLinkError.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/getTypeFromError.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/getValuesFromError.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/index.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{tools → src/tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{tools → src/tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{tools → src/tools}/getUserAgent.d.ts +0 -0
- /package/dist/{tools → src/tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{tools → src/tools}/prepareMediaStream.d.ts +0 -0
- /package/dist/{tools → src/tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{tools → src/tools}/setVideoTrackContentHints.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/index.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMainCam.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMic.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMainCam.d.ts +0 -0
- /package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMic.d.ts +0 -0
- /package/dist/{utils → src/utils}/errors.d.ts +0 -0
- /package/dist/{utils → src/utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{utils → src/utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/balance.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/index.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/processSender.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (n, e, t) =>
|
|
4
|
-
import { B as
|
|
5
|
-
import { j as
|
|
6
|
-
import { sequentPromises as
|
|
7
|
-
import { createStackPromises as
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var ie = (n, e, t) => e in n ? re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var a = (n, e, t) => ie(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { B as Y, N as q, l as c, E as B, s as ce, a as ae, P as ue, b as de } from "./SipConnector-BHvTGgmw.js";
|
|
5
|
+
import { j as Rn, k as gn, n as yn, m as Tn, S as En, c as Mn, d as bn, f as _n, g as An, e as vn, h as On, i as Nn } from "./SipConnector-BHvTGgmw.js";
|
|
6
|
+
import { sequentPromises as le } from "sequent-promises";
|
|
7
|
+
import { createStackPromises as Ce } from "stack-promises";
|
|
8
|
+
import D from "debug";
|
|
9
|
+
import { default as Bn } from "debug";
|
|
10
|
+
import { isCanceledError as Se } from "@krivega/cancelable-promise";
|
|
11
|
+
import { hasCanceledError as fe } from "repeated-calls";
|
|
12
|
+
import { debounce as me } from "ts-debounce";
|
|
13
|
+
const x = (n) => {
|
|
13
14
|
const { url: e, cause: t } = n;
|
|
14
15
|
let s = e;
|
|
15
|
-
return (t ===
|
|
16
|
+
return (t === Y || t === q) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
|
|
16
17
|
};
|
|
17
|
-
var
|
|
18
|
-
const
|
|
18
|
+
var z = /* @__PURE__ */ ((n) => (n.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", n.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", n.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", n.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", n.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", n.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", n))(z || {});
|
|
19
|
+
const he = new Error("Unknown error"), pe = (n = he) => {
|
|
19
20
|
var o;
|
|
20
21
|
const { cause: e, socket: t } = n;
|
|
21
22
|
let s = "CONNECT_SERVER_FAILED";
|
|
@@ -24,19 +25,19 @@ const Ce = (n = new Error()) => {
|
|
|
24
25
|
s = "WRONG_USER_OR_PASSWORD";
|
|
25
26
|
break;
|
|
26
27
|
}
|
|
27
|
-
case
|
|
28
|
+
case Y: {
|
|
28
29
|
s = "BAD_MEDIA_ERROR";
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
31
|
-
case
|
|
32
|
+
case q: {
|
|
32
33
|
s = "NOT_FOUND_ERROR";
|
|
33
34
|
break;
|
|
34
35
|
}
|
|
35
36
|
default:
|
|
36
|
-
t && ((o = t
|
|
37
|
+
t !== void 0 && ((o = t._ws) == null ? void 0 : o.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : x(n) !== void 0 && x(n) !== "" && (s = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
37
38
|
}
|
|
38
39
|
return s;
|
|
39
|
-
},
|
|
40
|
+
}, Re = (n) => {
|
|
40
41
|
let e = "";
|
|
41
42
|
try {
|
|
42
43
|
e = JSON.stringify(n);
|
|
@@ -44,16 +45,16 @@ const Ce = (n = new Error()) => {
|
|
|
44
45
|
c("failed to stringify message", t);
|
|
45
46
|
}
|
|
46
47
|
return e;
|
|
47
|
-
},
|
|
48
|
-
const { code: e, cause: t, message: s } = n, o =
|
|
49
|
-
return typeof s == "object" && s !== null ? r.message =
|
|
50
|
-
},
|
|
48
|
+
}, ge = new Error("Unknown error"), ye = (n = ge) => {
|
|
49
|
+
const { code: e, cause: t, message: s } = n, o = x(n), r = { code: "", cause: "", message: "" };
|
|
50
|
+
return typeof s == "object" && s !== null ? r.message = Re(s) : s && (r.message = String(s)), o !== void 0 && o !== "" && (r.link = o), e !== void 0 && e !== "" && (r.code = e), t !== void 0 && t !== "" && (r.cause = t), r;
|
|
51
|
+
}, Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
51
52
|
__proto__: null,
|
|
52
|
-
EErrorTypes:
|
|
53
|
-
getLinkError:
|
|
54
|
-
getTypeFromError:
|
|
55
|
-
getValuesFromError:
|
|
56
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
53
|
+
EErrorTypes: z,
|
|
54
|
+
getLinkError: x,
|
|
55
|
+
getTypeFromError: pe,
|
|
56
|
+
getValuesFromError: ye
|
|
57
|
+
}, Symbol.toStringTag, { value: "Module" })), Ee = ({
|
|
57
58
|
sessionId: n,
|
|
58
59
|
remoteAddress: e,
|
|
59
60
|
isMutedAudio: t,
|
|
@@ -61,139 +62,139 @@ const Ce = (n = new Error()) => {
|
|
|
61
62
|
isRegistered: o,
|
|
62
63
|
isPresentationCall: r
|
|
63
64
|
}) => {
|
|
64
|
-
const i = [], u = t ? "0" : "1",
|
|
65
|
-
return i.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${
|
|
66
|
-
},
|
|
65
|
+
const i = [], u = t ? "0" : "1", d = s ? "0" : "1";
|
|
66
|
+
return i.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${d}`), (o === !1 || o === void 0) && i.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && i.push(`X-Vinteo-Session: ${n}`), r === !0 && i.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && i.push(`X-Vinteo-Remote: ${e}`), i;
|
|
67
|
+
}, Me = "[@*!|]", be = "_", _e = (n) => {
|
|
67
68
|
let e = n;
|
|
68
|
-
return e = e.replaceAll(new RegExp(
|
|
69
|
-
},
|
|
69
|
+
return e = e.replaceAll(new RegExp(Me, "g"), be), e;
|
|
70
|
+
}, Ae = ({
|
|
70
71
|
appName: n,
|
|
71
72
|
appVersion: e,
|
|
72
73
|
browserName: t,
|
|
73
74
|
browserVersion: s
|
|
74
75
|
}) => {
|
|
75
|
-
const r = `${
|
|
76
|
-
return `ChromeNew - ${t ? `${t} ${s}, ${r}`
|
|
77
|
-
},
|
|
76
|
+
const r = `${_e(n)} ${e}`;
|
|
77
|
+
return `ChromeNew - ${t === void 0 ? r : `${t} ${s}, ${r}`}`;
|
|
78
|
+
}, ve = ({
|
|
78
79
|
isUnifiedSdpSemantic: n,
|
|
79
80
|
appVersion: e,
|
|
80
81
|
browserName: t,
|
|
81
82
|
browserVersion: s,
|
|
82
83
|
appName: o
|
|
83
|
-
}) => n ?
|
|
84
|
+
}) => n ? Ae({ appVersion: e, browserName: t, browserVersion: s, appName: o }) : "Chrome", Q = "purgatory", k = (n) => n === Q, Oe = (n) => (e) => [...e].map((s) => async () => n(s)), Ne = async ({
|
|
84
85
|
accumulatedKeys: n,
|
|
85
86
|
sendKey: e,
|
|
86
87
|
canRunTask: t
|
|
87
88
|
}) => {
|
|
88
|
-
const o =
|
|
89
|
-
return
|
|
90
|
-
},
|
|
91
|
-
const e = (m,
|
|
89
|
+
const o = Oe(e)(n);
|
|
90
|
+
return le(o, t);
|
|
91
|
+
}, we = (n) => (t) => (c("onStartMainCam"), n.onSession("admin-start-main-cam", t)), Be = (n) => (t) => (c("onStartMic"), n.onSession("admin-start-mic", t)), Pe = (n) => (t) => (c("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), Ie = (n) => (t) => (c("onStopMic"), n.onSession("admin-stop-mic", t)), De = ({ sipConnector: n }) => {
|
|
92
|
+
const e = (m, g) => ({ isSyncForced: h = !1 }) => {
|
|
92
93
|
if (h) {
|
|
93
94
|
m();
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
}, t =
|
|
97
|
+
g();
|
|
98
|
+
}, t = we(n), s = Pe(n), o = Be(n), r = Ie(n);
|
|
98
99
|
let i = () => {
|
|
99
100
|
}, u = () => {
|
|
100
|
-
},
|
|
101
|
-
},
|
|
101
|
+
}, d = () => {
|
|
102
|
+
}, C = () => {
|
|
102
103
|
};
|
|
103
|
-
const
|
|
104
|
+
const f = ({
|
|
104
105
|
onStartMainCamForced: m,
|
|
105
|
-
onStartMainCamNotForced:
|
|
106
|
+
onStartMainCamNotForced: g,
|
|
106
107
|
onStopMainCamForced: h,
|
|
107
|
-
onStopMainCamNotForced:
|
|
108
|
+
onStopMainCamNotForced: p,
|
|
108
109
|
onStartMicForced: y,
|
|
109
|
-
onStartMicNotForced:
|
|
110
|
-
onStopMicForced:
|
|
111
|
-
onStopMicNotForced:
|
|
110
|
+
onStartMicNotForced: T,
|
|
111
|
+
onStopMicForced: E,
|
|
112
|
+
onStopMicNotForced: M
|
|
112
113
|
}) => {
|
|
113
114
|
const A = e(
|
|
114
115
|
m,
|
|
115
|
-
|
|
116
|
+
g
|
|
116
117
|
);
|
|
117
118
|
i = t(A);
|
|
118
119
|
const v = e(
|
|
119
120
|
h,
|
|
120
|
-
|
|
121
|
+
p
|
|
121
122
|
);
|
|
122
123
|
u = s(v);
|
|
123
|
-
const O = e(y,
|
|
124
|
-
|
|
125
|
-
const N = e(
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
i(), u(),
|
|
124
|
+
const O = e(y, T);
|
|
125
|
+
d = o(O);
|
|
126
|
+
const N = e(E, M);
|
|
127
|
+
C = r(N);
|
|
128
|
+
}, S = () => {
|
|
129
|
+
i(), u(), d(), C();
|
|
129
130
|
};
|
|
130
131
|
return {
|
|
131
132
|
start: (m) => {
|
|
132
|
-
|
|
133
|
+
f(m);
|
|
133
134
|
},
|
|
134
135
|
stop: () => {
|
|
135
|
-
|
|
136
|
+
S();
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
|
-
},
|
|
139
|
+
}, Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
139
140
|
__proto__: null,
|
|
140
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
141
|
-
createSyncMediaState:
|
|
142
|
-
error:
|
|
143
|
-
getExtraHeaders:
|
|
144
|
-
getUserAgent:
|
|
145
|
-
hasPurgatory:
|
|
146
|
-
|
|
147
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
148
|
-
const t =
|
|
141
|
+
PURGATORY_CONFERENCE_NUMBER: Q,
|
|
142
|
+
createSyncMediaState: De,
|
|
143
|
+
error: Te,
|
|
144
|
+
getExtraHeaders: Ee,
|
|
145
|
+
getUserAgent: ve,
|
|
146
|
+
hasPurgatory: k,
|
|
147
|
+
sendDtmfAccumulated: Ne
|
|
148
|
+
}, Symbol.toStringTag, { value: "Module" })), ke = (n) => [...n.keys()].map((e) => n.get(e)), Fe = (n, e) => ke(n).find((t) => (t == null ? void 0 : t.type) === e), Ve = async (n) => n.getStats().then((e) => {
|
|
149
|
+
const t = Fe(e, "codec");
|
|
149
150
|
return t == null ? void 0 : t.mimeType;
|
|
150
|
-
}),
|
|
151
|
+
}), Ue = (n) => n.find((e) => {
|
|
151
152
|
var t;
|
|
152
|
-
return ((t = e
|
|
153
|
-
}),
|
|
154
|
-
const t =
|
|
155
|
-
return
|
|
156
|
-
},
|
|
153
|
+
return ((t = e.track) == null ? void 0 : t.kind) === "video";
|
|
154
|
+
}), J = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), xe = 1e6, R = (n) => n * xe, Z = R(0.06), Le = R(4), $e = (n) => n <= 64 ? Z : n <= 128 ? R(0.12) : n <= 256 ? R(0.25) : n <= 384 ? R(0.32) : n <= 426 ? R(0.38) : n <= 640 ? R(0.5) : n <= 848 ? R(0.7) : n <= 1280 ? R(1) : n <= 1920 ? R(2) : Le, He = "av1", Xe = (n) => J(n, He), je = 0.6, ee = (n, e) => Xe(e) ? n * je : n, We = (n) => ee(Z, n), ne = (n, e) => {
|
|
155
|
+
const t = $e(n);
|
|
156
|
+
return ee(t, e);
|
|
157
|
+
}, X = 1, te = ({
|
|
157
158
|
videoTrack: n,
|
|
158
159
|
targetSize: e,
|
|
159
160
|
codec: t
|
|
160
161
|
}) => {
|
|
161
|
-
const s = n.getSettings(), o = s.width, r = s.height, i = o / e.width, u = r / e.height,
|
|
162
|
-
return { scaleResolutionDownBy:
|
|
163
|
-
},
|
|
162
|
+
const s = n.getSettings(), o = s.width, r = s.height, i = o === void 0 ? X : o / e.width, u = r === void 0 ? X : r / e.height, d = Math.max(i, u, X), C = ne(e.width, t);
|
|
163
|
+
return { scaleResolutionDownBy: d, maxBitrate: C };
|
|
164
|
+
}, se = Ce(), Ge = async () => se().catch((n) => {
|
|
164
165
|
c("videoSendingBalancer: error", n);
|
|
165
|
-
}),
|
|
166
|
+
}), Ke = async (n) => (se.add(n), Ge()), W = async ({
|
|
166
167
|
sender: n,
|
|
167
168
|
scaleResolutionDownBy: e,
|
|
168
169
|
maxBitrate: t,
|
|
169
170
|
onSetParameters: s
|
|
170
|
-
}) =>
|
|
171
|
-
const o =
|
|
172
|
-
return
|
|
171
|
+
}) => Ke(async () => ce(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), Ye = async ({ sender: n, codec: e }, t) => {
|
|
172
|
+
const o = We(e);
|
|
173
|
+
return W({
|
|
173
174
|
sender: n,
|
|
174
175
|
maxBitrate: o,
|
|
175
176
|
onSetParameters: t,
|
|
176
177
|
scaleResolutionDownBy: 200
|
|
177
178
|
});
|
|
178
|
-
},
|
|
179
|
+
}, U = async ({
|
|
179
180
|
sender: n,
|
|
180
181
|
videoTrack: e,
|
|
181
182
|
codec: t
|
|
182
183
|
}, s) => {
|
|
183
|
-
const i = e.getSettings().width, u =
|
|
184
|
-
return
|
|
184
|
+
const i = e.getSettings().width, u = ne(i ?? 0, t);
|
|
185
|
+
return W({
|
|
185
186
|
sender: n,
|
|
186
187
|
maxBitrate: u,
|
|
187
188
|
onSetParameters: s,
|
|
188
189
|
scaleResolutionDownBy: 1
|
|
189
190
|
});
|
|
190
|
-
},
|
|
191
|
+
}, qe = async ({
|
|
191
192
|
sender: n,
|
|
192
193
|
videoTrack: e,
|
|
193
194
|
resolution: t,
|
|
194
195
|
codec: s
|
|
195
196
|
}, o) => {
|
|
196
|
-
const [r, i] = t.split("x"), { maxBitrate: u, scaleResolutionDownBy:
|
|
197
|
+
const [r, i] = t.split("x"), { maxBitrate: u, scaleResolutionDownBy: d } = te({
|
|
197
198
|
videoTrack: e,
|
|
198
199
|
codec: s,
|
|
199
200
|
targetSize: {
|
|
@@ -201,13 +202,13 @@ const Ce = (n = new Error()) => {
|
|
|
201
202
|
height: Number(i)
|
|
202
203
|
}
|
|
203
204
|
});
|
|
204
|
-
return
|
|
205
|
+
return W({
|
|
205
206
|
sender: n,
|
|
206
207
|
maxBitrate: u,
|
|
207
208
|
onSetParameters: o,
|
|
208
|
-
scaleResolutionDownBy:
|
|
209
|
+
scaleResolutionDownBy: d
|
|
209
210
|
});
|
|
210
|
-
},
|
|
211
|
+
}, ze = async ({
|
|
211
212
|
mainCam: n,
|
|
212
213
|
resolutionMainCam: e,
|
|
213
214
|
sender: t,
|
|
@@ -215,19 +216,23 @@ const Ce = (n = new Error()) => {
|
|
|
215
216
|
codec: o
|
|
216
217
|
}, r) => {
|
|
217
218
|
switch (n) {
|
|
218
|
-
case
|
|
219
|
-
return
|
|
220
|
-
case
|
|
221
|
-
return
|
|
222
|
-
case
|
|
223
|
-
return e !== void 0 ?
|
|
219
|
+
case B.PAUSE_MAIN_CAM:
|
|
220
|
+
return Ye({ sender: t, codec: o }, r);
|
|
221
|
+
case B.RESUME_MAIN_CAM:
|
|
222
|
+
return U({ sender: t, videoTrack: s, codec: o }, r);
|
|
223
|
+
case B.MAX_MAIN_CAM_RESOLUTION:
|
|
224
|
+
return e !== void 0 ? qe(
|
|
224
225
|
{ sender: t, videoTrack: s, codec: o, resolution: e },
|
|
225
226
|
r
|
|
226
|
-
) :
|
|
227
|
+
) : U({ sender: t, videoTrack: s, codec: o }, r);
|
|
228
|
+
case B.ADMIN_STOP_MAIN_CAM:
|
|
229
|
+
case B.ADMIN_START_MAIN_CAM:
|
|
230
|
+
case void 0:
|
|
231
|
+
return U({ sender: t, videoTrack: s, codec: o }, r);
|
|
227
232
|
default:
|
|
228
|
-
return
|
|
233
|
+
return U({ sender: t, videoTrack: s, codec: o }, r);
|
|
229
234
|
}
|
|
230
|
-
},
|
|
235
|
+
}, G = {
|
|
231
236
|
isChanged: !1,
|
|
232
237
|
parameters: {
|
|
233
238
|
encodings: [{}],
|
|
@@ -236,18 +241,18 @@ const Ce = (n = new Error()) => {
|
|
|
236
241
|
headerExtensions: [],
|
|
237
242
|
rtcp: {}
|
|
238
243
|
}
|
|
239
|
-
},
|
|
244
|
+
}, K = async ({
|
|
240
245
|
mainCam: n,
|
|
241
246
|
resolutionMainCam: e,
|
|
242
247
|
connection: t,
|
|
243
248
|
onSetParameters: s,
|
|
244
249
|
ignoreForCodec: o
|
|
245
250
|
}) => {
|
|
246
|
-
const r = t.getSenders(), i =
|
|
251
|
+
const r = t.getSenders(), i = Ue(r);
|
|
247
252
|
if (!(i != null && i.track))
|
|
248
|
-
return
|
|
249
|
-
const u = await
|
|
250
|
-
return
|
|
253
|
+
return G;
|
|
254
|
+
const u = await Ve(i);
|
|
255
|
+
return J(u, o) ? G : ze(
|
|
251
256
|
{
|
|
252
257
|
mainCam: n,
|
|
253
258
|
resolutionMainCam: e,
|
|
@@ -257,33 +262,35 @@ const Ce = (n = new Error()) => {
|
|
|
257
262
|
},
|
|
258
263
|
s
|
|
259
264
|
);
|
|
260
|
-
},
|
|
265
|
+
}, fn = (n, {
|
|
261
266
|
ignoreForCodec: e,
|
|
262
267
|
onSetParameters: t
|
|
263
268
|
} = {}) => {
|
|
264
269
|
const s = async () => {
|
|
265
|
-
const { connection:
|
|
266
|
-
if (!
|
|
270
|
+
const { connection: d } = n;
|
|
271
|
+
if (!d)
|
|
267
272
|
throw new Error("connection is not exist");
|
|
268
|
-
return
|
|
269
|
-
connection:
|
|
273
|
+
return K({
|
|
274
|
+
connection: d,
|
|
270
275
|
onSetParameters: t,
|
|
271
276
|
ignoreForCodec: e
|
|
272
277
|
});
|
|
273
278
|
};
|
|
274
279
|
let o = s;
|
|
275
|
-
const r =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
280
|
+
const r = (d) => {
|
|
281
|
+
o = async () => {
|
|
282
|
+
const { mainCam: C, resolutionMainCam: f } = d, { connection: S } = n;
|
|
283
|
+
if (!S)
|
|
284
|
+
throw new Error("connection is not exist");
|
|
285
|
+
return K({
|
|
286
|
+
mainCam: C,
|
|
287
|
+
resolutionMainCam: f,
|
|
288
|
+
connection: S,
|
|
289
|
+
onSetParameters: t,
|
|
290
|
+
ignoreForCodec: e
|
|
291
|
+
});
|
|
292
|
+
}, o().catch(D);
|
|
293
|
+
};
|
|
287
294
|
return {
|
|
288
295
|
subscribe: () => {
|
|
289
296
|
n.onSession("main-cam-control", r);
|
|
@@ -299,52 +306,54 @@ const Ce = (n = new Error()) => {
|
|
|
299
306
|
return o();
|
|
300
307
|
}
|
|
301
308
|
};
|
|
302
|
-
},
|
|
309
|
+
}, Qe = (n) => n.getVideoTracks()[0], P = ({
|
|
303
310
|
mediaStream: n,
|
|
304
311
|
simulcastEncodings: e,
|
|
305
312
|
sendEncodings: t
|
|
306
313
|
}) => {
|
|
307
314
|
if (e && e.length > 0) {
|
|
308
|
-
const s = t ?? [], o =
|
|
315
|
+
const s = t ?? [], o = Qe(n);
|
|
316
|
+
if (o === void 0)
|
|
317
|
+
throw new Error("No video track");
|
|
309
318
|
return e.forEach((r, i) => {
|
|
310
319
|
const u = s[i] ?? {};
|
|
311
320
|
u.active = !0, r.rid !== void 0 && (u.rid = r.rid), r.scalabilityMode !== void 0 && (u.scalabilityMode = r.scalabilityMode);
|
|
312
|
-
const { maxBitrate:
|
|
321
|
+
const { maxBitrate: d, scaleResolutionDownBy: C } = te({
|
|
313
322
|
videoTrack: o,
|
|
314
323
|
targetSize: {
|
|
315
324
|
width: r.width,
|
|
316
325
|
height: r.height
|
|
317
326
|
}
|
|
318
327
|
});
|
|
319
|
-
u.maxBitrate =
|
|
328
|
+
u.maxBitrate = d, u.scaleResolutionDownBy = C, s[i] = u;
|
|
320
329
|
}), s;
|
|
321
330
|
}
|
|
322
331
|
return t;
|
|
323
|
-
},
|
|
332
|
+
}, Je = (n, e) => n.filter((s) => e.some((o) => o.clockRate === s.clockRate && o.mimeType === s.mimeType && o.channels === s.channels && o.sdpFmtpLine === s.sdpFmtpLine)), Ze = (n) => {
|
|
324
333
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, o = t === null ? [] : t.codecs;
|
|
325
|
-
return
|
|
326
|
-
},
|
|
334
|
+
return Je(s, o);
|
|
335
|
+
}, en = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
327
336
|
const o = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), i = o === -1 ? Number.MAX_VALUE : o, u = r === -1 ? Number.MAX_VALUE : r;
|
|
328
337
|
return i - u;
|
|
329
|
-
}),
|
|
338
|
+
}), nn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), I = (n, {
|
|
330
339
|
preferredMimeTypesVideoCodecs: e,
|
|
331
340
|
excludeMimeTypesVideoCodecs: t
|
|
332
341
|
}) => async (s) => {
|
|
333
342
|
var o;
|
|
334
343
|
try {
|
|
335
|
-
if (typeof s.setCodecPreferences == "function" && ((o = s.sender.track) == null ? void 0 : o.kind) === "video" && (e !== void 0 &&
|
|
336
|
-
const r =
|
|
344
|
+
if (typeof s.setCodecPreferences == "function" && ((o = s.sender.track) == null ? void 0 : o.kind) === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
345
|
+
const r = Ze("video"), i = nn(r, t), u = en(i, e);
|
|
337
346
|
s.setCodecPreferences(u);
|
|
338
347
|
}
|
|
339
|
-
Object.keys(n).length > 0 && await
|
|
348
|
+
Object.keys(n).length > 0 && await ae(s.sender, n);
|
|
340
349
|
} catch (r) {
|
|
341
350
|
c("updateTransceiver error", r);
|
|
342
351
|
}
|
|
343
|
-
},
|
|
344
|
-
if (!
|
|
352
|
+
}, j = (n) => {
|
|
353
|
+
if (!Se(n) && !fe(n))
|
|
345
354
|
throw n;
|
|
346
355
|
return { isSuccessful: !1 };
|
|
347
|
-
},
|
|
356
|
+
}, tn = ({ kind: n, readyState: e }) => n === "video" && e === "live", sn = /* @__PURE__ */ new Set([
|
|
348
357
|
"on",
|
|
349
358
|
"once",
|
|
350
359
|
"onceRace",
|
|
@@ -366,14 +375,11 @@ const Ce = (n = new Error()) => {
|
|
|
366
375
|
"isConfigured",
|
|
367
376
|
"isRegistered"
|
|
368
377
|
]);
|
|
369
|
-
class
|
|
378
|
+
class mn {
|
|
370
379
|
constructor(e, {
|
|
371
380
|
preferredMimeTypesVideoCodecs: t,
|
|
372
381
|
excludeMimeTypesVideoCodecs: s
|
|
373
382
|
} = {}) {
|
|
374
|
-
a(this, "sipConnector");
|
|
375
|
-
a(this, "preferredMimeTypesVideoCodecs");
|
|
376
|
-
a(this, "excludeMimeTypesVideoCodecs");
|
|
377
383
|
// @ts-expect-error: proxy method
|
|
378
384
|
a(this, "on");
|
|
379
385
|
// @ts-expect-error: proxy method
|
|
@@ -414,6 +420,9 @@ class dn {
|
|
|
414
420
|
a(this, "isConfigured");
|
|
415
421
|
// @ts-expect-error: proxy method
|
|
416
422
|
a(this, "isRegistered");
|
|
423
|
+
a(this, "sipConnector");
|
|
424
|
+
a(this, "preferredMimeTypesVideoCodecs");
|
|
425
|
+
a(this, "excludeMimeTypesVideoCodecs");
|
|
417
426
|
a(this, "connectToServer", async (e) => {
|
|
418
427
|
const {
|
|
419
428
|
userAgent: t,
|
|
@@ -422,9 +431,9 @@ class dn {
|
|
|
422
431
|
remoteAddress: r,
|
|
423
432
|
displayName: i,
|
|
424
433
|
name: u,
|
|
425
|
-
password:
|
|
426
|
-
isRegisteredUser:
|
|
427
|
-
isDisconnectOnFail:
|
|
434
|
+
password: d,
|
|
435
|
+
isRegisteredUser: C,
|
|
436
|
+
isDisconnectOnFail: f
|
|
428
437
|
} = e;
|
|
429
438
|
return c("connectToServer", e), this.sipConnector.connect({
|
|
430
439
|
userAgent: t,
|
|
@@ -432,10 +441,10 @@ class dn {
|
|
|
432
441
|
sipServerUrl: o,
|
|
433
442
|
remoteAddress: r,
|
|
434
443
|
displayName: i,
|
|
435
|
-
password:
|
|
444
|
+
password: d,
|
|
436
445
|
user: u,
|
|
437
|
-
register:
|
|
438
|
-
}).then((
|
|
446
|
+
register: C
|
|
447
|
+
}).then((S) => (c("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (c("connectToServer catch: error", S), f === !0 ? this.sipConnector.disconnect().then(() => j(S)).catch(() => j(S)) : j(S)));
|
|
439
448
|
});
|
|
440
449
|
a(this, "callToServer", async (e) => {
|
|
441
450
|
const {
|
|
@@ -445,27 +454,29 @@ class dn {
|
|
|
445
454
|
iceServers: r,
|
|
446
455
|
contentHint: i,
|
|
447
456
|
simulcastEncodings: u,
|
|
448
|
-
degradationPreference:
|
|
449
|
-
sendEncodings:
|
|
450
|
-
offerToReceiveAudio:
|
|
451
|
-
offerToReceiveVideo:
|
|
452
|
-
directionVideo:
|
|
453
|
-
directionAudio:
|
|
457
|
+
degradationPreference: d,
|
|
458
|
+
sendEncodings: C,
|
|
459
|
+
offerToReceiveAudio: f,
|
|
460
|
+
offerToReceiveVideo: S,
|
|
461
|
+
directionVideo: F,
|
|
462
|
+
directionAudio: V,
|
|
454
463
|
setRemoteStreams: m,
|
|
455
|
-
onBeforeProgressCall:
|
|
464
|
+
onBeforeProgressCall: g,
|
|
456
465
|
onSuccessProgressCall: h,
|
|
457
|
-
onEnterPurgatory:
|
|
466
|
+
onEnterPurgatory: p,
|
|
458
467
|
onEnterConference: y,
|
|
459
|
-
onFailProgressCall:
|
|
460
|
-
onFinishProgressCall:
|
|
461
|
-
onEndedCall:
|
|
468
|
+
onFailProgressCall: T,
|
|
469
|
+
onFinishProgressCall: E,
|
|
470
|
+
onEndedCall: M
|
|
462
471
|
} = e, A = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
463
472
|
onReadyRemoteStreams: m
|
|
464
473
|
}), v = this.resolveHandleReadyRemoteStreams({
|
|
465
|
-
onReadyRemoteStreams:
|
|
466
|
-
|
|
474
|
+
onReadyRemoteStreams: () => {
|
|
475
|
+
A().catch(D);
|
|
476
|
+
}
|
|
477
|
+
}), O = I(
|
|
467
478
|
{
|
|
468
|
-
degradationPreference:
|
|
479
|
+
degradationPreference: d
|
|
469
480
|
},
|
|
470
481
|
{
|
|
471
482
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
@@ -478,31 +489,31 @@ class dn {
|
|
|
478
489
|
extraHeaders: o,
|
|
479
490
|
iceServers: r,
|
|
480
491
|
contentHint: i,
|
|
481
|
-
offerToReceiveAudio:
|
|
482
|
-
offerToReceiveVideo:
|
|
483
|
-
directionVideo:
|
|
484
|
-
directionAudio:
|
|
485
|
-
sendEncodings:
|
|
492
|
+
offerToReceiveAudio: f,
|
|
493
|
+
offerToReceiveVideo: S,
|
|
494
|
+
directionVideo: F,
|
|
495
|
+
directionAudio: V,
|
|
496
|
+
sendEncodings: P({
|
|
486
497
|
mediaStream: s,
|
|
487
498
|
simulcastEncodings: u,
|
|
488
|
-
sendEncodings:
|
|
499
|
+
sendEncodings: C
|
|
489
500
|
}),
|
|
490
501
|
number: t,
|
|
491
502
|
onAddedTransceiver: O,
|
|
492
503
|
ontrack: v
|
|
493
504
|
}));
|
|
494
|
-
let
|
|
495
|
-
const w = (c("subscribeEnterConference: onEnterConference", y),
|
|
496
|
-
c("enterRoom", { _room:
|
|
505
|
+
let b = !1, _;
|
|
506
|
+
const w = (c("subscribeEnterConference: onEnterConference", y), p ?? y ? this.sipConnector.onSession("enterRoom", ({ room: l }) => {
|
|
507
|
+
c("enterRoom", { _room: l, isSuccessProgressCall: b }), _ = l, k(_) ? p && p() : y && y({ isSuccessProgressCall: b });
|
|
497
508
|
}) : () => {
|
|
498
|
-
}),
|
|
499
|
-
w(),
|
|
500
|
-
}),
|
|
501
|
-
throw c("onFail"),
|
|
502
|
-
},
|
|
503
|
-
c("onFinish"),
|
|
509
|
+
}), L = (l) => (c("onSuccess"), b = !0, A().catch(D), h && h({ isPurgatory: k(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
510
|
+
w(), M && M();
|
|
511
|
+
}), l), $ = (l) => {
|
|
512
|
+
throw c("onFail"), T && T(), w(), l;
|
|
513
|
+
}, H = () => {
|
|
514
|
+
c("onFinish"), E && E();
|
|
504
515
|
};
|
|
505
|
-
return c("onBeforeProgressCall"),
|
|
516
|
+
return c("onBeforeProgressCall"), g && g(t), N().then(L).catch((l) => $(l)).finally(H);
|
|
506
517
|
});
|
|
507
518
|
a(this, "disconnectFromServer", async () => this.sipConnector.disconnect().then(() => (c("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (c("disconnectFromServer: catch", e), { isSuccessful: !1 })));
|
|
508
519
|
a(this, "answerIncomingCall", async (e) => {
|
|
@@ -513,24 +524,26 @@ class dn {
|
|
|
513
524
|
contentHint: r,
|
|
514
525
|
simulcastEncodings: i,
|
|
515
526
|
degradationPreference: u,
|
|
516
|
-
sendEncodings:
|
|
517
|
-
offerToReceiveAudio:
|
|
518
|
-
offerToReceiveVideo:
|
|
519
|
-
directionVideo:
|
|
520
|
-
directionAudio:
|
|
521
|
-
setRemoteStreams:
|
|
527
|
+
sendEncodings: d,
|
|
528
|
+
offerToReceiveAudio: C,
|
|
529
|
+
offerToReceiveVideo: f,
|
|
530
|
+
directionVideo: S,
|
|
531
|
+
directionAudio: F,
|
|
532
|
+
setRemoteStreams: V,
|
|
522
533
|
onBeforeProgressCall: m,
|
|
523
|
-
onSuccessProgressCall:
|
|
534
|
+
onSuccessProgressCall: g,
|
|
524
535
|
onEnterPurgatory: h,
|
|
525
|
-
onEnterConference:
|
|
536
|
+
onEnterConference: p,
|
|
526
537
|
onFailProgressCall: y,
|
|
527
|
-
onFinishProgressCall:
|
|
528
|
-
onEndedCall:
|
|
529
|
-
} = e,
|
|
530
|
-
onReadyRemoteStreams:
|
|
538
|
+
onFinishProgressCall: T,
|
|
539
|
+
onEndedCall: E
|
|
540
|
+
} = e, M = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
541
|
+
onReadyRemoteStreams: V
|
|
531
542
|
}), A = this.resolveHandleReadyRemoteStreams({
|
|
532
|
-
onReadyRemoteStreams:
|
|
533
|
-
|
|
543
|
+
onReadyRemoteStreams: () => {
|
|
544
|
+
M().catch(D);
|
|
545
|
+
}
|
|
546
|
+
}), v = I(
|
|
534
547
|
{
|
|
535
548
|
degradationPreference: u
|
|
536
549
|
},
|
|
@@ -545,37 +558,37 @@ class dn {
|
|
|
545
558
|
extraHeaders: s,
|
|
546
559
|
iceServers: o,
|
|
547
560
|
contentHint: r,
|
|
548
|
-
offerToReceiveAudio:
|
|
549
|
-
offerToReceiveVideo:
|
|
550
|
-
directionVideo:
|
|
551
|
-
directionAudio:
|
|
552
|
-
sendEncodings:
|
|
561
|
+
offerToReceiveAudio: C,
|
|
562
|
+
offerToReceiveVideo: f,
|
|
563
|
+
directionVideo: S,
|
|
564
|
+
directionAudio: F,
|
|
565
|
+
sendEncodings: P({
|
|
553
566
|
mediaStream: t,
|
|
554
567
|
simulcastEncodings: i,
|
|
555
|
-
sendEncodings:
|
|
568
|
+
sendEncodings: d
|
|
556
569
|
}),
|
|
557
570
|
onAddedTransceiver: v,
|
|
558
571
|
ontrack: A
|
|
559
572
|
}), N = () => {
|
|
560
|
-
const { remoteCallerData:
|
|
561
|
-
return
|
|
573
|
+
const { remoteCallerData: l } = this.sipConnector;
|
|
574
|
+
return l.incomingNumber;
|
|
562
575
|
};
|
|
563
|
-
let
|
|
564
|
-
const w = (c("subscribeEnterConference: onEnterConference",
|
|
565
|
-
c("enterRoom", { _room:
|
|
576
|
+
let b = !1, _;
|
|
577
|
+
const w = (c("subscribeEnterConference: onEnterConference", p), h ?? p ? this.sipConnector.onSession("enterRoom", (l) => {
|
|
578
|
+
c("enterRoom", { _room: l, isSuccessProgressCall: b }), _ = l, k(_) ? h && h() : p && p({ isSuccessProgressCall: b });
|
|
566
579
|
}) : () => {
|
|
567
|
-
}),
|
|
568
|
-
w(),
|
|
569
|
-
}),
|
|
570
|
-
throw c("onFail"), y && y(), w(),
|
|
571
|
-
},
|
|
572
|
-
c("onFinish"),
|
|
580
|
+
}), L = (l) => (c("onSuccess"), b = !0, M().catch(D), g && g({ isPurgatory: k(_) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
581
|
+
w(), E && E();
|
|
582
|
+
}), l), $ = (l) => {
|
|
583
|
+
throw c("onFail"), y && y(), w(), l;
|
|
584
|
+
}, H = () => {
|
|
585
|
+
c("onFinish"), T && T();
|
|
573
586
|
};
|
|
574
587
|
if (c("onBeforeProgressCall"), m) {
|
|
575
|
-
const
|
|
576
|
-
m(
|
|
588
|
+
const l = N();
|
|
589
|
+
m(l);
|
|
577
590
|
}
|
|
578
|
-
return O().then(
|
|
591
|
+
return O().then(L).catch((l) => $(l)).finally(H);
|
|
579
592
|
});
|
|
580
593
|
a(this, "updatePresentation", async ({
|
|
581
594
|
mediaStream: e,
|
|
@@ -585,28 +598,28 @@ class dn {
|
|
|
585
598
|
simulcastEncodings: r,
|
|
586
599
|
degradationPreference: i,
|
|
587
600
|
sendEncodings: u,
|
|
588
|
-
preferredMimeTypesVideoCodecs:
|
|
589
|
-
excludeMimeTypesVideoCodecs:
|
|
601
|
+
preferredMimeTypesVideoCodecs: d,
|
|
602
|
+
excludeMimeTypesVideoCodecs: C
|
|
590
603
|
}) => {
|
|
591
|
-
const
|
|
604
|
+
const f = I(
|
|
592
605
|
{
|
|
593
606
|
degradationPreference: i
|
|
594
607
|
},
|
|
595
608
|
{
|
|
596
|
-
preferredMimeTypesVideoCodecs:
|
|
597
|
-
excludeMimeTypesVideoCodecs:
|
|
609
|
+
preferredMimeTypesVideoCodecs: d,
|
|
610
|
+
excludeMimeTypesVideoCodecs: C
|
|
598
611
|
}
|
|
599
612
|
);
|
|
600
613
|
return c("updatePresentation"), this.sipConnector.updatePresentation(e, {
|
|
601
614
|
isP2P: t,
|
|
602
615
|
maxBitrate: s,
|
|
603
616
|
contentHint: o,
|
|
604
|
-
sendEncodings:
|
|
617
|
+
sendEncodings: P({
|
|
605
618
|
mediaStream: e,
|
|
606
619
|
simulcastEncodings: r,
|
|
607
620
|
sendEncodings: u
|
|
608
621
|
}),
|
|
609
|
-
onAddedTransceiver:
|
|
622
|
+
onAddedTransceiver: f
|
|
610
623
|
});
|
|
611
624
|
});
|
|
612
625
|
a(this, "startPresentation", async ({
|
|
@@ -617,16 +630,16 @@ class dn {
|
|
|
617
630
|
simulcastEncodings: r,
|
|
618
631
|
degradationPreference: i,
|
|
619
632
|
sendEncodings: u,
|
|
620
|
-
preferredMimeTypesVideoCodecs:
|
|
621
|
-
excludeMimeTypesVideoCodecs:
|
|
622
|
-
},
|
|
623
|
-
const
|
|
633
|
+
preferredMimeTypesVideoCodecs: d,
|
|
634
|
+
excludeMimeTypesVideoCodecs: C
|
|
635
|
+
}, f) => {
|
|
636
|
+
const S = I(
|
|
624
637
|
{
|
|
625
638
|
degradationPreference: i
|
|
626
639
|
},
|
|
627
640
|
{
|
|
628
|
-
preferredMimeTypesVideoCodecs:
|
|
629
|
-
excludeMimeTypesVideoCodecs:
|
|
641
|
+
preferredMimeTypesVideoCodecs: d,
|
|
642
|
+
excludeMimeTypesVideoCodecs: C
|
|
630
643
|
}
|
|
631
644
|
);
|
|
632
645
|
return c("startPresentation"), this.sipConnector.startPresentation(
|
|
@@ -635,14 +648,14 @@ class dn {
|
|
|
635
648
|
isP2P: t,
|
|
636
649
|
maxBitrate: s,
|
|
637
650
|
contentHint: o,
|
|
638
|
-
sendEncodings:
|
|
651
|
+
sendEncodings: P({
|
|
639
652
|
mediaStream: e,
|
|
640
653
|
simulcastEncodings: r,
|
|
641
654
|
sendEncodings: u
|
|
642
655
|
}),
|
|
643
|
-
onAddedTransceiver:
|
|
656
|
+
onAddedTransceiver: S
|
|
644
657
|
},
|
|
645
|
-
|
|
658
|
+
f
|
|
646
659
|
);
|
|
647
660
|
});
|
|
648
661
|
a(this, "stopShareSipConnector", async ({ isP2P: e = !1 } = {}) => (c("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
@@ -651,23 +664,20 @@ class dn {
|
|
|
651
664
|
c(t);
|
|
652
665
|
})));
|
|
653
666
|
a(this, "sendRefusalToTurnOnMic", async () => {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
});
|
|
667
|
+
this.sipConnector.isCallActive && (c("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
|
|
668
|
+
c("sendRefusalToTurnOnMic: error", e);
|
|
669
|
+
}));
|
|
658
670
|
});
|
|
659
671
|
a(this, "sendRefusalToTurnOnCam", async () => {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
});
|
|
672
|
+
this.sipConnector.isCallActive && (c("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
|
|
673
|
+
c("sendRefusalToTurnOnCam: error", e);
|
|
674
|
+
}));
|
|
664
675
|
});
|
|
665
676
|
a(this, "sendMediaState", async ({
|
|
666
677
|
isEnabledCam: e,
|
|
667
678
|
isEnabledMic: t
|
|
668
679
|
}) => {
|
|
669
|
-
|
|
670
|
-
return c("sendMediaState"), this.sipConnector.sendMediaState({ cam: e, mic: t });
|
|
680
|
+
this.sipConnector.isCallActive && (c("sendMediaState"), await this.sipConnector.sendMediaState({ cam: e, mic: t }));
|
|
671
681
|
});
|
|
672
682
|
a(this, "replaceMediaStream", async (e, {
|
|
673
683
|
deleteExisting: t,
|
|
@@ -676,9 +686,9 @@ class dn {
|
|
|
676
686
|
contentHint: r,
|
|
677
687
|
simulcastEncodings: i,
|
|
678
688
|
degradationPreference: u,
|
|
679
|
-
sendEncodings:
|
|
689
|
+
sendEncodings: d
|
|
680
690
|
} = {}) => {
|
|
681
|
-
const
|
|
691
|
+
const C = I(
|
|
682
692
|
{
|
|
683
693
|
degradationPreference: u
|
|
684
694
|
},
|
|
@@ -692,39 +702,39 @@ class dn {
|
|
|
692
702
|
addMissing: s,
|
|
693
703
|
forceRenegotiation: o,
|
|
694
704
|
contentHint: r,
|
|
695
|
-
sendEncodings:
|
|
705
|
+
sendEncodings: P({
|
|
696
706
|
mediaStream: e,
|
|
697
707
|
simulcastEncodings: i,
|
|
698
|
-
sendEncodings:
|
|
708
|
+
sendEncodings: d
|
|
699
709
|
}),
|
|
700
|
-
onAddedTransceiver:
|
|
710
|
+
onAddedTransceiver: C
|
|
701
711
|
});
|
|
702
712
|
});
|
|
703
713
|
a(this, "askPermissionToEnableCam", async () => {
|
|
704
|
-
|
|
705
|
-
return c("askPermissionToEnableCam"), this.sipConnector.askPermissionToEnableCam();
|
|
714
|
+
this.sipConnector.isCallActive && (c("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam());
|
|
706
715
|
});
|
|
707
716
|
a(this, "resolveHandleReadyRemoteStreamsDebounced", ({
|
|
708
717
|
onReadyRemoteStreams: e
|
|
709
|
-
}) =>
|
|
718
|
+
}) => me(() => {
|
|
710
719
|
const t = this.sipConnector.getRemoteStreams();
|
|
711
720
|
c("remoteStreams", t), t && e(t);
|
|
712
721
|
}, 200));
|
|
722
|
+
// eslint-disable-next-line class-methods-use-this
|
|
713
723
|
a(this, "resolveHandleReadyRemoteStreams", ({
|
|
714
724
|
onReadyRemoteStreams: e
|
|
715
725
|
}) => ({ track: t }) => {
|
|
716
|
-
|
|
726
|
+
tn(t) && e();
|
|
717
727
|
});
|
|
718
728
|
a(this, "getRemoteStreams", () => (c("getRemoteStreams"), this.sipConnector.getRemoteStreams()));
|
|
719
729
|
a(this, "onUseLicense", (e) => (c("onUseLicense"), this.sipConnector.onSession("useLicense", e)));
|
|
720
730
|
a(this, "onMustStopPresentation", (e) => (c("onMustStopPresentation"), this.sipConnector.onSession("mustStopPresentation", e)));
|
|
721
|
-
a(this, "onMoveToSpectators", (e) => (c("onMoveToSpectators"), this.sipConnector.onSession(
|
|
722
|
-
a(this, "onMoveToParticipants", (e) => (c("onMoveToParticipants"), this.sipConnector.onSession(
|
|
731
|
+
a(this, "onMoveToSpectators", (e) => (c("onMoveToSpectators"), this.sipConnector.onSession(ue, e)));
|
|
732
|
+
a(this, "onMoveToParticipants", (e) => (c("onMoveToParticipants"), this.sipConnector.onSession(de, e)));
|
|
723
733
|
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.sipConnector = e, new Proxy(this, {
|
|
724
734
|
get: (o, r, i) => {
|
|
725
|
-
if (typeof r == "string" &&
|
|
726
|
-
const
|
|
727
|
-
return typeof
|
|
735
|
+
if (typeof r == "string" && sn.has(r) && r in this.sipConnector) {
|
|
736
|
+
const d = Reflect.get(this.sipConnector, r, this.sipConnector);
|
|
737
|
+
return typeof d == "function" ? d.bind(this.sipConnector) : d;
|
|
728
738
|
}
|
|
729
739
|
const u = Reflect.get(o, r, i);
|
|
730
740
|
return typeof u == "function" ? u.bind(o) : u;
|
|
@@ -733,23 +743,23 @@ class dn {
|
|
|
733
743
|
}
|
|
734
744
|
}
|
|
735
745
|
export {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
746
|
+
B as EEventsMainCAM,
|
|
747
|
+
Rn as EEventsMic,
|
|
748
|
+
gn as EEventsSyncMediaState,
|
|
749
|
+
yn as EMimeTypesVideoCodecs,
|
|
750
|
+
Tn as EUseLicense,
|
|
751
|
+
En as SipConnector,
|
|
752
|
+
mn as SipConnectorFacade,
|
|
753
|
+
Mn as causes,
|
|
754
|
+
bn as constants,
|
|
755
|
+
Bn as debug,
|
|
756
|
+
_n as disableDebug,
|
|
757
|
+
An as enableDebug,
|
|
758
|
+
vn as eventNames,
|
|
759
|
+
Ve as getCodecFromSender,
|
|
760
|
+
On as hasCanceledCallError,
|
|
761
|
+
Nn as hasCanceledStartPresentationError,
|
|
762
|
+
fn as resolveVideoSendingBalancer,
|
|
763
|
+
ae as setParametersToSender,
|
|
764
|
+
Sn as tools
|
|
755
765
|
};
|