sip-connector 8.2.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SipConnector-BCc5pokv.cjs +1 -0
- package/dist/{SipConnector-C5s0hhzA.js → SipConnector-DagL4rCl.js} +209 -202
- package/dist/SipConnector.d.ts +6 -5
- package/dist/__fixtures__/BaseSession.mock.d.ts +0 -1
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +0 -1
- package/dist/__fixtures__/Registrator.mock.d.ts +0 -1
- package/dist/__fixtures__/Request.mock.d.ts +0 -1
- package/dist/__fixtures__/Session.mock.d.ts +0 -1
- package/dist/__fixtures__/UA.mock.d.ts +0 -1
- package/dist/__fixtures__/index.d.ts +0 -1
- package/dist/__fixtures__/jssip.mock.d.ts +0 -1
- package/dist/constants.d.ts +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.d.ts +0 -1
- package/dist/doMock.js +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +107 -105
- package/dist/logger.d.ts +0 -1
- package/dist/tools/__fixtures__/call.d.ts +0 -1
- package/dist/tools/__fixtures__/connectToServer.d.ts +0 -1
- package/dist/tools/__fixtures__/hasValidUri.d.ts +0 -1
- package/dist/tools/__fixtures__/processRequest.d.ts +0 -1
- package/dist/tools/answerIncomingCall.d.ts +0 -1
- package/dist/tools/callToServer.d.ts +0 -1
- package/dist/tools/connectToServer.d.ts +0 -1
- package/dist/tools/disconnectFromServer.d.ts +0 -1
- package/dist/tools/error/getLinkError.d.ts +0 -1
- package/dist/tools/error/getTypeFromError.d.ts +0 -1
- package/dist/tools/error/getValuesFromError.d.ts +0 -1
- package/dist/tools/prepareMediaStream.d.ts +7 -0
- package/dist/tools/resolveAskPermissionToEnableCam.d.ts +0 -1
- package/dist/tools/resolveGetRemoteStreams.d.ts +0 -1
- package/dist/tools/resolveOnMoveToSpectators.d.ts +0 -1
- package/dist/tools/resolveOnMustStopPresentation.d.ts +0 -1
- package/dist/tools/resolveOnUseLicense.d.ts +0 -1
- package/dist/tools/resolveSendMediaState.d.ts +0 -1
- package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +0 -1
- package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +0 -1
- package/dist/tools/resolveStartPresentation.d.ts +4 -4
- package/dist/tools/resolveStopShareSipConnector.d.ts +0 -1
- package/dist/tools/resolveUpdatePresentation.d.ts +0 -1
- package/dist/tools/resolveUpdateRemoteStreams.d.ts +1 -1
- package/dist/tools/setVideoTrackContentHints.d.ts +3 -0
- package/dist/tools/syncMediaState/index.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +0 -1
- package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +0 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +0 -4
- package/dist/videoSendingBalancer/balance.d.ts +0 -1
- package/dist/videoSendingBalancer/index.d.ts +0 -1
- package/dist/videoSendingBalancer/processSender.d.ts +0 -1
- package/package.json +19 -17
- package/dist/SipConnector-BA8w-WR5.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { l as o, B as V, N as x, E as B, s as q, S as
|
|
2
|
-
import { f as
|
|
1
|
+
import { l as o, B as V, N as x, E as B, s as q, S as Je } from "./SipConnector-DagL4rCl.js";
|
|
2
|
+
import { f as cn, g as un, i as ln, c as Sn, a as mn, d as dn, b as fn, e as Cn, h as gn } from "./SipConnector-DagL4rCl.js";
|
|
3
3
|
import { debounce as z } from "ts-debounce";
|
|
4
4
|
import { isCanceledError as J } from "@krivega/cancelable-promise";
|
|
5
5
|
import { hasCanceledError as Q } from "repeated-calls";
|
|
6
6
|
import { sequentPromises as Z } from "sequent-promises";
|
|
7
7
|
import { createStackPromises as ee } from "stack-promises";
|
|
8
|
-
import { default as
|
|
9
|
-
const $ = "purgatory",
|
|
8
|
+
import { default as En } from "debug";
|
|
9
|
+
const $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), ne = ({ kind: e, readyState: t }) => e === "video" && t === "live", X = (e) => ({ track: t }) => {
|
|
10
10
|
ne(t) && e();
|
|
11
11
|
}, D = ({
|
|
12
12
|
getRemoteStreams: e,
|
|
@@ -26,39 +26,39 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
26
26
|
onEnterPurgatory: f,
|
|
27
27
|
onEnterConference: S,
|
|
28
28
|
onFailProgressCall: m,
|
|
29
|
-
onFinishProgressCall:
|
|
29
|
+
onFinishProgressCall: T,
|
|
30
30
|
onEndedCall: C
|
|
31
31
|
} = n, R = D({
|
|
32
32
|
setRemoteStreams: u,
|
|
33
33
|
getRemoteStreams: w(e)
|
|
34
|
-
}), y =
|
|
34
|
+
}), y = X(R);
|
|
35
35
|
o("answerIncomingCall", n);
|
|
36
|
-
const
|
|
36
|
+
const b = async () => e.answerToIncomingCall({
|
|
37
37
|
mediaStream: r,
|
|
38
38
|
extraHeaders: s,
|
|
39
39
|
iceServers: a,
|
|
40
40
|
degradationPreference: c,
|
|
41
41
|
ontrack: y
|
|
42
|
-
}),
|
|
42
|
+
}), _ = () => {
|
|
43
43
|
const { remoteCallerData: i } = e;
|
|
44
44
|
return i.incomingNumber;
|
|
45
45
|
};
|
|
46
|
-
let E = !1,
|
|
47
|
-
const
|
|
48
|
-
o("enterRoom", { _room: i, isSuccessProgressCall: E }),
|
|
46
|
+
let E = !1, M;
|
|
47
|
+
const h = (o("subscribeEnterConference: onEnterConference", S), f ?? S ? e.onSession("enterRoom", (i) => {
|
|
48
|
+
o("enterRoom", { _room: i, isSuccessProgressCall: E }), M = i, A(M) ? f && f() : S && S({ isSuccessProgressCall: E });
|
|
49
49
|
}) : () => {
|
|
50
|
-
}), p = (i) => (o("onSuccess"), E = !0, R(), d && d({ isPurgatory:
|
|
51
|
-
|
|
50
|
+
}), p = (i) => (o("onSuccess"), E = !0, R(), d && d({ isPurgatory: A(M) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
51
|
+
h(), C && C();
|
|
52
52
|
}), i), O = (i) => {
|
|
53
|
-
throw o("onFail"), m && m(),
|
|
53
|
+
throw o("onFail"), m && m(), h(), i;
|
|
54
54
|
}, v = () => {
|
|
55
|
-
o("onFinish"),
|
|
55
|
+
o("onFinish"), T && T();
|
|
56
56
|
};
|
|
57
57
|
if (o("onBeforeProgressCall"), l) {
|
|
58
|
-
const i =
|
|
58
|
+
const i = _();
|
|
59
59
|
l(i);
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return b().then(p).catch((i) => O(i)).finally(v);
|
|
62
62
|
}, re = (e) => async (n) => {
|
|
63
63
|
const {
|
|
64
64
|
conference: r,
|
|
@@ -71,35 +71,35 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
71
71
|
onSuccessProgressCall: f,
|
|
72
72
|
onEnterPurgatory: S,
|
|
73
73
|
onEnterConference: m,
|
|
74
|
-
onFailProgressCall:
|
|
74
|
+
onFailProgressCall: T,
|
|
75
75
|
onFinishProgressCall: C,
|
|
76
76
|
onEndedCall: R
|
|
77
77
|
} = n, y = D({
|
|
78
78
|
setRemoteStreams: l,
|
|
79
79
|
getRemoteStreams: w(e)
|
|
80
|
-
}),
|
|
80
|
+
}), b = X(y);
|
|
81
81
|
o("callToServer", n);
|
|
82
|
-
const
|
|
82
|
+
const _ = async () => (o("startCall"), e.call({
|
|
83
83
|
mediaStream: s,
|
|
84
84
|
extraHeaders: a,
|
|
85
85
|
iceServers: c,
|
|
86
86
|
degradationPreference: u,
|
|
87
87
|
number: r,
|
|
88
|
-
ontrack:
|
|
88
|
+
ontrack: b
|
|
89
89
|
}));
|
|
90
|
-
let E = !1,
|
|
91
|
-
const
|
|
92
|
-
o("enterRoom", { _room: i, isSuccessProgressCall: E }),
|
|
90
|
+
let E = !1, M;
|
|
91
|
+
const h = (o("subscribeEnterConference: onEnterConference", m), S ?? m ? e.onSession("enterRoom", ({ room: i }) => {
|
|
92
|
+
o("enterRoom", { _room: i, isSuccessProgressCall: E }), M = i, A(M) ? S && S() : m && m({ isSuccessProgressCall: E });
|
|
93
93
|
}) : () => {
|
|
94
|
-
}), p = (i) => (o("onSuccess"), E = !0, y(), f && f({ isPurgatory:
|
|
95
|
-
|
|
94
|
+
}), p = (i) => (o("onSuccess"), E = !0, y(), f && f({ isPurgatory: A(M) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
95
|
+
h(), R && R();
|
|
96
96
|
}), i), O = (i) => {
|
|
97
|
-
throw o("onFail"),
|
|
97
|
+
throw o("onFail"), T && T(), h(), i;
|
|
98
98
|
}, v = () => {
|
|
99
99
|
o("onFinish"), C && C();
|
|
100
100
|
};
|
|
101
|
-
return o("onBeforeProgressCall"), d && d(r),
|
|
102
|
-
},
|
|
101
|
+
return o("onBeforeProgressCall"), d && d(r), _().then(p).catch((i) => O(i)).finally(v);
|
|
102
|
+
}, P = (e) => {
|
|
103
103
|
if (!J(e) && !Q(e))
|
|
104
104
|
throw e;
|
|
105
105
|
return { isSuccessful: !1 };
|
|
@@ -124,13 +124,13 @@ const $ = "purgatory", N = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
124
124
|
password: d,
|
|
125
125
|
user: l,
|
|
126
126
|
register: f
|
|
127
|
-
}).then((m) => (o("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (o("connectToServer catch: error", m), S === !0 ? e.disconnect().then(() =>
|
|
127
|
+
}).then((m) => (o("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (o("connectToServer catch: error", m), S === !0 ? e.disconnect().then(() => P(m)).catch(() => P(m)) : P(m)));
|
|
128
128
|
}, oe = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), F = (e) => {
|
|
129
129
|
const { url: t, cause: n } = e;
|
|
130
130
|
let r = t;
|
|
131
131
|
return (n === V || n === x) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
|
|
132
132
|
};
|
|
133
|
-
var
|
|
133
|
+
var G = /* @__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))(G || {});
|
|
134
134
|
const ae = (e = new Error()) => {
|
|
135
135
|
var s;
|
|
136
136
|
const { cause: t, socket: n } = e;
|
|
@@ -165,7 +165,7 @@ const ae = (e = new Error()) => {
|
|
|
165
165
|
return typeof r == "object" && r !== null ? a.message = ce(r) : r && (a.message = String(r)), s && (a.link = s), t && (a.code = t), n && (a.cause = n), a;
|
|
166
166
|
}, ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
167
167
|
__proto__: null,
|
|
168
|
-
EErrorTypes:
|
|
168
|
+
EErrorTypes: G,
|
|
169
169
|
getLinkError: F,
|
|
170
170
|
getTypeFromError: ae,
|
|
171
171
|
getValuesFromError: ie
|
|
@@ -199,7 +199,7 @@ const ae = (e = new Error()) => {
|
|
|
199
199
|
}) => e ? fe({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", ge = (e) => async () => {
|
|
200
200
|
if (e.isCallActive)
|
|
201
201
|
return o("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
202
|
-
}, Re = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Ee = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)),
|
|
202
|
+
}, Re = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Ee = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)), Me = (e) => (n) => (o("onUseLicense"), e.onSession("useLicense", n)), Te = (e) => async ({
|
|
203
203
|
isEnabledCam: n,
|
|
204
204
|
isEnabledMic: r
|
|
205
205
|
}) => {
|
|
@@ -210,52 +210,54 @@ const ae = (e = new Error()) => {
|
|
|
210
210
|
return o("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((n) => {
|
|
211
211
|
o("sendRefusalToTurnOnCam: error", n);
|
|
212
212
|
});
|
|
213
|
-
},
|
|
213
|
+
}, he = (e) => async () => {
|
|
214
214
|
if (e.isCallActive)
|
|
215
215
|
return o("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((n) => {
|
|
216
216
|
o("sendRefusalToTurnOnMic: error", n);
|
|
217
217
|
});
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
}, be = ({
|
|
219
|
+
sipConnector: e,
|
|
220
|
+
maxBitrate: t,
|
|
221
|
+
degradationPreference: n
|
|
221
222
|
}) => async ({
|
|
222
|
-
mediaStream:
|
|
223
|
-
isP2P:
|
|
224
|
-
},
|
|
225
|
-
|
|
223
|
+
mediaStream: s,
|
|
224
|
+
isP2P: a
|
|
225
|
+
}, c) => (o("startPresentation"), e.startPresentation(
|
|
226
|
+
s,
|
|
226
227
|
{
|
|
227
|
-
isP2P:
|
|
228
|
-
maxBitrate:
|
|
228
|
+
isP2P: a,
|
|
229
|
+
maxBitrate: t,
|
|
230
|
+
degradationPreference: n
|
|
229
231
|
},
|
|
230
|
-
|
|
231
|
-
)),
|
|
232
|
+
c
|
|
233
|
+
)), _e = ({ sipConnector: e }) => async ({ isP2P: n = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
|
|
232
234
|
isP2P: n
|
|
233
235
|
}).catch((r) => {
|
|
234
236
|
o(r);
|
|
235
|
-
})),
|
|
237
|
+
})), pe = 1e6, Oe = ({
|
|
236
238
|
sipConnector: e,
|
|
237
|
-
maxBitrate: t =
|
|
239
|
+
maxBitrate: t = pe
|
|
238
240
|
}) => async ({
|
|
239
241
|
mediaStream: r,
|
|
240
242
|
isP2P: s = !1
|
|
241
243
|
}) => (o("updatePresentation"), e.updatePresentation(r, {
|
|
242
244
|
isP2P: s,
|
|
243
245
|
maxBitrate: t
|
|
244
|
-
})),
|
|
246
|
+
})), ve = (e) => (t) => [...t].map((r) => async () => e(r)), Ae = async ({
|
|
245
247
|
accumulatedKeys: e,
|
|
246
248
|
sendKey: t,
|
|
247
249
|
canRunTask: n
|
|
248
250
|
}) => {
|
|
249
|
-
const s =
|
|
251
|
+
const s = ve(t)(e);
|
|
250
252
|
return Z(s, n);
|
|
251
|
-
},
|
|
253
|
+
}, Ne = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Be = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), Pe = (e) => (n) => (o("onStopMainCam"), e.onSession("admin-stop-main-cam", n)), Ie = (e) => (n) => (o("onStopMic"), e.onSession("admin-stop-mic", n)), we = ({ sipConnector: e }) => {
|
|
252
254
|
const t = (C, R) => ({ isSyncForced: y = !1 }) => {
|
|
253
255
|
if (y) {
|
|
254
256
|
C();
|
|
255
257
|
return;
|
|
256
258
|
}
|
|
257
259
|
R();
|
|
258
|
-
}, n =
|
|
260
|
+
}, n = Ne(e), r = Pe(e), s = Be(e), a = Ie(e);
|
|
259
261
|
let c = () => {
|
|
260
262
|
}, u = () => {
|
|
261
263
|
}, l = () => {
|
|
@@ -265,25 +267,25 @@ const ae = (e = new Error()) => {
|
|
|
265
267
|
onStartMainCamForced: C,
|
|
266
268
|
onStartMainCamNotForced: R,
|
|
267
269
|
onStopMainCamForced: y,
|
|
268
|
-
onStopMainCamNotForced:
|
|
269
|
-
onStartMicForced:
|
|
270
|
+
onStopMainCamNotForced: b,
|
|
271
|
+
onStartMicForced: _,
|
|
270
272
|
onStartMicNotForced: E,
|
|
271
|
-
onStopMicForced:
|
|
272
|
-
onStopMicNotForced:
|
|
273
|
+
onStopMicForced: M,
|
|
274
|
+
onStopMicNotForced: N
|
|
273
275
|
}) => {
|
|
274
|
-
const
|
|
276
|
+
const h = t(
|
|
275
277
|
C,
|
|
276
278
|
R
|
|
277
279
|
);
|
|
278
|
-
c = n(
|
|
280
|
+
c = n(h);
|
|
279
281
|
const p = t(
|
|
280
282
|
y,
|
|
281
|
-
|
|
283
|
+
b
|
|
282
284
|
);
|
|
283
285
|
u = r(p);
|
|
284
|
-
const O = t(
|
|
286
|
+
const O = t(_, E);
|
|
285
287
|
l = s(O);
|
|
286
|
-
const v = t(
|
|
288
|
+
const v = t(M, N);
|
|
287
289
|
d = a(v);
|
|
288
290
|
}, S = () => {
|
|
289
291
|
c(), u(), l(), d();
|
|
@@ -296,14 +298,14 @@ const ae = (e = new Error()) => {
|
|
|
296
298
|
S();
|
|
297
299
|
}
|
|
298
300
|
};
|
|
299
|
-
},
|
|
301
|
+
}, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
300
302
|
__proto__: null,
|
|
301
303
|
PURGATORY_CONFERENCE_NUMBER: $,
|
|
302
|
-
createSyncMediaState:
|
|
304
|
+
createSyncMediaState: we,
|
|
303
305
|
error: ue,
|
|
304
306
|
getExtraHeaders: le,
|
|
305
307
|
getUserAgent: Ce,
|
|
306
|
-
hasPurgatory:
|
|
308
|
+
hasPurgatory: A,
|
|
307
309
|
resolveAnswerIncomingCall: te,
|
|
308
310
|
resolveAskPermissionToEnableCam: ge,
|
|
309
311
|
resolveCallToServer: re,
|
|
@@ -312,40 +314,40 @@ const ae = (e = new Error()) => {
|
|
|
312
314
|
resolveGetRemoteStreams: w,
|
|
313
315
|
resolveOnMoveToSpectators: Ee,
|
|
314
316
|
resolveOnMustStopPresentation: Re,
|
|
315
|
-
resolveOnUseLicense:
|
|
316
|
-
resolveSendMediaState:
|
|
317
|
+
resolveOnUseLicense: Me,
|
|
318
|
+
resolveSendMediaState: Te,
|
|
317
319
|
resolveSendRefusalToTurnOnCam: ye,
|
|
318
|
-
resolveSendRefusalToTurnOnMic:
|
|
320
|
+
resolveSendRefusalToTurnOnMic: he,
|
|
319
321
|
resolveStartPresentation: be,
|
|
320
|
-
resolveStopShareSipConnector:
|
|
321
|
-
resolveUpdatePresentation:
|
|
322
|
+
resolveStopShareSipConnector: _e,
|
|
323
|
+
resolveUpdatePresentation: Oe,
|
|
322
324
|
resolveUpdateRemoteStreams: D,
|
|
323
325
|
sendDTMFAccumulated: Ae
|
|
324
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
325
|
-
const n =
|
|
326
|
+
}, Symbol.toStringTag, { value: "Module" })), De = (e) => [...e.keys()].map((t) => e.get(t)), Fe = (e, t) => De(e).find((n) => n.type === t), ke = async (e) => e.getStats().then((t) => {
|
|
327
|
+
const n = Fe(t, "codec");
|
|
326
328
|
return n == null ? void 0 : n.mimeType;
|
|
327
|
-
}),
|
|
329
|
+
}), Ue = (e) => e.find((t) => {
|
|
328
330
|
var n;
|
|
329
331
|
return ((n = t == null ? void 0 : t.track) == null ? void 0 : n.kind) === "video";
|
|
330
|
-
}), W = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()),
|
|
331
|
-
const n =
|
|
332
|
+
}), W = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Le = 1e6, g = (e) => e * Le, K = g(0.06), Ve = g(4), xe = (e) => e <= 64 ? K : e <= 128 ? g(0.12) : e <= 256 ? g(0.25) : e <= 384 ? g(0.32) : e <= 426 ? g(0.38) : e <= 640 ? g(0.5) : e <= 848 ? g(0.7) : e <= 1280 ? g(1) : e <= 1920 ? g(2) : Ve, $e = "av1", Xe = (e) => W(e, $e), Ge = 0.6, j = (e, t) => Xe(t) ? e * Ge : e, We = (e) => j(K, e), H = (e, t) => {
|
|
333
|
+
const n = xe(e);
|
|
332
334
|
return j(n, t);
|
|
333
|
-
}, Y = ee(),
|
|
335
|
+
}, Y = ee(), Ke = async () => Y().catch((e) => {
|
|
334
336
|
o("videoSendingBalancer: error", e);
|
|
335
|
-
}),
|
|
337
|
+
}), je = async (e) => (Y.add(e), Ke()), k = async ({
|
|
336
338
|
sender: e,
|
|
337
339
|
scaleResolutionDownBy: t,
|
|
338
340
|
maxBitrate: n,
|
|
339
341
|
onSetParameters: r
|
|
340
|
-
}) =>
|
|
341
|
-
const s =
|
|
342
|
+
}) => je(async () => q(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), He = async ({ sender: e, codec: t }, n) => {
|
|
343
|
+
const s = We(t);
|
|
342
344
|
return k({
|
|
343
345
|
sender: e,
|
|
344
346
|
maxBitrate: s,
|
|
345
347
|
onSetParameters: n,
|
|
346
348
|
scaleResolutionDownBy: 200
|
|
347
349
|
});
|
|
348
|
-
},
|
|
350
|
+
}, I = async ({ sender: e, track: t, codec: n }, r) => {
|
|
349
351
|
const c = t.getSettings().width, u = H(c, n);
|
|
350
352
|
return k({
|
|
351
353
|
sender: e,
|
|
@@ -353,20 +355,20 @@ const ae = (e = new Error()) => {
|
|
|
353
355
|
onSetParameters: r,
|
|
354
356
|
scaleResolutionDownBy: 1
|
|
355
357
|
});
|
|
356
|
-
},
|
|
358
|
+
}, Ye = async ({
|
|
357
359
|
sender: e,
|
|
358
360
|
track: t,
|
|
359
361
|
resolution: n,
|
|
360
362
|
codec: r
|
|
361
363
|
}, s) => {
|
|
362
|
-
const a = t.getSettings(), c = a.width, u = a.height, [l, d] = n.split("x"), f = c / Number(l), S = u / Number(d),
|
|
364
|
+
const a = t.getSettings(), c = a.width, u = a.height, [l, d] = n.split("x"), f = c / Number(l), S = u / Number(d), T = Math.max(f, S, 1), C = H(Number(l), r);
|
|
363
365
|
return k({
|
|
364
366
|
sender: e,
|
|
365
367
|
maxBitrate: C,
|
|
366
368
|
onSetParameters: s,
|
|
367
|
-
scaleResolutionDownBy:
|
|
369
|
+
scaleResolutionDownBy: T
|
|
368
370
|
});
|
|
369
|
-
},
|
|
371
|
+
}, qe = async ({
|
|
370
372
|
mainCam: e,
|
|
371
373
|
resolutionMainCam: t,
|
|
372
374
|
sender: n,
|
|
@@ -375,16 +377,16 @@ const ae = (e = new Error()) => {
|
|
|
375
377
|
}, a) => {
|
|
376
378
|
switch (e) {
|
|
377
379
|
case B.PAUSE_MAIN_CAM:
|
|
378
|
-
return
|
|
380
|
+
return He({ sender: n, codec: s }, a);
|
|
379
381
|
case B.RESUME_MAIN_CAM:
|
|
380
|
-
return
|
|
382
|
+
return I({ sender: n, track: r, codec: s }, a);
|
|
381
383
|
case B.MAX_MAIN_CAM_RESOLUTION:
|
|
382
|
-
return t !== void 0 ?
|
|
384
|
+
return t !== void 0 ? Ye(
|
|
383
385
|
{ sender: n, track: r, codec: s, resolution: t },
|
|
384
386
|
a
|
|
385
|
-
) :
|
|
387
|
+
) : I({ sender: n, track: r, codec: s }, a);
|
|
386
388
|
default:
|
|
387
|
-
return
|
|
389
|
+
return I({ sender: n, track: r, codec: s }, a);
|
|
388
390
|
}
|
|
389
391
|
}, U = {
|
|
390
392
|
isChanged: !1,
|
|
@@ -402,15 +404,15 @@ const ae = (e = new Error()) => {
|
|
|
402
404
|
onSetParameters: r,
|
|
403
405
|
ignoreForCodec: s
|
|
404
406
|
}) => {
|
|
405
|
-
const a = n.getSenders(), c =
|
|
407
|
+
const a = n.getSenders(), c = Ue(a);
|
|
406
408
|
if (!(c != null && c.track))
|
|
407
409
|
return U;
|
|
408
|
-
const u = await
|
|
409
|
-
return W(u, s) ? U :
|
|
410
|
+
const u = await ke(c);
|
|
411
|
+
return W(u, s) ? U : qe(
|
|
410
412
|
{ mainCam: e, resolutionMainCam: t, sender: c, codec: u, track: c.track },
|
|
411
413
|
r
|
|
412
414
|
);
|
|
413
|
-
},
|
|
415
|
+
}, sn = (e, {
|
|
414
416
|
ignoreForCodec: t,
|
|
415
417
|
onSetParameters: n
|
|
416
418
|
} = {}) => {
|
|
@@ -455,18 +457,18 @@ const ae = (e = new Error()) => {
|
|
|
455
457
|
};
|
|
456
458
|
export {
|
|
457
459
|
B as EEventsMainCAM,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
460
|
+
cn as EEventsMic,
|
|
461
|
+
un as EEventsSyncMediaState,
|
|
462
|
+
ln as EUseLicense,
|
|
463
|
+
Sn as causes,
|
|
464
|
+
mn as constants,
|
|
465
|
+
En as debug,
|
|
466
|
+
Je as default,
|
|
467
|
+
dn as disableDebug,
|
|
468
|
+
fn as enableDebug,
|
|
469
|
+
Cn as eventNames,
|
|
470
|
+
ke as getCodecFromSender,
|
|
471
|
+
gn as hasCanceledCallError,
|
|
472
|
+
sn as resolveVideoSendingBalancer,
|
|
473
|
+
rn as tools
|
|
472
474
|
};
|
package/dist/logger.d.ts
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TContentHint } from '../types';
|
|
2
|
+
declare const prepareMediaStream: (mediaStream?: MediaStream, { videoMode, audioMode, contentHint, }?: {
|
|
3
|
+
videoMode?: "recvonly" | "sendonly" | "sendrecv";
|
|
4
|
+
audioMode?: "recvonly" | "sendonly" | "sendrecv";
|
|
5
|
+
contentHint?: TContentHint;
|
|
6
|
+
}) => MediaStream | undefined;
|
|
7
|
+
export default prepareMediaStream;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { default as SipConnector } from '../SipConnector';
|
|
2
|
-
|
|
3
|
-
declare const resolveStartPresentation: ({ maxBitrate, sipConnector, }: {
|
|
4
|
-
maxBitrate?: number;
|
|
1
|
+
import { default as SipConnector, TDegradationPreference } from '../SipConnector';
|
|
2
|
+
declare const resolveStartPresentation: ({ sipConnector, maxBitrate, degradationPreference, }: {
|
|
5
3
|
sipConnector: SipConnector;
|
|
4
|
+
maxBitrate?: number;
|
|
5
|
+
degradationPreference?: TDegradationPreference;
|
|
6
6
|
}) => ({ mediaStream, isP2P, }: {
|
|
7
7
|
mediaStream: MediaStream;
|
|
8
8
|
isP2P: boolean;
|
|
@@ -2,7 +2,7 @@ declare const resolveUpdateRemoteStreams: ({ getRemoteStreams, setRemoteStreams,
|
|
|
2
2
|
getRemoteStreams: () => MediaStream[] | undefined;
|
|
3
3
|
setRemoteStreams: (streams: MediaStream[]) => void;
|
|
4
4
|
}) => {
|
|
5
|
-
(this: unknown, ...args: [] & any[]): Promise<
|
|
5
|
+
(this: unknown, ...args: [] & any[]): Promise<void>;
|
|
6
6
|
cancel: (reason?: any) => void;
|
|
7
7
|
};
|
|
8
8
|
export default resolveUpdateRemoteStreams;
|