sip-connector 11.6.1 → 12.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-DhuPlarI.js → SipConnector-Dq5DrJxd.js} +4 -4
- package/dist/SipConnectorFacade/SipConnectorFacade.d.ts +132 -0
- package/dist/SipConnectorFacade/index.d.ts +1 -0
- package/dist/doMock.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +581 -568
- package/dist/tools/index.d.ts +0 -18
- package/package.json +3 -3
- package/dist/tools/answerIncomingCall.d.ts +0 -26
- package/dist/tools/callToServer.d.ts +0 -27
- package/dist/tools/connectToServer.d.ts +0 -17
- package/dist/tools/disconnectFromServer.d.ts +0 -7
- package/dist/tools/resolveAskPermissionToEnableCam.d.ts +0 -3
- package/dist/tools/resolveGetRemoteStreams.d.ts +0 -3
- package/dist/tools/resolveHandleChangeTracks.d.ts +0 -4
- package/dist/tools/resolveOnMoveToParticipants.d.ts +0 -3
- package/dist/tools/resolveOnMoveToSpectators.d.ts +0 -3
- package/dist/tools/resolveOnMustStopPresentation.d.ts +0 -3
- package/dist/tools/resolveOnUseLicense.d.ts +0 -4
- package/dist/tools/resolveReplaceMediaStream.d.ts +0 -14
- package/dist/tools/resolveSendMediaState.d.ts +0 -6
- package/dist/tools/resolveSendRefusalToTurnOnCam.d.ts +0 -3
- package/dist/tools/resolveSendRefusalToTurnOnMic.d.ts +0 -3
- package/dist/tools/resolveStartPresentation.d.ts +0 -16
- package/dist/tools/resolveStopShareSipConnector.d.ts +0 -5
- package/dist/tools/resolveUpdatePresentation.d.ts +0 -14
- package/dist/tools/resolveUpdateRemoteStreams.d.ts +0 -8
package/dist/index.js
CHANGED
|
@@ -1,561 +1,233 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { sequentPromises as
|
|
7
|
-
import { createStackPromises as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}) => {
|
|
17
|
-
const r = e.getSettings(), s = r.width, o = r.height, a = s / t.width, i = o / t.height, u = Math.max(a, i, ye), d = Q(t.width, n);
|
|
18
|
-
return { scaleResolutionDownBy: u, maxBitrate: d };
|
|
19
|
-
}, w = ({
|
|
20
|
-
mediaStream: e,
|
|
21
|
-
simulcastEncodings: t,
|
|
22
|
-
sendEncodings: n
|
|
23
|
-
}) => {
|
|
24
|
-
if (t && t.length > 0) {
|
|
25
|
-
const r = n ?? [], s = me(e);
|
|
26
|
-
return t.forEach((o, a) => {
|
|
27
|
-
const i = r[a] ?? {}, { maxBitrate: u, scaleResolutionDownBy: d } = J({
|
|
28
|
-
videoTrack: s,
|
|
29
|
-
targetSize: {
|
|
30
|
-
width: o.width,
|
|
31
|
-
height: o.height
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
i.maxBitrate = u, i.scaleResolutionDownBy = d, r[a] = i;
|
|
35
|
-
}), r;
|
|
36
|
-
}
|
|
37
|
-
return n;
|
|
38
|
-
}, Z = "purgatory", B = (e) => e === Z, $ = (e) => () => (c("getRemoteStreams"), e.getRemoteStreams()), ve = ({ kind: e, readyState: t }) => e === "video" && t === "live", ee = (e) => ({ track: t }) => {
|
|
39
|
-
ve(t) && e();
|
|
40
|
-
}, V = ({
|
|
41
|
-
getRemoteStreams: e,
|
|
42
|
-
setRemoteStreams: t
|
|
43
|
-
}) => ie(() => {
|
|
44
|
-
const n = e();
|
|
45
|
-
c("remoteStreams", n), n && t(n);
|
|
46
|
-
}, 200), Me = (e, t) => [...e, ...t].filter((s, o, a) => o === a.findIndex((i) => i.clockRate === s.clockRate && i.mimeType === s.mimeType && i.channels === s.channels && i.sdpFmtpLine === s.sdpFmtpLine)), be = (e) => {
|
|
47
|
-
const t = RTCRtpSender.getCapabilities(e), n = RTCRtpReceiver.getCapabilities(e), r = t === null ? [] : t.codecs, s = n === null ? [] : n.codecs;
|
|
48
|
-
return Me(r, s);
|
|
49
|
-
}, _e = (e, t) => t === void 0 || t.length === 0 ? e : e.sort((n, r) => {
|
|
50
|
-
const s = t.indexOf(n.mimeType), o = t.indexOf(r.mimeType), a = s === -1 ? Number.MAX_VALUE : s, i = o === -1 ? Number.MAX_VALUE : o;
|
|
51
|
-
return a - i;
|
|
52
|
-
}), pe = (e, t) => t === void 0 || t.length === 0 ? e : e.filter((n) => !t.includes(n.mimeType)), I = (e, {
|
|
53
|
-
preferredMimeTypesVideoCodecs: t,
|
|
54
|
-
excludeMimeTypesVideoCodecs: n
|
|
55
|
-
}) => async (r) => {
|
|
56
|
-
var s;
|
|
57
|
-
if (typeof r.setCodecPreferences == "function" && ((s = r.sender.track) == null ? void 0 : s.kind) === "video" && (t !== void 0 && (t == null ? void 0 : t.length) > 0 || n !== void 0 && (n == null ? void 0 : n.length) > 0)) {
|
|
58
|
-
const o = be("video"), a = pe(o, n), i = _e(a, t);
|
|
59
|
-
r.setCodecPreferences(i);
|
|
60
|
-
}
|
|
61
|
-
Object.keys(e).length > 0 && await se(r.sender, e);
|
|
62
|
-
}, Ae = (e) => async (n) => {
|
|
63
|
-
const {
|
|
64
|
-
mediaStream: r,
|
|
65
|
-
extraHeaders: s,
|
|
66
|
-
iceServers: o,
|
|
67
|
-
contentHint: a,
|
|
68
|
-
simulcastEncodings: i,
|
|
69
|
-
degradationPreference: u,
|
|
70
|
-
sendEncodings: d,
|
|
71
|
-
preferredMimeTypesVideoCodecs: m,
|
|
72
|
-
excludeMimeTypesVideoCodecs: S,
|
|
73
|
-
setRemoteStreams: f,
|
|
74
|
-
onBeforeProgressCall: p,
|
|
75
|
-
onSuccessProgressCall: C,
|
|
76
|
-
onEnterPurgatory: R,
|
|
77
|
-
onEnterConference: g,
|
|
78
|
-
onFailProgressCall: T,
|
|
79
|
-
onFinishProgressCall: y,
|
|
80
|
-
onEndedCall: v
|
|
81
|
-
} = n, M = V({
|
|
82
|
-
setRemoteStreams: f,
|
|
83
|
-
getRemoteStreams: $(e)
|
|
84
|
-
}), _ = ee(M), A = I(
|
|
85
|
-
{
|
|
86
|
-
degradationPreference: u
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
preferredMimeTypesVideoCodecs: m,
|
|
90
|
-
excludeMimeTypesVideoCodecs: S
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
c("answerIncomingCall", n);
|
|
94
|
-
const O = async () => e.answerToIncomingCall({
|
|
95
|
-
mediaStream: r,
|
|
96
|
-
extraHeaders: s,
|
|
97
|
-
iceServers: o,
|
|
98
|
-
contentHint: a,
|
|
99
|
-
sendEncodings: w({
|
|
100
|
-
mediaStream: r,
|
|
101
|
-
simulcastEncodings: i,
|
|
102
|
-
sendEncodings: d
|
|
103
|
-
}),
|
|
104
|
-
onAddedTransceiver: A,
|
|
105
|
-
ontrack: _
|
|
106
|
-
}), P = () => {
|
|
107
|
-
const { remoteCallerData: l } = e;
|
|
108
|
-
return l.incomingNumber;
|
|
109
|
-
};
|
|
110
|
-
let h = !1, b;
|
|
111
|
-
const N = (c("subscribeEnterConference: onEnterConference", g), R ?? g ? e.onSession("enterRoom", (l) => {
|
|
112
|
-
c("enterRoom", { _room: l, isSuccessProgressCall: h }), b = l, B(b) ? R && R() : g && g({ isSuccessProgressCall: h });
|
|
113
|
-
}) : () => {
|
|
114
|
-
}), D = (l) => (c("onSuccess"), h = !0, M(), C && C({ isPurgatory: B(b) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
115
|
-
N(), v && v();
|
|
116
|
-
}), l), F = (l) => {
|
|
117
|
-
throw c("onFail"), T && T(), N(), l;
|
|
118
|
-
}, k = () => {
|
|
119
|
-
c("onFinish"), y && y();
|
|
120
|
-
};
|
|
121
|
-
if (c("onBeforeProgressCall"), p) {
|
|
122
|
-
const l = P();
|
|
123
|
-
p(l);
|
|
124
|
-
}
|
|
125
|
-
return O().then(D).catch((l) => F(l)).finally(k);
|
|
126
|
-
}, Oe = (e) => async (n) => {
|
|
127
|
-
const {
|
|
128
|
-
conference: r,
|
|
129
|
-
mediaStream: s,
|
|
130
|
-
extraHeaders: o,
|
|
131
|
-
iceServers: a,
|
|
132
|
-
contentHint: i,
|
|
133
|
-
simulcastEncodings: u,
|
|
134
|
-
degradationPreference: d,
|
|
135
|
-
sendEncodings: m,
|
|
136
|
-
preferredMimeTypesVideoCodecs: S,
|
|
137
|
-
excludeMimeTypesVideoCodecs: f,
|
|
138
|
-
setRemoteStreams: p,
|
|
139
|
-
onBeforeProgressCall: C,
|
|
140
|
-
onSuccessProgressCall: R,
|
|
141
|
-
onEnterPurgatory: g,
|
|
142
|
-
onEnterConference: T,
|
|
143
|
-
onFailProgressCall: y,
|
|
144
|
-
onFinishProgressCall: v,
|
|
145
|
-
onEndedCall: M
|
|
146
|
-
} = n, _ = V({
|
|
147
|
-
setRemoteStreams: p,
|
|
148
|
-
getRemoteStreams: $(e)
|
|
149
|
-
}), A = ee(_), O = I(
|
|
150
|
-
{
|
|
151
|
-
degradationPreference: d
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
preferredMimeTypesVideoCodecs: S,
|
|
155
|
-
excludeMimeTypesVideoCodecs: f
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
c("callToServer", n);
|
|
159
|
-
const P = async () => (c("startCall"), e.call({
|
|
160
|
-
mediaStream: s,
|
|
161
|
-
extraHeaders: o,
|
|
162
|
-
iceServers: a,
|
|
163
|
-
contentHint: i,
|
|
164
|
-
sendEncodings: w({
|
|
165
|
-
mediaStream: s,
|
|
166
|
-
simulcastEncodings: u,
|
|
167
|
-
sendEncodings: m
|
|
168
|
-
}),
|
|
169
|
-
number: r,
|
|
170
|
-
onAddedTransceiver: O,
|
|
171
|
-
ontrack: A
|
|
172
|
-
}));
|
|
173
|
-
let h = !1, b;
|
|
174
|
-
const N = (c("subscribeEnterConference: onEnterConference", T), g ?? T ? e.onSession("enterRoom", ({ room: l }) => {
|
|
175
|
-
c("enterRoom", { _room: l, isSuccessProgressCall: h }), b = l, B(b) ? g && g() : T && T({ isSuccessProgressCall: h });
|
|
176
|
-
}) : () => {
|
|
177
|
-
}), D = (l) => (c("onSuccess"), h = !0, _(), R && R({ isPurgatory: B(b) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
178
|
-
N(), M && M();
|
|
179
|
-
}), l), F = (l) => {
|
|
180
|
-
throw c("onFail"), y && y(), N(), l;
|
|
181
|
-
}, k = () => {
|
|
182
|
-
c("onFinish"), v && v();
|
|
183
|
-
};
|
|
184
|
-
return c("onBeforeProgressCall"), C && C(r), P().then(D).catch((l) => F(l)).finally(k);
|
|
185
|
-
}, L = (e) => {
|
|
186
|
-
if (!ue(e) && !le(e))
|
|
187
|
-
throw e;
|
|
188
|
-
return { isSuccessful: !1 };
|
|
189
|
-
}, Pe = (e) => async (n) => {
|
|
190
|
-
const {
|
|
191
|
-
userAgent: r,
|
|
192
|
-
sipWebSocketServerURL: s,
|
|
193
|
-
sipServerUrl: o,
|
|
194
|
-
remoteAddress: a,
|
|
195
|
-
displayName: i,
|
|
196
|
-
name: u,
|
|
197
|
-
password: d,
|
|
198
|
-
isRegisteredUser: m,
|
|
199
|
-
isDisconnectOnFail: S
|
|
200
|
-
} = n;
|
|
201
|
-
return c("connectToServer", n), e.connect({
|
|
202
|
-
userAgent: r,
|
|
203
|
-
sipWebSocketServerURL: s,
|
|
204
|
-
sipServerUrl: o,
|
|
205
|
-
remoteAddress: a,
|
|
206
|
-
displayName: i,
|
|
207
|
-
password: d,
|
|
208
|
-
user: u,
|
|
209
|
-
register: m
|
|
210
|
-
}).then((f) => (c("connectToServer then"), { ua: f, isSuccessful: !0 })).catch(async (f) => (c("connectToServer catch: error", f), S === !0 ? e.disconnect().then(() => L(f)).catch(() => L(f)) : L(f)));
|
|
211
|
-
}, Ne = (e) => async () => (c("disconnectFromServer"), e.disconnect().then(() => (c("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (c("disconnectFromServer: catch", t), { isSuccessful: !1 }))), X = (e) => {
|
|
212
|
-
const { url: t, cause: n } = e;
|
|
213
|
-
let r = t;
|
|
214
|
-
return (n === W || n === K) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
|
|
1
|
+
var Z = Object.defineProperty;
|
|
2
|
+
var ee = (n, e, t) => e in n ? Z(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var l = (n, e, t) => ee(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { B as X, N as j, l as i, E as k, s as ne, a as te, P as se, b as re, S as Je } from "./SipConnector-Dq5DrJxd.js";
|
|
5
|
+
import { i as ln, j as dn, k as Sn, c as mn, d as Cn, f as fn, g as hn, e as Rn, h as gn } from "./SipConnector-Dq5DrJxd.js";
|
|
6
|
+
import { sequentPromises as oe } from "sequent-promises";
|
|
7
|
+
import { createStackPromises as ce } from "stack-promises";
|
|
8
|
+
import { isCanceledError as ie } from "@krivega/cancelable-promise";
|
|
9
|
+
import { hasCanceledError as ae } from "repeated-calls";
|
|
10
|
+
import { debounce as ue } from "ts-debounce";
|
|
11
|
+
import { default as yn } from "debug";
|
|
12
|
+
const x = (n) => {
|
|
13
|
+
const { url: e, cause: t } = n;
|
|
14
|
+
let s = e;
|
|
15
|
+
return (t === X || t === j) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
|
|
215
16
|
};
|
|
216
|
-
var
|
|
217
|
-
const
|
|
218
|
-
var
|
|
219
|
-
const { cause:
|
|
220
|
-
let
|
|
221
|
-
switch (
|
|
17
|
+
var W = /* @__PURE__ */ ((n) => (n.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", n.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", n.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", n.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", n.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", n.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", n))(W || {});
|
|
18
|
+
const le = (n = new Error()) => {
|
|
19
|
+
var r;
|
|
20
|
+
const { cause: e, socket: t } = n;
|
|
21
|
+
let s = "CONNECT_SERVER_FAILED";
|
|
22
|
+
switch (e) {
|
|
222
23
|
case "Forbidden": {
|
|
223
|
-
|
|
24
|
+
s = "WRONG_USER_OR_PASSWORD";
|
|
224
25
|
break;
|
|
225
26
|
}
|
|
226
|
-
case
|
|
227
|
-
|
|
27
|
+
case X: {
|
|
28
|
+
s = "BAD_MEDIA_ERROR";
|
|
228
29
|
break;
|
|
229
30
|
}
|
|
230
|
-
case
|
|
231
|
-
|
|
31
|
+
case j: {
|
|
32
|
+
s = "NOT_FOUND_ERROR";
|
|
232
33
|
break;
|
|
233
34
|
}
|
|
234
35
|
default:
|
|
235
|
-
|
|
36
|
+
t && ((r = t == null ? void 0 : t._ws) == null ? void 0 : r.readyState) === 3 ? s = "WS_CONNECTION_FAILED" : x(n) && (s = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
236
37
|
}
|
|
237
|
-
return
|
|
238
|
-
},
|
|
239
|
-
let
|
|
38
|
+
return s;
|
|
39
|
+
}, de = (n) => {
|
|
40
|
+
let e = "";
|
|
240
41
|
try {
|
|
241
|
-
|
|
242
|
-
} catch (
|
|
243
|
-
|
|
42
|
+
e = JSON.stringify(n);
|
|
43
|
+
} catch (t) {
|
|
44
|
+
i("failed to stringify message", t);
|
|
244
45
|
}
|
|
245
|
-
return
|
|
246
|
-
},
|
|
247
|
-
const { code:
|
|
248
|
-
return typeof
|
|
249
|
-
},
|
|
46
|
+
return e;
|
|
47
|
+
}, Se = (n = new Error()) => {
|
|
48
|
+
const { code: e, cause: t, message: s } = n, r = x(n), o = { code: "", cause: "", message: "" };
|
|
49
|
+
return typeof s == "object" && s !== null ? o.message = de(s) : s && (o.message = String(s)), r && (o.link = r), e && (o.code = e), t && (o.cause = t), o;
|
|
50
|
+
}, me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
250
51
|
__proto__: null,
|
|
251
|
-
EErrorTypes:
|
|
252
|
-
getLinkError:
|
|
253
|
-
getTypeFromError:
|
|
254
|
-
getValuesFromError:
|
|
255
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
256
|
-
sessionId:
|
|
257
|
-
remoteAddress:
|
|
258
|
-
isMutedAudio:
|
|
259
|
-
isMutedVideo:
|
|
260
|
-
isRegistered:
|
|
52
|
+
EErrorTypes: W,
|
|
53
|
+
getLinkError: x,
|
|
54
|
+
getTypeFromError: le,
|
|
55
|
+
getValuesFromError: Se
|
|
56
|
+
}, Symbol.toStringTag, { value: "Module" })), Ce = ({
|
|
57
|
+
sessionId: n,
|
|
58
|
+
remoteAddress: e,
|
|
59
|
+
isMutedAudio: t,
|
|
60
|
+
isMutedVideo: s,
|
|
61
|
+
isRegistered: r,
|
|
261
62
|
isPresentationCall: o
|
|
262
63
|
}) => {
|
|
263
|
-
const
|
|
264
|
-
return
|
|
265
|
-
},
|
|
266
|
-
let
|
|
267
|
-
return
|
|
268
|
-
},
|
|
269
|
-
appName:
|
|
270
|
-
appVersion:
|
|
271
|
-
browserName:
|
|
272
|
-
browserVersion:
|
|
273
|
-
}) => {
|
|
274
|
-
const o = `${Le(e)} ${t}`;
|
|
275
|
-
return `ChromeNew - ${n ? `${n} ${r}, ${o}` : o}`;
|
|
276
|
-
}, $e = ({
|
|
277
|
-
isUnifiedSdpSemantic: e,
|
|
278
|
-
appVersion: t,
|
|
279
|
-
browserName: n,
|
|
280
|
-
browserVersion: r,
|
|
281
|
-
appName: s
|
|
282
|
-
}) => e ? xe({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", Ve = (e) => async () => {
|
|
283
|
-
if (e.isCallActive)
|
|
284
|
-
return c("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
285
|
-
}, Xe = (e) => (n) => (c("onMoveToParticipants"), e.onSession(oe, n)), je = (e) => (n) => (c("onMoveToSpectators"), e.onSession(ae, n)), Ge = (e) => (n) => (c("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), He = (e) => (n) => (c("onUseLicense"), e.onSession("useLicense", n)), We = (e) => async (n, {
|
|
286
|
-
deleteExisting: r,
|
|
287
|
-
addMissing: s,
|
|
288
|
-
forceRenegotiation: o,
|
|
289
|
-
contentHint: a,
|
|
290
|
-
simulcastEncodings: i,
|
|
291
|
-
degradationPreference: u,
|
|
292
|
-
sendEncodings: d,
|
|
293
|
-
preferredMimeTypesVideoCodecs: m,
|
|
294
|
-
excludeMimeTypesVideoCodecs: S
|
|
295
|
-
} = {}) => {
|
|
296
|
-
const f = I(
|
|
297
|
-
{
|
|
298
|
-
degradationPreference: u
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
preferredMimeTypesVideoCodecs: m,
|
|
302
|
-
excludeMimeTypesVideoCodecs: S
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
return c("replaceMediaStream"), e.replaceMediaStream(n, {
|
|
306
|
-
deleteExisting: r,
|
|
307
|
-
addMissing: s,
|
|
308
|
-
forceRenegotiation: o,
|
|
309
|
-
contentHint: a,
|
|
310
|
-
sendEncodings: w({
|
|
311
|
-
mediaStream: n,
|
|
312
|
-
simulcastEncodings: i,
|
|
313
|
-
sendEncodings: d
|
|
314
|
-
}),
|
|
315
|
-
onAddedTransceiver: f
|
|
316
|
-
});
|
|
317
|
-
}, Ke = (e) => async ({
|
|
318
|
-
isEnabledCam: n,
|
|
319
|
-
isEnabledMic: r
|
|
320
|
-
}) => {
|
|
321
|
-
if (e.isCallActive)
|
|
322
|
-
return c("sendMediaState"), e.sendMediaState({ cam: n, mic: r });
|
|
323
|
-
}, qe = (e) => async () => {
|
|
324
|
-
if (e.isCallActive)
|
|
325
|
-
return c("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((n) => {
|
|
326
|
-
c("sendRefusalToTurnOnCam: error", n);
|
|
327
|
-
});
|
|
328
|
-
}, Ye = (e) => async () => {
|
|
329
|
-
if (e.isCallActive)
|
|
330
|
-
return c("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((n) => {
|
|
331
|
-
c("sendRefusalToTurnOnMic: error", n);
|
|
332
|
-
});
|
|
333
|
-
}, ze = (e) => async ({
|
|
334
|
-
mediaStream: n,
|
|
335
|
-
isP2P: r,
|
|
336
|
-
maxBitrate: s,
|
|
337
|
-
contentHint: o,
|
|
338
|
-
simulcastEncodings: a,
|
|
339
|
-
degradationPreference: i,
|
|
340
|
-
sendEncodings: u,
|
|
341
|
-
preferredMimeTypesVideoCodecs: d,
|
|
342
|
-
excludeMimeTypesVideoCodecs: m
|
|
343
|
-
}, S) => {
|
|
344
|
-
const f = I(
|
|
345
|
-
{
|
|
346
|
-
degradationPreference: i
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
preferredMimeTypesVideoCodecs: d,
|
|
350
|
-
excludeMimeTypesVideoCodecs: m
|
|
351
|
-
}
|
|
352
|
-
);
|
|
353
|
-
return c("startPresentation"), e.startPresentation(
|
|
354
|
-
n,
|
|
355
|
-
{
|
|
356
|
-
isP2P: r,
|
|
357
|
-
maxBitrate: s,
|
|
358
|
-
contentHint: o,
|
|
359
|
-
sendEncodings: w({
|
|
360
|
-
mediaStream: n,
|
|
361
|
-
simulcastEncodings: a,
|
|
362
|
-
sendEncodings: u
|
|
363
|
-
}),
|
|
364
|
-
onAddedTransceiver: f
|
|
365
|
-
},
|
|
366
|
-
S
|
|
367
|
-
);
|
|
368
|
-
}, Qe = (e) => async ({ isP2P: n = !1 } = {}) => (c("stopShareSipConnector"), e.stopPresentation({
|
|
369
|
-
isP2P: n
|
|
370
|
-
}).catch((r) => {
|
|
371
|
-
c(r);
|
|
372
|
-
})), Je = (e) => async ({
|
|
373
|
-
mediaStream: n,
|
|
374
|
-
isP2P: r,
|
|
375
|
-
maxBitrate: s,
|
|
376
|
-
contentHint: o,
|
|
377
|
-
simulcastEncodings: a,
|
|
378
|
-
degradationPreference: i,
|
|
379
|
-
sendEncodings: u,
|
|
380
|
-
preferredMimeTypesVideoCodecs: d,
|
|
381
|
-
excludeMimeTypesVideoCodecs: m
|
|
64
|
+
const c = [], a = t ? "0" : "1", u = s ? "0" : "1";
|
|
65
|
+
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), r || c.push("X-Vinteo-Purgatory-Call: yes"), n && c.push(`X-Vinteo-Session: ${n}`), o && c.push("X-Vinteo-Presentation-Call: yes"), e && c.push(`X-Vinteo-Remote: ${e}`), c;
|
|
66
|
+
}, fe = "[@*!|]", he = "_", Re = (n) => {
|
|
67
|
+
let e = n;
|
|
68
|
+
return e = e.replaceAll(new RegExp(fe, "g"), he), e;
|
|
69
|
+
}, ge = ({
|
|
70
|
+
appName: n,
|
|
71
|
+
appVersion: e,
|
|
72
|
+
browserName: t,
|
|
73
|
+
browserVersion: s
|
|
382
74
|
}) => {
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
contentHint: o,
|
|
396
|
-
sendEncodings: w({
|
|
397
|
-
mediaStream: n,
|
|
398
|
-
simulcastEncodings: a,
|
|
399
|
-
sendEncodings: u
|
|
400
|
-
}),
|
|
401
|
-
onAddedTransceiver: S
|
|
402
|
-
});
|
|
403
|
-
}, Ze = (e) => (t) => [...t].map((r) => async () => e(r)), en = async ({
|
|
404
|
-
accumulatedKeys: e,
|
|
405
|
-
sendKey: t,
|
|
406
|
-
canRunTask: n
|
|
75
|
+
const o = `${Re(n)} ${e}`;
|
|
76
|
+
return `ChromeNew - ${t ? `${t} ${s}, ${o}` : o}`;
|
|
77
|
+
}, pe = ({
|
|
78
|
+
isUnifiedSdpSemantic: n,
|
|
79
|
+
appVersion: e,
|
|
80
|
+
browserName: t,
|
|
81
|
+
browserVersion: s,
|
|
82
|
+
appName: r
|
|
83
|
+
}) => n ? ge({ appVersion: e, browserName: t, browserVersion: s, appName: r }) : "Chrome", G = "purgatory", P = (n) => n === G, ye = (n) => (e) => [...e].map((s) => async () => n(s)), Ee = async ({
|
|
84
|
+
accumulatedKeys: n,
|
|
85
|
+
sendKey: e,
|
|
86
|
+
canRunTask: t
|
|
407
87
|
}) => {
|
|
408
|
-
const
|
|
409
|
-
return
|
|
410
|
-
},
|
|
411
|
-
const
|
|
412
|
-
if (
|
|
413
|
-
|
|
88
|
+
const r = ye(e)(n);
|
|
89
|
+
return oe(r, t);
|
|
90
|
+
}, Te = (n) => (t) => (i("onStartMainCam"), n.onSession("admin-start-main-cam", t)), be = (n) => (t) => (i("onStartMic"), n.onSession("admin-start-mic", t)), Me = (n) => (t) => (i("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), _e = (n) => (t) => (i("onStopMic"), n.onSession("admin-stop-mic", t)), Ae = ({ sipConnector: n }) => {
|
|
91
|
+
const e = (f, g) => ({ isSyncForced: p = !1 }) => {
|
|
92
|
+
if (p) {
|
|
93
|
+
f();
|
|
414
94
|
return;
|
|
415
95
|
}
|
|
416
|
-
|
|
417
|
-
},
|
|
418
|
-
let
|
|
419
|
-
},
|
|
96
|
+
g();
|
|
97
|
+
}, t = Te(n), s = Me(n), r = be(n), o = _e(n);
|
|
98
|
+
let c = () => {
|
|
99
|
+
}, a = () => {
|
|
420
100
|
}, u = () => {
|
|
421
|
-
},
|
|
101
|
+
}, S = () => {
|
|
422
102
|
};
|
|
423
|
-
const
|
|
424
|
-
onStartMainCamForced:
|
|
425
|
-
onStartMainCamNotForced:
|
|
426
|
-
onStopMainCamForced:
|
|
427
|
-
onStopMainCamNotForced:
|
|
428
|
-
onStartMicForced:
|
|
429
|
-
onStartMicNotForced:
|
|
430
|
-
onStopMicForced:
|
|
431
|
-
onStopMicNotForced:
|
|
103
|
+
const C = ({
|
|
104
|
+
onStartMainCamForced: f,
|
|
105
|
+
onStartMainCamNotForced: g,
|
|
106
|
+
onStopMainCamForced: p,
|
|
107
|
+
onStopMainCamNotForced: b,
|
|
108
|
+
onStartMicForced: _,
|
|
109
|
+
onStartMicNotForced: A,
|
|
110
|
+
onStopMicForced: O,
|
|
111
|
+
onStopMicNotForced: v
|
|
432
112
|
}) => {
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
|
|
113
|
+
const y = e(
|
|
114
|
+
f,
|
|
115
|
+
g
|
|
436
116
|
);
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
|
|
440
|
-
|
|
117
|
+
c = t(y);
|
|
118
|
+
const E = e(
|
|
119
|
+
p,
|
|
120
|
+
b
|
|
441
121
|
);
|
|
442
|
-
|
|
443
|
-
const
|
|
444
|
-
u =
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
},
|
|
448
|
-
|
|
122
|
+
a = s(E);
|
|
123
|
+
const w = e(_, A);
|
|
124
|
+
u = r(w);
|
|
125
|
+
const M = e(O, v);
|
|
126
|
+
S = o(M);
|
|
127
|
+
}, m = () => {
|
|
128
|
+
c(), a(), u(), S();
|
|
449
129
|
};
|
|
450
130
|
return {
|
|
451
|
-
start: (
|
|
452
|
-
|
|
131
|
+
start: (f) => {
|
|
132
|
+
C(f);
|
|
453
133
|
},
|
|
454
134
|
stop: () => {
|
|
455
|
-
|
|
135
|
+
m();
|
|
456
136
|
}
|
|
457
137
|
};
|
|
458
|
-
},
|
|
138
|
+
}, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
459
139
|
__proto__: null,
|
|
460
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
461
|
-
createSyncMediaState:
|
|
462
|
-
error:
|
|
463
|
-
getExtraHeaders:
|
|
464
|
-
getUserAgent:
|
|
465
|
-
hasPurgatory:
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
maxBitrate: n,
|
|
497
|
-
onSetParameters: r
|
|
498
|
-
}) => Sn(async () => ce(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), mn = async ({ sender: e, codec: t }, n) => {
|
|
499
|
-
const s = he(t);
|
|
500
|
-
return j({
|
|
501
|
-
sender: e,
|
|
502
|
-
maxBitrate: s,
|
|
503
|
-
onSetParameters: n,
|
|
140
|
+
PURGATORY_CONFERENCE_NUMBER: G,
|
|
141
|
+
createSyncMediaState: Ae,
|
|
142
|
+
error: me,
|
|
143
|
+
getExtraHeaders: Ce,
|
|
144
|
+
getUserAgent: pe,
|
|
145
|
+
hasPurgatory: P,
|
|
146
|
+
sendDTMFAccumulated: Ee
|
|
147
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = (n) => [...n.keys()].map((e) => n.get(e)), ve = (n, e) => Oe(n).find((t) => t.type === e), Ne = async (n) => n.getStats().then((e) => {
|
|
148
|
+
const t = ve(e, "codec");
|
|
149
|
+
return t == null ? void 0 : t.mimeType;
|
|
150
|
+
}), Be = (n) => n.find((e) => {
|
|
151
|
+
var t;
|
|
152
|
+
return ((t = e == null ? void 0 : e.track) == null ? void 0 : t.kind) === "video";
|
|
153
|
+
}), K = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Pe = 1e6, h = (n) => n * Pe, q = h(0.06), we = h(4), De = (n) => n <= 64 ? q : n <= 128 ? h(0.12) : n <= 256 ? h(0.25) : n <= 384 ? h(0.32) : n <= 426 ? h(0.38) : n <= 640 ? h(0.5) : n <= 848 ? h(0.7) : n <= 1280 ? h(1) : n <= 1920 ? h(2) : we, Ie = "av1", Fe = (n) => K(n, Ie), ke = 0.6, Y = (n, e) => Fe(e) ? n * ke : n, Ue = (n) => Y(q, n), z = (n, e) => {
|
|
154
|
+
const t = De(n);
|
|
155
|
+
return Y(t, e);
|
|
156
|
+
}, Le = 1, Q = ({
|
|
157
|
+
videoTrack: n,
|
|
158
|
+
targetSize: e,
|
|
159
|
+
codec: t
|
|
160
|
+
}) => {
|
|
161
|
+
const s = n.getSettings(), r = s.width, o = s.height, c = r / e.width, a = o / e.height, u = Math.max(c, a, Le), S = z(e.width, t);
|
|
162
|
+
return { scaleResolutionDownBy: u, maxBitrate: S };
|
|
163
|
+
}, J = ce(), xe = async () => J().catch((n) => {
|
|
164
|
+
i("videoSendingBalancer: error", n);
|
|
165
|
+
}), Ve = async (n) => (J.add(n), xe()), V = async ({
|
|
166
|
+
sender: n,
|
|
167
|
+
scaleResolutionDownBy: e,
|
|
168
|
+
maxBitrate: t,
|
|
169
|
+
onSetParameters: s
|
|
170
|
+
}) => Ve(async () => ne(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), $e = async ({ sender: n, codec: e }, t) => {
|
|
171
|
+
const r = Ue(e);
|
|
172
|
+
return V({
|
|
173
|
+
sender: n,
|
|
174
|
+
maxBitrate: r,
|
|
175
|
+
onSetParameters: t,
|
|
504
176
|
scaleResolutionDownBy: 200
|
|
505
177
|
});
|
|
506
|
-
},
|
|
507
|
-
sender:
|
|
508
|
-
videoTrack:
|
|
509
|
-
codec:
|
|
510
|
-
},
|
|
511
|
-
const
|
|
512
|
-
return
|
|
513
|
-
sender:
|
|
514
|
-
maxBitrate:
|
|
515
|
-
onSetParameters:
|
|
178
|
+
}, U = async ({
|
|
179
|
+
sender: n,
|
|
180
|
+
videoTrack: e,
|
|
181
|
+
codec: t
|
|
182
|
+
}, s) => {
|
|
183
|
+
const c = e.getSettings().width, a = z(c, t);
|
|
184
|
+
return V({
|
|
185
|
+
sender: n,
|
|
186
|
+
maxBitrate: a,
|
|
187
|
+
onSetParameters: s,
|
|
516
188
|
scaleResolutionDownBy: 1
|
|
517
189
|
});
|
|
518
|
-
},
|
|
519
|
-
sender:
|
|
520
|
-
videoTrack:
|
|
521
|
-
resolution:
|
|
522
|
-
codec:
|
|
523
|
-
},
|
|
524
|
-
const [o,
|
|
525
|
-
videoTrack:
|
|
526
|
-
codec:
|
|
190
|
+
}, He = async ({
|
|
191
|
+
sender: n,
|
|
192
|
+
videoTrack: e,
|
|
193
|
+
resolution: t,
|
|
194
|
+
codec: s
|
|
195
|
+
}, r) => {
|
|
196
|
+
const [o, c] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = Q({
|
|
197
|
+
videoTrack: e,
|
|
198
|
+
codec: s,
|
|
527
199
|
targetSize: {
|
|
528
200
|
width: Number(o),
|
|
529
|
-
height: Number(
|
|
201
|
+
height: Number(c)
|
|
530
202
|
}
|
|
531
203
|
});
|
|
532
|
-
return
|
|
533
|
-
sender:
|
|
534
|
-
maxBitrate:
|
|
535
|
-
onSetParameters:
|
|
204
|
+
return V({
|
|
205
|
+
sender: n,
|
|
206
|
+
maxBitrate: a,
|
|
207
|
+
onSetParameters: r,
|
|
536
208
|
scaleResolutionDownBy: u
|
|
537
209
|
});
|
|
538
|
-
},
|
|
539
|
-
mainCam:
|
|
540
|
-
resolutionMainCam:
|
|
541
|
-
sender:
|
|
542
|
-
videoTrack:
|
|
543
|
-
codec:
|
|
210
|
+
}, Xe = async ({
|
|
211
|
+
mainCam: n,
|
|
212
|
+
resolutionMainCam: e,
|
|
213
|
+
sender: t,
|
|
214
|
+
videoTrack: s,
|
|
215
|
+
codec: r
|
|
544
216
|
}, o) => {
|
|
545
|
-
switch (
|
|
546
|
-
case
|
|
547
|
-
return
|
|
548
|
-
case
|
|
549
|
-
return
|
|
550
|
-
case
|
|
551
|
-
return
|
|
552
|
-
{ sender:
|
|
217
|
+
switch (n) {
|
|
218
|
+
case k.PAUSE_MAIN_CAM:
|
|
219
|
+
return $e({ sender: t, codec: r }, o);
|
|
220
|
+
case k.RESUME_MAIN_CAM:
|
|
221
|
+
return U({ sender: t, videoTrack: s, codec: r }, o);
|
|
222
|
+
case k.MAX_MAIN_CAM_RESOLUTION:
|
|
223
|
+
return e !== void 0 ? He(
|
|
224
|
+
{ sender: t, videoTrack: s, codec: r, resolution: e },
|
|
553
225
|
o
|
|
554
|
-
) :
|
|
226
|
+
) : U({ sender: t, videoTrack: s, codec: r }, o);
|
|
555
227
|
default:
|
|
556
|
-
return
|
|
228
|
+
return U({ sender: t, videoTrack: s, codec: r }, o);
|
|
557
229
|
}
|
|
558
|
-
},
|
|
230
|
+
}, $ = {
|
|
559
231
|
isChanged: !1,
|
|
560
232
|
parameters: {
|
|
561
233
|
encodings: [{}],
|
|
@@ -565,84 +237,425 @@ const Be = (e = new Error()) => {
|
|
|
565
237
|
rtcp: {}
|
|
566
238
|
}
|
|
567
239
|
}, H = async ({
|
|
568
|
-
mainCam:
|
|
569
|
-
resolutionMainCam:
|
|
570
|
-
connection:
|
|
571
|
-
onSetParameters:
|
|
572
|
-
ignoreForCodec:
|
|
240
|
+
mainCam: n,
|
|
241
|
+
resolutionMainCam: e,
|
|
242
|
+
connection: t,
|
|
243
|
+
onSetParameters: s,
|
|
244
|
+
ignoreForCodec: r
|
|
573
245
|
}) => {
|
|
574
|
-
const o =
|
|
575
|
-
if (!(
|
|
576
|
-
return
|
|
577
|
-
const
|
|
578
|
-
return
|
|
246
|
+
const o = t.getSenders(), c = Be(o);
|
|
247
|
+
if (!(c != null && c.track))
|
|
248
|
+
return $;
|
|
249
|
+
const a = await Ne(c);
|
|
250
|
+
return K(a, r) ? $ : Xe(
|
|
579
251
|
{
|
|
580
|
-
mainCam:
|
|
581
|
-
resolutionMainCam:
|
|
582
|
-
sender:
|
|
583
|
-
codec:
|
|
584
|
-
videoTrack:
|
|
252
|
+
mainCam: n,
|
|
253
|
+
resolutionMainCam: e,
|
|
254
|
+
sender: c,
|
|
255
|
+
codec: a,
|
|
256
|
+
videoTrack: c.track
|
|
585
257
|
},
|
|
586
|
-
|
|
258
|
+
s
|
|
587
259
|
);
|
|
588
|
-
},
|
|
589
|
-
ignoreForCodec:
|
|
590
|
-
onSetParameters:
|
|
260
|
+
}, on = (n, {
|
|
261
|
+
ignoreForCodec: e,
|
|
262
|
+
onSetParameters: t
|
|
591
263
|
} = {}) => {
|
|
592
|
-
const
|
|
593
|
-
const { connection: u } =
|
|
264
|
+
const s = async () => {
|
|
265
|
+
const { connection: u } = n;
|
|
594
266
|
if (!u)
|
|
595
267
|
throw new Error("connection is not exist");
|
|
596
268
|
return H({
|
|
597
269
|
connection: u,
|
|
598
|
-
onSetParameters:
|
|
599
|
-
ignoreForCodec:
|
|
270
|
+
onSetParameters: t,
|
|
271
|
+
ignoreForCodec: e
|
|
600
272
|
});
|
|
601
273
|
};
|
|
602
|
-
let
|
|
603
|
-
const o = async (u) => (
|
|
604
|
-
const { mainCam:
|
|
605
|
-
if (!
|
|
274
|
+
let r = s;
|
|
275
|
+
const o = async (u) => (r = async () => {
|
|
276
|
+
const { mainCam: S, resolutionMainCam: C } = u, { connection: m } = n;
|
|
277
|
+
if (!m)
|
|
606
278
|
throw new Error("connection is not exist");
|
|
607
279
|
return H({
|
|
608
|
-
mainCam:
|
|
609
|
-
resolutionMainCam:
|
|
610
|
-
connection:
|
|
611
|
-
onSetParameters:
|
|
612
|
-
ignoreForCodec:
|
|
280
|
+
mainCam: S,
|
|
281
|
+
resolutionMainCam: C,
|
|
282
|
+
connection: m,
|
|
283
|
+
onSetParameters: t,
|
|
284
|
+
ignoreForCodec: e
|
|
613
285
|
});
|
|
614
|
-
},
|
|
286
|
+
}, r());
|
|
615
287
|
return {
|
|
616
288
|
subscribe: () => {
|
|
617
|
-
|
|
289
|
+
n.onSession("main-cam-control", o);
|
|
618
290
|
},
|
|
619
291
|
unsubscribe: () => {
|
|
620
|
-
|
|
292
|
+
n.offSession("main-cam-control", o);
|
|
621
293
|
},
|
|
622
|
-
balanceByTrack:
|
|
294
|
+
balanceByTrack: s,
|
|
623
295
|
resetMainCamControl() {
|
|
624
|
-
|
|
296
|
+
r = s;
|
|
625
297
|
},
|
|
626
298
|
async reBalance() {
|
|
627
|
-
return
|
|
299
|
+
return r();
|
|
628
300
|
}
|
|
629
301
|
};
|
|
630
|
-
}
|
|
302
|
+
}, je = (n) => n.getVideoTracks()[0], N = ({
|
|
303
|
+
mediaStream: n,
|
|
304
|
+
simulcastEncodings: e,
|
|
305
|
+
sendEncodings: t
|
|
306
|
+
}) => {
|
|
307
|
+
if (e && e.length > 0) {
|
|
308
|
+
const s = t ?? [], r = je(n);
|
|
309
|
+
return e.forEach((o, c) => {
|
|
310
|
+
const a = s[c] ?? {}, { maxBitrate: u, scaleResolutionDownBy: S } = Q({
|
|
311
|
+
videoTrack: r,
|
|
312
|
+
targetSize: {
|
|
313
|
+
width: o.width,
|
|
314
|
+
height: o.height
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
a.maxBitrate = u, a.scaleResolutionDownBy = S, s[c] = a;
|
|
318
|
+
}), s;
|
|
319
|
+
}
|
|
320
|
+
return t;
|
|
321
|
+
}, We = (n, e) => [...n, ...e].filter((r, o, c) => o === c.findIndex((a) => a.clockRate === r.clockRate && a.mimeType === r.mimeType && a.channels === r.channels && a.sdpFmtpLine === r.sdpFmtpLine)), Ge = (n) => {
|
|
322
|
+
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, r = t === null ? [] : t.codecs;
|
|
323
|
+
return We(s, r);
|
|
324
|
+
}, Ke = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
325
|
+
const r = e.indexOf(t.mimeType), o = e.indexOf(s.mimeType), c = r === -1 ? Number.MAX_VALUE : r, a = o === -1 ? Number.MAX_VALUE : o;
|
|
326
|
+
return c - a;
|
|
327
|
+
}), qe = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), B = (n, {
|
|
328
|
+
preferredMimeTypesVideoCodecs: e,
|
|
329
|
+
excludeMimeTypesVideoCodecs: t
|
|
330
|
+
}) => async (s) => {
|
|
331
|
+
var r;
|
|
332
|
+
if (typeof s.setCodecPreferences == "function" && ((r = s.sender.track) == null ? void 0 : r.kind) === "video" && (e !== void 0 && (e == null ? void 0 : e.length) > 0 || t !== void 0 && (t == null ? void 0 : t.length) > 0)) {
|
|
333
|
+
const o = Ge("video"), c = qe(o, t), a = Ke(c, e);
|
|
334
|
+
s.setCodecPreferences(a);
|
|
335
|
+
}
|
|
336
|
+
Object.keys(n).length > 0 && await te(s.sender, n);
|
|
337
|
+
}, L = (n) => {
|
|
338
|
+
if (!ie(n) && !ae(n))
|
|
339
|
+
throw n;
|
|
340
|
+
return { isSuccessful: !1 };
|
|
341
|
+
}, Ye = ({ kind: n, readyState: e }) => n === "video" && e === "live";
|
|
342
|
+
class cn {
|
|
343
|
+
constructor(e, {
|
|
344
|
+
preferredMimeTypesVideoCodecs: t,
|
|
345
|
+
excludeMimeTypesVideoCodecs: s
|
|
346
|
+
} = {}) {
|
|
347
|
+
l(this, "sipConnector");
|
|
348
|
+
l(this, "preferredMimeTypesVideoCodecs");
|
|
349
|
+
l(this, "excludeMimeTypesVideoCodecs");
|
|
350
|
+
l(this, "connectToServer", async (e) => {
|
|
351
|
+
const {
|
|
352
|
+
userAgent: t,
|
|
353
|
+
sipWebSocketServerURL: s,
|
|
354
|
+
sipServerUrl: r,
|
|
355
|
+
remoteAddress: o,
|
|
356
|
+
displayName: c,
|
|
357
|
+
name: a,
|
|
358
|
+
password: u,
|
|
359
|
+
isRegisteredUser: S,
|
|
360
|
+
isDisconnectOnFail: C
|
|
361
|
+
} = e;
|
|
362
|
+
return i("connectToServer", e), this.sipConnector.connect({
|
|
363
|
+
userAgent: t,
|
|
364
|
+
sipWebSocketServerURL: s,
|
|
365
|
+
sipServerUrl: r,
|
|
366
|
+
remoteAddress: o,
|
|
367
|
+
displayName: c,
|
|
368
|
+
password: u,
|
|
369
|
+
user: a,
|
|
370
|
+
register: S
|
|
371
|
+
}).then((m) => (i("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (i("connectToServer catch: error", m), C === !0 ? this.sipConnector.disconnect().then(() => L(m)).catch(() => L(m)) : L(m)));
|
|
372
|
+
});
|
|
373
|
+
l(this, "callToServer", async (e) => {
|
|
374
|
+
const {
|
|
375
|
+
conference: t,
|
|
376
|
+
mediaStream: s,
|
|
377
|
+
extraHeaders: r,
|
|
378
|
+
iceServers: o,
|
|
379
|
+
contentHint: c,
|
|
380
|
+
simulcastEncodings: a,
|
|
381
|
+
degradationPreference: u,
|
|
382
|
+
sendEncodings: S,
|
|
383
|
+
setRemoteStreams: C,
|
|
384
|
+
onBeforeProgressCall: m,
|
|
385
|
+
onSuccessProgressCall: T,
|
|
386
|
+
onEnterPurgatory: R,
|
|
387
|
+
onEnterConference: f,
|
|
388
|
+
onFailProgressCall: g,
|
|
389
|
+
onFinishProgressCall: p,
|
|
390
|
+
onEndedCall: b
|
|
391
|
+
} = e, _ = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
392
|
+
onReadyRemoteStreams: C
|
|
393
|
+
}), A = this.resolveHandleReadyRemoteStreams({
|
|
394
|
+
onReadyRemoteStreams: _
|
|
395
|
+
}), O = B(
|
|
396
|
+
{
|
|
397
|
+
degradationPreference: u
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
401
|
+
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
i("callToServer", e);
|
|
405
|
+
const v = async () => (i("startCall"), this.sipConnector.call({
|
|
406
|
+
mediaStream: s,
|
|
407
|
+
extraHeaders: r,
|
|
408
|
+
iceServers: o,
|
|
409
|
+
contentHint: c,
|
|
410
|
+
sendEncodings: N({
|
|
411
|
+
mediaStream: s,
|
|
412
|
+
simulcastEncodings: a,
|
|
413
|
+
sendEncodings: S
|
|
414
|
+
}),
|
|
415
|
+
number: t,
|
|
416
|
+
onAddedTransceiver: O,
|
|
417
|
+
ontrack: A
|
|
418
|
+
}));
|
|
419
|
+
let y = !1, E;
|
|
420
|
+
const M = (i("subscribeEnterConference: onEnterConference", f), R ?? f ? this.sipConnector.onSession("enterRoom", ({ room: d }) => {
|
|
421
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: y }), E = d, P(E) ? R && R() : f && f({ isSuccessProgressCall: y });
|
|
422
|
+
}) : () => {
|
|
423
|
+
}), D = (d) => (i("onSuccess"), y = !0, _(), T && T({ isPurgatory: P(E) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
424
|
+
M(), b && b();
|
|
425
|
+
}), d), I = (d) => {
|
|
426
|
+
throw i("onFail"), g && g(), M(), d;
|
|
427
|
+
}, F = () => {
|
|
428
|
+
i("onFinish"), p && p();
|
|
429
|
+
};
|
|
430
|
+
return i("onBeforeProgressCall"), m && m(t), v().then(D).catch((d) => I(d)).finally(F);
|
|
431
|
+
});
|
|
432
|
+
l(this, "disconnectFromServer", async () => this.sipConnector.disconnect().then(() => (i("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (i("disconnectFromServer: catch", e), { isSuccessful: !1 })));
|
|
433
|
+
l(this, "answerIncomingCall", async (e) => {
|
|
434
|
+
const {
|
|
435
|
+
mediaStream: t,
|
|
436
|
+
extraHeaders: s,
|
|
437
|
+
iceServers: r,
|
|
438
|
+
contentHint: o,
|
|
439
|
+
simulcastEncodings: c,
|
|
440
|
+
degradationPreference: a,
|
|
441
|
+
sendEncodings: u,
|
|
442
|
+
setRemoteStreams: S,
|
|
443
|
+
onBeforeProgressCall: C,
|
|
444
|
+
onSuccessProgressCall: m,
|
|
445
|
+
onEnterPurgatory: T,
|
|
446
|
+
onEnterConference: R,
|
|
447
|
+
onFailProgressCall: f,
|
|
448
|
+
onFinishProgressCall: g,
|
|
449
|
+
onEndedCall: p
|
|
450
|
+
} = e, b = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
451
|
+
onReadyRemoteStreams: S
|
|
452
|
+
}), _ = this.resolveHandleReadyRemoteStreams({
|
|
453
|
+
onReadyRemoteStreams: b
|
|
454
|
+
}), A = B(
|
|
455
|
+
{
|
|
456
|
+
degradationPreference: a
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
460
|
+
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
461
|
+
}
|
|
462
|
+
);
|
|
463
|
+
i("answerIncomingCall", e);
|
|
464
|
+
const O = async () => this.sipConnector.answerToIncomingCall({
|
|
465
|
+
mediaStream: t,
|
|
466
|
+
extraHeaders: s,
|
|
467
|
+
iceServers: r,
|
|
468
|
+
contentHint: o,
|
|
469
|
+
sendEncodings: N({
|
|
470
|
+
mediaStream: t,
|
|
471
|
+
simulcastEncodings: c,
|
|
472
|
+
sendEncodings: u
|
|
473
|
+
}),
|
|
474
|
+
onAddedTransceiver: A,
|
|
475
|
+
ontrack: _
|
|
476
|
+
}), v = () => {
|
|
477
|
+
const { remoteCallerData: d } = this.sipConnector;
|
|
478
|
+
return d.incomingNumber;
|
|
479
|
+
};
|
|
480
|
+
let y = !1, E;
|
|
481
|
+
const M = (i("subscribeEnterConference: onEnterConference", R), T ?? R ? this.sipConnector.onSession("enterRoom", (d) => {
|
|
482
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: y }), E = d, P(E) ? T && T() : R && R({ isSuccessProgressCall: y });
|
|
483
|
+
}) : () => {
|
|
484
|
+
}), D = (d) => (i("onSuccess"), y = !0, b(), m && m({ isPurgatory: P(E) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
485
|
+
M(), p && p();
|
|
486
|
+
}), d), I = (d) => {
|
|
487
|
+
throw i("onFail"), f && f(), M(), d;
|
|
488
|
+
}, F = () => {
|
|
489
|
+
i("onFinish"), g && g();
|
|
490
|
+
};
|
|
491
|
+
if (i("onBeforeProgressCall"), C) {
|
|
492
|
+
const d = v();
|
|
493
|
+
C(d);
|
|
494
|
+
}
|
|
495
|
+
return O().then(D).catch((d) => I(d)).finally(F);
|
|
496
|
+
});
|
|
497
|
+
l(this, "updatePresentation", async ({
|
|
498
|
+
mediaStream: e,
|
|
499
|
+
isP2P: t,
|
|
500
|
+
maxBitrate: s,
|
|
501
|
+
contentHint: r,
|
|
502
|
+
simulcastEncodings: o,
|
|
503
|
+
degradationPreference: c,
|
|
504
|
+
sendEncodings: a,
|
|
505
|
+
preferredMimeTypesVideoCodecs: u,
|
|
506
|
+
excludeMimeTypesVideoCodecs: S
|
|
507
|
+
}) => {
|
|
508
|
+
const C = B(
|
|
509
|
+
{
|
|
510
|
+
degradationPreference: c
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
preferredMimeTypesVideoCodecs: u,
|
|
514
|
+
excludeMimeTypesVideoCodecs: S
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
return i("updatePresentation"), this.sipConnector.updatePresentation(e, {
|
|
518
|
+
isP2P: t,
|
|
519
|
+
maxBitrate: s,
|
|
520
|
+
contentHint: r,
|
|
521
|
+
sendEncodings: N({
|
|
522
|
+
mediaStream: e,
|
|
523
|
+
simulcastEncodings: o,
|
|
524
|
+
sendEncodings: a
|
|
525
|
+
}),
|
|
526
|
+
onAddedTransceiver: C
|
|
527
|
+
});
|
|
528
|
+
});
|
|
529
|
+
l(this, "startPresentation", async ({
|
|
530
|
+
mediaStream: e,
|
|
531
|
+
isP2P: t,
|
|
532
|
+
maxBitrate: s,
|
|
533
|
+
contentHint: r,
|
|
534
|
+
simulcastEncodings: o,
|
|
535
|
+
degradationPreference: c,
|
|
536
|
+
sendEncodings: a,
|
|
537
|
+
preferredMimeTypesVideoCodecs: u,
|
|
538
|
+
excludeMimeTypesVideoCodecs: S
|
|
539
|
+
}, C) => {
|
|
540
|
+
const m = B(
|
|
541
|
+
{
|
|
542
|
+
degradationPreference: c
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
preferredMimeTypesVideoCodecs: u,
|
|
546
|
+
excludeMimeTypesVideoCodecs: S
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
return i("startPresentation"), this.sipConnector.startPresentation(
|
|
550
|
+
e,
|
|
551
|
+
{
|
|
552
|
+
isP2P: t,
|
|
553
|
+
maxBitrate: s,
|
|
554
|
+
contentHint: r,
|
|
555
|
+
sendEncodings: N({
|
|
556
|
+
mediaStream: e,
|
|
557
|
+
simulcastEncodings: o,
|
|
558
|
+
sendEncodings: a
|
|
559
|
+
}),
|
|
560
|
+
onAddedTransceiver: m
|
|
561
|
+
},
|
|
562
|
+
C
|
|
563
|
+
);
|
|
564
|
+
});
|
|
565
|
+
l(this, "stopShareSipConnector", async ({ isP2P: e = !1 } = {}) => (i("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
566
|
+
isP2P: e
|
|
567
|
+
}).catch((t) => {
|
|
568
|
+
i(t);
|
|
569
|
+
})));
|
|
570
|
+
l(this, "sendRefusalToTurnOnMic", async () => {
|
|
571
|
+
if (this.sipConnector.isCallActive)
|
|
572
|
+
return i("sendRefusalToTurnOnMic"), this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
|
|
573
|
+
i("sendRefusalToTurnOnMic: error", e);
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
l(this, "sendRefusalToTurnOnCam", async () => {
|
|
577
|
+
if (this.sipConnector.isCallActive)
|
|
578
|
+
return i("sendRefusalToTurnOnCam"), this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
|
|
579
|
+
i("sendRefusalToTurnOnCam: error", e);
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
l(this, "sendMediaState", async ({
|
|
583
|
+
isEnabledCam: e,
|
|
584
|
+
isEnabledMic: t
|
|
585
|
+
}) => {
|
|
586
|
+
if (this.sipConnector.isCallActive)
|
|
587
|
+
return i("sendMediaState"), this.sipConnector.sendMediaState({ cam: e, mic: t });
|
|
588
|
+
});
|
|
589
|
+
l(this, "replaceMediaStream", async (e, {
|
|
590
|
+
deleteExisting: t,
|
|
591
|
+
addMissing: s,
|
|
592
|
+
forceRenegotiation: r,
|
|
593
|
+
contentHint: o,
|
|
594
|
+
simulcastEncodings: c,
|
|
595
|
+
degradationPreference: a,
|
|
596
|
+
sendEncodings: u
|
|
597
|
+
} = {}) => {
|
|
598
|
+
const S = B(
|
|
599
|
+
{
|
|
600
|
+
degradationPreference: a
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
604
|
+
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
return i("replaceMediaStream"), this.sipConnector.replaceMediaStream(e, {
|
|
608
|
+
deleteExisting: t,
|
|
609
|
+
addMissing: s,
|
|
610
|
+
forceRenegotiation: r,
|
|
611
|
+
contentHint: o,
|
|
612
|
+
sendEncodings: N({
|
|
613
|
+
mediaStream: e,
|
|
614
|
+
simulcastEncodings: c,
|
|
615
|
+
sendEncodings: u
|
|
616
|
+
}),
|
|
617
|
+
onAddedTransceiver: S
|
|
618
|
+
});
|
|
619
|
+
});
|
|
620
|
+
l(this, "askPermissionToEnableCam", async () => {
|
|
621
|
+
if (this.sipConnector.isCallActive)
|
|
622
|
+
return i("askPermissionToEnableCam"), this.sipConnector.askPermissionToEnableCam();
|
|
623
|
+
});
|
|
624
|
+
l(this, "resolveHandleReadyRemoteStreamsDebounced", ({
|
|
625
|
+
onReadyRemoteStreams: e
|
|
626
|
+
}) => ue(() => {
|
|
627
|
+
const t = this.sipConnector.getRemoteStreams();
|
|
628
|
+
i("remoteStreams", t), t && e(t);
|
|
629
|
+
}, 200));
|
|
630
|
+
l(this, "resolveHandleReadyRemoteStreams", ({
|
|
631
|
+
onReadyRemoteStreams: e
|
|
632
|
+
}) => ({ track: t }) => {
|
|
633
|
+
Ye(t) && e();
|
|
634
|
+
});
|
|
635
|
+
l(this, "getRemoteStreams", () => (i("getRemoteStreams"), this.sipConnector.getRemoteStreams()));
|
|
636
|
+
l(this, "onUseLicense", (e) => (i("onUseLicense"), this.sipConnector.onSession("useLicense", e)));
|
|
637
|
+
l(this, "onMustStopPresentation", (e) => (i("onMustStopPresentation"), this.sipConnector.onSession("mustStopPresentation", e)));
|
|
638
|
+
l(this, "onMoveToSpectators", (e) => (i("onMoveToSpectators"), this.sipConnector.onSession(se, e)));
|
|
639
|
+
l(this, "onMoveToParticipants", (e) => (i("onMoveToParticipants"), this.sipConnector.onSession(re, e)));
|
|
640
|
+
this.sipConnector = e, this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
631
643
|
export {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
644
|
+
k as EEventsMainCAM,
|
|
645
|
+
ln as EEventsMic,
|
|
646
|
+
dn as EEventsSyncMediaState,
|
|
647
|
+
Sn as EUseLicense,
|
|
648
|
+
cn as SipConnectorFacade,
|
|
649
|
+
mn as causes,
|
|
650
|
+
Cn as constants,
|
|
651
|
+
yn as debug,
|
|
652
|
+
Je as default,
|
|
653
|
+
fn as disableDebug,
|
|
654
|
+
hn as enableDebug,
|
|
655
|
+
Rn as eventNames,
|
|
656
|
+
Ne as getCodecFromSender,
|
|
657
|
+
gn as hasCanceledCallError,
|
|
658
|
+
on as resolveVideoSendingBalancer,
|
|
659
|
+
te as setParametersToSender,
|
|
660
|
+
rn as tools
|
|
648
661
|
};
|