sip-connector 15.1.0 → 15.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/README.md +160 -11
- package/dist/{@SipConnector-G96OmJEP.js → @SipConnector-BEZk1hmx.js} +548 -267
- package/dist/@SipConnector-hpySQIBa.cjs +1 -0
- package/dist/SipConnector/@SipConnector.d.ts +2 -0
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/SipConnectorFacade/SipConnectorFacade.d.ts +3 -0
- package/dist/StatsManager/@StatsManager.d.ts +19 -0
- package/dist/StatsManager/eventNames.d.ts +2 -0
- package/dist/StatsManager/index.d.ts +2 -0
- package/dist/StatsPeerConnection/StatsPeerConnection.d.ts +20 -0
- package/dist/StatsPeerConnection/__fixtures__/callStaticsState.d.ts +3923 -0
- package/dist/StatsPeerConnection/constants.d.ts +14 -0
- package/dist/StatsPeerConnection/eventNames.d.ts +10 -0
- package/dist/StatsPeerConnection/index.d.ts +4 -0
- package/dist/StatsPeerConnection/parseStatsReports.d.ts +14 -0
- package/dist/StatsPeerConnection/requestAllStatistics.d.ts +11 -0
- package/dist/StatsPeerConnection/typings.d.ts +194 -0
- package/dist/StatsPeerConnection/utils/hasAvailableStats.d.ts +2 -0
- package/dist/StatsPeerConnection/utils/index.d.ts +3 -0
- package/dist/StatsPeerConnection/utils/now.d.ts +2 -0
- package/dist/StatsPeerConnection/utils/statsReportToObject.d.ts +4 -0
- package/dist/{videoSendingBalancer → VideoSendingBalancer}/ParametersSetterWithQueue.d.ts +2 -2
- package/dist/{videoSendingBalancer → VideoSendingBalancer}/SenderBalancer.d.ts +2 -2
- package/dist/{videoSendingBalancer → VideoSendingBalancer}/VideoSendingBalancer.d.ts +2 -2
- package/dist/{videoSendingBalancer → VideoSendingBalancer}/types.d.ts +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +270 -255
- package/dist/tools/createUaParser/createUaParser.d.ts +4 -0
- package/dist/tools/createUaParser/index.d.ts +1 -0
- package/dist/tools/createUaParser/isElectronEnvironment.d.ts +2 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/{setParametersToSender → tools/setParametersToSender}/configureDegradationPreference.d.ts +1 -1
- package/dist/{setParametersToSender → tools/setParametersToSender}/configureEncodings.d.ts +1 -1
- package/dist/{setParametersToSender → tools/setParametersToSender}/index.d.ts +1 -1
- package/dist/{setParametersToSender → tools/setParametersToSender}/setEncodingsToSender.d.ts +2 -2
- package/dist/{setParametersToSender → tools/setParametersToSender}/setMaxBitrateToSender.d.ts +1 -1
- package/dist/tools/setParametersToSender/setParametersToSender.d.ts +4 -0
- package/dist/{setParametersToSender → tools/setParametersToSender}/types.d.ts +1 -1
- package/package.json +7 -13
- package/dist/@SipConnector-BBhQzo-W.cjs +0 -1
- package/dist/setParametersToSender/setParametersToSender.d.ts +0 -4
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/CodecProvider.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/SenderFinder.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/TaskQueue.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/VideoSendingEventHandler.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/calcMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/calcMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/hasAv1Codec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/index.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcBitrate/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcResolution/calcScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/calcResolution/index.d.ts +0 -0
- /package/dist/{videoSendingBalancer → VideoSendingBalancer}/index.d.ts +0 -0
- /package/dist/{setParametersToSender → tools/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → tools/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{setParametersToSender → tools/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{setParametersToSender → tools/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{setParametersToSender → tools/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,53 +1,136 @@
|
|
|
1
1
|
import "events-constructor";
|
|
2
|
-
import { E as R, O as
|
|
3
|
-
import { b as
|
|
4
|
-
import { isCanceledError as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { debounce as
|
|
7
|
-
import {
|
|
2
|
+
import { E as R, O as ae, l as i, p as de, a as O } from "./@SipConnector-BEZk1hmx.js";
|
|
3
|
+
import { c as xn, b as Un, S as Vn, f as Ln, d as Hn, e as $n, h as Wn } from "./@SipConnector-BEZk1hmx.js";
|
|
4
|
+
import { isCanceledError as Y } from "@krivega/cancelable-promise";
|
|
5
|
+
import { hasCanceledError as ue } from "repeated-calls";
|
|
6
|
+
import { debounce as le } from "ts-debounce";
|
|
7
|
+
import { UAParser as he } from "ua-parser-js";
|
|
8
|
+
import { sequentPromises as fe } from "sequent-promises";
|
|
9
|
+
import { createStackPromises as Se } from "stack-promises";
|
|
8
10
|
import k from "debug";
|
|
9
|
-
import { default as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (K(n))
|
|
11
|
+
import { default as Jn } from "debug";
|
|
12
|
+
const me = (n) => n instanceof Object && ("originator" in n || "cause" in n), Pn = (n) => {
|
|
13
|
+
if (Y(n))
|
|
13
14
|
return !0;
|
|
14
|
-
if (!
|
|
15
|
+
if (!me(n))
|
|
15
16
|
return !1;
|
|
16
17
|
const { originator: e, cause: t } = n;
|
|
17
|
-
return typeof t == "string" ? t === R.REQUEST_TIMEOUT || t === R.REJECTED || e ===
|
|
18
|
-
},
|
|
18
|
+
return typeof t == "string" ? t === R.REQUEST_TIMEOUT || t === R.REJECTED || e === ae.LOCAL && (t === R.CANCELED || t === R.BYE) : !1;
|
|
19
|
+
}, Ce = () => globalThis.process?.versions?.electron !== void 0, q = () => {
|
|
20
|
+
const n = new he(), { name: e } = n.getBrowser(), t = Ce();
|
|
21
|
+
return {
|
|
22
|
+
isChrome: e === "Chrome" || t
|
|
23
|
+
};
|
|
24
|
+
}, x = (n) => {
|
|
25
|
+
const { url: e, cause: t } = n;
|
|
26
|
+
let r = e;
|
|
27
|
+
return (t === R.BAD_MEDIA_DESCRIPTION || t === R.NOT_FOUND) && (r = `${n.message.to.uri.user}@${n.message.to.uri.host}`), r;
|
|
28
|
+
};
|
|
29
|
+
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 || {});
|
|
30
|
+
const ge = new Error("Unknown error"), pe = (n = ge) => {
|
|
31
|
+
const { cause: e, socket: t } = n;
|
|
32
|
+
let r = "CONNECT_SERVER_FAILED";
|
|
33
|
+
switch (e) {
|
|
34
|
+
case "Forbidden": {
|
|
35
|
+
r = "WRONG_USER_OR_PASSWORD";
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case R.BAD_MEDIA_DESCRIPTION: {
|
|
39
|
+
r = "BAD_MEDIA_ERROR";
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case R.NOT_FOUND: {
|
|
43
|
+
r = "NOT_FOUND_ERROR";
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
default:
|
|
47
|
+
t !== void 0 && t._ws?.readyState === 3 ? r = "WS_CONNECTION_FAILED" : x(n) !== void 0 && x(n) !== "" && (r = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
48
|
+
}
|
|
49
|
+
return r;
|
|
50
|
+
}, Re = (n) => {
|
|
51
|
+
let e = "";
|
|
52
|
+
try {
|
|
53
|
+
e = JSON.stringify(n);
|
|
54
|
+
} catch (t) {
|
|
55
|
+
i("failed to stringify message", t);
|
|
56
|
+
}
|
|
57
|
+
return e;
|
|
58
|
+
}, ye = new Error("Unknown error"), ve = (n = ye) => {
|
|
59
|
+
const { code: e, cause: t, message: r } = n, s = x(n), o = { code: "", cause: "", message: "" };
|
|
60
|
+
return typeof r == "object" && r !== null ? o.message = Re(r) : r && (o.message = String(r)), s !== void 0 && s !== "" && (o.link = s), e !== void 0 && e !== "" && (o.code = e), t !== void 0 && t !== "" && (o.cause = t), o;
|
|
61
|
+
}, Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
62
|
+
__proto__: null,
|
|
63
|
+
EErrorTypes: z,
|
|
64
|
+
getLinkError: x,
|
|
65
|
+
getTypeFromError: pe,
|
|
66
|
+
getValuesFromError: ve
|
|
67
|
+
}, Symbol.toStringTag, { value: "Module" })), Ee = ({
|
|
68
|
+
sessionId: n,
|
|
69
|
+
remoteAddress: e,
|
|
70
|
+
isMutedAudio: t,
|
|
71
|
+
isMutedVideo: r,
|
|
72
|
+
isRegistered: s,
|
|
73
|
+
isPresentationCall: o
|
|
74
|
+
}) => {
|
|
75
|
+
const c = [], a = t ? "0" : "1", d = r ? "0" : "1";
|
|
76
|
+
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${d}`), (s === !1 || s === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Session: ${n}`), o === !0 && c.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Remote: ${e}`), c;
|
|
77
|
+
}, Me = "[@*!|]", be = "_", Be = (n) => {
|
|
78
|
+
let e = n;
|
|
79
|
+
return e = e.replaceAll(new RegExp(Me, "g"), be), e;
|
|
80
|
+
}, _e = ({
|
|
81
|
+
appName: n,
|
|
82
|
+
appVersion: e,
|
|
83
|
+
browserName: t,
|
|
84
|
+
browserVersion: r
|
|
85
|
+
}) => {
|
|
86
|
+
const o = `${Be(n)} ${e}`;
|
|
87
|
+
return `ChromeNew - ${t === void 0 ? o : `${t} ${r}, ${o}`}`;
|
|
88
|
+
}, Ae = ({
|
|
89
|
+
isUnifiedSdpSemantic: n,
|
|
90
|
+
appVersion: e,
|
|
91
|
+
browserName: t,
|
|
92
|
+
browserVersion: r,
|
|
93
|
+
appName: s
|
|
94
|
+
}) => n ? _e({ appVersion: e, browserName: t, browserVersion: r, appName: s }) : "Chrome", Z = "purgatory", U = (n) => n === Z, Ne = (n) => (e) => [...e].map((r) => async () => n(r)), Pe = async ({
|
|
95
|
+
accumulatedKeys: n,
|
|
96
|
+
sendKey: e,
|
|
97
|
+
canRunTask: t
|
|
98
|
+
}) => {
|
|
99
|
+
const s = Ne(e)(n);
|
|
100
|
+
return fe(s, t);
|
|
101
|
+
}, Oe = (n, e) => (n.degradationPreference = e.degradationPreference, n), we = (n, e) => {
|
|
19
102
|
n.encodings ??= [];
|
|
20
103
|
for (let t = n.encodings.length; t < e; t += 1)
|
|
21
104
|
n.encodings.push({});
|
|
22
105
|
return n;
|
|
23
|
-
},
|
|
24
|
-
if (
|
|
106
|
+
}, ee = (n) => (e, t) => t !== void 0 && e !== t || t === void 0 && e !== n, De = ee(), ke = (n, e) => {
|
|
107
|
+
if (De(n, e))
|
|
25
108
|
return n;
|
|
26
|
-
},
|
|
27
|
-
const t = n.maxBitrate, r =
|
|
109
|
+
}, Ie = (n, e) => {
|
|
110
|
+
const t = n.maxBitrate, r = ke(e, t);
|
|
28
111
|
return r !== void 0 && (n.maxBitrate = r), n;
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
),
|
|
32
|
-
const t = n === void 0 ? void 0 : Math.max(n,
|
|
33
|
-
if (t !== void 0 &&
|
|
112
|
+
}, ne = 1, Fe = ee(
|
|
113
|
+
ne
|
|
114
|
+
), xe = (n, e) => {
|
|
115
|
+
const t = n === void 0 ? void 0 : Math.max(n, ne);
|
|
116
|
+
if (t !== void 0 && Fe(
|
|
34
117
|
t,
|
|
35
118
|
e
|
|
36
119
|
))
|
|
37
120
|
return t;
|
|
38
|
-
},
|
|
39
|
-
const t = n.scaleResolutionDownBy, r =
|
|
121
|
+
}, Ue = (n, e) => {
|
|
122
|
+
const t = n.scaleResolutionDownBy, r = xe(
|
|
40
123
|
e,
|
|
41
124
|
t
|
|
42
125
|
);
|
|
43
126
|
return r !== void 0 && (n.scaleResolutionDownBy = r), n;
|
|
44
|
-
},
|
|
127
|
+
}, Ve = (n, e) => {
|
|
45
128
|
const t = e.encodings?.length ?? 0;
|
|
46
|
-
return
|
|
129
|
+
return we(n, t), n.encodings.forEach((r, s) => {
|
|
47
130
|
const o = (e?.encodings ?? [])[s], c = o?.maxBitrate, a = o?.scaleResolutionDownBy;
|
|
48
|
-
|
|
131
|
+
Ie(r, c), Ue(r, a);
|
|
49
132
|
}), n;
|
|
50
|
-
},
|
|
133
|
+
}, Le = (n, e) => {
|
|
51
134
|
if (n.codecs?.length !== e.codecs?.length)
|
|
52
135
|
return !0;
|
|
53
136
|
for (let t = 0; t < (n.codecs?.length ?? 0); t++)
|
|
@@ -64,15 +147,15 @@ const le = (n) => n instanceof Object && ("originator" in n || "cause" in n), bn
|
|
|
64
147
|
if (JSON.stringify(n.encodings[t]) !== JSON.stringify(e.encodings[t]))
|
|
65
148
|
return !0;
|
|
66
149
|
return n.rtcp?.cname !== e.rtcp?.cname || n.rtcp?.reducedSize !== e.rtcp?.reducedSize || n.degradationPreference !== e.degradationPreference;
|
|
67
|
-
},
|
|
150
|
+
}, J = async (n, e) => {
|
|
68
151
|
const t = n.getParameters(), r = JSON.parse(
|
|
69
152
|
JSON.stringify(t)
|
|
70
153
|
);
|
|
71
|
-
|
|
72
|
-
const s =
|
|
154
|
+
Ve(t, e), Oe(t, e);
|
|
155
|
+
const s = Le(r, t);
|
|
73
156
|
return s && await n.setParameters(t), { parameters: t, isChanged: s };
|
|
74
|
-
},
|
|
75
|
-
const { isChanged: r, parameters: s } = await
|
|
157
|
+
}, te = async (n, e, t) => {
|
|
158
|
+
const { isChanged: r, parameters: s } = await J(n, {
|
|
76
159
|
encodings: [
|
|
77
160
|
{
|
|
78
161
|
scaleResolutionDownBy: e.scaleResolutionDownBy,
|
|
@@ -81,24 +164,81 @@ const le = (n) => n instanceof Object && ("originator" in n || "cause" in n), bn
|
|
|
81
164
|
]
|
|
82
165
|
});
|
|
83
166
|
return r && t && t(s), { isChanged: r, parameters: s };
|
|
84
|
-
},
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
167
|
+
}, He = (n) => (t) => (i("onStartMainCam"), n.on("api:admin-start-main-cam", t)), $e = (n) => (t) => (i("onStartMic"), n.on("api:admin-start-mic", t)), We = (n) => (t) => (i("onStopMainCam"), n.on("api:admin-stop-main-cam", t)), Qe = (n) => (t) => (i("onStopMic"), n.on("api:admin-stop-mic", t)), Je = ({ sipConnector: n }) => {
|
|
168
|
+
const e = (S, C) => ({ isSyncForced: g }) => {
|
|
169
|
+
if (g === !0) {
|
|
170
|
+
S();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
C();
|
|
174
|
+
}, t = He(n), r = We(n), s = $e(n), o = Qe(n);
|
|
175
|
+
let c, a, d, l;
|
|
176
|
+
const f = ({
|
|
177
|
+
onStartMainCamForced: S,
|
|
178
|
+
onStartMainCamNotForced: C,
|
|
179
|
+
onStopMainCamForced: g,
|
|
180
|
+
onStopMainCamNotForced: p,
|
|
181
|
+
onStartMicForced: y,
|
|
182
|
+
onStartMicNotForced: E,
|
|
183
|
+
onStopMicForced: M,
|
|
184
|
+
onStopMicNotForced: b
|
|
185
|
+
}) => {
|
|
186
|
+
const B = e(
|
|
187
|
+
S,
|
|
188
|
+
C
|
|
189
|
+
);
|
|
190
|
+
c = t(B);
|
|
191
|
+
const _ = e(
|
|
192
|
+
g,
|
|
193
|
+
p
|
|
194
|
+
);
|
|
195
|
+
a = r(_);
|
|
196
|
+
const A = e(y, E);
|
|
197
|
+
d = s(A);
|
|
198
|
+
const N = e(M, b);
|
|
199
|
+
l = o(N);
|
|
200
|
+
}, h = () => {
|
|
201
|
+
c?.(), a?.(), d?.(), l?.();
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
start: (S) => {
|
|
205
|
+
f(S);
|
|
206
|
+
},
|
|
207
|
+
stop: () => {
|
|
208
|
+
h();
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}, On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
212
|
+
__proto__: null,
|
|
213
|
+
PURGATORY_CONFERENCE_NUMBER: Z,
|
|
214
|
+
createSyncMediaState: Je,
|
|
215
|
+
createUaParser: q,
|
|
216
|
+
error: Te,
|
|
217
|
+
getExtraHeaders: Ee,
|
|
218
|
+
getUserAgent: Ae,
|
|
219
|
+
hasPurgatory: U,
|
|
220
|
+
prepareMediaStream: de,
|
|
221
|
+
sendDtmfAccumulated: Pe,
|
|
222
|
+
setEncodingsToSender: te,
|
|
223
|
+
setParametersToSender: J
|
|
224
|
+
}, Symbol.toStringTag, { value: "Module" })), wn = () => q().isChrome, Xe = (n) => n.getVideoTracks()[0], je = 1e6, m = (n) => n * je, re = m(0.06), se = m(4), Ge = (n) => n <= 64 ? re : n <= 128 ? m(0.12) : n <= 256 ? m(0.25) : n <= 384 ? m(0.32) : n <= 426 ? m(0.38) : n <= 640 ? m(0.5) : n <= 848 ? m(0.7) : n <= 1280 ? m(1) : n <= 1920 ? m(2) : se, oe = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Ke = "av1", Ye = (n) => oe(n, Ke), qe = 0.6, X = (n, e) => Ye(e) ? n * qe : n, ze = (n) => X(re, n), Ze = (n) => X(se, n), Q = (n, e) => {
|
|
225
|
+
const t = Ge(n);
|
|
226
|
+
return X(t, e);
|
|
227
|
+
}, $ = 1, ie = ({
|
|
88
228
|
videoTrack: n,
|
|
89
229
|
targetSize: e
|
|
90
230
|
}) => {
|
|
91
231
|
const t = n.getSettings(), r = t.width, s = t.height, o = r === void 0 ? $ : r / e.width, c = s === void 0 ? $ : s / e.height;
|
|
92
232
|
return Math.max(o, c, $);
|
|
93
|
-
},
|
|
94
|
-
class
|
|
95
|
-
// eslint-disable-next-line class-methods-use-this
|
|
233
|
+
}, en = (n) => [...n.keys()].map((e) => n.get(e)), nn = (n, e) => en(n).find((t) => t?.type === e), tn = async (n) => n.getStats().then((e) => nn(e, "codec")?.mimeType);
|
|
234
|
+
class rn {
|
|
235
|
+
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
96
236
|
async getCodecFromSender(e) {
|
|
97
|
-
return await
|
|
237
|
+
return await tn(e) ?? "";
|
|
98
238
|
}
|
|
99
239
|
}
|
|
100
|
-
class
|
|
101
|
-
stackPromises =
|
|
240
|
+
class sn {
|
|
241
|
+
stackPromises = Se({
|
|
102
242
|
noRunIsNotActual: !0
|
|
103
243
|
});
|
|
104
244
|
/**
|
|
@@ -122,20 +262,20 @@ class Ie {
|
|
|
122
262
|
});
|
|
123
263
|
}
|
|
124
264
|
}
|
|
125
|
-
class
|
|
265
|
+
class on {
|
|
126
266
|
taskQueue;
|
|
127
267
|
onSetParameters;
|
|
128
268
|
constructor(e) {
|
|
129
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
269
|
+
this.onSetParameters = e, this.taskQueue = new sn();
|
|
130
270
|
}
|
|
131
271
|
async setEncodingsToSender(e, t) {
|
|
132
|
-
return this.taskQueue.add(async () =>
|
|
272
|
+
return this.taskQueue.add(async () => te(e, t, this.onSetParameters));
|
|
133
273
|
}
|
|
134
274
|
stop() {
|
|
135
275
|
this.taskQueue.stop();
|
|
136
276
|
}
|
|
137
277
|
}
|
|
138
|
-
class
|
|
278
|
+
class cn {
|
|
139
279
|
ignoreForCodec;
|
|
140
280
|
senderFinder;
|
|
141
281
|
codecProvider;
|
|
@@ -168,7 +308,7 @@ class xe {
|
|
|
168
308
|
if (!s?.track)
|
|
169
309
|
return this.resultNoChanged;
|
|
170
310
|
const o = await this.codecProvider.getCodecFromSender(s);
|
|
171
|
-
if (
|
|
311
|
+
if (oe(o, this.ignoreForCodec))
|
|
172
312
|
return this.resultNoChanged;
|
|
173
313
|
const { mainCam: c, resolutionMainCam: a } = t ?? {};
|
|
174
314
|
return this.processSender(
|
|
@@ -188,14 +328,14 @@ class xe {
|
|
|
188
328
|
async processSender(e, t) {
|
|
189
329
|
const { mainCam: r, resolutionMainCam: s } = e;
|
|
190
330
|
switch (r) {
|
|
191
|
-
case
|
|
331
|
+
case O.PAUSE_MAIN_CAM:
|
|
192
332
|
return this.downgradeResolutionSender(t);
|
|
193
|
-
case
|
|
333
|
+
case O.RESUME_MAIN_CAM:
|
|
194
334
|
return this.setBitrateByTrackResolution(t);
|
|
195
|
-
case
|
|
335
|
+
case O.MAX_MAIN_CAM_RESOLUTION:
|
|
196
336
|
return s !== void 0 ? this.setResolutionSender(s, t) : this.setBitrateByTrackResolution(t);
|
|
197
|
-
case
|
|
198
|
-
case
|
|
337
|
+
case O.ADMIN_STOP_MAIN_CAM:
|
|
338
|
+
case O.ADMIN_START_MAIN_CAM:
|
|
199
339
|
case void 0:
|
|
200
340
|
return this.setBitrateByTrackResolution(t);
|
|
201
341
|
default:
|
|
@@ -210,7 +350,7 @@ class xe {
|
|
|
210
350
|
async downgradeResolutionSender(e) {
|
|
211
351
|
const { sender: t, codec: r } = e, s = {
|
|
212
352
|
scaleResolutionDownBy: 200,
|
|
213
|
-
maxBitrate:
|
|
353
|
+
maxBitrate: ze(r)
|
|
214
354
|
};
|
|
215
355
|
return this.parametersSetter.setEncodingsToSender(t, s);
|
|
216
356
|
}
|
|
@@ -220,7 +360,7 @@ class xe {
|
|
|
220
360
|
* @returns Promise с результатом
|
|
221
361
|
*/
|
|
222
362
|
async setBitrateByTrackResolution(e) {
|
|
223
|
-
const { sender: t, videoTrack: r, codec: s } = e, c = r.getSettings().width, a = c === void 0 ?
|
|
363
|
+
const { sender: t, videoTrack: r, codec: s } = e, c = r.getSettings().width, a = c === void 0 ? Ze(s) : Q(c, s);
|
|
224
364
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
225
365
|
scaleResolutionDownBy: 1,
|
|
226
366
|
maxBitrate: a
|
|
@@ -236,7 +376,7 @@ class xe {
|
|
|
236
376
|
const [r, s] = e.split("x"), { sender: o, videoTrack: c, codec: a } = t, d = {
|
|
237
377
|
width: Number(r),
|
|
238
378
|
height: Number(s)
|
|
239
|
-
}, l =
|
|
379
|
+
}, l = ie({
|
|
240
380
|
videoTrack: c,
|
|
241
381
|
targetSize: d
|
|
242
382
|
}), f = Q(d.width, a), h = {
|
|
@@ -246,14 +386,14 @@ class xe {
|
|
|
246
386
|
return this.parametersSetter.setEncodingsToSender(o, h);
|
|
247
387
|
}
|
|
248
388
|
}
|
|
249
|
-
const
|
|
250
|
-
class
|
|
251
|
-
// eslint-disable-next-line class-methods-use-this
|
|
389
|
+
const an = (n) => n.find((e) => e.track?.kind === "video");
|
|
390
|
+
class dn {
|
|
391
|
+
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
252
392
|
findVideoSender(e) {
|
|
253
|
-
return
|
|
393
|
+
return an(e);
|
|
254
394
|
}
|
|
255
395
|
}
|
|
256
|
-
class
|
|
396
|
+
class un {
|
|
257
397
|
sipConnector;
|
|
258
398
|
currentHandler;
|
|
259
399
|
constructor(e) {
|
|
@@ -280,16 +420,16 @@ class Le {
|
|
|
280
420
|
return this.sipConnector.connection;
|
|
281
421
|
}
|
|
282
422
|
}
|
|
283
|
-
class
|
|
423
|
+
class ln {
|
|
284
424
|
eventHandler;
|
|
285
425
|
senderBalancer;
|
|
286
426
|
parametersSetterWithQueue;
|
|
287
427
|
serverHeaders;
|
|
288
428
|
constructor(e, { ignoreForCodec: t, onSetParameters: r } = {}) {
|
|
289
|
-
this.eventHandler = new
|
|
429
|
+
this.eventHandler = new un(e), this.parametersSetterWithQueue = new on(r), this.senderBalancer = new cn(
|
|
290
430
|
{
|
|
291
|
-
senderFinder: new
|
|
292
|
-
codecProvider: new
|
|
431
|
+
senderFinder: new dn(),
|
|
432
|
+
codecProvider: new rn(),
|
|
293
433
|
parametersSetter: this.parametersSetterWithQueue
|
|
294
434
|
},
|
|
295
435
|
{
|
|
@@ -340,29 +480,29 @@ class He {
|
|
|
340
480
|
this.serverHeaders = e, this.balanceByTrack().catch(k);
|
|
341
481
|
};
|
|
342
482
|
}
|
|
343
|
-
const
|
|
483
|
+
const Dn = (n, e = {}) => new ln(n, e), hn = ({
|
|
344
484
|
videoTrack: n,
|
|
345
485
|
targetSize: e,
|
|
346
486
|
codec: t
|
|
347
487
|
}) => {
|
|
348
|
-
const r =
|
|
488
|
+
const r = ie({
|
|
349
489
|
videoTrack: n,
|
|
350
490
|
targetSize: e
|
|
351
491
|
}), s = Q(e.width, t);
|
|
352
492
|
return { scaleResolutionDownBy: r, maxBitrate: s };
|
|
353
|
-
},
|
|
493
|
+
}, w = ({
|
|
354
494
|
mediaStream: n,
|
|
355
495
|
simulcastEncodings: e,
|
|
356
496
|
sendEncodings: t
|
|
357
497
|
}) => {
|
|
358
498
|
if (e && e.length > 0) {
|
|
359
|
-
const r = t ?? [], s =
|
|
499
|
+
const r = t ?? [], s = Xe(n);
|
|
360
500
|
if (s === void 0)
|
|
361
501
|
throw new Error("No video track");
|
|
362
502
|
return e.forEach((o, c) => {
|
|
363
503
|
const a = r[c] ?? {};
|
|
364
504
|
a.active = !0, o.rid !== void 0 && (a.rid = o.rid), o.scalabilityMode !== void 0 && (a.scalabilityMode = o.scalabilityMode);
|
|
365
|
-
const { maxBitrate: d, scaleResolutionDownBy: l } =
|
|
505
|
+
const { maxBitrate: d, scaleResolutionDownBy: l } = hn({
|
|
366
506
|
videoTrack: s,
|
|
367
507
|
targetSize: {
|
|
368
508
|
width: o.width,
|
|
@@ -373,18 +513,18 @@ const Bn = (n, e = {}) => new He(n, e), $e = ({
|
|
|
373
513
|
}), r;
|
|
374
514
|
}
|
|
375
515
|
return t;
|
|
376
|
-
},
|
|
516
|
+
}, fn = (n, e) => n.filter((r) => e.some((s) => s.clockRate === r.clockRate && s.mimeType === r.mimeType && s.channels === r.channels && s.sdpFmtpLine === r.sdpFmtpLine)), Sn = (n) => {
|
|
377
517
|
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), r = e === null ? [] : e.codecs, s = t === null ? [] : t.codecs;
|
|
378
|
-
return
|
|
379
|
-
},
|
|
518
|
+
return fn(r, s);
|
|
519
|
+
}, mn = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, r) => {
|
|
380
520
|
const s = e.indexOf(t.mimeType), o = e.indexOf(r.mimeType), c = s === -1 ? Number.MAX_VALUE : s, a = o === -1 ? Number.MAX_VALUE : o;
|
|
381
521
|
return c - a;
|
|
382
|
-
}),
|
|
522
|
+
}), Cn = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), gn = (n, {
|
|
383
523
|
preferredMimeTypesVideoCodecs: e,
|
|
384
524
|
excludeMimeTypesVideoCodecs: t
|
|
385
525
|
}) => {
|
|
386
526
|
if (typeof n.setCodecPreferences == "function" && n.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
387
|
-
const r =
|
|
527
|
+
const r = Sn("video"), s = Cn(r, t), o = mn(s, e);
|
|
388
528
|
n.setCodecPreferences(o);
|
|
389
529
|
}
|
|
390
530
|
}, D = (n, {
|
|
@@ -392,24 +532,24 @@ const Bn = (n, e = {}) => new He(n, e), $e = ({
|
|
|
392
532
|
excludeMimeTypesVideoCodecs: t
|
|
393
533
|
}) => async (r) => {
|
|
394
534
|
try {
|
|
395
|
-
|
|
535
|
+
gn(r, {
|
|
396
536
|
preferredMimeTypesVideoCodecs: e,
|
|
397
537
|
excludeMimeTypesVideoCodecs: t
|
|
398
|
-
}), Object.values(n).filter((o) => o != null).length > 0 && (i("updateTransceiver setParametersToSender", n), await
|
|
538
|
+
}), Object.values(n).filter((o) => o != null).length > 0 && (i("updateTransceiver setParametersToSender", n), await J(r.sender, n));
|
|
399
539
|
} catch (s) {
|
|
400
540
|
i("updateTransceiver error", s);
|
|
401
541
|
}
|
|
402
542
|
}, W = (n) => {
|
|
403
|
-
if (!
|
|
543
|
+
if (!Y(n) && !ue(n))
|
|
404
544
|
throw n;
|
|
405
545
|
return { isSuccessful: !1 };
|
|
406
|
-
},
|
|
407
|
-
|
|
408
|
-
},
|
|
546
|
+
}, pn = ({ kind: n, readyState: e }) => n === "video" && e === "live", j = (n, e, { onEnterPurgatory: t, onEnterConference: r }) => {
|
|
547
|
+
U(n) ? t && t() : r && r({ isSuccessProgressCall: e });
|
|
548
|
+
}, G = (n, e) => {
|
|
409
549
|
n(), e && e();
|
|
410
|
-
},
|
|
550
|
+
}, K = (n, e, t) => {
|
|
411
551
|
throw n && n(), e(), t;
|
|
412
|
-
},
|
|
552
|
+
}, Rn = /* @__PURE__ */ new Set([
|
|
413
553
|
"on",
|
|
414
554
|
"once",
|
|
415
555
|
"onceRace",
|
|
@@ -426,7 +566,7 @@ const Bn = (n, e = {}) => new He(n, e), $e = ({
|
|
|
426
566
|
"isConfigured",
|
|
427
567
|
"isRegistered"
|
|
428
568
|
]);
|
|
429
|
-
class
|
|
569
|
+
class kn {
|
|
430
570
|
// @ts-expect-error: proxy method
|
|
431
571
|
on;
|
|
432
572
|
// @ts-expect-error: proxy method
|
|
@@ -466,7 +606,7 @@ class _n {
|
|
|
466
606
|
} = {}) {
|
|
467
607
|
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = r, this.sipConnector = e, new Proxy(this, {
|
|
468
608
|
get: (s, o, c) => {
|
|
469
|
-
if (typeof o == "string" &&
|
|
609
|
+
if (typeof o == "string" && Rn.has(o) && o in this.sipConnector) {
|
|
470
610
|
const d = Reflect.get(this.sipConnector, o, this.sipConnector);
|
|
471
611
|
return typeof d == "function" ? d.bind(this.sipConnector) : d;
|
|
472
612
|
}
|
|
@@ -513,8 +653,8 @@ class _n {
|
|
|
513
653
|
directionVideo: I,
|
|
514
654
|
directionAudio: F,
|
|
515
655
|
setRemoteStreams: S,
|
|
516
|
-
onBeforeProgressCall:
|
|
517
|
-
onSuccessProgressCall:
|
|
656
|
+
onBeforeProgressCall: C,
|
|
657
|
+
onSuccessProgressCall: g,
|
|
518
658
|
onEnterPurgatory: p,
|
|
519
659
|
onEnterConference: y,
|
|
520
660
|
onFailProgressCall: E,
|
|
@@ -545,7 +685,7 @@ class _n {
|
|
|
545
685
|
offerToReceiveVideo: h,
|
|
546
686
|
directionVideo: I,
|
|
547
687
|
directionAudio: F,
|
|
548
|
-
sendEncodings:
|
|
688
|
+
sendEncodings: w({
|
|
549
689
|
mediaStream: r,
|
|
550
690
|
simulcastEncodings: a,
|
|
551
691
|
sendEncodings: l
|
|
@@ -555,17 +695,17 @@ class _n {
|
|
|
555
695
|
ontrack: _
|
|
556
696
|
}));
|
|
557
697
|
let v = !1, T;
|
|
558
|
-
const
|
|
559
|
-
i("enterRoom", { _room: u, isSuccessProgressCall: v }), T = u, (p ?? y) &&
|
|
698
|
+
const P = (i("subscribeEnterConference: onEnterConference", y), this.sipConnector.on("api:enterRoom", ({ room: u }) => {
|
|
699
|
+
i("enterRoom", { _room: u, isSuccessProgressCall: v }), T = u, (p ?? y) && j(T, v, {
|
|
560
700
|
onEnterPurgatory: p,
|
|
561
701
|
onEnterConference: y
|
|
562
702
|
});
|
|
563
|
-
})), V = (u) => (i("onSuccess"), v = !0, B().catch(k),
|
|
564
|
-
|
|
565
|
-
}), u), L = (u) => (i("onFail"),
|
|
703
|
+
})), V = (u) => (i("onSuccess"), v = !0, B().catch(k), g && g({ isPurgatory: U(T) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
704
|
+
G(P, b);
|
|
705
|
+
}), u), L = (u) => (i("onFail"), K(E, P, u)), H = () => {
|
|
566
706
|
i("onFinish"), M && M();
|
|
567
707
|
};
|
|
568
|
-
return i("onBeforeProgressCall"),
|
|
708
|
+
return i("onBeforeProgressCall"), C && C(t), N().then(V).catch((u) => L(u)).finally(H);
|
|
569
709
|
};
|
|
570
710
|
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (i("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (i("disconnectFromServer: catch", e), { isSuccessful: !1 }));
|
|
571
711
|
answerToIncomingCall = async (e) => {
|
|
@@ -583,8 +723,8 @@ class _n {
|
|
|
583
723
|
directionAudio: I,
|
|
584
724
|
setRemoteStreams: F,
|
|
585
725
|
onBeforeProgressCall: S,
|
|
586
|
-
onSuccessProgressCall:
|
|
587
|
-
onEnterPurgatory:
|
|
726
|
+
onSuccessProgressCall: C,
|
|
727
|
+
onEnterPurgatory: g,
|
|
588
728
|
onEnterConference: p,
|
|
589
729
|
onFailProgressCall: y,
|
|
590
730
|
onFinishProgressCall: E,
|
|
@@ -614,7 +754,7 @@ class _n {
|
|
|
614
754
|
offerToReceiveVideo: f,
|
|
615
755
|
directionVideo: h,
|
|
616
756
|
directionAudio: I,
|
|
617
|
-
sendEncodings:
|
|
757
|
+
sendEncodings: w({
|
|
618
758
|
mediaStream: t,
|
|
619
759
|
simulcastEncodings: c,
|
|
620
760
|
sendEncodings: d
|
|
@@ -626,14 +766,14 @@ class _n {
|
|
|
626
766
|
return u.incomingNumber;
|
|
627
767
|
};
|
|
628
768
|
let v = !1, T;
|
|
629
|
-
const
|
|
630
|
-
i("enterRoom", { _room: u, isSuccessProgressCall: v }), T = u, (
|
|
631
|
-
onEnterPurgatory:
|
|
769
|
+
const P = (i("subscribeEnterConference: onEnterConference", p), this.sipConnector.on("api:enterRoom", (u) => {
|
|
770
|
+
i("enterRoom", { _room: u, isSuccessProgressCall: v }), T = u, (g ?? p) && j(T, v, {
|
|
771
|
+
onEnterPurgatory: g,
|
|
632
772
|
onEnterConference: p
|
|
633
773
|
});
|
|
634
|
-
})), V = (u) => (i("onSuccess"), v = !0, b().catch(k),
|
|
635
|
-
|
|
636
|
-
}), u), L = (u) => (i("onFail"),
|
|
774
|
+
})), V = (u) => (i("onSuccess"), v = !0, b().catch(k), C && C({ isPurgatory: U(T) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
775
|
+
G(P, M);
|
|
776
|
+
}), u), L = (u) => (i("onFail"), K(y, P, u)), H = () => {
|
|
637
777
|
i("onFinish"), E && E();
|
|
638
778
|
};
|
|
639
779
|
if (i("onBeforeProgressCall"), S) {
|
|
@@ -666,7 +806,7 @@ class _n {
|
|
|
666
806
|
isP2P: t,
|
|
667
807
|
maxBitrate: r,
|
|
668
808
|
contentHint: s,
|
|
669
|
-
sendEncodings:
|
|
809
|
+
sendEncodings: w({
|
|
670
810
|
mediaStream: e,
|
|
671
811
|
simulcastEncodings: o,
|
|
672
812
|
sendEncodings: a
|
|
@@ -700,7 +840,7 @@ class _n {
|
|
|
700
840
|
maxBitrate: r,
|
|
701
841
|
contentHint: s,
|
|
702
842
|
callLimit: f,
|
|
703
|
-
sendEncodings:
|
|
843
|
+
sendEncodings: w({
|
|
704
844
|
mediaStream: e,
|
|
705
845
|
simulcastEncodings: o,
|
|
706
846
|
sendEncodings: a
|
|
@@ -752,7 +892,7 @@ class _n {
|
|
|
752
892
|
addMissing: r,
|
|
753
893
|
forceRenegotiation: s,
|
|
754
894
|
contentHint: o,
|
|
755
|
-
sendEncodings:
|
|
895
|
+
sendEncodings: w({
|
|
756
896
|
mediaStream: e,
|
|
757
897
|
simulcastEncodings: c,
|
|
758
898
|
sendEncodings: d
|
|
@@ -765,168 +905,43 @@ class _n {
|
|
|
765
905
|
};
|
|
766
906
|
resolveHandleReadyRemoteStreamsDebounced = ({
|
|
767
907
|
onReadyRemoteStreams: e
|
|
768
|
-
}) =>
|
|
908
|
+
}) => le(() => {
|
|
769
909
|
const t = this.sipConnector.getRemoteStreams();
|
|
770
910
|
i("remoteStreams", t), t && e(t);
|
|
771
911
|
}, 200);
|
|
772
|
-
// eslint-disable-next-line class-methods-use-this
|
|
912
|
+
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
773
913
|
resolveHandleReadyRemoteStreams = ({
|
|
774
914
|
onReadyRemoteStreams: e
|
|
775
915
|
}) => ({ track: t }) => {
|
|
776
|
-
|
|
916
|
+
pn(t) && e();
|
|
777
917
|
};
|
|
778
918
|
getRemoteStreams = () => (i("getRemoteStreams"), this.sipConnector.getRemoteStreams());
|
|
779
919
|
onUseLicense = (e) => (i("onUseLicense"), this.sipConnector.on("api:useLicense", e));
|
|
780
920
|
onMustStopPresentation = (e) => (i("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", e));
|
|
781
921
|
onMoveToSpectators = (e) => (i("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", e));
|
|
782
922
|
onMoveToParticipants = (e) => (i("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", e));
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
let r = e;
|
|
787
|
-
return (t === R.BAD_MEDIA_DESCRIPTION || t === R.NOT_FOUND) && (r = `${n.message.to.uri.user}@${n.message.to.uri.host}`), r;
|
|
788
|
-
};
|
|
789
|
-
var se = /* @__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))(se || {});
|
|
790
|
-
const Ye = new Error("Unknown error"), qe = (n = Ye) => {
|
|
791
|
-
const { cause: e, socket: t } = n;
|
|
792
|
-
let r = "CONNECT_SERVER_FAILED";
|
|
793
|
-
switch (e) {
|
|
794
|
-
case "Forbidden": {
|
|
795
|
-
r = "WRONG_USER_OR_PASSWORD";
|
|
796
|
-
break;
|
|
797
|
-
}
|
|
798
|
-
case R.BAD_MEDIA_DESCRIPTION: {
|
|
799
|
-
r = "BAD_MEDIA_ERROR";
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
case R.NOT_FOUND: {
|
|
803
|
-
r = "NOT_FOUND_ERROR";
|
|
804
|
-
break;
|
|
805
|
-
}
|
|
806
|
-
default:
|
|
807
|
-
t !== void 0 && t._ws?.readyState === 3 ? r = "WS_CONNECTION_FAILED" : U(n) !== void 0 && U(n) !== "" && (r = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
808
|
-
}
|
|
809
|
-
return r;
|
|
810
|
-
}, ze = (n) => {
|
|
811
|
-
let e = "";
|
|
812
|
-
try {
|
|
813
|
-
e = JSON.stringify(n);
|
|
814
|
-
} catch (t) {
|
|
815
|
-
i("failed to stringify message", t);
|
|
816
|
-
}
|
|
817
|
-
return e;
|
|
818
|
-
}, Ze = new Error("Unknown error"), en = (n = Ze) => {
|
|
819
|
-
const { code: e, cause: t, message: r } = n, s = U(n), o = { code: "", cause: "", message: "" };
|
|
820
|
-
return typeof r == "object" && r !== null ? o.message = ze(r) : r && (o.message = String(r)), s !== void 0 && s !== "" && (o.link = s), e !== void 0 && e !== "" && (o.code = e), t !== void 0 && t !== "" && (o.cause = t), o;
|
|
821
|
-
}, nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
822
|
-
__proto__: null,
|
|
823
|
-
EErrorTypes: se,
|
|
824
|
-
getLinkError: U,
|
|
825
|
-
getTypeFromError: qe,
|
|
826
|
-
getValuesFromError: en
|
|
827
|
-
}, Symbol.toStringTag, { value: "Module" })), tn = ({
|
|
828
|
-
sessionId: n,
|
|
829
|
-
remoteAddress: e,
|
|
830
|
-
isMutedAudio: t,
|
|
831
|
-
isMutedVideo: r,
|
|
832
|
-
isRegistered: s,
|
|
833
|
-
isPresentationCall: o
|
|
834
|
-
}) => {
|
|
835
|
-
const c = [], a = t ? "0" : "1", d = r ? "0" : "1";
|
|
836
|
-
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${d}`), (s === !1 || s === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Session: ${n}`), o === !0 && c.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Remote: ${e}`), c;
|
|
837
|
-
}, rn = "[@*!|]", sn = "_", on = (n) => {
|
|
838
|
-
let e = n;
|
|
839
|
-
return e = e.replaceAll(new RegExp(rn, "g"), sn), e;
|
|
840
|
-
}, cn = ({
|
|
841
|
-
appName: n,
|
|
842
|
-
appVersion: e,
|
|
843
|
-
browserName: t,
|
|
844
|
-
browserVersion: r
|
|
845
|
-
}) => {
|
|
846
|
-
const o = `${on(n)} ${e}`;
|
|
847
|
-
return `ChromeNew - ${t === void 0 ? o : `${t} ${r}, ${o}`}`;
|
|
848
|
-
}, an = ({
|
|
849
|
-
isUnifiedSdpSemantic: n,
|
|
850
|
-
appVersion: e,
|
|
851
|
-
browserName: t,
|
|
852
|
-
browserVersion: r,
|
|
853
|
-
appName: s
|
|
854
|
-
}) => n ? cn({ appVersion: e, browserName: t, browserVersion: r, appName: s }) : "Chrome", dn = (n) => (e) => [...e].map((r) => async () => n(r)), un = async ({
|
|
855
|
-
accumulatedKeys: n,
|
|
856
|
-
sendKey: e,
|
|
857
|
-
canRunTask: t
|
|
858
|
-
}) => {
|
|
859
|
-
const s = dn(e)(n);
|
|
860
|
-
return ue(s, t);
|
|
861
|
-
}, ln = (n) => (t) => (i("onStartMainCam"), n.on("api:admin-start-main-cam", t)), hn = (n) => (t) => (i("onStartMic"), n.on("api:admin-start-mic", t)), fn = (n) => (t) => (i("onStopMainCam"), n.on("api:admin-stop-main-cam", t)), Sn = (n) => (t) => (i("onStopMic"), n.on("api:admin-stop-mic", t)), Cn = ({ sipConnector: n }) => {
|
|
862
|
-
const e = (S, g) => ({ isSyncForced: m }) => {
|
|
863
|
-
if (m === !0) {
|
|
864
|
-
S();
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
g();
|
|
868
|
-
}, t = ln(n), r = fn(n), s = hn(n), o = Sn(n);
|
|
869
|
-
let c, a, d, l;
|
|
870
|
-
const f = ({
|
|
871
|
-
onStartMainCamForced: S,
|
|
872
|
-
onStartMainCamNotForced: g,
|
|
873
|
-
onStopMainCamForced: m,
|
|
874
|
-
onStopMainCamNotForced: p,
|
|
875
|
-
onStartMicForced: y,
|
|
876
|
-
onStartMicNotForced: E,
|
|
877
|
-
onStopMicForced: M,
|
|
878
|
-
onStopMicNotForced: b
|
|
879
|
-
}) => {
|
|
880
|
-
const B = e(
|
|
881
|
-
S,
|
|
882
|
-
g
|
|
883
|
-
);
|
|
884
|
-
c = t(B);
|
|
885
|
-
const _ = e(
|
|
886
|
-
m,
|
|
887
|
-
p
|
|
888
|
-
);
|
|
889
|
-
a = r(_);
|
|
890
|
-
const A = e(y, E);
|
|
891
|
-
d = s(A);
|
|
892
|
-
const N = e(M, b);
|
|
893
|
-
l = o(N);
|
|
894
|
-
}, h = () => {
|
|
895
|
-
c?.(), a?.(), d?.(), l?.();
|
|
923
|
+
onStats = (e) => (i("onStats"), this.sipConnector.on("stats:collected", e));
|
|
924
|
+
offStats = (e) => {
|
|
925
|
+
i("offStats"), this.sipConnector.off("stats:collected", e);
|
|
896
926
|
};
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
f(S);
|
|
900
|
-
},
|
|
901
|
-
stop: () => {
|
|
902
|
-
h();
|
|
903
|
-
}
|
|
904
|
-
};
|
|
905
|
-
}, An = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
906
|
-
__proto__: null,
|
|
907
|
-
PURGATORY_CONFERENCE_NUMBER: re,
|
|
908
|
-
createSyncMediaState: Cn,
|
|
909
|
-
error: nn,
|
|
910
|
-
getExtraHeaders: tn,
|
|
911
|
-
getUserAgent: an,
|
|
912
|
-
hasPurgatory: x,
|
|
913
|
-
sendDtmfAccumulated: un
|
|
914
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
915
|
-
var gn = /* @__PURE__ */ ((n) => (n.VP8 = "video/VP8", n.VP9 = "video/VP9", n.H264 = "video/H264", n.AV1 = "video/AV1", n.rtx = "video/rtx", n.red = "video/red", n.flexfec03 = "video/flexfec-03", n))(gn || {});
|
|
927
|
+
}
|
|
928
|
+
var yn = /* @__PURE__ */ ((n) => (n.VP8 = "video/VP8", n.VP9 = "video/VP9", n.H264 = "video/H264", n.AV1 = "video/AV1", n.rtx = "video/rtx", n.red = "video/red", n.flexfec03 = "video/flexfec-03", n))(yn || {});
|
|
916
929
|
export {
|
|
917
930
|
R as ECallCause,
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
931
|
+
yn as EMimeTypesVideoCodecs,
|
|
932
|
+
xn as EStatsTypes,
|
|
933
|
+
Un as EUseLicense,
|
|
934
|
+
Vn as SipConnector,
|
|
935
|
+
kn as SipConnectorFacade,
|
|
936
|
+
Ln as StatsPeerConnection,
|
|
937
|
+
ln as VideoSendingBalancer,
|
|
938
|
+
Jn as debug,
|
|
939
|
+
Hn as disableDebug,
|
|
940
|
+
$n as enableDebug,
|
|
941
|
+
tn as getCodecFromSender,
|
|
942
|
+
wn as hasAvailableStats,
|
|
943
|
+
Pn as hasCanceledCallError,
|
|
944
|
+
Wn as hasCanceledStartPresentationError,
|
|
945
|
+
Dn as resolveVideoSendingBalancer,
|
|
946
|
+
On as tools
|
|
932
947
|
};
|