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