sip-connector 14.1.0-alpha.1 → 14.1.0-alpha.10
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-Bkm1XX-8.cjs +1 -0
- package/dist/{SipConnector-CK3GgjXE.js → @SipConnector-D4tn0Ep5.js} +456 -680
- package/dist/ApiManager/@ApiManager.d.ts +2 -2
- package/dist/ApiManager/constants.d.ts +1 -1
- package/dist/ApiManager/index.d.ts +1 -0
- package/dist/CallManager/causes.d.ts +2 -1
- package/dist/CallManager/index.d.ts +2 -0
- package/dist/CallManager/types.d.ts +1 -1
- package/dist/ConnectionManager/@ConnectionManager.d.ts +2 -1
- package/dist/ConnectionManager/ConnectionFlow.d.ts +2 -1
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +3 -2
- package/dist/PresentationManager/@PresentationManager.d.ts +2 -2
- package/dist/PresentationManager/index.d.ts +1 -0
- package/dist/{SipConnector.d.ts → SipConnector/@SipConnector.d.ts} +19 -30
- package/dist/SipConnector/eventNames.d.ts +4 -0
- package/dist/SipConnector/index.d.ts +2 -0
- package/dist/SipConnectorFacade/SipConnectorFacade.d.ts +10 -28
- package/dist/__fixtures__/BaseSession.mock.d.ts +1 -1
- package/dist/{eventNames.d.ts → __fixtures__/eventNames.d.ts} +1 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.d.ts +1 -1
- package/dist/doMock.js +212 -130
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.js +512 -546
- package/dist/tools/__fixtures__/processRequest.d.ts +1 -1
- package/dist/tools/error/getLinkError.d.ts +1 -1
- package/dist/tools/error/getTypeFromError.d.ts +1 -1
- package/dist/tools/error/getValuesFromError.d.ts +1 -1
- package/dist/tools/prepareMediaStream.d.ts +1 -1
- package/dist/tools/setVideoTrackContentHints.d.ts +1 -1
- package/dist/tools/syncMediaState/index.d.ts +1 -1
- package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
- package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +1 -1
- package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
- package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +1 -1
- package/dist/types.d.ts +0 -46
- package/dist/videoSendingBalancer/balance.d.ts +1 -1
- package/dist/videoSendingBalancer/index.d.ts +1 -1
- package/dist/videoSendingBalancer/processSender.d.ts +1 -1
- package/package.json +1 -1
- package/dist/SipConnector-CwI8aFEA.cjs +0 -1
- package/dist/causes.d.ts +0 -23
- package/dist/headers.d.ts +0 -37
- /package/dist/{getExtraHeadersRemoteAddress.d.ts → ConnectionManager/getExtraHeadersRemoteAddress.d.ts} +0 -0
- /package/dist/{constants.d.ts → __fixtures__/constants.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,46 +1,53 @@
|
|
|
1
|
-
import { B as G, N as K, l as i, E as F, O as ue } from "./SipConnector-CK3GgjXE.js";
|
|
2
|
-
import { S as Bn, c as Pn, a as xn, d as Un, b as Fn, e as kn, h as Vn } from "./SipConnector-CK3GgjXE.js";
|
|
3
|
-
import { sequentPromises as le } from "sequent-promises";
|
|
4
|
-
import { createStackPromises as de } from "stack-promises";
|
|
5
|
-
import B from "debug";
|
|
6
|
-
import { default as Hn } from "debug";
|
|
7
1
|
import "events-constructor";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
2
|
+
import { E as y, O as ce, l as c, a as w } from "./@SipConnector-D4tn0Ep5.js";
|
|
3
|
+
import { b as On, S as Nn, d as Bn, e as wn, h as Dn } from "./@SipConnector-D4tn0Ep5.js";
|
|
4
|
+
import { isCanceledError as K } from "@krivega/cancelable-promise";
|
|
5
|
+
import { hasCanceledError as ae } from "repeated-calls";
|
|
6
|
+
import { debounce as ue } from "ts-debounce";
|
|
7
|
+
import I from "debug";
|
|
8
|
+
import { default as In } from "debug";
|
|
9
|
+
import { sequentPromises as de } from "sequent-promises";
|
|
10
|
+
import { createStackPromises as le } from "stack-promises";
|
|
11
|
+
const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn = (e) => {
|
|
12
|
+
if (K(e))
|
|
13
|
+
return !0;
|
|
14
|
+
if (!fe(e))
|
|
15
|
+
return !1;
|
|
16
|
+
const { originator: n, cause: t } = e;
|
|
17
|
+
return typeof t == "string" ? t === y.REQUEST_TIMEOUT || t === y.REJECTED || n === ce.LOCAL && (t === y.CANCELED || t === y.BYE) : !1;
|
|
18
|
+
}, he = (e, n) => (e.degradationPreference = n.degradationPreference, e), ge = (e, n) => {
|
|
12
19
|
e.encodings ??= [];
|
|
13
20
|
for (let t = e.encodings.length; t < n; t += 1)
|
|
14
21
|
e.encodings.push({});
|
|
15
22
|
return e;
|
|
16
|
-
},
|
|
17
|
-
if (
|
|
23
|
+
}, Y = (e) => (n, t) => t !== void 0 && n !== t || t === void 0 && n !== e, Ce = Y(), Se = (e, n) => {
|
|
24
|
+
if (Ce(e, n))
|
|
18
25
|
return e;
|
|
19
|
-
},
|
|
20
|
-
const t = e.maxBitrate, o =
|
|
26
|
+
}, me = (e, n) => {
|
|
27
|
+
const t = e.maxBitrate, o = Se(n, t);
|
|
21
28
|
return o !== void 0 && (e.maxBitrate = o), e;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
),
|
|
25
|
-
const t = e === void 0 ? void 0 : Math.max(e,
|
|
26
|
-
if (t !== void 0 &&
|
|
29
|
+
}, q = 1, Re = Y(
|
|
30
|
+
q
|
|
31
|
+
), pe = (e, n) => {
|
|
32
|
+
const t = e === void 0 ? void 0 : Math.max(e, q);
|
|
33
|
+
if (t !== void 0 && Re(
|
|
27
34
|
t,
|
|
28
35
|
n
|
|
29
36
|
))
|
|
30
37
|
return t;
|
|
31
|
-
},
|
|
32
|
-
const t = e.scaleResolutionDownBy, o =
|
|
38
|
+
}, ye = (e, n) => {
|
|
39
|
+
const t = e.scaleResolutionDownBy, o = pe(
|
|
33
40
|
n,
|
|
34
41
|
t
|
|
35
42
|
);
|
|
36
43
|
return o !== void 0 && (e.scaleResolutionDownBy = o), e;
|
|
37
|
-
},
|
|
44
|
+
}, Ee = (e, n) => {
|
|
38
45
|
const t = n.encodings?.length ?? 0;
|
|
39
|
-
return
|
|
40
|
-
const
|
|
41
|
-
|
|
46
|
+
return ge(e, t), e.encodings.forEach((o, s) => {
|
|
47
|
+
const r = (n?.encodings ?? [])[s], i = r?.maxBitrate, a = r?.scaleResolutionDownBy;
|
|
48
|
+
me(o, i), ye(o, a);
|
|
42
49
|
}), e;
|
|
43
|
-
},
|
|
50
|
+
}, Te = (e, n) => {
|
|
44
51
|
if (e.codecs?.length !== n.codecs?.length)
|
|
45
52
|
return !0;
|
|
46
53
|
for (let t = 0; t < (e.codecs?.length ?? 0); t++)
|
|
@@ -57,379 +64,75 @@ const ge = (e, n) => (e.degradationPreference = n.degradationPreference, e), Se
|
|
|
57
64
|
if (JSON.stringify(e.encodings[t]) !== JSON.stringify(n.encodings[t]))
|
|
58
65
|
return !0;
|
|
59
66
|
return e.rtcp?.cname !== n.rtcp?.cname || e.rtcp?.reducedSize !== n.rtcp?.reducedSize || e.degradationPreference !== n.degradationPreference;
|
|
60
|
-
},
|
|
67
|
+
}, z = async (e, n) => {
|
|
61
68
|
const t = e.getParameters(), o = JSON.parse(
|
|
62
69
|
JSON.stringify(t)
|
|
63
70
|
);
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
},
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
var ee = /* @__PURE__ */ ((e) => (e.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", e.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", e.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", e.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", e.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", e.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", e))(ee || {});
|
|
73
|
-
const Ee = new Error("Unknown error"), Ne = (e = Ee) => {
|
|
74
|
-
const { cause: n, socket: t } = e;
|
|
75
|
-
let o = "CONNECT_SERVER_FAILED";
|
|
76
|
-
switch (n) {
|
|
77
|
-
case "Forbidden": {
|
|
78
|
-
o = "WRONG_USER_OR_PASSWORD";
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case G: {
|
|
82
|
-
o = "BAD_MEDIA_ERROR";
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case K: {
|
|
86
|
-
o = "NOT_FOUND_ERROR";
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
default:
|
|
90
|
-
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : V(e) !== void 0 && V(e) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
91
|
-
}
|
|
92
|
-
return o;
|
|
93
|
-
}, _e = (e) => {
|
|
94
|
-
let n = "";
|
|
95
|
-
try {
|
|
96
|
-
n = JSON.stringify(e);
|
|
97
|
-
} catch (t) {
|
|
98
|
-
i("failed to stringify message", t);
|
|
99
|
-
}
|
|
100
|
-
return n;
|
|
101
|
-
}, ve = new Error("Unknown error"), Oe = (e = ve) => {
|
|
102
|
-
const { code: n, cause: t, message: o } = e, r = V(e), s = { code: "", cause: "", message: "" };
|
|
103
|
-
return typeof o == "object" && o !== null ? s.message = _e(o) : o && (s.message = String(o)), r !== void 0 && r !== "" && (s.link = r), n !== void 0 && n !== "" && (s.code = n), t !== void 0 && t !== "" && (s.cause = t), s;
|
|
104
|
-
}, be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
105
|
-
__proto__: null,
|
|
106
|
-
EErrorTypes: ee,
|
|
107
|
-
getLinkError: V,
|
|
108
|
-
getTypeFromError: Ne,
|
|
109
|
-
getValuesFromError: Oe
|
|
110
|
-
}, Symbol.toStringTag, { value: "Module" })), Ie = ({
|
|
111
|
-
sessionId: e,
|
|
112
|
-
remoteAddress: n,
|
|
113
|
-
isMutedAudio: t,
|
|
114
|
-
isMutedVideo: o,
|
|
115
|
-
isRegistered: r,
|
|
116
|
-
isPresentationCall: s
|
|
117
|
-
}) => {
|
|
118
|
-
const c = [], a = t ? "0" : "1", u = o ? "0" : "1";
|
|
119
|
-
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), (r === !1 || r === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Session: ${e}`), s === !0 && c.push("X-Vinteo-Presentation-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Remote: ${n}`), c;
|
|
120
|
-
}, De = "[@*!|]", we = "_", Be = (e) => {
|
|
121
|
-
let n = e;
|
|
122
|
-
return n = n.replaceAll(new RegExp(De, "g"), we), n;
|
|
123
|
-
}, Pe = ({
|
|
124
|
-
appName: e,
|
|
125
|
-
appVersion: n,
|
|
126
|
-
browserName: t,
|
|
127
|
-
browserVersion: o
|
|
128
|
-
}) => {
|
|
129
|
-
const s = `${Be(e)} ${n}`;
|
|
130
|
-
return `ChromeNew - ${t === void 0 ? s : `${t} ${o}, ${s}`}`;
|
|
131
|
-
}, xe = ({
|
|
132
|
-
isUnifiedSdpSemantic: e,
|
|
133
|
-
appVersion: n,
|
|
134
|
-
browserName: t,
|
|
135
|
-
browserVersion: o,
|
|
136
|
-
appName: r
|
|
137
|
-
}) => e ? Pe({ appVersion: n, browserName: t, browserVersion: o, appName: r }) : "Chrome", ne = "purgatory", P = (e) => e === ne, Ue = (e) => (n) => [...n].map((o) => async () => e(o)), Fe = async ({
|
|
138
|
-
accumulatedKeys: e,
|
|
139
|
-
sendKey: n,
|
|
140
|
-
canRunTask: t
|
|
141
|
-
}) => {
|
|
142
|
-
const r = Ue(n)(e);
|
|
143
|
-
return le(r, t);
|
|
144
|
-
}, ke = (e) => (t) => (i("onStartMainCam"), e.onApi("admin-start-main-cam", t)), Ve = (e) => (t) => (i("onStartMic"), e.onApi("admin-start-mic", t)), Le = (e) => (t) => (i("onStopMainCam"), e.onApi("admin-stop-main-cam", t)), He = (e) => (t) => (i("onStopMic"), e.onApi("admin-stop-mic", t)), $e = ({ sipConnector: e }) => {
|
|
145
|
-
const n = (g, R) => ({ isSyncForced: S }) => {
|
|
146
|
-
if (S === !0) {
|
|
147
|
-
g();
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
R();
|
|
151
|
-
}, t = ke(e), o = Le(e), r = Ve(e), s = He(e);
|
|
152
|
-
let c, a, u, d;
|
|
153
|
-
const C = ({
|
|
154
|
-
onStartMainCamForced: g,
|
|
155
|
-
onStartMainCamNotForced: R,
|
|
156
|
-
onStopMainCamForced: S,
|
|
157
|
-
onStopMainCamNotForced: h,
|
|
158
|
-
onStartMicForced: p,
|
|
159
|
-
onStartMicNotForced: y,
|
|
160
|
-
onStopMicForced: A,
|
|
161
|
-
onStopMicNotForced: T
|
|
162
|
-
}) => {
|
|
163
|
-
const N = n(
|
|
164
|
-
g,
|
|
165
|
-
R
|
|
166
|
-
);
|
|
167
|
-
c = t(N);
|
|
168
|
-
const v = n(
|
|
169
|
-
S,
|
|
170
|
-
h
|
|
171
|
-
);
|
|
172
|
-
a = o(v);
|
|
173
|
-
const O = n(p, y);
|
|
174
|
-
u = r(O);
|
|
175
|
-
const b = n(A, T);
|
|
176
|
-
d = s(b);
|
|
177
|
-
}, f = () => {
|
|
178
|
-
c?.(), a?.(), u?.(), d?.();
|
|
179
|
-
};
|
|
180
|
-
return {
|
|
181
|
-
start: (g) => {
|
|
182
|
-
C(g);
|
|
183
|
-
},
|
|
184
|
-
stop: () => {
|
|
185
|
-
f();
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
189
|
-
__proto__: null,
|
|
190
|
-
PURGATORY_CONFERENCE_NUMBER: ne,
|
|
191
|
-
createSyncMediaState: $e,
|
|
192
|
-
error: be,
|
|
193
|
-
getExtraHeaders: Ie,
|
|
194
|
-
getUserAgent: xe,
|
|
195
|
-
hasPurgatory: P,
|
|
196
|
-
sendDtmfAccumulated: Fe
|
|
197
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
198
|
-
var _ = /* @__PURE__ */ ((e) => (e.PAUSE_MAIN_CAM = "PAUSEMAINCAM", e.RESUME_MAIN_CAM = "RESUMEMAINCAM", e.MAX_MAIN_CAM_RESOLUTION = "MAXMAINCAMRESOLUTION", e.ADMIN_STOP_MAIN_CAM = "ADMINSTOPMAINCAM", e.ADMIN_START_MAIN_CAM = "ADMINSTARTMAINCAM", e))(_ || {}), Xe = /* @__PURE__ */ ((e) => (e.ADMIN_STOP_MIC = "ADMINSTOPMIC", e.ADMIN_START_MIC = "ADMINSTARTMIC", e))(Xe || {}), Je = /* @__PURE__ */ ((e) => (e.ADMIN_SYNC_FORCED = "1", e.ADMIN_SYNC_NOT_FORCED = "0", e))(Je || {}), We = /* @__PURE__ */ ((e) => (e.AUDIO = "AUDIO", e.VIDEO = "VIDEO", e.AUDIOPLUSPRESENTATION = "AUDIOPLUSPRESENTATION", e))(We || {}), Ye = /* @__PURE__ */ ((e) => (e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e))(Ye || {});
|
|
199
|
-
const je = (e) => [...e.keys()].map((n) => e.get(n)), Ge = (e, n) => je(e).find((t) => t?.type === n), Ke = async (e) => e.getStats().then((n) => Ge(n, "codec")?.mimeType), qe = (e) => e.find((n) => n.track?.kind === "video"), te = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()), ze = 1e6, m = (e) => e * ze, oe = m(0.06), Qe = m(4), Ze = (e) => e <= 64 ? oe : e <= 128 ? m(0.12) : e <= 256 ? m(0.25) : e <= 384 ? m(0.32) : e <= 426 ? m(0.38) : e <= 640 ? m(0.5) : e <= 848 ? m(0.7) : e <= 1280 ? m(1) : e <= 1920 ? m(2) : Qe, en = "av1", nn = (e) => te(e, en), tn = 0.6, re = (e, n) => nn(n) ? e * tn : e, on = (e) => re(oe, e), se = (e, n) => {
|
|
200
|
-
const t = Ze(e);
|
|
201
|
-
return re(t, n);
|
|
202
|
-
}, X = 1, ce = ({
|
|
71
|
+
Ee(t, n), he(t, n);
|
|
72
|
+
const s = Te(o, t);
|
|
73
|
+
return s && await e.setParameters(t), { parameters: t, isChanged: s };
|
|
74
|
+
}, ve = (e) => e.getVideoTracks()[0], Me = 1e6, m = (e) => e * Me, Q = m(0.06), be = m(4), _e = (e) => e <= 64 ? Q : e <= 128 ? m(0.12) : e <= 256 ? m(0.25) : e <= 384 ? m(0.32) : e <= 426 ? m(0.38) : e <= 640 ? m(0.5) : e <= 848 ? m(0.7) : e <= 1280 ? m(1) : e <= 1920 ? m(2) : be, Z = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()), Ae = "av1", Oe = (e) => Z(e, Ae), Ne = 0.6, ee = (e, n) => Oe(n) ? e * Ne : e, Be = (e) => ee(Q, e), ne = (e, n) => {
|
|
75
|
+
const t = _e(e);
|
|
76
|
+
return ee(t, n);
|
|
77
|
+
}, J = 1, te = ({
|
|
203
78
|
videoTrack: e,
|
|
204
79
|
targetSize: n,
|
|
205
80
|
codec: t
|
|
206
81
|
}) => {
|
|
207
|
-
const o = e.getSettings(),
|
|
208
|
-
return { scaleResolutionDownBy: u, maxBitrate:
|
|
209
|
-
},
|
|
210
|
-
const { isChanged: o, parameters: r } = await Z(e, {
|
|
211
|
-
encodings: [
|
|
212
|
-
{
|
|
213
|
-
scaleResolutionDownBy: n.scaleResolutionDownBy,
|
|
214
|
-
maxBitrate: n.maxBitrate
|
|
215
|
-
}
|
|
216
|
-
]
|
|
217
|
-
});
|
|
218
|
-
return o && t && t(r), { isChanged: o, parameters: r };
|
|
219
|
-
}, ie = de(), sn = async () => ie().catch((e) => {
|
|
220
|
-
i("videoSendingBalancer: error", e);
|
|
221
|
-
}), cn = async (e) => (ie.add(e), sn()), W = async ({
|
|
222
|
-
sender: e,
|
|
223
|
-
scaleResolutionDownBy: n,
|
|
224
|
-
maxBitrate: t,
|
|
225
|
-
onSetParameters: o
|
|
226
|
-
}) => cn(async () => rn(e, { scaleResolutionDownBy: n, maxBitrate: t }, o)), an = async ({ sender: e, codec: n }, t) => {
|
|
227
|
-
const r = on(n);
|
|
228
|
-
return W({
|
|
229
|
-
sender: e,
|
|
230
|
-
maxBitrate: r,
|
|
231
|
-
onSetParameters: t,
|
|
232
|
-
scaleResolutionDownBy: 200
|
|
233
|
-
});
|
|
234
|
-
}, k = async ({
|
|
235
|
-
sender: e,
|
|
236
|
-
videoTrack: n,
|
|
237
|
-
codec: t
|
|
238
|
-
}, o) => {
|
|
239
|
-
const c = n.getSettings().width, a = se(c ?? 0, t);
|
|
240
|
-
return W({
|
|
241
|
-
sender: e,
|
|
242
|
-
maxBitrate: a,
|
|
243
|
-
onSetParameters: o,
|
|
244
|
-
scaleResolutionDownBy: 1
|
|
245
|
-
});
|
|
246
|
-
}, un = async ({
|
|
247
|
-
sender: e,
|
|
248
|
-
videoTrack: n,
|
|
249
|
-
resolution: t,
|
|
250
|
-
codec: o
|
|
251
|
-
}, r) => {
|
|
252
|
-
const [s, c] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = ce({
|
|
253
|
-
videoTrack: n,
|
|
254
|
-
codec: o,
|
|
255
|
-
targetSize: {
|
|
256
|
-
width: Number(s),
|
|
257
|
-
height: Number(c)
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
return W({
|
|
261
|
-
sender: e,
|
|
262
|
-
maxBitrate: a,
|
|
263
|
-
onSetParameters: r,
|
|
264
|
-
scaleResolutionDownBy: u
|
|
265
|
-
});
|
|
266
|
-
}, ln = async ({
|
|
267
|
-
mainCam: e,
|
|
268
|
-
resolutionMainCam: n,
|
|
269
|
-
sender: t,
|
|
270
|
-
videoTrack: o,
|
|
271
|
-
codec: r
|
|
272
|
-
}, s) => {
|
|
273
|
-
switch (e) {
|
|
274
|
-
case _.PAUSE_MAIN_CAM:
|
|
275
|
-
return an({ sender: t, codec: r }, s);
|
|
276
|
-
case _.RESUME_MAIN_CAM:
|
|
277
|
-
return k({ sender: t, videoTrack: o, codec: r }, s);
|
|
278
|
-
case _.MAX_MAIN_CAM_RESOLUTION:
|
|
279
|
-
return n !== void 0 ? un(
|
|
280
|
-
{ sender: t, videoTrack: o, codec: r, resolution: n },
|
|
281
|
-
s
|
|
282
|
-
) : k({ sender: t, videoTrack: o, codec: r }, s);
|
|
283
|
-
case _.ADMIN_STOP_MAIN_CAM:
|
|
284
|
-
case _.ADMIN_START_MAIN_CAM:
|
|
285
|
-
case void 0:
|
|
286
|
-
return k({ sender: t, videoTrack: o, codec: r }, s);
|
|
287
|
-
default:
|
|
288
|
-
return k({ sender: t, videoTrack: o, codec: r }, s);
|
|
289
|
-
}
|
|
290
|
-
}, Y = {
|
|
291
|
-
isChanged: !1,
|
|
292
|
-
parameters: {
|
|
293
|
-
encodings: [{}],
|
|
294
|
-
transactionId: "0",
|
|
295
|
-
codecs: [],
|
|
296
|
-
headerExtensions: [],
|
|
297
|
-
rtcp: {}
|
|
298
|
-
}
|
|
299
|
-
}, j = async ({
|
|
300
|
-
mainCam: e,
|
|
301
|
-
resolutionMainCam: n,
|
|
302
|
-
connection: t,
|
|
303
|
-
onSetParameters: o,
|
|
304
|
-
ignoreForCodec: r
|
|
305
|
-
}) => {
|
|
306
|
-
const s = t.getSenders(), c = qe(s);
|
|
307
|
-
if (!c?.track)
|
|
308
|
-
return Y;
|
|
309
|
-
const a = await Ke(c);
|
|
310
|
-
return te(a, r) ? Y : ln(
|
|
311
|
-
{
|
|
312
|
-
mainCam: e,
|
|
313
|
-
resolutionMainCam: n,
|
|
314
|
-
sender: c,
|
|
315
|
-
codec: a,
|
|
316
|
-
videoTrack: c.track
|
|
317
|
-
},
|
|
318
|
-
o
|
|
319
|
-
);
|
|
320
|
-
}, On = (e, {
|
|
321
|
-
ignoreForCodec: n,
|
|
322
|
-
onSetParameters: t
|
|
323
|
-
} = {}) => {
|
|
324
|
-
const o = async () => {
|
|
325
|
-
const { connection: u } = e;
|
|
326
|
-
if (!u)
|
|
327
|
-
throw new Error("connection is not exist");
|
|
328
|
-
return j({
|
|
329
|
-
connection: u,
|
|
330
|
-
onSetParameters: t,
|
|
331
|
-
ignoreForCodec: n
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
let r = o;
|
|
335
|
-
const s = (u) => {
|
|
336
|
-
r = async () => {
|
|
337
|
-
const { mainCam: d, resolutionMainCam: C } = u, { connection: f } = e;
|
|
338
|
-
if (!f)
|
|
339
|
-
throw new Error("connection is not exist");
|
|
340
|
-
return j({
|
|
341
|
-
mainCam: d,
|
|
342
|
-
resolutionMainCam: C,
|
|
343
|
-
connection: f,
|
|
344
|
-
onSetParameters: t,
|
|
345
|
-
ignoreForCodec: n
|
|
346
|
-
});
|
|
347
|
-
}, r().catch(B);
|
|
348
|
-
};
|
|
349
|
-
return {
|
|
350
|
-
subscribe: () => {
|
|
351
|
-
e.onApi("main-cam-control", s);
|
|
352
|
-
},
|
|
353
|
-
unsubscribe: () => {
|
|
354
|
-
e.offApi("main-cam-control", s);
|
|
355
|
-
},
|
|
356
|
-
balanceByTrack: o,
|
|
357
|
-
resetMainCamControl() {
|
|
358
|
-
r = o;
|
|
359
|
-
},
|
|
360
|
-
async reBalance() {
|
|
361
|
-
return r();
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
}, dn = (e) => e instanceof Object && ("originator" in e || "cause" in e), bn = (e) => {
|
|
365
|
-
if (q(e))
|
|
366
|
-
return !0;
|
|
367
|
-
if (!dn(e))
|
|
368
|
-
return !1;
|
|
369
|
-
const { originator: n, cause: t } = e;
|
|
370
|
-
return typeof t == "string" ? t === F.REQUEST_TIMEOUT || t === F.REJECTED || n === ue.LOCAL && (t === F.CANCELED || t === F.BYE) : !1;
|
|
371
|
-
}, fn = (e) => e.getVideoTracks()[0], D = ({
|
|
82
|
+
const o = e.getSettings(), s = o.width, r = o.height, i = s === void 0 ? J : s / n.width, a = r === void 0 ? J : r / n.height, u = Math.max(i, a, J), l = ne(n.width, t);
|
|
83
|
+
return { scaleResolutionDownBy: u, maxBitrate: l };
|
|
84
|
+
}, D = ({
|
|
372
85
|
mediaStream: e,
|
|
373
86
|
simulcastEncodings: n,
|
|
374
87
|
sendEncodings: t
|
|
375
88
|
}) => {
|
|
376
89
|
if (n && n.length > 0) {
|
|
377
|
-
const o = t ?? [],
|
|
378
|
-
if (
|
|
90
|
+
const o = t ?? [], s = ve(e);
|
|
91
|
+
if (s === void 0)
|
|
379
92
|
throw new Error("No video track");
|
|
380
|
-
return n.forEach((
|
|
381
|
-
const a = o[
|
|
382
|
-
a.active = !0,
|
|
383
|
-
const { maxBitrate: u, scaleResolutionDownBy:
|
|
384
|
-
videoTrack:
|
|
93
|
+
return n.forEach((r, i) => {
|
|
94
|
+
const a = o[i] ?? {};
|
|
95
|
+
a.active = !0, r.rid !== void 0 && (a.rid = r.rid), r.scalabilityMode !== void 0 && (a.scalabilityMode = r.scalabilityMode);
|
|
96
|
+
const { maxBitrate: u, scaleResolutionDownBy: l } = te({
|
|
97
|
+
videoTrack: s,
|
|
385
98
|
targetSize: {
|
|
386
|
-
width:
|
|
387
|
-
height:
|
|
99
|
+
width: r.width,
|
|
100
|
+
height: r.height
|
|
388
101
|
}
|
|
389
102
|
});
|
|
390
|
-
a.maxBitrate = u, a.scaleResolutionDownBy =
|
|
103
|
+
a.maxBitrate = u, a.scaleResolutionDownBy = l, o[i] = a;
|
|
391
104
|
}), o;
|
|
392
105
|
}
|
|
393
106
|
return t;
|
|
394
|
-
},
|
|
395
|
-
const n = RTCRtpSender.getCapabilities(e), t = RTCRtpReceiver.getCapabilities(e), o = n === null ? [] : n.codecs,
|
|
396
|
-
return
|
|
397
|
-
},
|
|
398
|
-
const
|
|
399
|
-
return
|
|
400
|
-
}),
|
|
107
|
+
}, oe = "purgatory", x = (e) => e === oe, we = (e, n) => e.filter((o) => n.some((s) => s.clockRate === o.clockRate && s.mimeType === o.mimeType && s.channels === o.channels && s.sdpFmtpLine === o.sdpFmtpLine)), De = (e) => {
|
|
108
|
+
const n = RTCRtpSender.getCapabilities(e), t = RTCRtpReceiver.getCapabilities(e), o = n === null ? [] : n.codecs, s = t === null ? [] : t.codecs;
|
|
109
|
+
return we(o, s);
|
|
110
|
+
}, Pe = (e, n) => n === void 0 || n.length === 0 ? e : e.sort((t, o) => {
|
|
111
|
+
const s = n.indexOf(t.mimeType), r = n.indexOf(o.mimeType), i = s === -1 ? Number.MAX_VALUE : s, a = r === -1 ? Number.MAX_VALUE : r;
|
|
112
|
+
return i - a;
|
|
113
|
+
}), Ie = (e, n) => n === void 0 || n.length === 0 ? e : e.filter((t) => !n.includes(t.mimeType)), P = (e, {
|
|
401
114
|
preferredMimeTypesVideoCodecs: n,
|
|
402
115
|
excludeMimeTypesVideoCodecs: t
|
|
403
116
|
}) => async (o) => {
|
|
404
117
|
try {
|
|
405
118
|
if (typeof o.setCodecPreferences == "function" && o.sender.track?.kind === "video" && (n !== void 0 && n.length > 0 || t !== void 0 && t.length > 0)) {
|
|
406
|
-
const
|
|
407
|
-
o.setCodecPreferences(
|
|
119
|
+
const s = De("video"), r = Ie(s, t), i = Pe(r, n);
|
|
120
|
+
o.setCodecPreferences(i);
|
|
408
121
|
}
|
|
409
|
-
Object.keys(e).length > 0 && await
|
|
410
|
-
} catch (
|
|
411
|
-
|
|
122
|
+
Object.keys(e).length > 0 && await z(o.sender, e);
|
|
123
|
+
} catch (s) {
|
|
124
|
+
c("updateTransceiver error", s);
|
|
412
125
|
}
|
|
413
|
-
},
|
|
414
|
-
if (!
|
|
126
|
+
}, X = (e) => {
|
|
127
|
+
if (!K(e) && !ae(e))
|
|
415
128
|
throw e;
|
|
416
129
|
return { isSuccessful: !1 };
|
|
417
|
-
},
|
|
130
|
+
}, xe = ({ kind: e, readyState: n }) => e === "video" && n === "live", Fe = /* @__PURE__ */ new Set([
|
|
418
131
|
"on",
|
|
419
132
|
"once",
|
|
420
133
|
"onceRace",
|
|
421
134
|
"wait",
|
|
422
135
|
"off",
|
|
423
|
-
"onCall",
|
|
424
|
-
"onceCall",
|
|
425
|
-
"onceRaceCall",
|
|
426
|
-
"waitCall",
|
|
427
|
-
"offCall",
|
|
428
|
-
"onIncomingCall",
|
|
429
|
-
"onceIncomingCall",
|
|
430
|
-
"onceRaceIncomingCall",
|
|
431
|
-
"waitIncomingCall",
|
|
432
|
-
"offIncomingCall",
|
|
433
136
|
"sendDTMF",
|
|
434
137
|
"hangUp",
|
|
435
138
|
"declineToIncomingCall",
|
|
@@ -441,7 +144,7 @@ const je = (e) => [...e.keys()].map((n) => e.get(n)), Ge = (e, n) => je(e).find(
|
|
|
441
144
|
"isConfigured",
|
|
442
145
|
"isRegistered"
|
|
443
146
|
]);
|
|
444
|
-
class
|
|
147
|
+
class vn {
|
|
445
148
|
// @ts-expect-error: proxy method
|
|
446
149
|
on;
|
|
447
150
|
// @ts-expect-error: proxy method
|
|
@@ -453,26 +156,6 @@ class In {
|
|
|
453
156
|
// @ts-expect-error: proxy method
|
|
454
157
|
off;
|
|
455
158
|
// @ts-expect-error: proxy method
|
|
456
|
-
onCall;
|
|
457
|
-
// @ts-expect-error: proxy method
|
|
458
|
-
onceCall;
|
|
459
|
-
// @ts-expect-error: proxy method
|
|
460
|
-
onceRaceCall;
|
|
461
|
-
// @ts-expect-error: proxy method
|
|
462
|
-
waitCall;
|
|
463
|
-
// @ts-expect-error: proxy method
|
|
464
|
-
offCall;
|
|
465
|
-
// @ts-expect-error: proxy method
|
|
466
|
-
onIncomingCall;
|
|
467
|
-
// @ts-expect-error: proxy method
|
|
468
|
-
onceIncomingCall;
|
|
469
|
-
// @ts-expect-error: proxy method
|
|
470
|
-
onceRaceIncomingCall;
|
|
471
|
-
// @ts-expect-error: proxy method
|
|
472
|
-
waitIncomingCall;
|
|
473
|
-
// @ts-expect-error: proxy method
|
|
474
|
-
offIncomingCall;
|
|
475
|
-
// @ts-expect-error: proxy method
|
|
476
159
|
sendDTMF;
|
|
477
160
|
// @ts-expect-error: proxy method
|
|
478
161
|
hangUp;
|
|
@@ -500,13 +183,13 @@ class In {
|
|
|
500
183
|
excludeMimeTypesVideoCodecs: o
|
|
501
184
|
} = {}) {
|
|
502
185
|
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = o, this.sipConnector = n, new Proxy(this, {
|
|
503
|
-
get: (
|
|
504
|
-
if (typeof
|
|
505
|
-
const u = Reflect.get(this.sipConnector,
|
|
186
|
+
get: (s, r, i) => {
|
|
187
|
+
if (typeof r == "string" && Fe.has(r) && r in this.sipConnector) {
|
|
188
|
+
const u = Reflect.get(this.sipConnector, r, this.sipConnector);
|
|
506
189
|
return typeof u == "function" ? u.bind(this.sipConnector) : u;
|
|
507
190
|
}
|
|
508
|
-
const a = Reflect.get(
|
|
509
|
-
return typeof a == "function" ? a.bind(
|
|
191
|
+
const a = Reflect.get(s, r, i);
|
|
192
|
+
return typeof a == "function" ? a.bind(s) : a;
|
|
510
193
|
}
|
|
511
194
|
});
|
|
512
195
|
}
|
|
@@ -514,54 +197,54 @@ class In {
|
|
|
514
197
|
const {
|
|
515
198
|
userAgent: t,
|
|
516
199
|
sipWebSocketServerURL: o,
|
|
517
|
-
sipServerUrl:
|
|
518
|
-
remoteAddress:
|
|
519
|
-
displayName:
|
|
200
|
+
sipServerUrl: s,
|
|
201
|
+
remoteAddress: r,
|
|
202
|
+
displayName: i,
|
|
520
203
|
name: a,
|
|
521
204
|
password: u,
|
|
522
|
-
isRegisteredUser:
|
|
523
|
-
isDisconnectOnFail:
|
|
205
|
+
isRegisteredUser: l,
|
|
206
|
+
isDisconnectOnFail: h
|
|
524
207
|
} = n;
|
|
525
|
-
return
|
|
208
|
+
return c("connectToServer", n), this.sipConnector.connect({
|
|
526
209
|
userAgent: t,
|
|
527
210
|
sipWebSocketServerURL: o,
|
|
528
|
-
sipServerUrl:
|
|
529
|
-
remoteAddress:
|
|
530
|
-
displayName:
|
|
211
|
+
sipServerUrl: s,
|
|
212
|
+
remoteAddress: r,
|
|
213
|
+
displayName: i,
|
|
531
214
|
password: u,
|
|
532
215
|
user: a,
|
|
533
|
-
register:
|
|
534
|
-
}).then((f) => (
|
|
216
|
+
register: l
|
|
217
|
+
}).then((f) => (c("connectToServer then"), { ua: f, isSuccessful: !0 })).catch(async (f) => (c("connectToServer catch: error", f), h === !0 ? this.sipConnector.disconnect().then(() => X(f)).catch(() => X(f)) : X(f)));
|
|
535
218
|
};
|
|
536
219
|
callToServer = async (n) => {
|
|
537
220
|
const {
|
|
538
221
|
conference: t,
|
|
539
222
|
mediaStream: o,
|
|
540
|
-
extraHeaders:
|
|
541
|
-
iceServers:
|
|
542
|
-
contentHint:
|
|
223
|
+
extraHeaders: s,
|
|
224
|
+
iceServers: r,
|
|
225
|
+
contentHint: i,
|
|
543
226
|
simulcastEncodings: a,
|
|
544
227
|
degradationPreference: u,
|
|
545
|
-
sendEncodings:
|
|
546
|
-
offerToReceiveAudio:
|
|
228
|
+
sendEncodings: l,
|
|
229
|
+
offerToReceiveAudio: h,
|
|
547
230
|
offerToReceiveVideo: f,
|
|
548
|
-
directionVideo:
|
|
549
|
-
directionAudio:
|
|
231
|
+
directionVideo: F,
|
|
232
|
+
directionAudio: k,
|
|
550
233
|
setRemoteStreams: g,
|
|
551
234
|
onBeforeProgressCall: R,
|
|
552
|
-
onSuccessProgressCall:
|
|
553
|
-
onEnterPurgatory:
|
|
235
|
+
onSuccessProgressCall: C,
|
|
236
|
+
onEnterPurgatory: S,
|
|
554
237
|
onEnterConference: p,
|
|
555
|
-
onFailProgressCall:
|
|
556
|
-
onFinishProgressCall:
|
|
557
|
-
onEndedCall:
|
|
558
|
-
} = n,
|
|
238
|
+
onFailProgressCall: E,
|
|
239
|
+
onFinishProgressCall: T,
|
|
240
|
+
onEndedCall: v
|
|
241
|
+
} = n, _ = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
559
242
|
onReadyRemoteStreams: g
|
|
560
|
-
}),
|
|
243
|
+
}), A = this.resolveHandleReadyRemoteStreams({
|
|
561
244
|
onReadyRemoteStreams: () => {
|
|
562
|
-
|
|
245
|
+
_().catch(I);
|
|
563
246
|
}
|
|
564
|
-
}), O =
|
|
247
|
+
}), O = P(
|
|
565
248
|
{
|
|
566
249
|
degradationPreference: u
|
|
567
250
|
},
|
|
@@ -570,67 +253,67 @@ class In {
|
|
|
570
253
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
571
254
|
}
|
|
572
255
|
);
|
|
573
|
-
|
|
574
|
-
const
|
|
256
|
+
c("callToServer", n);
|
|
257
|
+
const N = async () => (c("startCall"), this.sipConnector.call({
|
|
575
258
|
mediaStream: o,
|
|
576
|
-
extraHeaders:
|
|
577
|
-
iceServers:
|
|
578
|
-
contentHint:
|
|
579
|
-
offerToReceiveAudio:
|
|
259
|
+
extraHeaders: s,
|
|
260
|
+
iceServers: r,
|
|
261
|
+
contentHint: i,
|
|
262
|
+
offerToReceiveAudio: h,
|
|
580
263
|
offerToReceiveVideo: f,
|
|
581
|
-
directionVideo:
|
|
582
|
-
directionAudio:
|
|
264
|
+
directionVideo: F,
|
|
265
|
+
directionAudio: k,
|
|
583
266
|
sendEncodings: D({
|
|
584
267
|
mediaStream: o,
|
|
585
268
|
simulcastEncodings: a,
|
|
586
|
-
sendEncodings:
|
|
269
|
+
sendEncodings: l
|
|
587
270
|
}),
|
|
588
271
|
number: t,
|
|
589
272
|
onAddedTransceiver: O,
|
|
590
|
-
ontrack:
|
|
273
|
+
ontrack: A
|
|
591
274
|
}));
|
|
592
|
-
let M = !1,
|
|
593
|
-
const
|
|
594
|
-
|
|
275
|
+
let M = !1, b;
|
|
276
|
+
const B = (c("subscribeEnterConference: onEnterConference", p), S ?? p ? this.sipConnector.on("api:enterRoom", ({ room: d }) => {
|
|
277
|
+
c("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, x(b) ? S && S() : p && p({ isSuccessProgressCall: M });
|
|
595
278
|
}) : () => {
|
|
596
|
-
}), L = (
|
|
597
|
-
|
|
598
|
-
}),
|
|
599
|
-
throw
|
|
279
|
+
}), L = (d) => (c("onSuccess"), M = !0, _().catch(I), C && C({ isPurgatory: x(b) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
280
|
+
B(), v && v();
|
|
281
|
+
}), d), H = (d) => {
|
|
282
|
+
throw c("onFail"), E && E(), B(), d;
|
|
600
283
|
}, $ = () => {
|
|
601
|
-
|
|
284
|
+
c("onFinish"), T && T();
|
|
602
285
|
};
|
|
603
|
-
return
|
|
286
|
+
return c("onBeforeProgressCall"), R && R(t), N().then(L).catch((d) => H(d)).finally($);
|
|
604
287
|
};
|
|
605
|
-
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (
|
|
288
|
+
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (c("disconnectFromServer: then"), { isSuccessful: !0 })).catch((n) => (c("disconnectFromServer: catch", n), { isSuccessful: !1 }));
|
|
606
289
|
answerToIncomingCall = async (n) => {
|
|
607
290
|
const {
|
|
608
291
|
mediaStream: t,
|
|
609
292
|
extraHeaders: o,
|
|
610
|
-
iceServers:
|
|
611
|
-
contentHint:
|
|
612
|
-
simulcastEncodings:
|
|
293
|
+
iceServers: s,
|
|
294
|
+
contentHint: r,
|
|
295
|
+
simulcastEncodings: i,
|
|
613
296
|
degradationPreference: a,
|
|
614
297
|
sendEncodings: u,
|
|
615
|
-
offerToReceiveAudio:
|
|
616
|
-
offerToReceiveVideo:
|
|
298
|
+
offerToReceiveAudio: l,
|
|
299
|
+
offerToReceiveVideo: h,
|
|
617
300
|
directionVideo: f,
|
|
618
|
-
directionAudio:
|
|
619
|
-
setRemoteStreams:
|
|
301
|
+
directionAudio: F,
|
|
302
|
+
setRemoteStreams: k,
|
|
620
303
|
onBeforeProgressCall: g,
|
|
621
304
|
onSuccessProgressCall: R,
|
|
622
|
-
onEnterPurgatory:
|
|
623
|
-
onEnterConference:
|
|
305
|
+
onEnterPurgatory: C,
|
|
306
|
+
onEnterConference: S,
|
|
624
307
|
onFailProgressCall: p,
|
|
625
|
-
onFinishProgressCall:
|
|
626
|
-
onEndedCall:
|
|
627
|
-
} = n,
|
|
628
|
-
onReadyRemoteStreams:
|
|
629
|
-
}),
|
|
308
|
+
onFinishProgressCall: E,
|
|
309
|
+
onEndedCall: T
|
|
310
|
+
} = n, v = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
311
|
+
onReadyRemoteStreams: k
|
|
312
|
+
}), _ = this.resolveHandleReadyRemoteStreams({
|
|
630
313
|
onReadyRemoteStreams: () => {
|
|
631
|
-
|
|
314
|
+
v().catch(I);
|
|
632
315
|
}
|
|
633
|
-
}),
|
|
316
|
+
}), A = P(
|
|
634
317
|
{
|
|
635
318
|
degradationPreference: a
|
|
636
319
|
},
|
|
@@ -639,141 +322,141 @@ class In {
|
|
|
639
322
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
640
323
|
}
|
|
641
324
|
);
|
|
642
|
-
|
|
325
|
+
c("answerToIncomingCall", n);
|
|
643
326
|
const O = async () => this.sipConnector.answerToIncomingCall({
|
|
644
327
|
mediaStream: t,
|
|
645
328
|
extraHeaders: o,
|
|
646
|
-
iceServers:
|
|
647
|
-
contentHint:
|
|
648
|
-
offerToReceiveAudio:
|
|
649
|
-
offerToReceiveVideo:
|
|
329
|
+
iceServers: s,
|
|
330
|
+
contentHint: r,
|
|
331
|
+
offerToReceiveAudio: l,
|
|
332
|
+
offerToReceiveVideo: h,
|
|
650
333
|
directionVideo: f,
|
|
651
|
-
directionAudio:
|
|
334
|
+
directionAudio: F,
|
|
652
335
|
sendEncodings: D({
|
|
653
336
|
mediaStream: t,
|
|
654
|
-
simulcastEncodings:
|
|
337
|
+
simulcastEncodings: i,
|
|
655
338
|
sendEncodings: u
|
|
656
339
|
}),
|
|
657
|
-
onAddedTransceiver:
|
|
658
|
-
ontrack:
|
|
659
|
-
}),
|
|
660
|
-
const { remoteCallerData:
|
|
661
|
-
return
|
|
340
|
+
onAddedTransceiver: A,
|
|
341
|
+
ontrack: _
|
|
342
|
+
}), N = () => {
|
|
343
|
+
const { remoteCallerData: d } = this.sipConnector;
|
|
344
|
+
return d.incomingNumber;
|
|
662
345
|
};
|
|
663
|
-
let M = !1,
|
|
664
|
-
const
|
|
665
|
-
|
|
346
|
+
let M = !1, b;
|
|
347
|
+
const B = (c("subscribeEnterConference: onEnterConference", S), C ?? S ? this.sipConnector.on("api:enterRoom", (d) => {
|
|
348
|
+
c("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, x(b) ? C && C() : S && S({ isSuccessProgressCall: M });
|
|
666
349
|
}) : () => {
|
|
667
|
-
}), L = (
|
|
668
|
-
|
|
669
|
-
}),
|
|
670
|
-
throw
|
|
350
|
+
}), L = (d) => (c("onSuccess"), M = !0, v().catch(I), R && R({ isPurgatory: x(b) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
351
|
+
B(), T && T();
|
|
352
|
+
}), d), H = (d) => {
|
|
353
|
+
throw c("onFail"), p && p(), B(), d;
|
|
671
354
|
}, $ = () => {
|
|
672
|
-
|
|
355
|
+
c("onFinish"), E && E();
|
|
673
356
|
};
|
|
674
|
-
if (
|
|
675
|
-
const
|
|
676
|
-
g(
|
|
357
|
+
if (c("onBeforeProgressCall"), g) {
|
|
358
|
+
const d = N();
|
|
359
|
+
g(d);
|
|
677
360
|
}
|
|
678
|
-
return O().then(L).catch((
|
|
361
|
+
return O().then(L).catch((d) => H(d)).finally($);
|
|
679
362
|
};
|
|
680
363
|
updatePresentation = async ({
|
|
681
364
|
mediaStream: n,
|
|
682
365
|
isP2P: t,
|
|
683
366
|
maxBitrate: o,
|
|
684
|
-
contentHint:
|
|
685
|
-
simulcastEncodings:
|
|
686
|
-
degradationPreference:
|
|
367
|
+
contentHint: s,
|
|
368
|
+
simulcastEncodings: r,
|
|
369
|
+
degradationPreference: i,
|
|
687
370
|
sendEncodings: a,
|
|
688
371
|
preferredMimeTypesVideoCodecs: u,
|
|
689
|
-
excludeMimeTypesVideoCodecs:
|
|
372
|
+
excludeMimeTypesVideoCodecs: l
|
|
690
373
|
}) => {
|
|
691
|
-
const
|
|
374
|
+
const h = P(
|
|
692
375
|
{
|
|
693
|
-
degradationPreference:
|
|
376
|
+
degradationPreference: i
|
|
694
377
|
},
|
|
695
378
|
{
|
|
696
379
|
preferredMimeTypesVideoCodecs: u,
|
|
697
|
-
excludeMimeTypesVideoCodecs:
|
|
380
|
+
excludeMimeTypesVideoCodecs: l
|
|
698
381
|
}
|
|
699
382
|
);
|
|
700
|
-
return
|
|
383
|
+
return c("updatePresentation"), this.sipConnector.updatePresentation(n, {
|
|
701
384
|
isP2P: t,
|
|
702
385
|
maxBitrate: o,
|
|
703
|
-
contentHint:
|
|
386
|
+
contentHint: s,
|
|
704
387
|
sendEncodings: D({
|
|
705
388
|
mediaStream: n,
|
|
706
|
-
simulcastEncodings:
|
|
389
|
+
simulcastEncodings: r,
|
|
707
390
|
sendEncodings: a
|
|
708
391
|
}),
|
|
709
|
-
onAddedTransceiver:
|
|
392
|
+
onAddedTransceiver: h
|
|
710
393
|
});
|
|
711
394
|
};
|
|
712
395
|
startPresentation = async ({
|
|
713
396
|
mediaStream: n,
|
|
714
397
|
isP2P: t,
|
|
715
398
|
maxBitrate: o,
|
|
716
|
-
contentHint:
|
|
717
|
-
simulcastEncodings:
|
|
718
|
-
degradationPreference:
|
|
399
|
+
contentHint: s,
|
|
400
|
+
simulcastEncodings: r,
|
|
401
|
+
degradationPreference: i,
|
|
719
402
|
sendEncodings: a,
|
|
720
403
|
preferredMimeTypesVideoCodecs: u,
|
|
721
|
-
excludeMimeTypesVideoCodecs:
|
|
722
|
-
callLimit:
|
|
404
|
+
excludeMimeTypesVideoCodecs: l,
|
|
405
|
+
callLimit: h
|
|
723
406
|
}) => {
|
|
724
|
-
const f =
|
|
407
|
+
const f = P(
|
|
725
408
|
{
|
|
726
|
-
degradationPreference:
|
|
409
|
+
degradationPreference: i
|
|
727
410
|
},
|
|
728
411
|
{
|
|
729
412
|
preferredMimeTypesVideoCodecs: u,
|
|
730
|
-
excludeMimeTypesVideoCodecs:
|
|
413
|
+
excludeMimeTypesVideoCodecs: l
|
|
731
414
|
}
|
|
732
415
|
);
|
|
733
|
-
return
|
|
416
|
+
return c("startPresentation"), this.sipConnector.startPresentation(n, {
|
|
734
417
|
isP2P: t,
|
|
735
418
|
maxBitrate: o,
|
|
736
|
-
contentHint:
|
|
737
|
-
callLimit:
|
|
419
|
+
contentHint: s,
|
|
420
|
+
callLimit: h,
|
|
738
421
|
sendEncodings: D({
|
|
739
422
|
mediaStream: n,
|
|
740
|
-
simulcastEncodings:
|
|
423
|
+
simulcastEncodings: r,
|
|
741
424
|
sendEncodings: a
|
|
742
425
|
}),
|
|
743
426
|
onAddedTransceiver: f
|
|
744
427
|
});
|
|
745
428
|
};
|
|
746
|
-
stopShareSipConnector = async ({ isP2P: n = !1 } = {}) => (
|
|
429
|
+
stopShareSipConnector = async ({ isP2P: n = !1 } = {}) => (c("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
747
430
|
isP2P: n
|
|
748
431
|
}).catch((t) => {
|
|
749
|
-
|
|
432
|
+
c(t);
|
|
750
433
|
}));
|
|
751
434
|
sendRefusalToTurnOnMic = async () => {
|
|
752
|
-
|
|
753
|
-
|
|
435
|
+
c("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((n) => {
|
|
436
|
+
c("sendRefusalToTurnOnMic: error", n);
|
|
754
437
|
});
|
|
755
438
|
};
|
|
756
439
|
sendRefusalToTurnOnCam = async () => {
|
|
757
|
-
|
|
758
|
-
|
|
440
|
+
c("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((n) => {
|
|
441
|
+
c("sendRefusalToTurnOnCam: error", n);
|
|
759
442
|
});
|
|
760
443
|
};
|
|
761
444
|
sendMediaState = async ({
|
|
762
445
|
isEnabledCam: n,
|
|
763
446
|
isEnabledMic: t
|
|
764
447
|
}) => {
|
|
765
|
-
|
|
448
|
+
c("sendMediaState"), await this.sipConnector.sendMediaState({ cam: n, mic: t });
|
|
766
449
|
};
|
|
767
450
|
replaceMediaStream = async (n, {
|
|
768
451
|
deleteExisting: t,
|
|
769
452
|
addMissing: o,
|
|
770
|
-
forceRenegotiation:
|
|
771
|
-
contentHint:
|
|
772
|
-
simulcastEncodings:
|
|
453
|
+
forceRenegotiation: s,
|
|
454
|
+
contentHint: r,
|
|
455
|
+
simulcastEncodings: i,
|
|
773
456
|
degradationPreference: a,
|
|
774
457
|
sendEncodings: u
|
|
775
458
|
} = {}) => {
|
|
776
|
-
const
|
|
459
|
+
const l = P(
|
|
777
460
|
{
|
|
778
461
|
degradationPreference: a
|
|
779
462
|
},
|
|
@@ -782,58 +465,341 @@ class In {
|
|
|
782
465
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
783
466
|
}
|
|
784
467
|
);
|
|
785
|
-
return
|
|
468
|
+
return c("replaceMediaStream"), this.sipConnector.replaceMediaStream(n, {
|
|
786
469
|
deleteExisting: t,
|
|
787
470
|
addMissing: o,
|
|
788
|
-
forceRenegotiation:
|
|
789
|
-
contentHint:
|
|
471
|
+
forceRenegotiation: s,
|
|
472
|
+
contentHint: r,
|
|
790
473
|
sendEncodings: D({
|
|
791
474
|
mediaStream: n,
|
|
792
|
-
simulcastEncodings:
|
|
475
|
+
simulcastEncodings: i,
|
|
793
476
|
sendEncodings: u
|
|
794
477
|
}),
|
|
795
|
-
onAddedTransceiver:
|
|
478
|
+
onAddedTransceiver: l
|
|
796
479
|
});
|
|
797
480
|
};
|
|
798
481
|
askPermissionToEnableCam = async () => {
|
|
799
|
-
|
|
482
|
+
c("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam();
|
|
800
483
|
};
|
|
801
484
|
resolveHandleReadyRemoteStreamsDebounced = ({
|
|
802
485
|
onReadyRemoteStreams: n
|
|
803
|
-
}) =>
|
|
486
|
+
}) => ue(() => {
|
|
804
487
|
const t = this.sipConnector.getRemoteStreams();
|
|
805
|
-
|
|
488
|
+
c("remoteStreams", t), t && n(t);
|
|
806
489
|
}, 200);
|
|
807
490
|
// eslint-disable-next-line class-methods-use-this
|
|
808
491
|
resolveHandleReadyRemoteStreams = ({
|
|
809
492
|
onReadyRemoteStreams: n
|
|
810
493
|
}) => ({ track: t }) => {
|
|
811
|
-
|
|
494
|
+
xe(t) && n();
|
|
812
495
|
};
|
|
813
|
-
getRemoteStreams = () => (
|
|
814
|
-
onUseLicense = (n) => (
|
|
815
|
-
onMustStopPresentation = (n) => (
|
|
816
|
-
onMoveToSpectators = (n) => (
|
|
817
|
-
onMoveToParticipants = (n) => (
|
|
496
|
+
getRemoteStreams = () => (c("getRemoteStreams"), this.sipConnector.getRemoteStreams());
|
|
497
|
+
onUseLicense = (n) => (c("onUseLicense"), this.sipConnector.on("api:useLicense", n));
|
|
498
|
+
onMustStopPresentation = (n) => (c("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", n));
|
|
499
|
+
onMoveToSpectators = (n) => (c("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", n));
|
|
500
|
+
onMoveToParticipants = (n) => (c("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", n));
|
|
818
501
|
}
|
|
502
|
+
const V = (e) => {
|
|
503
|
+
const { url: n, cause: t } = e;
|
|
504
|
+
let o = n;
|
|
505
|
+
return (t === y.BAD_MEDIA_DESCRIPTION || t === y.NOT_FOUND) && (o = `${e.message.to.uri.user}@${e.message.to.uri.host}`), o;
|
|
506
|
+
};
|
|
507
|
+
var se = /* @__PURE__ */ ((e) => (e.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", e.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", e.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", e.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", e.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", e.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", e))(se || {});
|
|
508
|
+
const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
509
|
+
const { cause: n, socket: t } = e;
|
|
510
|
+
let o = "CONNECT_SERVER_FAILED";
|
|
511
|
+
switch (n) {
|
|
512
|
+
case "Forbidden": {
|
|
513
|
+
o = "WRONG_USER_OR_PASSWORD";
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
case y.BAD_MEDIA_DESCRIPTION: {
|
|
517
|
+
o = "BAD_MEDIA_ERROR";
|
|
518
|
+
break;
|
|
519
|
+
}
|
|
520
|
+
case y.NOT_FOUND: {
|
|
521
|
+
o = "NOT_FOUND_ERROR";
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
524
|
+
default:
|
|
525
|
+
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : V(e) !== void 0 && V(e) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
526
|
+
}
|
|
527
|
+
return o;
|
|
528
|
+
}, Ve = (e) => {
|
|
529
|
+
let n = "";
|
|
530
|
+
try {
|
|
531
|
+
n = JSON.stringify(e);
|
|
532
|
+
} catch (t) {
|
|
533
|
+
c("failed to stringify message", t);
|
|
534
|
+
}
|
|
535
|
+
return n;
|
|
536
|
+
}, Le = new Error("Unknown error"), He = (e = Le) => {
|
|
537
|
+
const { code: n, cause: t, message: o } = e, s = V(e), r = { code: "", cause: "", message: "" };
|
|
538
|
+
return typeof o == "object" && o !== null ? r.message = Ve(o) : o && (r.message = String(o)), s !== void 0 && s !== "" && (r.link = s), n !== void 0 && n !== "" && (r.code = n), t !== void 0 && t !== "" && (r.cause = t), r;
|
|
539
|
+
}, $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
540
|
+
__proto__: null,
|
|
541
|
+
EErrorTypes: se,
|
|
542
|
+
getLinkError: V,
|
|
543
|
+
getTypeFromError: Ue,
|
|
544
|
+
getValuesFromError: He
|
|
545
|
+
}, Symbol.toStringTag, { value: "Module" })), Je = ({
|
|
546
|
+
sessionId: e,
|
|
547
|
+
remoteAddress: n,
|
|
548
|
+
isMutedAudio: t,
|
|
549
|
+
isMutedVideo: o,
|
|
550
|
+
isRegistered: s,
|
|
551
|
+
isPresentationCall: r
|
|
552
|
+
}) => {
|
|
553
|
+
const i = [], a = t ? "0" : "1", u = o ? "0" : "1";
|
|
554
|
+
return i.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), (s === !1 || s === void 0) && i.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && i.push(`X-Vinteo-Session: ${e}`), r === !0 && i.push("X-Vinteo-Presentation-Call: yes"), n !== void 0 && n !== "" && i.push(`X-Vinteo-Remote: ${n}`), i;
|
|
555
|
+
}, Xe = "[@*!|]", We = "_", je = (e) => {
|
|
556
|
+
let n = e;
|
|
557
|
+
return n = n.replaceAll(new RegExp(Xe, "g"), We), n;
|
|
558
|
+
}, Ge = ({
|
|
559
|
+
appName: e,
|
|
560
|
+
appVersion: n,
|
|
561
|
+
browserName: t,
|
|
562
|
+
browserVersion: o
|
|
563
|
+
}) => {
|
|
564
|
+
const r = `${je(e)} ${n}`;
|
|
565
|
+
return `ChromeNew - ${t === void 0 ? r : `${t} ${o}, ${r}`}`;
|
|
566
|
+
}, Ke = ({
|
|
567
|
+
isUnifiedSdpSemantic: e,
|
|
568
|
+
appVersion: n,
|
|
569
|
+
browserName: t,
|
|
570
|
+
browserVersion: o,
|
|
571
|
+
appName: s
|
|
572
|
+
}) => e ? Ge({ appVersion: n, browserName: t, browserVersion: o, appName: s }) : "Chrome", Ye = (e) => (n) => [...n].map((o) => async () => e(o)), qe = async ({
|
|
573
|
+
accumulatedKeys: e,
|
|
574
|
+
sendKey: n,
|
|
575
|
+
canRunTask: t
|
|
576
|
+
}) => {
|
|
577
|
+
const s = Ye(n)(e);
|
|
578
|
+
return de(s, t);
|
|
579
|
+
}, ze = (e) => (t) => (c("onStartMainCam"), e.on("api:admin-start-main-cam", t)), Qe = (e) => (t) => (c("onStartMic"), e.on("api:admin-start-mic", t)), Ze = (e) => (t) => (c("onStopMainCam"), e.on("api:admin-stop-main-cam", t)), en = (e) => (t) => (c("onStopMic"), e.on("api:admin-stop-mic", t)), nn = ({ sipConnector: e }) => {
|
|
580
|
+
const n = (g, R) => ({ isSyncForced: C }) => {
|
|
581
|
+
if (C === !0) {
|
|
582
|
+
g();
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
R();
|
|
586
|
+
}, t = ze(e), o = Ze(e), s = Qe(e), r = en(e);
|
|
587
|
+
let i, a, u, l;
|
|
588
|
+
const h = ({
|
|
589
|
+
onStartMainCamForced: g,
|
|
590
|
+
onStartMainCamNotForced: R,
|
|
591
|
+
onStopMainCamForced: C,
|
|
592
|
+
onStopMainCamNotForced: S,
|
|
593
|
+
onStartMicForced: p,
|
|
594
|
+
onStartMicNotForced: E,
|
|
595
|
+
onStopMicForced: T,
|
|
596
|
+
onStopMicNotForced: v
|
|
597
|
+
}) => {
|
|
598
|
+
const _ = n(
|
|
599
|
+
g,
|
|
600
|
+
R
|
|
601
|
+
);
|
|
602
|
+
i = t(_);
|
|
603
|
+
const A = n(
|
|
604
|
+
C,
|
|
605
|
+
S
|
|
606
|
+
);
|
|
607
|
+
a = o(A);
|
|
608
|
+
const O = n(p, E);
|
|
609
|
+
u = s(O);
|
|
610
|
+
const N = n(T, v);
|
|
611
|
+
l = r(N);
|
|
612
|
+
}, f = () => {
|
|
613
|
+
i?.(), a?.(), u?.(), l?.();
|
|
614
|
+
};
|
|
615
|
+
return {
|
|
616
|
+
start: (g) => {
|
|
617
|
+
h(g);
|
|
618
|
+
},
|
|
619
|
+
stop: () => {
|
|
620
|
+
f();
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
}, Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
624
|
+
__proto__: null,
|
|
625
|
+
PURGATORY_CONFERENCE_NUMBER: oe,
|
|
626
|
+
createSyncMediaState: nn,
|
|
627
|
+
error: $e,
|
|
628
|
+
getExtraHeaders: Je,
|
|
629
|
+
getUserAgent: Ke,
|
|
630
|
+
hasPurgatory: x,
|
|
631
|
+
sendDtmfAccumulated: qe
|
|
632
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
633
|
+
var tn = /* @__PURE__ */ ((e) => (e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e))(tn || {});
|
|
634
|
+
const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find((t) => t?.type === n), rn = async (e) => e.getStats().then((n) => sn(n, "codec")?.mimeType), cn = (e) => e.find((n) => n.track?.kind === "video"), an = async (e, n, t) => {
|
|
635
|
+
const { isChanged: o, parameters: s } = await z(e, {
|
|
636
|
+
encodings: [
|
|
637
|
+
{
|
|
638
|
+
scaleResolutionDownBy: n.scaleResolutionDownBy,
|
|
639
|
+
maxBitrate: n.maxBitrate
|
|
640
|
+
}
|
|
641
|
+
]
|
|
642
|
+
});
|
|
643
|
+
return o && t && t(s), { isChanged: o, parameters: s };
|
|
644
|
+
}, re = le(), un = async () => re().catch((e) => {
|
|
645
|
+
c("videoSendingBalancer: error", e);
|
|
646
|
+
}), dn = async (e) => (re.add(e), un()), W = async ({
|
|
647
|
+
sender: e,
|
|
648
|
+
scaleResolutionDownBy: n,
|
|
649
|
+
maxBitrate: t,
|
|
650
|
+
onSetParameters: o
|
|
651
|
+
}) => dn(async () => an(e, { scaleResolutionDownBy: n, maxBitrate: t }, o)), ln = async ({ sender: e, codec: n }, t) => {
|
|
652
|
+
const s = Be(n);
|
|
653
|
+
return W({
|
|
654
|
+
sender: e,
|
|
655
|
+
maxBitrate: s,
|
|
656
|
+
onSetParameters: t,
|
|
657
|
+
scaleResolutionDownBy: 200
|
|
658
|
+
});
|
|
659
|
+
}, U = async ({
|
|
660
|
+
sender: e,
|
|
661
|
+
videoTrack: n,
|
|
662
|
+
codec: t
|
|
663
|
+
}, o) => {
|
|
664
|
+
const i = n.getSettings().width, a = ne(i ?? 0, t);
|
|
665
|
+
return W({
|
|
666
|
+
sender: e,
|
|
667
|
+
maxBitrate: a,
|
|
668
|
+
onSetParameters: o,
|
|
669
|
+
scaleResolutionDownBy: 1
|
|
670
|
+
});
|
|
671
|
+
}, fn = async ({
|
|
672
|
+
sender: e,
|
|
673
|
+
videoTrack: n,
|
|
674
|
+
resolution: t,
|
|
675
|
+
codec: o
|
|
676
|
+
}, s) => {
|
|
677
|
+
const [r, i] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = te({
|
|
678
|
+
videoTrack: n,
|
|
679
|
+
codec: o,
|
|
680
|
+
targetSize: {
|
|
681
|
+
width: Number(r),
|
|
682
|
+
height: Number(i)
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
return W({
|
|
686
|
+
sender: e,
|
|
687
|
+
maxBitrate: a,
|
|
688
|
+
onSetParameters: s,
|
|
689
|
+
scaleResolutionDownBy: u
|
|
690
|
+
});
|
|
691
|
+
}, hn = async ({
|
|
692
|
+
mainCam: e,
|
|
693
|
+
resolutionMainCam: n,
|
|
694
|
+
sender: t,
|
|
695
|
+
videoTrack: o,
|
|
696
|
+
codec: s
|
|
697
|
+
}, r) => {
|
|
698
|
+
switch (e) {
|
|
699
|
+
case w.PAUSE_MAIN_CAM:
|
|
700
|
+
return ln({ sender: t, codec: s }, r);
|
|
701
|
+
case w.RESUME_MAIN_CAM:
|
|
702
|
+
return U({ sender: t, videoTrack: o, codec: s }, r);
|
|
703
|
+
case w.MAX_MAIN_CAM_RESOLUTION:
|
|
704
|
+
return n !== void 0 ? fn(
|
|
705
|
+
{ sender: t, videoTrack: o, codec: s, resolution: n },
|
|
706
|
+
r
|
|
707
|
+
) : U({ sender: t, videoTrack: o, codec: s }, r);
|
|
708
|
+
case w.ADMIN_STOP_MAIN_CAM:
|
|
709
|
+
case w.ADMIN_START_MAIN_CAM:
|
|
710
|
+
case void 0:
|
|
711
|
+
return U({ sender: t, videoTrack: o, codec: s }, r);
|
|
712
|
+
default:
|
|
713
|
+
return U({ sender: t, videoTrack: o, codec: s }, r);
|
|
714
|
+
}
|
|
715
|
+
}, j = {
|
|
716
|
+
isChanged: !1,
|
|
717
|
+
parameters: {
|
|
718
|
+
encodings: [{}],
|
|
719
|
+
transactionId: "0",
|
|
720
|
+
codecs: [],
|
|
721
|
+
headerExtensions: [],
|
|
722
|
+
rtcp: {}
|
|
723
|
+
}
|
|
724
|
+
}, G = async ({
|
|
725
|
+
mainCam: e,
|
|
726
|
+
resolutionMainCam: n,
|
|
727
|
+
connection: t,
|
|
728
|
+
onSetParameters: o,
|
|
729
|
+
ignoreForCodec: s
|
|
730
|
+
}) => {
|
|
731
|
+
const r = t.getSenders(), i = cn(r);
|
|
732
|
+
if (!i?.track)
|
|
733
|
+
return j;
|
|
734
|
+
const a = await rn(i);
|
|
735
|
+
return Z(a, s) ? j : hn(
|
|
736
|
+
{
|
|
737
|
+
mainCam: e,
|
|
738
|
+
resolutionMainCam: n,
|
|
739
|
+
sender: i,
|
|
740
|
+
codec: a,
|
|
741
|
+
videoTrack: i.track
|
|
742
|
+
},
|
|
743
|
+
o
|
|
744
|
+
);
|
|
745
|
+
}, bn = (e, {
|
|
746
|
+
ignoreForCodec: n,
|
|
747
|
+
onSetParameters: t
|
|
748
|
+
} = {}) => {
|
|
749
|
+
const o = async () => {
|
|
750
|
+
const { connection: u } = e;
|
|
751
|
+
if (!u)
|
|
752
|
+
throw new Error("connection is not exist");
|
|
753
|
+
return G({
|
|
754
|
+
connection: u,
|
|
755
|
+
onSetParameters: t,
|
|
756
|
+
ignoreForCodec: n
|
|
757
|
+
});
|
|
758
|
+
};
|
|
759
|
+
let s = o;
|
|
760
|
+
const r = (u) => {
|
|
761
|
+
s = async () => {
|
|
762
|
+
const { mainCam: l, resolutionMainCam: h } = u, { connection: f } = e;
|
|
763
|
+
if (!f)
|
|
764
|
+
throw new Error("connection is not exist");
|
|
765
|
+
return G({
|
|
766
|
+
mainCam: l,
|
|
767
|
+
resolutionMainCam: h,
|
|
768
|
+
connection: f,
|
|
769
|
+
onSetParameters: t,
|
|
770
|
+
ignoreForCodec: n
|
|
771
|
+
});
|
|
772
|
+
}, s().catch(I);
|
|
773
|
+
};
|
|
774
|
+
return {
|
|
775
|
+
subscribe: () => {
|
|
776
|
+
e.on("api:main-cam-control", r);
|
|
777
|
+
},
|
|
778
|
+
unsubscribe: () => {
|
|
779
|
+
e.off("api:main-cam-control", r);
|
|
780
|
+
},
|
|
781
|
+
balanceByTrack: o,
|
|
782
|
+
resetMainCamControl() {
|
|
783
|
+
s = o;
|
|
784
|
+
},
|
|
785
|
+
async reBalance() {
|
|
786
|
+
return s();
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
};
|
|
819
790
|
export {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
bn as hasCanceledCallError,
|
|
835
|
-
Vn as hasCanceledStartPresentationError,
|
|
836
|
-
On as resolveVideoSendingBalancer,
|
|
837
|
-
Z as setParametersToSender,
|
|
838
|
-
vn as tools
|
|
791
|
+
y as ECallCause,
|
|
792
|
+
tn as EMimeTypesVideoCodecs,
|
|
793
|
+
On as EUseLicense,
|
|
794
|
+
Nn as SipConnector,
|
|
795
|
+
vn as SipConnectorFacade,
|
|
796
|
+
In as debug,
|
|
797
|
+
Bn as disableDebug,
|
|
798
|
+
wn as enableDebug,
|
|
799
|
+
rn as getCodecFromSender,
|
|
800
|
+
Tn as hasCanceledCallError,
|
|
801
|
+
Dn as hasCanceledStartPresentationError,
|
|
802
|
+
bn as resolveVideoSendingBalancer,
|
|
803
|
+
z as setParametersToSender,
|
|
804
|
+
Mn as tools
|
|
839
805
|
};
|