sip-connector 6.22.0 → 6.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SipConnector-4TW1xlov.cjs +1 -0
- package/dist/{SipConnector-_AhwhWtL.js → SipConnector-Hg44qtgr.js} +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +289 -326
- package/dist/index.cjs +1 -1
- package/dist/index.js +150 -150
- package/package.json +27 -25
- package/dist/SipConnector-XqVe938n.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { l as c, B as
|
|
2
|
-
import { f as
|
|
3
|
-
import { debounce as
|
|
4
|
-
import { isCanceledError as
|
|
5
|
-
import { default as
|
|
1
|
+
import { l as c, B as V, N as $, E as P, s as q, S as nn } from "./SipConnector-Hg44qtgr.js";
|
|
2
|
+
import { f as ln, g as Sn, i as dn, c as mn, a as fn, d as Cn, b as En, e as gn, h as Rn } from "./SipConnector-Hg44qtgr.js";
|
|
3
|
+
import { debounce as J } from "ts-debounce";
|
|
4
|
+
import { isCanceledError as Q } from "@krivega/cancelable-promise";
|
|
5
|
+
import { default as yn } from "debug";
|
|
6
6
|
import "events-constructor";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
},
|
|
7
|
+
const G = "purgatory", A = (e) => e === G, k = (e) => () => (c("getRemoteStreams"), e.getRemoteStreams()), Z = ({ kind: e, readyState: n }) => e === "video" && n === "live", j = (e) => ({ track: n }) => {
|
|
8
|
+
Z(n) && e();
|
|
9
|
+
}, D = ({
|
|
10
10
|
getRemoteStreams: e,
|
|
11
11
|
setRemoteStreams: n
|
|
12
|
-
}) =>
|
|
12
|
+
}) => J(() => {
|
|
13
13
|
const t = e();
|
|
14
14
|
c("remoteStreams", t), t && n(t);
|
|
15
|
-
}, 200),
|
|
15
|
+
}, 200), ee = (e) => async (t) => {
|
|
16
16
|
const {
|
|
17
17
|
mediaStream: s,
|
|
18
18
|
extraHeaders: r,
|
|
@@ -26,26 +26,26 @@ const $ = "purgatory", A = (e) => e === $, B = (e) => () => (c("getRemoteStreams
|
|
|
26
26
|
onFailProgressCall: T,
|
|
27
27
|
onFinishProgressCall: h,
|
|
28
28
|
onEndedCall: y
|
|
29
|
-
} = t, g =
|
|
29
|
+
} = t, g = D({
|
|
30
30
|
setRemoteStreams: u,
|
|
31
|
-
getRemoteStreams:
|
|
32
|
-
}),
|
|
31
|
+
getRemoteStreams: k(e)
|
|
32
|
+
}), M = j(g);
|
|
33
33
|
c("answerIncomingCall", t);
|
|
34
34
|
const v = async () => e.answerToIncomingCall({
|
|
35
35
|
mediaStream: s,
|
|
36
36
|
extraHeaders: r,
|
|
37
37
|
iceServers: o,
|
|
38
38
|
degradationPreference: a,
|
|
39
|
-
ontrack:
|
|
39
|
+
ontrack: M
|
|
40
40
|
}), p = () => {
|
|
41
41
|
const { remoteCallerData: d } = e;
|
|
42
42
|
return d.incomingNumber;
|
|
43
43
|
};
|
|
44
|
-
let
|
|
44
|
+
let _ = !1, i;
|
|
45
45
|
const l = (c("subscribeEnterConference: onEnterConference", f), C ?? f ? e.onSession("enterRoom", (d) => {
|
|
46
|
-
c("enterRoom", { _room: d, isSuccessProgressCall:
|
|
46
|
+
c("enterRoom", { _room: d, isSuccessProgressCall: _ }), i = d, A(i) ? C && C() : f && f({ isSuccessProgressCall: _ });
|
|
47
47
|
}) : () => {
|
|
48
|
-
}), R = (d) => (c("onSuccess"),
|
|
48
|
+
}), R = (d) => (c("onSuccess"), _ = !0, g(), E && E({ isPurgatory: A(i) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
49
49
|
l(), y && y();
|
|
50
50
|
}), d), b = (d) => {
|
|
51
51
|
throw c("onFail"), T && T(), l(), d;
|
|
@@ -57,7 +57,7 @@ const $ = "purgatory", A = (e) => e === $, B = (e) => () => (c("getRemoteStreams
|
|
|
57
57
|
m(d);
|
|
58
58
|
}
|
|
59
59
|
return v().then(R).catch(b).finally(O);
|
|
60
|
-
},
|
|
60
|
+
}, ne = (e) => async (t) => {
|
|
61
61
|
const {
|
|
62
62
|
conference: s,
|
|
63
63
|
mediaStream: r,
|
|
@@ -72,10 +72,10 @@ const $ = "purgatory", A = (e) => e === $, B = (e) => () => (c("getRemoteStreams
|
|
|
72
72
|
onFailProgressCall: h,
|
|
73
73
|
onFinishProgressCall: y,
|
|
74
74
|
onEndedCall: g
|
|
75
|
-
} = t,
|
|
75
|
+
} = t, M = D({
|
|
76
76
|
setRemoteStreams: m,
|
|
77
|
-
getRemoteStreams:
|
|
78
|
-
}), v =
|
|
77
|
+
getRemoteStreams: k(e)
|
|
78
|
+
}), v = j(M);
|
|
79
79
|
c("callToServer", t);
|
|
80
80
|
const p = async () => (c("startCall"), e.call({
|
|
81
81
|
mediaStream: r,
|
|
@@ -85,11 +85,11 @@ const $ = "purgatory", A = (e) => e === $, B = (e) => () => (c("getRemoteStreams
|
|
|
85
85
|
number: s,
|
|
86
86
|
ontrack: v
|
|
87
87
|
}));
|
|
88
|
-
let
|
|
88
|
+
let _ = !1, i;
|
|
89
89
|
const l = (c("subscribeEnterConference: onEnterConference", T), f ?? T ? e.onSession("enterRoom", (d) => {
|
|
90
|
-
c("enterRoom", { _room: d, isSuccessProgressCall:
|
|
90
|
+
c("enterRoom", { _room: d, isSuccessProgressCall: _ }), i = d, A(i) ? f && f() : T && T({ isSuccessProgressCall: _ });
|
|
91
91
|
}) : () => {
|
|
92
|
-
}), R = (d) => (c("onSuccess"),
|
|
92
|
+
}), R = (d) => (c("onSuccess"), _ = !0, M(), C && C({ isPurgatory: A(i) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
93
93
|
l(), g && g();
|
|
94
94
|
}), d), b = (d) => {
|
|
95
95
|
throw c("onFail"), h && h(), l(), d;
|
|
@@ -98,10 +98,10 @@ const $ = "purgatory", A = (e) => e === $, B = (e) => () => (c("getRemoteStreams
|
|
|
98
98
|
};
|
|
99
99
|
return c("onBeforeProgressCall"), E && E(s), p().then(R).catch(b).finally(O);
|
|
100
100
|
}, w = (e) => {
|
|
101
|
-
if (!
|
|
101
|
+
if (!Q(e))
|
|
102
102
|
throw e;
|
|
103
103
|
return !1;
|
|
104
|
-
},
|
|
104
|
+
}, te = (e) => async (t) => {
|
|
105
105
|
const {
|
|
106
106
|
userAgent: s,
|
|
107
107
|
sipWebSocketServerURL: r,
|
|
@@ -125,13 +125,13 @@ const $ = "purgatory", A = (e) => e === $, B = (e) => () => (c("getRemoteStreams
|
|
|
125
125
|
user: m,
|
|
126
126
|
register: C
|
|
127
127
|
}).then(() => (c("connectToServer then"), !0)).catch(async (h) => (c("connectToServer catch: error", h), T === !0 ? e.disconnect().then(() => w(h)).catch(() => w(h)) : w(h)));
|
|
128
|
-
},
|
|
128
|
+
}, se = (e) => async () => (c("disconnectFromServer"), e.disconnect().then(() => (c("disconnectFromServer: then"), !1)).catch((n) => (c("disconnectFromServer: catch", n), !1))), F = (e) => {
|
|
129
129
|
const { url: n, cause: t } = e;
|
|
130
130
|
let s = n;
|
|
131
|
-
return (t ===
|
|
131
|
+
return (t === V || t === $) && (s = `${e.message.to.uri.user}@${e.message.to.uri.host}`), s;
|
|
132
132
|
};
|
|
133
|
-
var
|
|
134
|
-
const
|
|
133
|
+
var X = /* @__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))(X || {});
|
|
134
|
+
const re = (e = new Error()) => {
|
|
135
135
|
var r;
|
|
136
136
|
const { cause: n, socket: t } = e;
|
|
137
137
|
let s = "CONNECT_SERVER_FAILED";
|
|
@@ -140,28 +140,28 @@ const se = (e = new Error()) => {
|
|
|
140
140
|
s = "WRONG_USER_OR_PASSWORD";
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
143
|
-
case
|
|
143
|
+
case V: {
|
|
144
144
|
s = "BAD_MEDIA_ERROR";
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
|
-
case
|
|
147
|
+
case $: {
|
|
148
148
|
s = "NOT_FOUND_ERROR";
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
151
|
default:
|
|
152
|
-
t && ((r = t == null ? void 0 : t._ws) == null ? void 0 : r.readyState) === 3 ? s = "WS_CONNECTION_FAILED" :
|
|
152
|
+
t && ((r = t == null ? void 0 : t._ws) == null ? void 0 : r.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : F(e) && (s = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
153
153
|
}
|
|
154
154
|
return s;
|
|
155
|
-
},
|
|
156
|
-
const { code: n, cause: t, message: s } = e, r =
|
|
155
|
+
}, oe = (e = new Error()) => {
|
|
156
|
+
const { code: n, cause: t, message: s } = e, r = F(e), o = {};
|
|
157
157
|
return s && (o.message = s), r && (o.link = r), n && (o.code = n), t && (o.cause = t), o;
|
|
158
|
-
},
|
|
158
|
+
}, ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
159
159
|
__proto__: null,
|
|
160
|
-
EErrorTypes:
|
|
161
|
-
getLinkError:
|
|
162
|
-
getTypeFromError:
|
|
163
|
-
getValuesFromError:
|
|
164
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
160
|
+
EErrorTypes: X,
|
|
161
|
+
getLinkError: F,
|
|
162
|
+
getTypeFromError: re,
|
|
163
|
+
getValuesFromError: oe
|
|
164
|
+
}, Symbol.toStringTag, { value: "Module" })), ae = ({
|
|
165
165
|
sessionId: e,
|
|
166
166
|
remoteAddress: n,
|
|
167
167
|
isMutedAudio: t,
|
|
@@ -171,7 +171,7 @@ const se = (e = new Error()) => {
|
|
|
171
171
|
}) => {
|
|
172
172
|
const a = [], u = t ? "0" : "1", m = s ? "0" : "1";
|
|
173
173
|
return a.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${m}`), r || a.push("X-Vinteo-Purgatory-Call: yes"), e && a.push(`X-Vinteo-Session: ${e}`), o && a.push("X-Vinteo-Presentation-Call: yes"), n && a.push(`X-Vinteo-Remote: ${n}`), a;
|
|
174
|
-
},
|
|
174
|
+
}, ie = ({
|
|
175
175
|
appName: e,
|
|
176
176
|
appVersion: n,
|
|
177
177
|
browserName: t,
|
|
@@ -179,33 +179,33 @@ const se = (e = new Error()) => {
|
|
|
179
179
|
}) => {
|
|
180
180
|
const r = `${e} ${n}`;
|
|
181
181
|
return `ChromeNew - ${t ? `${t} ${s}, ${r}` : r}`;
|
|
182
|
-
},
|
|
182
|
+
}, ue = ({
|
|
183
183
|
isUnifiedSdpSemantic: e,
|
|
184
184
|
appVersion: n,
|
|
185
185
|
browserName: t,
|
|
186
186
|
browserVersion: s,
|
|
187
187
|
appName: r
|
|
188
|
-
}) => e ?
|
|
188
|
+
}) => e ? ie({ appVersion: n, browserName: t, browserVersion: s, appName: r }) : "Chrome", le = (e) => async () => {
|
|
189
189
|
if (e.isCallActive)
|
|
190
190
|
return c("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
191
|
-
},
|
|
191
|
+
}, Se = (e) => (t) => (c("onMustStopPresentation"), e.onSession("mustStopPresentation", t)), de = (e) => (t) => (c("onUseLicense"), e.onSession("useLicense", t)), me = (e) => async ({
|
|
192
192
|
isEnabledCam: t,
|
|
193
193
|
isEnabledMic: s
|
|
194
194
|
}) => {
|
|
195
195
|
if (e.isCallActive)
|
|
196
196
|
return c("sendMediaState"), e.sendMediaState({ cam: t, mic: s });
|
|
197
|
-
},
|
|
197
|
+
}, fe = (e) => async () => {
|
|
198
198
|
if (e.isCallActive)
|
|
199
199
|
return c("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((t) => {
|
|
200
200
|
c("sendRefusalToTurnOnCam: error", t);
|
|
201
201
|
});
|
|
202
|
-
},
|
|
202
|
+
}, Ce = (e) => async () => {
|
|
203
203
|
if (e.isCallActive)
|
|
204
204
|
return c("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((t) => {
|
|
205
205
|
c("sendRefusalToTurnOnMic: error", t);
|
|
206
206
|
});
|
|
207
|
-
},
|
|
208
|
-
maxBitrate: e =
|
|
207
|
+
}, Ee = 1e6, ge = ({
|
|
208
|
+
maxBitrate: e = Ee,
|
|
209
209
|
sipConnector: n
|
|
210
210
|
}) => async ({
|
|
211
211
|
mediaStream: s,
|
|
@@ -213,22 +213,22 @@ const se = (e = new Error()) => {
|
|
|
213
213
|
}) => (c("startPresentation"), n.startPresentation(s, {
|
|
214
214
|
isP2P: r,
|
|
215
215
|
maxBitrate: e
|
|
216
|
-
})),
|
|
216
|
+
})), Re = ({ sipConnector: e }) => async ({ isP2P: t = !1 } = {}) => (c("stopShareSipConnector"), e.stopPresentation({
|
|
217
217
|
isP2P: t
|
|
218
|
-
}).catch(c)),
|
|
218
|
+
}).catch(c)), he = 1e6, ye = ({
|
|
219
219
|
sipConnector: e,
|
|
220
|
-
maxBitrate: n =
|
|
220
|
+
maxBitrate: n = he
|
|
221
221
|
}) => async ({
|
|
222
222
|
mediaStream: s,
|
|
223
223
|
isP2P: r = !1
|
|
224
224
|
}) => (c("updatePresentation"), e.updatePresentation(s, {
|
|
225
225
|
isP2P: r,
|
|
226
226
|
maxBitrate: n
|
|
227
|
-
})),
|
|
227
|
+
})), Te = "ERROR_NOT_RUNNING", Me = (e) => {
|
|
228
228
|
const n = new Error("Promise was not running");
|
|
229
|
-
return n.basePromise = e, n.id =
|
|
229
|
+
return n.basePromise = e, n.id = Te, n.name = "Not running", n;
|
|
230
230
|
}, _e = async (e, n) => e.reduce(
|
|
231
|
-
async (t, s) => t.then(async ({ success: r, errors: o, results: a }) => (!n || n(s) ? s() : Promise.reject(
|
|
231
|
+
async (t, s) => t.then(async ({ success: r, errors: o, results: a }) => (!n || n(s) ? s() : Promise.reject(Me(s))).then((u) => ({
|
|
232
232
|
errors: o,
|
|
233
233
|
success: [...r, u],
|
|
234
234
|
results: [...a, u],
|
|
@@ -248,21 +248,21 @@ const se = (e = new Error()) => {
|
|
|
248
248
|
isSuccessful: !1,
|
|
249
249
|
isError: !1
|
|
250
250
|
})
|
|
251
|
-
),
|
|
251
|
+
), be = (e) => (n) => [...n].map((s) => async () => e(s)), Ne = async ({
|
|
252
252
|
accumulatedKeys: e,
|
|
253
253
|
sendKey: n,
|
|
254
254
|
canRunTask: t
|
|
255
255
|
}) => {
|
|
256
|
-
const r =
|
|
256
|
+
const r = be(n)(e);
|
|
257
257
|
return _e(r, t);
|
|
258
|
-
},
|
|
259
|
-
const n = (y, g) => ({ isSyncForced:
|
|
260
|
-
if (
|
|
258
|
+
}, Oe = (e) => (t) => (c("onStartMainCam"), e.onSession("admin-start-main-cam", t)), ve = (e) => (t) => (c("onStartMic"), e.onSession("admin-start-mic", t)), pe = (e) => (t) => (c("onStopMainCam"), e.onSession("admin-stop-main-cam", t)), Ae = (e) => (t) => (c("onStopMic"), e.onSession("admin-stop-mic", t)), Pe = ({ sipConnector: e }) => {
|
|
259
|
+
const n = (y, g) => ({ isSyncForced: M = !1 }) => {
|
|
260
|
+
if (M) {
|
|
261
261
|
y();
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
g();
|
|
265
|
-
}, t =
|
|
265
|
+
}, t = Oe(e), s = pe(e), r = ve(e), o = Ae(e);
|
|
266
266
|
let a = () => {
|
|
267
267
|
}, u = () => {
|
|
268
268
|
}, m = () => {
|
|
@@ -271,10 +271,10 @@ const se = (e = new Error()) => {
|
|
|
271
271
|
const C = ({
|
|
272
272
|
onStartMainCamForced: y,
|
|
273
273
|
onStartMainCamNotForced: g,
|
|
274
|
-
onStopMainCamForced:
|
|
274
|
+
onStopMainCamForced: M,
|
|
275
275
|
onStopMainCamNotForced: v,
|
|
276
276
|
onStartMicForced: p,
|
|
277
|
-
onStartMicNotForced:
|
|
277
|
+
onStartMicNotForced: _,
|
|
278
278
|
onStopMicForced: i,
|
|
279
279
|
onStopMicNotForced: S
|
|
280
280
|
}) => {
|
|
@@ -284,11 +284,11 @@ const se = (e = new Error()) => {
|
|
|
284
284
|
);
|
|
285
285
|
a = t(l);
|
|
286
286
|
const R = n(
|
|
287
|
-
|
|
287
|
+
M,
|
|
288
288
|
v
|
|
289
289
|
);
|
|
290
290
|
u = s(R);
|
|
291
|
-
const b = n(p,
|
|
291
|
+
const b = n(p, _);
|
|
292
292
|
m = r(b);
|
|
293
293
|
const O = n(i, S);
|
|
294
294
|
E = o(O);
|
|
@@ -303,41 +303,41 @@ const se = (e = new Error()) => {
|
|
|
303
303
|
f();
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
|
-
},
|
|
306
|
+
}, on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
307
307
|
__proto__: null,
|
|
308
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
309
|
-
createSyncMediaState:
|
|
310
|
-
error:
|
|
311
|
-
getExtraHeaders:
|
|
312
|
-
getUserAgent:
|
|
308
|
+
PURGATORY_CONFERENCE_NUMBER: G,
|
|
309
|
+
createSyncMediaState: Pe,
|
|
310
|
+
error: ce,
|
|
311
|
+
getExtraHeaders: ae,
|
|
312
|
+
getUserAgent: ue,
|
|
313
313
|
hasPurgatory: A,
|
|
314
|
-
resolveAnswerIncomingCall:
|
|
315
|
-
resolveAskPermissionToEnableCam:
|
|
316
|
-
resolveCallToServer:
|
|
317
|
-
resolveConnectToServer:
|
|
318
|
-
resolveDisconnectFromServer:
|
|
319
|
-
resolveGetRemoteStreams:
|
|
320
|
-
resolveOnMustStopPresentation:
|
|
321
|
-
resolveOnUseLicense:
|
|
322
|
-
resolveSendMediaState:
|
|
323
|
-
resolveSendRefusalToTurnOnCam:
|
|
324
|
-
resolveSendRefusalToTurnOnMic:
|
|
325
|
-
resolveStartPresentation:
|
|
326
|
-
resolveStopShareSipConnector:
|
|
327
|
-
resolveUpdatePresentation:
|
|
328
|
-
resolveUpdateRemoteStreams:
|
|
329
|
-
sendDTMFAccumulated:
|
|
330
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
331
|
-
const t =
|
|
314
|
+
resolveAnswerIncomingCall: ee,
|
|
315
|
+
resolveAskPermissionToEnableCam: le,
|
|
316
|
+
resolveCallToServer: ne,
|
|
317
|
+
resolveConnectToServer: te,
|
|
318
|
+
resolveDisconnectFromServer: se,
|
|
319
|
+
resolveGetRemoteStreams: k,
|
|
320
|
+
resolveOnMustStopPresentation: Se,
|
|
321
|
+
resolveOnUseLicense: de,
|
|
322
|
+
resolveSendMediaState: me,
|
|
323
|
+
resolveSendRefusalToTurnOnCam: fe,
|
|
324
|
+
resolveSendRefusalToTurnOnMic: Ce,
|
|
325
|
+
resolveStartPresentation: ge,
|
|
326
|
+
resolveStopShareSipConnector: Re,
|
|
327
|
+
resolveUpdatePresentation: ye,
|
|
328
|
+
resolveUpdateRemoteStreams: D,
|
|
329
|
+
sendDTMFAccumulated: Ne
|
|
330
|
+
}, Symbol.toStringTag, { value: "Module" })), we = (e) => [...e.keys()].map((n) => e.get(n)), Ie = (e, n) => we(e).find((t) => t.type === n), Be = async (e) => e.getStats().then((n) => {
|
|
331
|
+
const t = Ie(n, "codec");
|
|
332
332
|
return t == null ? void 0 : t.mimeType;
|
|
333
|
-
}),
|
|
333
|
+
}), ke = (e) => e.find((n) => {
|
|
334
334
|
var t;
|
|
335
335
|
return ((t = n == null ? void 0 : n.track) == null ? void 0 : t.kind) === "video";
|
|
336
|
-
}),
|
|
336
|
+
}), K = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()), De = "ERROR_NOT_RUNNING", Fe = (e) => {
|
|
337
337
|
const n = new Error("Promise was not running");
|
|
338
|
-
return n.basePromise = e, n.id =
|
|
339
|
-
},
|
|
340
|
-
async (t, s) => t.then(async ({ success: r, errors: o, results: a }) => (!n || n(s) ? s() : Promise.reject(
|
|
338
|
+
return n.basePromise = e, n.id = De, n.name = "Not running", n;
|
|
339
|
+
}, Ue = async (e, n) => e.reduce(
|
|
340
|
+
async (t, s) => t.then(async ({ success: r, errors: o, results: a }) => (!n || n(s) ? s() : Promise.reject(Fe(s))).then((u) => ({
|
|
341
341
|
errors: o,
|
|
342
342
|
success: [...r, u],
|
|
343
343
|
results: [...a, u],
|
|
@@ -357,9 +357,9 @@ const se = (e = new Error()) => {
|
|
|
357
357
|
isSuccessful: !1,
|
|
358
358
|
isError: !1
|
|
359
359
|
})
|
|
360
|
-
),
|
|
360
|
+
), Le = new Error("Stack is empty"), I = (e) => e[e.length - 1], xe = new Error("Promise is not actual"), Ve = new Error(
|
|
361
361
|
"stackPromises only works with functions that returns a Promise"
|
|
362
|
-
),
|
|
362
|
+
), $e = ({
|
|
363
363
|
noRejectIsNotActual: e = !1,
|
|
364
364
|
noRunIsNotActual: n = !1
|
|
365
365
|
} = {}) => {
|
|
@@ -380,7 +380,7 @@ const se = (e = new Error()) => {
|
|
|
380
380
|
if (l)
|
|
381
381
|
return l.promise;
|
|
382
382
|
}, u = ({ task: i }) => {
|
|
383
|
-
const S = s
|
|
383
|
+
const S = I(s);
|
|
384
384
|
return (S == null ? void 0 : S.task) === i;
|
|
385
385
|
}, m = ({ task: i, index: S }) => (r({ task: i, index: S }), async () => {
|
|
386
386
|
let l = a({ task: i, index: S });
|
|
@@ -392,7 +392,7 @@ const se = (e = new Error()) => {
|
|
|
392
392
|
}) => ({ results: l, isSuccessful: R }) => {
|
|
393
393
|
const b = l.length, O = t.length;
|
|
394
394
|
if (b === O) {
|
|
395
|
-
const d = l
|
|
395
|
+
const d = I(l);
|
|
396
396
|
if (R) {
|
|
397
397
|
i(d);
|
|
398
398
|
return;
|
|
@@ -401,75 +401,75 @@ const se = (e = new Error()) => {
|
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
403
|
if (e) {
|
|
404
|
-
const d = l
|
|
404
|
+
const d = I(l);
|
|
405
405
|
i(d);
|
|
406
406
|
return;
|
|
407
407
|
}
|
|
408
|
-
S(
|
|
408
|
+
S(xe);
|
|
409
409
|
};
|
|
410
410
|
let C = !1;
|
|
411
411
|
const f = () => {
|
|
412
412
|
C = !0;
|
|
413
413
|
}, T = () => {
|
|
414
414
|
C = !1;
|
|
415
|
-
}, h = () => C, y = async () => (f(),
|
|
415
|
+
}, h = () => C, y = async () => (f(), Ue(t, h)), g = async () => {
|
|
416
416
|
if (t.length === 0)
|
|
417
|
-
throw
|
|
417
|
+
throw Le;
|
|
418
418
|
return new Promise((i, S) => {
|
|
419
419
|
const l = E({ resolve: i, reject: S });
|
|
420
420
|
y().then(l).catch(l);
|
|
421
421
|
});
|
|
422
|
-
},
|
|
422
|
+
}, M = (i) => {
|
|
423
423
|
if (typeof i != "function")
|
|
424
|
-
throw
|
|
424
|
+
throw Ve;
|
|
425
425
|
const S = t.length;
|
|
426
426
|
return t.push(m({ task: i, index: S })), g;
|
|
427
|
-
}, v = async (i) => (
|
|
427
|
+
}, v = async (i) => (M(i), g()), p = () => {
|
|
428
428
|
t.length = 0, s.length = 0;
|
|
429
|
-
},
|
|
429
|
+
}, _ = () => {
|
|
430
430
|
T(), p();
|
|
431
431
|
};
|
|
432
|
-
return g.add =
|
|
433
|
-
},
|
|
434
|
-
const t =
|
|
435
|
-
return
|
|
436
|
-
},
|
|
432
|
+
return g.add = M, g.run = v, g.stop = _, g;
|
|
433
|
+
}, Ge = 1e6, N = (e) => e * Ge, W = N(0.06), je = N(4), Xe = (e) => e <= 64 ? W : e <= 128 ? N(0.12) : e <= 256 ? N(0.25) : e <= 384 ? N(0.32) : e <= 426 ? N(0.38) : e <= 640 ? N(0.5) : e <= 848 ? N(0.7) : e <= 1280 ? N(1) : e <= 1920 ? N(2) : je, Ke = "av1", We = (e) => K(e, Ke), He = 0.6, H = (e, n) => We(n) ? e * He : e, Ye = (e) => H(W, e), Y = (e, n) => {
|
|
434
|
+
const t = Xe(e);
|
|
435
|
+
return H(t, n);
|
|
436
|
+
}, z = $e(), ze = async () => z().catch((e) => {
|
|
437
437
|
c("videoSendingBalancer: error", e);
|
|
438
|
-
}),
|
|
438
|
+
}), qe = async (e) => (z.add(e), ze()), U = async ({
|
|
439
439
|
sender: e,
|
|
440
440
|
scaleResolutionDownBy: n,
|
|
441
441
|
maxBitrate: t,
|
|
442
442
|
onSetParameters: s
|
|
443
|
-
}) =>
|
|
444
|
-
const r =
|
|
445
|
-
return
|
|
443
|
+
}) => qe(async () => q(e, { scaleResolutionDownBy: n, maxBitrate: t }, s)), Je = async ({ sender: e, codec: n }, t) => {
|
|
444
|
+
const r = Ye(n);
|
|
445
|
+
return U({
|
|
446
446
|
sender: e,
|
|
447
447
|
maxBitrate: r,
|
|
448
448
|
onSetParameters: t,
|
|
449
449
|
scaleResolutionDownBy: 200
|
|
450
450
|
});
|
|
451
|
-
},
|
|
452
|
-
const a = n.getSettings().width, u =
|
|
453
|
-
return
|
|
451
|
+
}, B = async ({ sender: e, track: n, codec: t }, s) => {
|
|
452
|
+
const a = n.getSettings().width, u = Y(a, t);
|
|
453
|
+
return U({
|
|
454
454
|
sender: e,
|
|
455
455
|
maxBitrate: u,
|
|
456
456
|
onSetParameters: s,
|
|
457
457
|
scaleResolutionDownBy: 1
|
|
458
458
|
});
|
|
459
|
-
},
|
|
459
|
+
}, Qe = async ({
|
|
460
460
|
sender: e,
|
|
461
461
|
track: n,
|
|
462
462
|
resolution: t,
|
|
463
463
|
codec: s
|
|
464
464
|
}, r) => {
|
|
465
|
-
const o = n.getSettings(), a = o.width, u = o.height, [m, E] = t.split("x"), C = a / Number(m), f = u / Number(E), h = Math.max(C, f, 1), y =
|
|
466
|
-
return
|
|
465
|
+
const o = n.getSettings(), a = o.width, u = o.height, [m, E] = t.split("x"), C = a / Number(m), f = u / Number(E), h = Math.max(C, f, 1), y = Y(Number(m), s);
|
|
466
|
+
return U({
|
|
467
467
|
sender: e,
|
|
468
468
|
maxBitrate: y,
|
|
469
469
|
onSetParameters: r,
|
|
470
470
|
scaleResolutionDownBy: h
|
|
471
471
|
});
|
|
472
|
-
},
|
|
472
|
+
}, Ze = async ({
|
|
473
473
|
mainCam: e,
|
|
474
474
|
resolutionMainCam: n,
|
|
475
475
|
sender: t,
|
|
@@ -478,18 +478,18 @@ const se = (e = new Error()) => {
|
|
|
478
478
|
}, o) => {
|
|
479
479
|
switch (e) {
|
|
480
480
|
case P.PAUSE_MAIN_CAM:
|
|
481
|
-
return
|
|
481
|
+
return Je({ sender: t, codec: r }, o);
|
|
482
482
|
case P.RESUME_MAIN_CAM:
|
|
483
|
-
return
|
|
483
|
+
return B({ sender: t, track: s, codec: r }, o);
|
|
484
484
|
case P.MAX_MAIN_CAM_RESOLUTION:
|
|
485
|
-
return n !== void 0 ?
|
|
485
|
+
return n !== void 0 ? Qe(
|
|
486
486
|
{ sender: t, track: s, codec: r, resolution: n },
|
|
487
487
|
o
|
|
488
|
-
) :
|
|
488
|
+
) : B({ sender: t, track: s, codec: r }, o);
|
|
489
489
|
default:
|
|
490
|
-
return
|
|
490
|
+
return B({ sender: t, track: s, codec: r }, o);
|
|
491
491
|
}
|
|
492
|
-
},
|
|
492
|
+
}, L = {
|
|
493
493
|
isChanged: !1,
|
|
494
494
|
parameters: {
|
|
495
495
|
encodings: [{}],
|
|
@@ -498,22 +498,22 @@ const se = (e = new Error()) => {
|
|
|
498
498
|
headerExtensions: [],
|
|
499
499
|
rtcp: {}
|
|
500
500
|
}
|
|
501
|
-
},
|
|
501
|
+
}, x = async ({
|
|
502
502
|
mainCam: e,
|
|
503
503
|
resolutionMainCam: n,
|
|
504
504
|
connection: t,
|
|
505
505
|
onSetParameters: s,
|
|
506
506
|
ignoreForCodec: r
|
|
507
507
|
}) => {
|
|
508
|
-
const o = t.getSenders(), a =
|
|
508
|
+
const o = t.getSenders(), a = ke(o);
|
|
509
509
|
if (!(a != null && a.track))
|
|
510
|
-
return
|
|
511
|
-
const u = await
|
|
512
|
-
return
|
|
510
|
+
return L;
|
|
511
|
+
const u = await Be(a);
|
|
512
|
+
return K(u, r) ? L : Ze(
|
|
513
513
|
{ mainCam: e, resolutionMainCam: n, sender: a, codec: u, track: a.track },
|
|
514
514
|
s
|
|
515
515
|
);
|
|
516
|
-
},
|
|
516
|
+
}, cn = (e, {
|
|
517
517
|
ignoreForCodec: n,
|
|
518
518
|
onSetParameters: t
|
|
519
519
|
} = {}) => {
|
|
@@ -521,7 +521,7 @@ const se = (e = new Error()) => {
|
|
|
521
521
|
const { connection: m } = e;
|
|
522
522
|
if (!m)
|
|
523
523
|
throw new Error("connection is not exist");
|
|
524
|
-
return
|
|
524
|
+
return x({
|
|
525
525
|
connection: m,
|
|
526
526
|
onSetParameters: t,
|
|
527
527
|
ignoreForCodec: n
|
|
@@ -532,7 +532,7 @@ const se = (e = new Error()) => {
|
|
|
532
532
|
const { mainCam: E, resolutionMainCam: C } = m, { connection: f } = e;
|
|
533
533
|
if (!f)
|
|
534
534
|
throw new Error("connection is not exist");
|
|
535
|
-
return
|
|
535
|
+
return x({
|
|
536
536
|
mainCam: E,
|
|
537
537
|
resolutionMainCam: C,
|
|
538
538
|
connection: f,
|
|
@@ -558,18 +558,18 @@ const se = (e = new Error()) => {
|
|
|
558
558
|
};
|
|
559
559
|
export {
|
|
560
560
|
P as EEventsMainCAM,
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
561
|
+
ln as EEventsMic,
|
|
562
|
+
Sn as EEventsSyncMediaState,
|
|
563
|
+
dn as EUseLicense,
|
|
564
|
+
mn as causes,
|
|
565
|
+
fn as constants,
|
|
566
|
+
yn as debug,
|
|
567
|
+
nn as default,
|
|
568
|
+
Cn as disableDebug,
|
|
569
|
+
En as enableDebug,
|
|
570
|
+
gn as eventNames,
|
|
571
|
+
Be as getCodecFromSender,
|
|
572
|
+
Rn as hasCanceledCallError,
|
|
573
|
+
cn as resolveVideoSendingBalancer,
|
|
574
|
+
on as tools
|
|
575
575
|
};
|