sip-connector 6.24.3 → 6.25.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-BrUmibLH.cjs +1 -0
- package/dist/{SipConnector-BfKQCTIn.js → SipConnector-Dq76GLMy.js} +284 -273
- package/dist/SipConnector.d.ts +6 -4
- package/dist/__fixtures__/BaseSession.mock.d.ts +4 -4
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +3 -2
- package/dist/__fixtures__/Registrator.mock.d.ts +2 -1
- package/dist/__fixtures__/Request.mock.d.ts +1 -0
- package/dist/__fixtures__/Session.mock.d.ts +3 -3
- package/dist/__fixtures__/UA.mock.d.ts +6 -7
- package/dist/__fixtures__/index.d.ts +5 -4
- package/dist/__fixtures__/jssip.mock.d.ts +5 -4
- package/dist/__fixtures__/participantMoveRequests.d.ts +1 -0
- package/dist/constants.d.ts +2 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.d.ts +2 -1
- package/dist/doMock.js +1 -1
- package/dist/eventNames.d.ts +2 -2
- package/dist/headers.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +156 -155
- package/dist/logger.d.ts +2 -1
- package/dist/tools/__fixtures__/call.d.ts +3 -3
- package/dist/tools/__fixtures__/connectToServer.d.ts +3 -2
- package/dist/tools/__fixtures__/hasValidUri.d.ts +2 -1
- package/dist/tools/__fixtures__/processRequest.d.ts +2 -1
- package/dist/tools/answerIncomingCall.d.ts +13 -12
- package/dist/tools/callToServer.d.ts +13 -12
- package/dist/tools/connectToServer.d.ts +3 -2
- package/dist/tools/disconnectFromServer.d.ts +2 -1
- package/dist/tools/error/getLinkError.d.ts +2 -1
- package/dist/tools/error/getTypeFromError.d.ts +2 -1
- package/dist/tools/error/getValuesFromError.d.ts +2 -1
- package/dist/tools/getExtraHeaders.d.ts +4 -4
- package/dist/tools/getUserAgent.d.ts +2 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/resolveAskPermissionToEnableCam.d.ts +2 -1
- package/dist/tools/resolveGetRemoteStreams.d.ts +2 -1
- package/dist/tools/resolveOnMoveToSpectators.d.ts +4 -0
- package/dist/tools/resolveOnMustStopPresentation.d.ts +2 -1
- package/dist/tools/resolveOnUseLicense.d.ts +3 -2
- package/dist/tools/resolveSendMediaState.d.ts +2 -1
- package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +2 -1
- package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +2 -1
- package/dist/tools/resolveStartPresentation.d.ts +3 -2
- package/dist/tools/resolveStopShareSipConnector.d.ts +3 -2
- package/dist/tools/resolveUpdatePresentation.d.ts +3 -2
- package/dist/tools/sendDTMFAccumulated.d.ts +1 -1
- package/dist/tools/syncMediaState/index.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStartMainCam.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStartMic.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStopMainCam.d.ts +2 -1
- package/dist/tools/syncMediaState/resolveOnStopMic.d.ts +2 -1
- package/dist/types.d.ts +2 -1
- package/dist/utils.d.ts +2 -2
- package/dist/videoSendingBalancer/balance.d.ts +7 -6
- package/dist/videoSendingBalancer/index.d.ts +7 -6
- package/dist/videoSendingBalancer/processSender.d.ts +5 -4
- package/dist/videoSendingBalancer/scaleBitrate.d.ts +1 -1
- package/package.json +8 -8
- package/dist/SipConnector-BWd7Anni.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { l as
|
|
2
|
-
import { f as
|
|
1
|
+
import { l as o, B as V, N as $, E as P, s as q, S as tn } from "./SipConnector-Dq76GLMy.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-Dq76GLMy.js";
|
|
3
3
|
import { debounce as J } from "ts-debounce";
|
|
4
4
|
import { isCanceledError as Q } from "@krivega/cancelable-promise";
|
|
5
|
-
import { default as
|
|
6
|
-
const G = "purgatory", A = (e) => e === G, k = (e) => () => (
|
|
5
|
+
import { default as Tn } from "debug";
|
|
6
|
+
const G = "purgatory", A = (e) => e === G, k = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), Z = ({ kind: e, readyState: n }) => e === "video" && n === "live", j = (e) => ({ track: n }) => {
|
|
7
7
|
Z(n) && e();
|
|
8
8
|
}, D = ({
|
|
9
9
|
getRemoteStreams: e,
|
|
10
10
|
setRemoteStreams: n
|
|
11
11
|
}) => J(() => {
|
|
12
12
|
const t = e();
|
|
13
|
-
|
|
13
|
+
o("remoteStreams", t), t && n(t);
|
|
14
14
|
}, 200), ee = (e) => async (t) => {
|
|
15
15
|
const {
|
|
16
16
|
mediaStream: s,
|
|
17
17
|
extraHeaders: r,
|
|
18
|
-
iceServers:
|
|
18
|
+
iceServers: c,
|
|
19
19
|
degradationPreference: a,
|
|
20
20
|
setRemoteStreams: u,
|
|
21
21
|
onBeforeProgressCall: m,
|
|
22
22
|
onSuccessProgressCall: g,
|
|
23
23
|
onEnterPurgatory: C,
|
|
24
24
|
onEnterConference: f,
|
|
25
|
-
onFailProgressCall:
|
|
25
|
+
onFailProgressCall: y,
|
|
26
26
|
onFinishProgressCall: E,
|
|
27
|
-
onEndedCall:
|
|
27
|
+
onEndedCall: T
|
|
28
28
|
} = t, R = D({
|
|
29
29
|
setRemoteStreams: u,
|
|
30
30
|
getRemoteStreams: k(e)
|
|
31
31
|
}), M = j(R);
|
|
32
|
-
|
|
33
|
-
const
|
|
32
|
+
o("answerIncomingCall", t);
|
|
33
|
+
const O = async () => e.answerToIncomingCall({
|
|
34
34
|
mediaStream: s,
|
|
35
35
|
extraHeaders: r,
|
|
36
|
-
iceServers:
|
|
36
|
+
iceServers: c,
|
|
37
37
|
degradationPreference: a,
|
|
38
38
|
ontrack: M
|
|
39
39
|
}), p = () => {
|
|
@@ -41,61 +41,61 @@ const G = "purgatory", A = (e) => e === G, k = (e) => () => (c("getRemoteStreams
|
|
|
41
41
|
return l.incomingNumber;
|
|
42
42
|
};
|
|
43
43
|
let _ = !1, i;
|
|
44
|
-
const S = (
|
|
45
|
-
|
|
44
|
+
const S = (o("subscribeEnterConference: onEnterConference", f), C ?? f ? e.onSession("enterRoom", (l) => {
|
|
45
|
+
o("enterRoom", { _room: l, isSuccessProgressCall: _ }), i = l, A(i) ? C && C() : f && f({ isSuccessProgressCall: _ });
|
|
46
46
|
}) : () => {
|
|
47
|
-
}), h = (l) => (
|
|
48
|
-
S(),
|
|
47
|
+
}), h = (l) => (o("onSuccess"), _ = !0, R(), g && g({ isPurgatory: A(i) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
48
|
+
S(), T && T();
|
|
49
49
|
}), l), b = (l) => {
|
|
50
|
-
throw
|
|
51
|
-
},
|
|
52
|
-
|
|
50
|
+
throw o("onFail"), y && y(), S(), l;
|
|
51
|
+
}, N = () => {
|
|
52
|
+
o("onFinish"), E && E();
|
|
53
53
|
};
|
|
54
|
-
if (
|
|
54
|
+
if (o("onBeforeProgressCall"), m) {
|
|
55
55
|
const l = p();
|
|
56
56
|
m(l);
|
|
57
57
|
}
|
|
58
|
-
return
|
|
58
|
+
return O().then(h).catch((l) => b(l)).finally(N);
|
|
59
59
|
}, ne = (e) => async (t) => {
|
|
60
60
|
const {
|
|
61
61
|
conference: s,
|
|
62
62
|
mediaStream: r,
|
|
63
|
-
extraHeaders:
|
|
63
|
+
extraHeaders: c,
|
|
64
64
|
iceServers: a,
|
|
65
65
|
degradationPreference: u,
|
|
66
66
|
setRemoteStreams: m,
|
|
67
67
|
onBeforeProgressCall: g,
|
|
68
68
|
onSuccessProgressCall: C,
|
|
69
69
|
onEnterPurgatory: f,
|
|
70
|
-
onEnterConference:
|
|
70
|
+
onEnterConference: y,
|
|
71
71
|
onFailProgressCall: E,
|
|
72
|
-
onFinishProgressCall:
|
|
72
|
+
onFinishProgressCall: T,
|
|
73
73
|
onEndedCall: R
|
|
74
74
|
} = t, M = D({
|
|
75
75
|
setRemoteStreams: m,
|
|
76
76
|
getRemoteStreams: k(e)
|
|
77
|
-
}),
|
|
78
|
-
|
|
79
|
-
const p = async () => (
|
|
77
|
+
}), O = j(M);
|
|
78
|
+
o("callToServer", t);
|
|
79
|
+
const p = async () => (o("startCall"), e.call({
|
|
80
80
|
mediaStream: r,
|
|
81
|
-
extraHeaders:
|
|
81
|
+
extraHeaders: c,
|
|
82
82
|
iceServers: a,
|
|
83
83
|
degradationPreference: u,
|
|
84
84
|
number: s,
|
|
85
|
-
ontrack:
|
|
85
|
+
ontrack: O
|
|
86
86
|
}));
|
|
87
87
|
let _ = !1, i;
|
|
88
|
-
const S = (
|
|
89
|
-
|
|
88
|
+
const S = (o("subscribeEnterConference: onEnterConference", y), f ?? y ? e.onSession("enterRoom", (l) => {
|
|
89
|
+
o("enterRoom", { _room: l, isSuccessProgressCall: _ }), i = l, A(i) ? f && f() : y && y({ isSuccessProgressCall: _ });
|
|
90
90
|
}) : () => {
|
|
91
|
-
}), h = (l) => (
|
|
91
|
+
}), h = (l) => (o("onSuccess"), _ = !0, M(), C && C({ isPurgatory: A(i) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
92
92
|
S(), R && R();
|
|
93
93
|
}), l), b = (l) => {
|
|
94
|
-
throw
|
|
95
|
-
},
|
|
96
|
-
|
|
94
|
+
throw o("onFail"), E && E(), S(), l;
|
|
95
|
+
}, N = () => {
|
|
96
|
+
o("onFinish"), T && T();
|
|
97
97
|
};
|
|
98
|
-
return
|
|
98
|
+
return o("onBeforeProgressCall"), g && g(s), p().then(h).catch((l) => b(l)).finally(N);
|
|
99
99
|
}, w = (e) => {
|
|
100
100
|
if (!Q(e))
|
|
101
101
|
throw e;
|
|
@@ -104,27 +104,27 @@ const G = "purgatory", A = (e) => e === G, k = (e) => () => (c("getRemoteStreams
|
|
|
104
104
|
const {
|
|
105
105
|
userAgent: s,
|
|
106
106
|
sipWebSocketServerURL: r,
|
|
107
|
-
sipServerUrl:
|
|
107
|
+
sipServerUrl: c,
|
|
108
108
|
remoteAddress: a,
|
|
109
109
|
displayName: u,
|
|
110
110
|
name: m,
|
|
111
111
|
password: g,
|
|
112
112
|
isRegisteredUser: C,
|
|
113
113
|
sdpSemantics: f,
|
|
114
|
-
isDisconnectOnFail:
|
|
114
|
+
isDisconnectOnFail: y
|
|
115
115
|
} = t;
|
|
116
|
-
return
|
|
116
|
+
return o("connectToServer", t), e.connect({
|
|
117
117
|
userAgent: s,
|
|
118
118
|
sdpSemantics: f,
|
|
119
119
|
sipWebSocketServerURL: r,
|
|
120
|
-
sipServerUrl:
|
|
120
|
+
sipServerUrl: c,
|
|
121
121
|
remoteAddress: a,
|
|
122
122
|
displayName: u,
|
|
123
123
|
password: g,
|
|
124
124
|
user: m,
|
|
125
125
|
register: C
|
|
126
|
-
}).then((E) => (
|
|
127
|
-
}, se = (e) => async () => (
|
|
126
|
+
}).then((E) => (o("connectToServer then"), { ua: E, isSuccessful: !0 })).catch(async (E) => (o("connectToServer catch: error", E), y === !0 ? e.disconnect().then(() => w(E)).catch(() => w(E)) : w(E)));
|
|
127
|
+
}, se = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((n) => (o("disconnectFromServer: catch", n), { isSuccessful: !1 }))), F = (e) => {
|
|
128
128
|
const { url: n, cause: t } = e;
|
|
129
129
|
let s = n;
|
|
130
130
|
return (t === V || t === $) && (s = `${e.message.to.uri.user}@${e.message.to.uri.host}`), s;
|
|
@@ -152,8 +152,8 @@ const re = (e = new Error()) => {
|
|
|
152
152
|
}
|
|
153
153
|
return s;
|
|
154
154
|
}, oe = (e = new Error()) => {
|
|
155
|
-
const { code: n, cause: t, message: s } = e, r = F(e),
|
|
156
|
-
return s && (
|
|
155
|
+
const { code: n, cause: t, message: s } = e, r = F(e), c = {};
|
|
156
|
+
return s && (c.message = s), r && (c.link = r), n && (c.code = n), t && (c.cause = t), c;
|
|
157
157
|
}, ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
158
158
|
__proto__: null,
|
|
159
159
|
EErrorTypes: X,
|
|
@@ -166,10 +166,10 @@ const re = (e = new Error()) => {
|
|
|
166
166
|
isMutedAudio: t,
|
|
167
167
|
isMutedVideo: s,
|
|
168
168
|
isRegistered: r,
|
|
169
|
-
isPresentationCall:
|
|
169
|
+
isPresentationCall: c
|
|
170
170
|
}) => {
|
|
171
171
|
const a = [], u = t ? "0" : "1", m = s ? "0" : "1";
|
|
172
|
-
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}`),
|
|
172
|
+
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}`), c && a.push("X-Vinteo-Presentation-Call: yes"), n && a.push(`X-Vinteo-Remote: ${n}`), a;
|
|
173
173
|
}, ie = ({
|
|
174
174
|
appName: e,
|
|
175
175
|
appVersion: n,
|
|
@@ -186,58 +186,58 @@ const re = (e = new Error()) => {
|
|
|
186
186
|
appName: r
|
|
187
187
|
}) => e ? ie({ appVersion: n, browserName: t, browserVersion: s, appName: r }) : "Chrome", le = (e) => async () => {
|
|
188
188
|
if (e.isCallActive)
|
|
189
|
-
return
|
|
190
|
-
}, Se = (e) => (t) => (
|
|
189
|
+
return o("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
190
|
+
}, Se = (e) => (t) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", t)), de = (e) => (t) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", t)), me = (e) => (t) => (o("onUseLicense"), e.onSession("useLicense", t)), fe = (e) => async ({
|
|
191
191
|
isEnabledCam: t,
|
|
192
192
|
isEnabledMic: s
|
|
193
193
|
}) => {
|
|
194
194
|
if (e.isCallActive)
|
|
195
|
-
return
|
|
196
|
-
},
|
|
195
|
+
return o("sendMediaState"), e.sendMediaState({ cam: t, mic: s });
|
|
196
|
+
}, Ce = (e) => async () => {
|
|
197
197
|
if (e.isCallActive)
|
|
198
|
-
return
|
|
199
|
-
|
|
198
|
+
return o("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((t) => {
|
|
199
|
+
o("sendRefusalToTurnOnCam: error", t);
|
|
200
200
|
});
|
|
201
|
-
},
|
|
201
|
+
}, Ee = (e) => async () => {
|
|
202
202
|
if (e.isCallActive)
|
|
203
|
-
return
|
|
204
|
-
|
|
203
|
+
return o("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((t) => {
|
|
204
|
+
o("sendRefusalToTurnOnMic: error", t);
|
|
205
205
|
});
|
|
206
|
-
},
|
|
207
|
-
maxBitrate: e =
|
|
206
|
+
}, ge = 1e6, Re = ({
|
|
207
|
+
maxBitrate: e = ge,
|
|
208
208
|
sipConnector: n
|
|
209
209
|
}) => async ({
|
|
210
210
|
mediaStream: s,
|
|
211
211
|
isP2P: r = !1
|
|
212
|
-
}) => (
|
|
212
|
+
}) => (o("startPresentation"), n.startPresentation(s, {
|
|
213
213
|
isP2P: r,
|
|
214
214
|
maxBitrate: e
|
|
215
|
-
})),
|
|
215
|
+
})), he = ({ sipConnector: e }) => async ({ isP2P: t = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
|
|
216
216
|
isP2P: t
|
|
217
217
|
}).catch((s) => {
|
|
218
|
-
|
|
219
|
-
})),
|
|
218
|
+
o(s);
|
|
219
|
+
})), Te = 1e6, ye = ({
|
|
220
220
|
sipConnector: e,
|
|
221
|
-
maxBitrate: n =
|
|
221
|
+
maxBitrate: n = Te
|
|
222
222
|
}) => async ({
|
|
223
223
|
mediaStream: s,
|
|
224
224
|
isP2P: r = !1
|
|
225
|
-
}) => (
|
|
225
|
+
}) => (o("updatePresentation"), e.updatePresentation(s, {
|
|
226
226
|
isP2P: r,
|
|
227
227
|
maxBitrate: n
|
|
228
|
-
})),
|
|
228
|
+
})), Me = "ERROR_NOT_RUNNING", _e = (e) => {
|
|
229
229
|
const n = new Error("Promise was not running");
|
|
230
|
-
return n.basePromise = e, n.id =
|
|
231
|
-
},
|
|
232
|
-
async (t, s) => t.then(async ({ success: r, errors:
|
|
233
|
-
errors:
|
|
230
|
+
return n.basePromise = e, n.id = Me, n.name = "Not running", n;
|
|
231
|
+
}, be = async (e, n) => e.reduce(
|
|
232
|
+
async (t, s) => t.then(async ({ success: r, errors: c, results: a }) => (!n || n(s) ? s() : Promise.reject(_e(s))).then((u) => ({
|
|
233
|
+
errors: c,
|
|
234
234
|
success: [...r, u],
|
|
235
235
|
results: [...a, u],
|
|
236
236
|
isSuccessful: !0,
|
|
237
237
|
isError: !1
|
|
238
238
|
})).catch((u) => ({
|
|
239
239
|
success: r,
|
|
240
|
-
errors: [...
|
|
240
|
+
errors: [...c, u],
|
|
241
241
|
results: [...a, u],
|
|
242
242
|
isSuccessful: !1,
|
|
243
243
|
isError: !0
|
|
@@ -249,65 +249,65 @@ const re = (e = new Error()) => {
|
|
|
249
249
|
isSuccessful: !1,
|
|
250
250
|
isError: !1
|
|
251
251
|
})
|
|
252
|
-
),
|
|
252
|
+
), ve = (e) => (n) => [...n].map((s) => async () => e(s)), Ne = async ({
|
|
253
253
|
accumulatedKeys: e,
|
|
254
254
|
sendKey: n,
|
|
255
255
|
canRunTask: t
|
|
256
256
|
}) => {
|
|
257
|
-
const r =
|
|
258
|
-
return
|
|
259
|
-
}, Oe = (e) => (t) => (
|
|
260
|
-
const n = (
|
|
257
|
+
const r = ve(n)(e);
|
|
258
|
+
return be(r, t);
|
|
259
|
+
}, Oe = (e) => (t) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", t)), pe = (e) => (t) => (o("onStartMic"), e.onSession("admin-start-mic", t)), Ae = (e) => (t) => (o("onStopMainCam"), e.onSession("admin-stop-main-cam", t)), Pe = (e) => (t) => (o("onStopMic"), e.onSession("admin-stop-mic", t)), we = ({ sipConnector: e }) => {
|
|
260
|
+
const n = (T, R) => ({ isSyncForced: M = !1 }) => {
|
|
261
261
|
if (M) {
|
|
262
|
-
|
|
262
|
+
T();
|
|
263
263
|
return;
|
|
264
264
|
}
|
|
265
265
|
R();
|
|
266
|
-
}, t = Oe(e), s =
|
|
266
|
+
}, t = Oe(e), s = Ae(e), r = pe(e), c = Pe(e);
|
|
267
267
|
let a = () => {
|
|
268
268
|
}, u = () => {
|
|
269
269
|
}, m = () => {
|
|
270
270
|
}, g = () => {
|
|
271
271
|
};
|
|
272
272
|
const C = ({
|
|
273
|
-
onStartMainCamForced:
|
|
273
|
+
onStartMainCamForced: T,
|
|
274
274
|
onStartMainCamNotForced: R,
|
|
275
275
|
onStopMainCamForced: M,
|
|
276
|
-
onStopMainCamNotForced:
|
|
276
|
+
onStopMainCamNotForced: O,
|
|
277
277
|
onStartMicForced: p,
|
|
278
278
|
onStartMicNotForced: _,
|
|
279
279
|
onStopMicForced: i,
|
|
280
280
|
onStopMicNotForced: d
|
|
281
281
|
}) => {
|
|
282
282
|
const S = n(
|
|
283
|
-
|
|
283
|
+
T,
|
|
284
284
|
R
|
|
285
285
|
);
|
|
286
286
|
a = t(S);
|
|
287
287
|
const h = n(
|
|
288
288
|
M,
|
|
289
|
-
|
|
289
|
+
O
|
|
290
290
|
);
|
|
291
291
|
u = s(h);
|
|
292
292
|
const b = n(p, _);
|
|
293
293
|
m = r(b);
|
|
294
|
-
const
|
|
295
|
-
g =
|
|
294
|
+
const N = n(i, d);
|
|
295
|
+
g = c(N);
|
|
296
296
|
}, f = () => {
|
|
297
297
|
a(), u(), m(), g();
|
|
298
298
|
};
|
|
299
299
|
return {
|
|
300
|
-
start: (
|
|
301
|
-
C(
|
|
300
|
+
start: (T) => {
|
|
301
|
+
C(T);
|
|
302
302
|
},
|
|
303
303
|
stop: () => {
|
|
304
304
|
f();
|
|
305
305
|
}
|
|
306
306
|
};
|
|
307
|
-
},
|
|
307
|
+
}, on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
308
308
|
__proto__: null,
|
|
309
309
|
PURGATORY_CONFERENCE_NUMBER: G,
|
|
310
|
-
createSyncMediaState:
|
|
310
|
+
createSyncMediaState: we,
|
|
311
311
|
error: ce,
|
|
312
312
|
getExtraHeaders: ae,
|
|
313
313
|
getUserAgent: ue,
|
|
@@ -318,35 +318,36 @@ const re = (e = new Error()) => {
|
|
|
318
318
|
resolveConnectToServer: te,
|
|
319
319
|
resolveDisconnectFromServer: se,
|
|
320
320
|
resolveGetRemoteStreams: k,
|
|
321
|
+
resolveOnMoveToSpectators: de,
|
|
321
322
|
resolveOnMustStopPresentation: Se,
|
|
322
|
-
resolveOnUseLicense:
|
|
323
|
-
resolveSendMediaState:
|
|
324
|
-
resolveSendRefusalToTurnOnCam:
|
|
325
|
-
resolveSendRefusalToTurnOnMic:
|
|
326
|
-
resolveStartPresentation:
|
|
327
|
-
resolveStopShareSipConnector:
|
|
323
|
+
resolveOnUseLicense: me,
|
|
324
|
+
resolveSendMediaState: fe,
|
|
325
|
+
resolveSendRefusalToTurnOnCam: Ce,
|
|
326
|
+
resolveSendRefusalToTurnOnMic: Ee,
|
|
327
|
+
resolveStartPresentation: Re,
|
|
328
|
+
resolveStopShareSipConnector: he,
|
|
328
329
|
resolveUpdatePresentation: ye,
|
|
329
330
|
resolveUpdateRemoteStreams: D,
|
|
330
331
|
sendDTMFAccumulated: Ne
|
|
331
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
332
|
-
const t =
|
|
332
|
+
}, Symbol.toStringTag, { value: "Module" })), Ie = (e) => [...e.keys()].map((n) => e.get(n)), Be = (e, n) => Ie(e).find((t) => t.type === n), ke = async (e) => e.getStats().then((n) => {
|
|
333
|
+
const t = Be(n, "codec");
|
|
333
334
|
return t == null ? void 0 : t.mimeType;
|
|
334
|
-
}),
|
|
335
|
+
}), De = (e) => e.find((n) => {
|
|
335
336
|
var t;
|
|
336
337
|
return ((t = n == null ? void 0 : n.track) == null ? void 0 : t.kind) === "video";
|
|
337
|
-
}), K = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()),
|
|
338
|
+
}), K = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()), Fe = "ERROR_NOT_RUNNING", Ue = (e) => {
|
|
338
339
|
const n = new Error("Promise was not running");
|
|
339
|
-
return n.basePromise = e, n.id =
|
|
340
|
-
},
|
|
341
|
-
async (t, s) => t.then(async ({ success: r, errors:
|
|
342
|
-
errors:
|
|
340
|
+
return n.basePromise = e, n.id = Fe, n.name = "Not running", n;
|
|
341
|
+
}, Le = async (e, n) => e.reduce(
|
|
342
|
+
async (t, s) => t.then(async ({ success: r, errors: c, results: a }) => (!n || n(s) ? s() : Promise.reject(Ue(s))).then((u) => ({
|
|
343
|
+
errors: c,
|
|
343
344
|
success: [...r, u],
|
|
344
345
|
results: [...a, u],
|
|
345
346
|
isSuccessful: !0,
|
|
346
347
|
isError: !1
|
|
347
348
|
})).catch((u) => ({
|
|
348
349
|
success: r,
|
|
349
|
-
errors: [...
|
|
350
|
+
errors: [...c, u],
|
|
350
351
|
results: [...a, u],
|
|
351
352
|
isSuccessful: !1,
|
|
352
353
|
isError: !0
|
|
@@ -358,16 +359,16 @@ const re = (e = new Error()) => {
|
|
|
358
359
|
isSuccessful: !1,
|
|
359
360
|
isError: !1
|
|
360
361
|
})
|
|
361
|
-
),
|
|
362
|
+
), xe = new Error("Stack is empty"), I = (e) => e[e.length - 1], Ve = new Error("Promise is not actual"), $e = new Error(
|
|
362
363
|
"stackPromises only works with functions that returns a Promise"
|
|
363
|
-
),
|
|
364
|
+
), Ge = ({
|
|
364
365
|
noRejectIsNotActual: e = !1,
|
|
365
366
|
noRunIsNotActual: n = !1
|
|
366
367
|
} = {}) => {
|
|
367
368
|
const t = [], s = [], r = ({ task: i, index: d }) => {
|
|
368
369
|
s.push({ task: i, index: d });
|
|
369
|
-
},
|
|
370
|
-
const h = s.find(({ task: b, index:
|
|
370
|
+
}, c = (i, { task: d, index: S }) => {
|
|
371
|
+
const h = s.find(({ task: b, index: N }) => d === b && S === N);
|
|
371
372
|
if (!h)
|
|
372
373
|
throw new Error("Task not found");
|
|
373
374
|
if (h.promise)
|
|
@@ -386,13 +387,13 @@ const re = (e = new Error()) => {
|
|
|
386
387
|
}, m = ({ task: i, index: d }) => (r({ task: i, index: d }), async () => {
|
|
387
388
|
let S = a({ task: i, index: d });
|
|
388
389
|
const h = u({ task: i });
|
|
389
|
-
return !S && n && !h ? Promise.resolve() : (S || (S = i({ isActual: h }),
|
|
390
|
+
return !S && n && !h ? Promise.resolve() : (S || (S = i({ isActual: h }), c(S, { task: i, index: d })), S);
|
|
390
391
|
}), g = ({
|
|
391
392
|
resolve: i,
|
|
392
393
|
reject: d
|
|
393
394
|
}) => ({ results: S, isSuccessful: h }) => {
|
|
394
|
-
const b = S.length,
|
|
395
|
-
if (b ===
|
|
395
|
+
const b = S.length, N = t.length;
|
|
396
|
+
if (b === N) {
|
|
396
397
|
const l = I(S);
|
|
397
398
|
if (h) {
|
|
398
399
|
i(l);
|
|
@@ -406,43 +407,43 @@ const re = (e = new Error()) => {
|
|
|
406
407
|
i(l);
|
|
407
408
|
return;
|
|
408
409
|
}
|
|
409
|
-
d(
|
|
410
|
+
d(Ve);
|
|
410
411
|
};
|
|
411
412
|
let C = !1;
|
|
412
413
|
const f = () => {
|
|
413
414
|
C = !0;
|
|
414
|
-
},
|
|
415
|
+
}, y = () => {
|
|
415
416
|
C = !1;
|
|
416
|
-
}, E = () => C,
|
|
417
|
+
}, E = () => C, T = async () => (f(), Le(t, E)), R = async () => {
|
|
417
418
|
if (t.length === 0)
|
|
418
|
-
throw
|
|
419
|
+
throw xe;
|
|
419
420
|
return new Promise((i, d) => {
|
|
420
421
|
const S = g({ resolve: i, reject: d });
|
|
421
|
-
|
|
422
|
+
T().then(S).catch(S);
|
|
422
423
|
});
|
|
423
424
|
}, M = (i) => {
|
|
424
425
|
if (typeof i != "function")
|
|
425
|
-
throw
|
|
426
|
+
throw $e;
|
|
426
427
|
const d = t.length;
|
|
427
428
|
return t.push(m({ task: i, index: d })), R;
|
|
428
|
-
},
|
|
429
|
+
}, O = async (i) => (M(i), R()), p = () => {
|
|
429
430
|
t.length = 0, s.length = 0;
|
|
430
431
|
}, _ = () => {
|
|
431
|
-
|
|
432
|
+
y(), p();
|
|
432
433
|
};
|
|
433
|
-
return R.add = M, R.run =
|
|
434
|
-
},
|
|
435
|
-
const t =
|
|
434
|
+
return R.add = M, R.run = O, R.stop = _, R;
|
|
435
|
+
}, je = 1e6, v = (e) => e * je, W = v(0.06), Xe = v(4), Ke = (e) => e <= 64 ? W : e <= 128 ? v(0.12) : e <= 256 ? v(0.25) : e <= 384 ? v(0.32) : e <= 426 ? v(0.38) : e <= 640 ? v(0.5) : e <= 848 ? v(0.7) : e <= 1280 ? v(1) : e <= 1920 ? v(2) : Xe, We = "av1", He = (e) => K(e, We), Ye = 0.6, H = (e, n) => He(n) ? e * Ye : e, ze = (e) => H(W, e), Y = (e, n) => {
|
|
436
|
+
const t = Ke(e);
|
|
436
437
|
return H(t, n);
|
|
437
|
-
}, z =
|
|
438
|
-
|
|
439
|
-
}),
|
|
438
|
+
}, z = Ge(), qe = async () => z().catch((e) => {
|
|
439
|
+
o("videoSendingBalancer: error", e);
|
|
440
|
+
}), Je = async (e) => (z.add(e), qe()), U = async ({
|
|
440
441
|
sender: e,
|
|
441
442
|
scaleResolutionDownBy: n,
|
|
442
443
|
maxBitrate: t,
|
|
443
444
|
onSetParameters: s
|
|
444
|
-
}) =>
|
|
445
|
-
const r =
|
|
445
|
+
}) => Je(async () => q(e, { scaleResolutionDownBy: n, maxBitrate: t }, s)), Qe = async ({ sender: e, codec: n }, t) => {
|
|
446
|
+
const r = ze(n);
|
|
446
447
|
return U({
|
|
447
448
|
sender: e,
|
|
448
449
|
maxBitrate: r,
|
|
@@ -457,38 +458,38 @@ const re = (e = new Error()) => {
|
|
|
457
458
|
onSetParameters: s,
|
|
458
459
|
scaleResolutionDownBy: 1
|
|
459
460
|
});
|
|
460
|
-
},
|
|
461
|
+
}, Ze = async ({
|
|
461
462
|
sender: e,
|
|
462
463
|
track: n,
|
|
463
464
|
resolution: t,
|
|
464
465
|
codec: s
|
|
465
466
|
}, r) => {
|
|
466
|
-
const
|
|
467
|
+
const c = n.getSettings(), a = c.width, u = c.height, [m, g] = t.split("x"), C = a / Number(m), f = u / Number(g), E = Math.max(C, f, 1), T = Y(Number(m), s);
|
|
467
468
|
return U({
|
|
468
469
|
sender: e,
|
|
469
|
-
maxBitrate:
|
|
470
|
+
maxBitrate: T,
|
|
470
471
|
onSetParameters: r,
|
|
471
472
|
scaleResolutionDownBy: E
|
|
472
473
|
});
|
|
473
|
-
},
|
|
474
|
+
}, en = async ({
|
|
474
475
|
mainCam: e,
|
|
475
476
|
resolutionMainCam: n,
|
|
476
477
|
sender: t,
|
|
477
478
|
track: s,
|
|
478
479
|
codec: r
|
|
479
|
-
},
|
|
480
|
+
}, c) => {
|
|
480
481
|
switch (e) {
|
|
481
482
|
case P.PAUSE_MAIN_CAM:
|
|
482
|
-
return
|
|
483
|
+
return Qe({ sender: t, codec: r }, c);
|
|
483
484
|
case P.RESUME_MAIN_CAM:
|
|
484
|
-
return B({ sender: t, track: s, codec: r },
|
|
485
|
+
return B({ sender: t, track: s, codec: r }, c);
|
|
485
486
|
case P.MAX_MAIN_CAM_RESOLUTION:
|
|
486
|
-
return n !== void 0 ?
|
|
487
|
+
return n !== void 0 ? Ze(
|
|
487
488
|
{ sender: t, track: s, codec: r, resolution: n },
|
|
488
|
-
|
|
489
|
-
) : B({ sender: t, track: s, codec: r },
|
|
489
|
+
c
|
|
490
|
+
) : B({ sender: t, track: s, codec: r }, c);
|
|
490
491
|
default:
|
|
491
|
-
return B({ sender: t, track: s, codec: r },
|
|
492
|
+
return B({ sender: t, track: s, codec: r }, c);
|
|
492
493
|
}
|
|
493
494
|
}, L = {
|
|
494
495
|
isChanged: !1,
|
|
@@ -506,15 +507,15 @@ const re = (e = new Error()) => {
|
|
|
506
507
|
onSetParameters: s,
|
|
507
508
|
ignoreForCodec: r
|
|
508
509
|
}) => {
|
|
509
|
-
const
|
|
510
|
+
const c = t.getSenders(), a = De(c);
|
|
510
511
|
if (!(a != null && a.track))
|
|
511
512
|
return L;
|
|
512
|
-
const u = await
|
|
513
|
-
return K(u, r) ? L :
|
|
513
|
+
const u = await ke(a);
|
|
514
|
+
return K(u, r) ? L : en(
|
|
514
515
|
{ mainCam: e, resolutionMainCam: n, sender: a, codec: u, track: a.track },
|
|
515
516
|
s
|
|
516
517
|
);
|
|
517
|
-
},
|
|
518
|
+
}, cn = (e, {
|
|
518
519
|
ignoreForCodec: n,
|
|
519
520
|
onSetParameters: t
|
|
520
521
|
} = {}) => {
|
|
@@ -529,7 +530,7 @@ const re = (e = new Error()) => {
|
|
|
529
530
|
});
|
|
530
531
|
};
|
|
531
532
|
let r = s;
|
|
532
|
-
const
|
|
533
|
+
const c = async (m) => (r = async () => {
|
|
533
534
|
const { mainCam: g, resolutionMainCam: C } = m, { connection: f } = e;
|
|
534
535
|
if (!f)
|
|
535
536
|
throw new Error("connection is not exist");
|
|
@@ -543,10 +544,10 @@ const re = (e = new Error()) => {
|
|
|
543
544
|
}, r());
|
|
544
545
|
return {
|
|
545
546
|
subscribe: () => {
|
|
546
|
-
e.onSession("main-cam-control",
|
|
547
|
+
e.onSession("main-cam-control", c);
|
|
547
548
|
},
|
|
548
549
|
unsubscribe: () => {
|
|
549
|
-
e.offSession("main-cam-control",
|
|
550
|
+
e.offSession("main-cam-control", c);
|
|
550
551
|
},
|
|
551
552
|
balanceByTrack: s,
|
|
552
553
|
resetMainCamControl() {
|
|
@@ -559,18 +560,18 @@ const re = (e = new Error()) => {
|
|
|
559
560
|
};
|
|
560
561
|
export {
|
|
561
562
|
P as EEventsMainCAM,
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
563
|
+
ln as EEventsMic,
|
|
564
|
+
Sn as EEventsSyncMediaState,
|
|
565
|
+
dn as EUseLicense,
|
|
566
|
+
mn as causes,
|
|
567
|
+
fn as constants,
|
|
568
|
+
Tn as debug,
|
|
569
|
+
tn as default,
|
|
570
|
+
Cn as disableDebug,
|
|
571
|
+
En as enableDebug,
|
|
572
|
+
gn as eventNames,
|
|
573
|
+
ke as getCodecFromSender,
|
|
574
|
+
Rn as hasCanceledCallError,
|
|
575
|
+
cn as resolveVideoSendingBalancer,
|
|
576
|
+
on as tools
|
|
576
577
|
};
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { default as RTCPeerConnectionMock } from '../../__fixtures__/RTCPeerConnectionMock';
|
|
2
|
+
|
|
3
3
|
declare const data: {
|
|
4
|
-
mediaStream: import(
|
|
4
|
+
mediaStream: import('webrtc-mock').MediaStreamMock;
|
|
5
5
|
conference: string;
|
|
6
6
|
setOutgoingCall: jest.Mock<any, any, any>;
|
|
7
7
|
setRemoteStreams: jest.Mock<any, any, any>;
|