sip-connector 9.0.0 → 9.1.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-DagL4rCl.js → SipConnector-Eb3K8Ixo.js} +263 -258
- package/dist/SipConnector-Qzp-_Vxz.cjs +1 -0
- package/dist/SipConnector.d.ts +4 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +197 -193
- package/dist/tools/answerIncomingCall.d.ts +2 -0
- package/dist/tools/callToServer.d.ts +2 -0
- package/package.json +10 -10
- package/dist/SipConnector-BCc5pokv.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,109 +1,113 @@
|
|
|
1
|
-
import { l as o, B as
|
|
2
|
-
import { f as
|
|
3
|
-
import { debounce as
|
|
4
|
-
import { isCanceledError as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { sequentPromises as
|
|
7
|
-
import { createStackPromises as
|
|
8
|
-
import { default as
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
},
|
|
1
|
+
import { l as o, B as x, N as $, E as B, s as z, S as Je } from "./SipConnector-Eb3K8Ixo.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-Eb3K8Ixo.js";
|
|
3
|
+
import { debounce as J } from "ts-debounce";
|
|
4
|
+
import { isCanceledError as Q } from "@krivega/cancelable-promise";
|
|
5
|
+
import { hasCanceledError as Z } from "repeated-calls";
|
|
6
|
+
import { sequentPromises as ee } from "sequent-promises";
|
|
7
|
+
import { createStackPromises as ne } from "stack-promises";
|
|
8
|
+
import { default as En } from "debug";
|
|
9
|
+
const X = "purgatory", A = (e) => e === X, D = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), te = ({ kind: e, readyState: t }) => e === "video" && t === "live", H = (e) => ({ track: t }) => {
|
|
10
|
+
te(t) && e();
|
|
11
|
+
}, F = ({
|
|
12
12
|
getRemoteStreams: e,
|
|
13
13
|
setRemoteStreams: t
|
|
14
|
-
}) =>
|
|
14
|
+
}) => J(() => {
|
|
15
15
|
const n = e();
|
|
16
16
|
o("remoteStreams", n), n && t(n);
|
|
17
|
-
}, 200),
|
|
17
|
+
}, 200), re = (e) => async (n) => {
|
|
18
18
|
const {
|
|
19
19
|
mediaStream: r,
|
|
20
20
|
extraHeaders: s,
|
|
21
21
|
iceServers: a,
|
|
22
22
|
degradationPreference: c,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
contentHint: i,
|
|
24
|
+
setRemoteStreams: l,
|
|
25
|
+
onBeforeProgressCall: d,
|
|
26
|
+
onSuccessProgressCall: f,
|
|
27
|
+
onEnterPurgatory: m,
|
|
27
28
|
onEnterConference: S,
|
|
28
|
-
onFailProgressCall:
|
|
29
|
-
onFinishProgressCall:
|
|
30
|
-
onEndedCall:
|
|
31
|
-
} = n,
|
|
32
|
-
setRemoteStreams:
|
|
33
|
-
getRemoteStreams:
|
|
34
|
-
}),
|
|
29
|
+
onFailProgressCall: g,
|
|
30
|
+
onFinishProgressCall: C,
|
|
31
|
+
onEndedCall: E
|
|
32
|
+
} = n, M = F({
|
|
33
|
+
setRemoteStreams: l,
|
|
34
|
+
getRemoteStreams: D(e)
|
|
35
|
+
}), b = H(M);
|
|
35
36
|
o("answerIncomingCall", n);
|
|
36
|
-
const
|
|
37
|
+
const _ = async () => e.answerToIncomingCall({
|
|
37
38
|
mediaStream: r,
|
|
38
39
|
extraHeaders: s,
|
|
39
40
|
iceServers: a,
|
|
41
|
+
contentHint: i,
|
|
40
42
|
degradationPreference: c,
|
|
41
|
-
ontrack:
|
|
42
|
-
}),
|
|
43
|
+
ontrack: b
|
|
44
|
+
}), p = () => {
|
|
43
45
|
const { remoteCallerData: u } = e;
|
|
44
46
|
return u.incomingNumber;
|
|
45
47
|
};
|
|
46
|
-
let
|
|
47
|
-
const h = (o("subscribeEnterConference: onEnterConference", S),
|
|
48
|
-
o("enterRoom", { _room: u, isSuccessProgressCall:
|
|
48
|
+
let T = !1, y;
|
|
49
|
+
const h = (o("subscribeEnterConference: onEnterConference", S), m ?? S ? e.onSession("enterRoom", (u) => {
|
|
50
|
+
o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ? m && m() : S && S({ isSuccessProgressCall: T });
|
|
49
51
|
}) : () => {
|
|
50
|
-
}),
|
|
51
|
-
h(),
|
|
52
|
-
}), u),
|
|
53
|
-
throw o("onFail"),
|
|
54
|
-
},
|
|
55
|
-
o("onFinish"),
|
|
52
|
+
}), O = (u) => (o("onSuccess"), T = !0, M(), f && f({ isPurgatory: A(y) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
53
|
+
h(), E && E();
|
|
54
|
+
}), u), v = (u) => {
|
|
55
|
+
throw o("onFail"), g && g(), h(), u;
|
|
56
|
+
}, P = () => {
|
|
57
|
+
o("onFinish"), C && C();
|
|
56
58
|
};
|
|
57
|
-
if (o("onBeforeProgressCall"),
|
|
58
|
-
const u =
|
|
59
|
-
|
|
59
|
+
if (o("onBeforeProgressCall"), d) {
|
|
60
|
+
const u = p();
|
|
61
|
+
d(u);
|
|
60
62
|
}
|
|
61
|
-
return
|
|
62
|
-
},
|
|
63
|
+
return _().then(O).catch((u) => v(u)).finally(P);
|
|
64
|
+
}, se = (e) => async (n) => {
|
|
63
65
|
const {
|
|
64
66
|
conference: r,
|
|
65
67
|
mediaStream: s,
|
|
66
68
|
extraHeaders: a,
|
|
67
69
|
iceServers: c,
|
|
68
70
|
degradationPreference: i,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
contentHint: l,
|
|
72
|
+
setRemoteStreams: d,
|
|
73
|
+
onBeforeProgressCall: f,
|
|
74
|
+
onSuccessProgressCall: m,
|
|
72
75
|
onEnterPurgatory: S,
|
|
73
|
-
onEnterConference:
|
|
74
|
-
onFailProgressCall:
|
|
75
|
-
onFinishProgressCall:
|
|
76
|
-
onEndedCall:
|
|
77
|
-
} = n,
|
|
78
|
-
setRemoteStreams:
|
|
79
|
-
getRemoteStreams:
|
|
80
|
-
}),
|
|
76
|
+
onEnterConference: g,
|
|
77
|
+
onFailProgressCall: C,
|
|
78
|
+
onFinishProgressCall: E,
|
|
79
|
+
onEndedCall: M
|
|
80
|
+
} = n, b = F({
|
|
81
|
+
setRemoteStreams: d,
|
|
82
|
+
getRemoteStreams: D(e)
|
|
83
|
+
}), _ = H(b);
|
|
81
84
|
o("callToServer", n);
|
|
82
|
-
const
|
|
85
|
+
const p = async () => (o("startCall"), e.call({
|
|
83
86
|
mediaStream: s,
|
|
84
87
|
extraHeaders: a,
|
|
85
88
|
iceServers: c,
|
|
86
89
|
degradationPreference: i,
|
|
90
|
+
contentHint: l,
|
|
87
91
|
number: r,
|
|
88
|
-
ontrack:
|
|
92
|
+
ontrack: _
|
|
89
93
|
}));
|
|
90
|
-
let
|
|
91
|
-
const h = (o("subscribeEnterConference: onEnterConference",
|
|
92
|
-
o("enterRoom", { _room: u, isSuccessProgressCall:
|
|
94
|
+
let T = !1, y;
|
|
95
|
+
const h = (o("subscribeEnterConference: onEnterConference", g), S ?? g ? e.onSession("enterRoom", ({ room: u }) => {
|
|
96
|
+
o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ? S && S() : g && g({ isSuccessProgressCall: T });
|
|
93
97
|
}) : () => {
|
|
94
|
-
}),
|
|
95
|
-
h(),
|
|
96
|
-
}), u),
|
|
97
|
-
throw o("onFail"),
|
|
98
|
-
},
|
|
99
|
-
o("onFinish"),
|
|
98
|
+
}), O = (u) => (o("onSuccess"), T = !0, b(), m && m({ isPurgatory: A(y) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
99
|
+
h(), M && M();
|
|
100
|
+
}), u), v = (u) => {
|
|
101
|
+
throw o("onFail"), C && C(), h(), u;
|
|
102
|
+
}, P = () => {
|
|
103
|
+
o("onFinish"), E && E();
|
|
100
104
|
};
|
|
101
|
-
return o("onBeforeProgressCall"),
|
|
102
|
-
},
|
|
103
|
-
if (!
|
|
105
|
+
return o("onBeforeProgressCall"), f && f(r), p().then(O).catch((u) => v(u)).finally(P);
|
|
106
|
+
}, I = (e) => {
|
|
107
|
+
if (!Q(e) && !Z(e))
|
|
104
108
|
throw e;
|
|
105
109
|
return { isSuccessful: !1 };
|
|
106
|
-
},
|
|
110
|
+
}, oe = (e) => async (n) => {
|
|
107
111
|
const {
|
|
108
112
|
userAgent: r,
|
|
109
113
|
sipWebSocketServerURL: s,
|
|
@@ -113,7 +117,7 @@ const $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
113
117
|
name: l,
|
|
114
118
|
password: d,
|
|
115
119
|
isRegisteredUser: f,
|
|
116
|
-
isDisconnectOnFail:
|
|
120
|
+
isDisconnectOnFail: m
|
|
117
121
|
} = n;
|
|
118
122
|
return o("connectToServer", n), e.connect({
|
|
119
123
|
userAgent: r,
|
|
@@ -124,14 +128,14 @@ const $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams
|
|
|
124
128
|
password: d,
|
|
125
129
|
user: l,
|
|
126
130
|
register: f
|
|
127
|
-
}).then((
|
|
128
|
-
},
|
|
131
|
+
}).then((S) => (o("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (o("connectToServer catch: error", S), m === !0 ? e.disconnect().then(() => I(S)).catch(() => I(S)) : I(S)));
|
|
132
|
+
}, ae = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), k = (e) => {
|
|
129
133
|
const { url: t, cause: n } = e;
|
|
130
134
|
let r = t;
|
|
131
|
-
return (n ===
|
|
135
|
+
return (n === x || n === $) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
|
|
132
136
|
};
|
|
133
137
|
var W = /* @__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))(W || {});
|
|
134
|
-
const
|
|
138
|
+
const ce = (e = new Error()) => {
|
|
135
139
|
var s;
|
|
136
140
|
const { cause: t, socket: n } = e;
|
|
137
141
|
let r = "CONNECT_SERVER_FAILED";
|
|
@@ -140,19 +144,19 @@ const ae = (e = new Error()) => {
|
|
|
140
144
|
r = "WRONG_USER_OR_PASSWORD";
|
|
141
145
|
break;
|
|
142
146
|
}
|
|
143
|
-
case
|
|
147
|
+
case x: {
|
|
144
148
|
r = "BAD_MEDIA_ERROR";
|
|
145
149
|
break;
|
|
146
150
|
}
|
|
147
|
-
case
|
|
151
|
+
case $: {
|
|
148
152
|
r = "NOT_FOUND_ERROR";
|
|
149
153
|
break;
|
|
150
154
|
}
|
|
151
155
|
default:
|
|
152
|
-
n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" :
|
|
156
|
+
n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" : k(e) && (r = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
153
157
|
}
|
|
154
158
|
return r;
|
|
155
|
-
},
|
|
159
|
+
}, ie = (e) => {
|
|
156
160
|
let t = "";
|
|
157
161
|
try {
|
|
158
162
|
t = JSON.stringify(e);
|
|
@@ -160,16 +164,16 @@ const ae = (e = new Error()) => {
|
|
|
160
164
|
o("failed to stringify message", n);
|
|
161
165
|
}
|
|
162
166
|
return t;
|
|
163
|
-
},
|
|
164
|
-
const { code: t, cause: n, message: r } = e, s =
|
|
165
|
-
return typeof r == "object" && r !== null ? a.message =
|
|
166
|
-
},
|
|
167
|
+
}, ue = (e = new Error()) => {
|
|
168
|
+
const { code: t, cause: n, message: r } = e, s = k(e), a = { code: "", cause: "", message: "" };
|
|
169
|
+
return typeof r == "object" && r !== null ? a.message = ie(r) : r && (a.message = String(r)), s && (a.link = s), t && (a.code = t), n && (a.cause = n), a;
|
|
170
|
+
}, le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
167
171
|
__proto__: null,
|
|
168
172
|
EErrorTypes: W,
|
|
169
|
-
getLinkError:
|
|
170
|
-
getTypeFromError:
|
|
171
|
-
getValuesFromError:
|
|
172
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
173
|
+
getLinkError: k,
|
|
174
|
+
getTypeFromError: ce,
|
|
175
|
+
getValuesFromError: ue
|
|
176
|
+
}, Symbol.toStringTag, { value: "Module" })), Se = ({
|
|
173
177
|
sessionId: e,
|
|
174
178
|
remoteAddress: t,
|
|
175
179
|
isMutedAudio: n,
|
|
@@ -179,43 +183,43 @@ const ae = (e = new Error()) => {
|
|
|
179
183
|
}) => {
|
|
180
184
|
const c = [], i = n ? "0" : "1", l = r ? "0" : "1";
|
|
181
185
|
return c.push(`X-Vinteo-Mic-State: ${i}`, `X-Vinteo-MainCam-State: ${l}`), s || c.push("X-Vinteo-Purgatory-Call: yes"), e && c.push(`X-Vinteo-Session: ${e}`), a && c.push("X-Vinteo-Presentation-Call: yes"), t && c.push(`X-Vinteo-Remote: ${t}`), c;
|
|
182
|
-
},
|
|
186
|
+
}, me = "[@*!|]", de = "_", fe = (e) => {
|
|
183
187
|
let t = e;
|
|
184
|
-
return t = t.replaceAll(new RegExp(
|
|
185
|
-
},
|
|
188
|
+
return t = t.replaceAll(new RegExp(me, "g"), de), t;
|
|
189
|
+
}, Ce = ({
|
|
186
190
|
appName: e,
|
|
187
191
|
appVersion: t,
|
|
188
192
|
browserName: n,
|
|
189
193
|
browserVersion: r
|
|
190
194
|
}) => {
|
|
191
|
-
const a = `${
|
|
195
|
+
const a = `${fe(e)} ${t}`;
|
|
192
196
|
return `ChromeNew - ${n ? `${n} ${r}, ${a}` : a}`;
|
|
193
|
-
},
|
|
197
|
+
}, ge = ({
|
|
194
198
|
isUnifiedSdpSemantic: e,
|
|
195
199
|
appVersion: t,
|
|
196
200
|
browserName: n,
|
|
197
201
|
browserVersion: r,
|
|
198
202
|
appName: s
|
|
199
|
-
}) => e ?
|
|
203
|
+
}) => e ? Ce({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", Re = (e) => async () => {
|
|
200
204
|
if (e.isCallActive)
|
|
201
205
|
return o("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
202
|
-
},
|
|
206
|
+
}, Ee = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Me = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)), Te = (e) => (n) => (o("onUseLicense"), e.onSession("useLicense", n)), ye = (e) => async ({
|
|
203
207
|
isEnabledCam: n,
|
|
204
208
|
isEnabledMic: r
|
|
205
209
|
}) => {
|
|
206
210
|
if (e.isCallActive)
|
|
207
211
|
return o("sendMediaState"), e.sendMediaState({ cam: n, mic: r });
|
|
208
|
-
},
|
|
212
|
+
}, he = (e) => async () => {
|
|
209
213
|
if (e.isCallActive)
|
|
210
214
|
return o("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((n) => {
|
|
211
215
|
o("sendRefusalToTurnOnCam: error", n);
|
|
212
216
|
});
|
|
213
|
-
},
|
|
217
|
+
}, be = (e) => async () => {
|
|
214
218
|
if (e.isCallActive)
|
|
215
219
|
return o("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((n) => {
|
|
216
220
|
o("sendRefusalToTurnOnMic: error", n);
|
|
217
221
|
});
|
|
218
|
-
},
|
|
222
|
+
}, _e = (e) => async ({
|
|
219
223
|
mediaStream: n,
|
|
220
224
|
isP2P: r,
|
|
221
225
|
maxBitrate: s,
|
|
@@ -230,11 +234,11 @@ const ae = (e = new Error()) => {
|
|
|
230
234
|
contentHint: c
|
|
231
235
|
},
|
|
232
236
|
i
|
|
233
|
-
)),
|
|
237
|
+
)), pe = (e) => async ({ isP2P: n = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
|
|
234
238
|
isP2P: n
|
|
235
239
|
}).catch((r) => {
|
|
236
240
|
o(r);
|
|
237
|
-
})),
|
|
241
|
+
})), Oe = (e) => async ({
|
|
238
242
|
mediaStream: n,
|
|
239
243
|
isP2P: r,
|
|
240
244
|
maxBitrate: s,
|
|
@@ -245,21 +249,21 @@ const ae = (e = new Error()) => {
|
|
|
245
249
|
maxBitrate: s,
|
|
246
250
|
degradationPreference: a,
|
|
247
251
|
contentHint: c
|
|
248
|
-
})),
|
|
252
|
+
})), ve = (e) => (t) => [...t].map((r) => async () => e(r)), Ae = async ({
|
|
249
253
|
accumulatedKeys: e,
|
|
250
254
|
sendKey: t,
|
|
251
255
|
canRunTask: n
|
|
252
256
|
}) => {
|
|
253
|
-
const s =
|
|
254
|
-
return
|
|
255
|
-
},
|
|
256
|
-
const t = (C,
|
|
257
|
-
if (
|
|
257
|
+
const s = ve(t)(e);
|
|
258
|
+
return ee(s, n);
|
|
259
|
+
}, Ne = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Pe = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), Be = (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 }) => {
|
|
260
|
+
const t = (C, E) => ({ isSyncForced: M = !1 }) => {
|
|
261
|
+
if (M) {
|
|
258
262
|
C();
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
261
|
-
|
|
262
|
-
}, n =
|
|
265
|
+
E();
|
|
266
|
+
}, n = Ne(e), r = Be(e), s = Pe(e), a = Ie(e);
|
|
263
267
|
let c = () => {
|
|
264
268
|
}, i = () => {
|
|
265
269
|
}, l = () => {
|
|
@@ -267,29 +271,29 @@ const ae = (e = new Error()) => {
|
|
|
267
271
|
};
|
|
268
272
|
const f = ({
|
|
269
273
|
onStartMainCamForced: C,
|
|
270
|
-
onStartMainCamNotForced:
|
|
271
|
-
onStopMainCamForced:
|
|
274
|
+
onStartMainCamNotForced: E,
|
|
275
|
+
onStopMainCamForced: M,
|
|
272
276
|
onStopMainCamNotForced: b,
|
|
273
277
|
onStartMicForced: _,
|
|
274
|
-
onStartMicNotForced:
|
|
275
|
-
onStopMicForced:
|
|
276
|
-
onStopMicNotForced:
|
|
278
|
+
onStartMicNotForced: p,
|
|
279
|
+
onStopMicForced: T,
|
|
280
|
+
onStopMicNotForced: y
|
|
277
281
|
}) => {
|
|
278
|
-
const
|
|
282
|
+
const N = t(
|
|
279
283
|
C,
|
|
280
|
-
|
|
284
|
+
E
|
|
281
285
|
);
|
|
282
|
-
c = n(
|
|
283
|
-
const
|
|
284
|
-
|
|
286
|
+
c = n(N);
|
|
287
|
+
const h = t(
|
|
288
|
+
M,
|
|
285
289
|
b
|
|
286
290
|
);
|
|
287
|
-
i = r(
|
|
288
|
-
const O = t(_,
|
|
291
|
+
i = r(h);
|
|
292
|
+
const O = t(_, p);
|
|
289
293
|
l = s(O);
|
|
290
|
-
const v = t(
|
|
294
|
+
const v = t(T, y);
|
|
291
295
|
d = a(v);
|
|
292
|
-
},
|
|
296
|
+
}, m = () => {
|
|
293
297
|
c(), i(), l(), d();
|
|
294
298
|
};
|
|
295
299
|
return {
|
|
@@ -297,80 +301,80 @@ const ae = (e = new Error()) => {
|
|
|
297
301
|
f(C);
|
|
298
302
|
},
|
|
299
303
|
stop: () => {
|
|
300
|
-
|
|
304
|
+
m();
|
|
301
305
|
}
|
|
302
306
|
};
|
|
303
|
-
},
|
|
307
|
+
}, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
304
308
|
__proto__: null,
|
|
305
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
306
|
-
createSyncMediaState:
|
|
307
|
-
error:
|
|
308
|
-
getExtraHeaders:
|
|
309
|
-
getUserAgent:
|
|
309
|
+
PURGATORY_CONFERENCE_NUMBER: X,
|
|
310
|
+
createSyncMediaState: we,
|
|
311
|
+
error: le,
|
|
312
|
+
getExtraHeaders: Se,
|
|
313
|
+
getUserAgent: ge,
|
|
310
314
|
hasPurgatory: A,
|
|
311
|
-
resolveAnswerIncomingCall:
|
|
312
|
-
resolveAskPermissionToEnableCam:
|
|
313
|
-
resolveCallToServer:
|
|
314
|
-
resolveConnectToServer:
|
|
315
|
-
resolveDisconnectFromServer:
|
|
316
|
-
resolveGetRemoteStreams:
|
|
317
|
-
resolveOnMoveToSpectators:
|
|
318
|
-
resolveOnMustStopPresentation:
|
|
319
|
-
resolveOnUseLicense:
|
|
320
|
-
resolveSendMediaState:
|
|
321
|
-
resolveSendRefusalToTurnOnCam:
|
|
322
|
-
resolveSendRefusalToTurnOnMic:
|
|
323
|
-
resolveStartPresentation:
|
|
324
|
-
resolveStopShareSipConnector:
|
|
325
|
-
resolveUpdatePresentation:
|
|
326
|
-
resolveUpdateRemoteStreams:
|
|
327
|
-
sendDTMFAccumulated:
|
|
328
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
329
|
-
const n =
|
|
315
|
+
resolveAnswerIncomingCall: re,
|
|
316
|
+
resolveAskPermissionToEnableCam: Re,
|
|
317
|
+
resolveCallToServer: se,
|
|
318
|
+
resolveConnectToServer: oe,
|
|
319
|
+
resolveDisconnectFromServer: ae,
|
|
320
|
+
resolveGetRemoteStreams: D,
|
|
321
|
+
resolveOnMoveToSpectators: Me,
|
|
322
|
+
resolveOnMustStopPresentation: Ee,
|
|
323
|
+
resolveOnUseLicense: Te,
|
|
324
|
+
resolveSendMediaState: ye,
|
|
325
|
+
resolveSendRefusalToTurnOnCam: he,
|
|
326
|
+
resolveSendRefusalToTurnOnMic: be,
|
|
327
|
+
resolveStartPresentation: _e,
|
|
328
|
+
resolveStopShareSipConnector: pe,
|
|
329
|
+
resolveUpdatePresentation: Oe,
|
|
330
|
+
resolveUpdateRemoteStreams: F,
|
|
331
|
+
sendDTMFAccumulated: Ae
|
|
332
|
+
}, 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) => {
|
|
333
|
+
const n = Fe(t, "codec");
|
|
330
334
|
return n == null ? void 0 : n.mimeType;
|
|
331
|
-
}),
|
|
335
|
+
}), Ue = (e) => e.find((t) => {
|
|
332
336
|
var n;
|
|
333
337
|
return ((n = t == null ? void 0 : t.track) == null ? void 0 : n.kind) === "video";
|
|
334
|
-
}), G = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()),
|
|
335
|
-
const n =
|
|
338
|
+
}), G = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Le = 1e6, R = (e) => e * Le, K = R(0.06), Ve = R(4), xe = (e) => e <= 64 ? K : e <= 128 ? R(0.12) : e <= 256 ? R(0.25) : e <= 384 ? R(0.32) : e <= 426 ? R(0.38) : e <= 640 ? R(0.5) : e <= 848 ? R(0.7) : e <= 1280 ? R(1) : e <= 1920 ? R(2) : Ve, $e = "av1", Xe = (e) => G(e, $e), He = 0.6, j = (e, t) => Xe(t) ? e * He : e, We = (e) => j(K, e), Y = (e, t) => {
|
|
339
|
+
const n = xe(e);
|
|
336
340
|
return j(n, t);
|
|
337
|
-
},
|
|
341
|
+
}, q = ne(), Ge = async () => q().catch((e) => {
|
|
338
342
|
o("videoSendingBalancer: error", e);
|
|
339
|
-
}), Ke = async (e) => (
|
|
343
|
+
}), Ke = async (e) => (q.add(e), Ge()), U = async ({
|
|
340
344
|
sender: e,
|
|
341
345
|
scaleResolutionDownBy: t,
|
|
342
346
|
maxBitrate: n,
|
|
343
347
|
onSetParameters: r
|
|
344
|
-
}) => Ke(async () =>
|
|
348
|
+
}) => Ke(async () => z(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), je = async ({ sender: e, codec: t }, n) => {
|
|
345
349
|
const s = We(t);
|
|
346
|
-
return
|
|
350
|
+
return U({
|
|
347
351
|
sender: e,
|
|
348
352
|
maxBitrate: s,
|
|
349
353
|
onSetParameters: n,
|
|
350
354
|
scaleResolutionDownBy: 200
|
|
351
355
|
});
|
|
352
|
-
},
|
|
353
|
-
const c = t.getSettings().width, i =
|
|
354
|
-
return
|
|
356
|
+
}, w = async ({ sender: e, track: t, codec: n }, r) => {
|
|
357
|
+
const c = t.getSettings().width, i = Y(c, n);
|
|
358
|
+
return U({
|
|
355
359
|
sender: e,
|
|
356
360
|
maxBitrate: i,
|
|
357
361
|
onSetParameters: r,
|
|
358
362
|
scaleResolutionDownBy: 1
|
|
359
363
|
});
|
|
360
|
-
},
|
|
364
|
+
}, Ye = async ({
|
|
361
365
|
sender: e,
|
|
362
366
|
track: t,
|
|
363
367
|
resolution: n,
|
|
364
368
|
codec: r
|
|
365
369
|
}, s) => {
|
|
366
|
-
const a = t.getSettings(), c = a.width, i = a.height, [l, d] = n.split("x"), f = c / Number(l),
|
|
367
|
-
return
|
|
370
|
+
const a = t.getSettings(), c = a.width, i = a.height, [l, d] = n.split("x"), f = c / Number(l), m = i / Number(d), g = Math.max(f, m, 1), C = Y(Number(l), r);
|
|
371
|
+
return U({
|
|
368
372
|
sender: e,
|
|
369
373
|
maxBitrate: C,
|
|
370
374
|
onSetParameters: s,
|
|
371
|
-
scaleResolutionDownBy:
|
|
375
|
+
scaleResolutionDownBy: g
|
|
372
376
|
});
|
|
373
|
-
},
|
|
377
|
+
}, qe = async ({
|
|
374
378
|
mainCam: e,
|
|
375
379
|
resolutionMainCam: t,
|
|
376
380
|
sender: n,
|
|
@@ -378,19 +382,19 @@ const ae = (e = new Error()) => {
|
|
|
378
382
|
codec: s
|
|
379
383
|
}, a) => {
|
|
380
384
|
switch (e) {
|
|
381
|
-
case
|
|
385
|
+
case B.PAUSE_MAIN_CAM:
|
|
382
386
|
return je({ sender: n, codec: s }, a);
|
|
383
|
-
case
|
|
384
|
-
return
|
|
385
|
-
case
|
|
386
|
-
return t !== void 0 ?
|
|
387
|
+
case B.RESUME_MAIN_CAM:
|
|
388
|
+
return w({ sender: n, track: r, codec: s }, a);
|
|
389
|
+
case B.MAX_MAIN_CAM_RESOLUTION:
|
|
390
|
+
return t !== void 0 ? Ye(
|
|
387
391
|
{ sender: n, track: r, codec: s, resolution: t },
|
|
388
392
|
a
|
|
389
|
-
) :
|
|
393
|
+
) : w({ sender: n, track: r, codec: s }, a);
|
|
390
394
|
default:
|
|
391
|
-
return
|
|
395
|
+
return w({ sender: n, track: r, codec: s }, a);
|
|
392
396
|
}
|
|
393
|
-
},
|
|
397
|
+
}, L = {
|
|
394
398
|
isChanged: !1,
|
|
395
399
|
parameters: {
|
|
396
400
|
encodings: [{}],
|
|
@@ -399,22 +403,22 @@ const ae = (e = new Error()) => {
|
|
|
399
403
|
headerExtensions: [],
|
|
400
404
|
rtcp: {}
|
|
401
405
|
}
|
|
402
|
-
},
|
|
406
|
+
}, V = async ({
|
|
403
407
|
mainCam: e,
|
|
404
408
|
resolutionMainCam: t,
|
|
405
409
|
connection: n,
|
|
406
410
|
onSetParameters: r,
|
|
407
411
|
ignoreForCodec: s
|
|
408
412
|
}) => {
|
|
409
|
-
const a = n.getSenders(), c =
|
|
413
|
+
const a = n.getSenders(), c = Ue(a);
|
|
410
414
|
if (!(c != null && c.track))
|
|
411
|
-
return
|
|
412
|
-
const i = await
|
|
413
|
-
return G(i, s) ?
|
|
415
|
+
return L;
|
|
416
|
+
const i = await ke(c);
|
|
417
|
+
return G(i, s) ? L : qe(
|
|
414
418
|
{ mainCam: e, resolutionMainCam: t, sender: c, codec: i, track: c.track },
|
|
415
419
|
r
|
|
416
420
|
);
|
|
417
|
-
},
|
|
421
|
+
}, sn = (e, {
|
|
418
422
|
ignoreForCodec: t,
|
|
419
423
|
onSetParameters: n
|
|
420
424
|
} = {}) => {
|
|
@@ -422,7 +426,7 @@ const ae = (e = new Error()) => {
|
|
|
422
426
|
const { connection: l } = e;
|
|
423
427
|
if (!l)
|
|
424
428
|
throw new Error("connection is not exist");
|
|
425
|
-
return
|
|
429
|
+
return V({
|
|
426
430
|
connection: l,
|
|
427
431
|
onSetParameters: n,
|
|
428
432
|
ignoreForCodec: t
|
|
@@ -430,13 +434,13 @@ const ae = (e = new Error()) => {
|
|
|
430
434
|
};
|
|
431
435
|
let s = r;
|
|
432
436
|
const a = async (l) => (s = async () => {
|
|
433
|
-
const { mainCam: d, resolutionMainCam: f } = l, { connection:
|
|
434
|
-
if (!
|
|
437
|
+
const { mainCam: d, resolutionMainCam: f } = l, { connection: m } = e;
|
|
438
|
+
if (!m)
|
|
435
439
|
throw new Error("connection is not exist");
|
|
436
|
-
return
|
|
440
|
+
return V({
|
|
437
441
|
mainCam: d,
|
|
438
442
|
resolutionMainCam: f,
|
|
439
|
-
connection:
|
|
443
|
+
connection: m,
|
|
440
444
|
onSetParameters: n,
|
|
441
445
|
ignoreForCodec: t
|
|
442
446
|
});
|
|
@@ -458,19 +462,19 @@ const ae = (e = new Error()) => {
|
|
|
458
462
|
};
|
|
459
463
|
};
|
|
460
464
|
export {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
465
|
+
B as EEventsMainCAM,
|
|
466
|
+
cn as EEventsMic,
|
|
467
|
+
un as EEventsSyncMediaState,
|
|
468
|
+
ln as EUseLicense,
|
|
469
|
+
Sn as causes,
|
|
470
|
+
mn as constants,
|
|
471
|
+
En as debug,
|
|
472
|
+
Je as default,
|
|
473
|
+
dn as disableDebug,
|
|
474
|
+
fn as enableDebug,
|
|
475
|
+
Cn as eventNames,
|
|
476
|
+
ke as getCodecFromSender,
|
|
477
|
+
gn as hasCanceledCallError,
|
|
478
|
+
sn as resolveVideoSendingBalancer,
|
|
479
|
+
rn as tools
|
|
476
480
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { default as SipConnector } from '../SipConnector';
|
|
2
|
+
import { TContentHint } from '../types';
|
|
2
3
|
type TDegradationPreference = 'balanced' | 'maintain-framerate' | 'maintain-resolution';
|
|
3
4
|
declare const resolveAnswerIncomingCall: (sipConnector: SipConnector) => (parameters: {
|
|
4
5
|
mediaStream: MediaStream;
|
|
5
6
|
extraHeaders?: string[] | undefined;
|
|
6
7
|
iceServers?: RTCIceServer[];
|
|
7
8
|
degradationPreference?: TDegradationPreference;
|
|
9
|
+
contentHint?: TContentHint;
|
|
8
10
|
setRemoteStreams: (streams: MediaStream[]) => void;
|
|
9
11
|
onBeforeProgressCall?: (conference?: string) => void;
|
|
10
12
|
onSuccessProgressCall?: (parameters_: {
|