sip-connector 14.1.0-alpha.10 → 14.1.0-alpha.12
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-D4tn0Ep5.js → @SipConnector-C-ThpS1P.js} +4 -1
- package/dist/@SipConnector-Xh6_JpUI.cjs +1 -0
- package/dist/ApiManager/eventNames.d.ts +1 -1
- package/dist/CallManager/eventNames.d.ts +1 -1
- package/dist/ConnectionManager/@ConnectionManager.d.ts +1 -1
- package/dist/ConnectionManager/ConnectionFlow.d.ts +1 -1
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +1 -1
- package/dist/ConnectionManager/RegistrationManager.d.ts +1 -1
- package/dist/ConnectionManager/eventNames.d.ts +1 -1
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +1 -1
- package/dist/PresentationManager/eventNames.d.ts +1 -1
- package/dist/SipConnector/@SipConnector.d.ts +1 -1
- package/dist/SipConnector/eventNames.d.ts +1 -1
- package/dist/__fixtures__/BaseSession.mock.d.ts +5 -5
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +6 -0
- package/dist/__fixtures__/RTCSessionMock.d.ts +5 -5
- package/dist/__fixtures__/UA.mock.d.ts +1 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +122 -122
- package/dist/index.cjs +1 -1
- package/dist/index.js +149 -142
- package/dist/setParametersToSender/resolveHasNeedToUpdateItemEncoding.d.ts +1 -1
- package/package.json +4 -4
- package/dist/@SipConnector-Bkm1XX-8.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "events-constructor";
|
|
2
|
-
import { E as y, O as ce, l as
|
|
3
|
-
import { b as
|
|
2
|
+
import { E as y, O as ce, l as i, a as w } from "./@SipConnector-C-ThpS1P.js";
|
|
3
|
+
import { b as Nn, S as Bn, d as wn, e as Dn, h as Pn } from "./@SipConnector-C-ThpS1P.js";
|
|
4
4
|
import { isCanceledError as K } from "@krivega/cancelable-promise";
|
|
5
5
|
import { hasCanceledError as ae } from "repeated-calls";
|
|
6
6
|
import { debounce as ue } from "ts-debounce";
|
|
7
7
|
import I from "debug";
|
|
8
|
-
import { default as
|
|
8
|
+
import { default as xn } from "debug";
|
|
9
9
|
import { sequentPromises as de } from "sequent-promises";
|
|
10
10
|
import { createStackPromises as le } from "stack-promises";
|
|
11
|
-
const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e),
|
|
11
|
+
const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), vn = (e) => {
|
|
12
12
|
if (K(e))
|
|
13
13
|
return !0;
|
|
14
14
|
if (!fe(e))
|
|
@@ -44,8 +44,8 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
44
44
|
}, Ee = (e, n) => {
|
|
45
45
|
const t = n.encodings?.length ?? 0;
|
|
46
46
|
return ge(e, t), e.encodings.forEach((o, s) => {
|
|
47
|
-
const r = (n?.encodings ?? [])[s],
|
|
48
|
-
me(o,
|
|
47
|
+
const r = (n?.encodings ?? [])[s], c = r?.maxBitrate, a = r?.scaleResolutionDownBy;
|
|
48
|
+
me(o, c), ye(o, a);
|
|
49
49
|
}), e;
|
|
50
50
|
}, Te = (e, n) => {
|
|
51
51
|
if (e.codecs?.length !== n.codecs?.length)
|
|
@@ -79,7 +79,7 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
79
79
|
targetSize: n,
|
|
80
80
|
codec: t
|
|
81
81
|
}) => {
|
|
82
|
-
const o = e.getSettings(), s = o.width, r = o.height,
|
|
82
|
+
const o = e.getSettings(), s = o.width, r = o.height, c = s === void 0 ? J : s / n.width, a = r === void 0 ? J : r / n.height, u = Math.max(c, a, J), l = ne(n.width, t);
|
|
83
83
|
return { scaleResolutionDownBy: u, maxBitrate: l };
|
|
84
84
|
}, D = ({
|
|
85
85
|
mediaStream: e,
|
|
@@ -90,8 +90,8 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
90
90
|
const o = t ?? [], s = ve(e);
|
|
91
91
|
if (s === void 0)
|
|
92
92
|
throw new Error("No video track");
|
|
93
|
-
return n.forEach((r,
|
|
94
|
-
const a = o[
|
|
93
|
+
return n.forEach((r, c) => {
|
|
94
|
+
const a = o[c] ?? {};
|
|
95
95
|
a.active = !0, r.rid !== void 0 && (a.rid = r.rid), r.scalabilityMode !== void 0 && (a.scalabilityMode = r.scalabilityMode);
|
|
96
96
|
const { maxBitrate: u, scaleResolutionDownBy: l } = te({
|
|
97
97
|
videoTrack: s,
|
|
@@ -100,7 +100,7 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
100
100
|
height: r.height
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
a.maxBitrate = u, a.scaleResolutionDownBy = l, o[
|
|
103
|
+
a.maxBitrate = u, a.scaleResolutionDownBy = l, o[c] = a;
|
|
104
104
|
}), o;
|
|
105
105
|
}
|
|
106
106
|
return t;
|
|
@@ -108,26 +108,33 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
108
108
|
const n = RTCRtpSender.getCapabilities(e), t = RTCRtpReceiver.getCapabilities(e), o = n === null ? [] : n.codecs, s = t === null ? [] : t.codecs;
|
|
109
109
|
return we(o, s);
|
|
110
110
|
}, Pe = (e, n) => n === void 0 || n.length === 0 ? e : e.sort((t, o) => {
|
|
111
|
-
const s = n.indexOf(t.mimeType), r = n.indexOf(o.mimeType),
|
|
112
|
-
return
|
|
113
|
-
}), Ie = (e, n) => n === void 0 || n.length === 0 ? e : e.filter((t) => !n.includes(t.mimeType)),
|
|
111
|
+
const s = n.indexOf(t.mimeType), r = n.indexOf(o.mimeType), c = s === -1 ? Number.MAX_VALUE : s, a = r === -1 ? Number.MAX_VALUE : r;
|
|
112
|
+
return c - a;
|
|
113
|
+
}), Ie = (e, n) => n === void 0 || n.length === 0 ? e : e.filter((t) => !n.includes(t.mimeType)), xe = (e, {
|
|
114
|
+
preferredMimeTypesVideoCodecs: n,
|
|
115
|
+
excludeMimeTypesVideoCodecs: t
|
|
116
|
+
}) => {
|
|
117
|
+
if (typeof e.setCodecPreferences == "function" && e.sender.track?.kind === "video" && (n !== void 0 && n.length > 0 || t !== void 0 && t.length > 0)) {
|
|
118
|
+
const o = De("video"), s = Ie(o, t), r = Pe(s, n);
|
|
119
|
+
e.setCodecPreferences(r);
|
|
120
|
+
}
|
|
121
|
+
}, P = (e, {
|
|
114
122
|
preferredMimeTypesVideoCodecs: n,
|
|
115
123
|
excludeMimeTypesVideoCodecs: t
|
|
116
124
|
}) => async (o) => {
|
|
117
125
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
Object.keys(e).length > 0 && await z(o.sender, e);
|
|
126
|
+
xe(o, {
|
|
127
|
+
preferredMimeTypesVideoCodecs: n,
|
|
128
|
+
excludeMimeTypesVideoCodecs: t
|
|
129
|
+
}), Object.values(e).filter((r) => r != null).length > 0 && (i("updateTransceiver setParametersToSender", e), await z(o.sender, e));
|
|
123
130
|
} catch (s) {
|
|
124
|
-
|
|
131
|
+
i("updateTransceiver error", s);
|
|
125
132
|
}
|
|
126
133
|
}, X = (e) => {
|
|
127
134
|
if (!K(e) && !ae(e))
|
|
128
135
|
throw e;
|
|
129
136
|
return { isSuccessful: !1 };
|
|
130
|
-
},
|
|
137
|
+
}, Fe = ({ kind: e, readyState: n }) => e === "video" && n === "live", Ue = /* @__PURE__ */ new Set([
|
|
131
138
|
"on",
|
|
132
139
|
"once",
|
|
133
140
|
"onceRace",
|
|
@@ -144,7 +151,7 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
144
151
|
"isConfigured",
|
|
145
152
|
"isRegistered"
|
|
146
153
|
]);
|
|
147
|
-
class
|
|
154
|
+
class Mn {
|
|
148
155
|
// @ts-expect-error: proxy method
|
|
149
156
|
on;
|
|
150
157
|
// @ts-expect-error: proxy method
|
|
@@ -183,12 +190,12 @@ class vn {
|
|
|
183
190
|
excludeMimeTypesVideoCodecs: o
|
|
184
191
|
} = {}) {
|
|
185
192
|
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = o, this.sipConnector = n, new Proxy(this, {
|
|
186
|
-
get: (s, r,
|
|
187
|
-
if (typeof r == "string" &&
|
|
193
|
+
get: (s, r, c) => {
|
|
194
|
+
if (typeof r == "string" && Ue.has(r) && r in this.sipConnector) {
|
|
188
195
|
const u = Reflect.get(this.sipConnector, r, this.sipConnector);
|
|
189
196
|
return typeof u == "function" ? u.bind(this.sipConnector) : u;
|
|
190
197
|
}
|
|
191
|
-
const a = Reflect.get(s, r,
|
|
198
|
+
const a = Reflect.get(s, r, c);
|
|
192
199
|
return typeof a == "function" ? a.bind(s) : a;
|
|
193
200
|
}
|
|
194
201
|
});
|
|
@@ -199,22 +206,22 @@ class vn {
|
|
|
199
206
|
sipWebSocketServerURL: o,
|
|
200
207
|
sipServerUrl: s,
|
|
201
208
|
remoteAddress: r,
|
|
202
|
-
displayName:
|
|
209
|
+
displayName: c,
|
|
203
210
|
name: a,
|
|
204
211
|
password: u,
|
|
205
212
|
isRegisteredUser: l,
|
|
206
213
|
isDisconnectOnFail: h
|
|
207
214
|
} = n;
|
|
208
|
-
return
|
|
215
|
+
return i("connectToServer", n), this.sipConnector.connect({
|
|
209
216
|
userAgent: t,
|
|
210
217
|
sipWebSocketServerURL: o,
|
|
211
218
|
sipServerUrl: s,
|
|
212
219
|
remoteAddress: r,
|
|
213
|
-
displayName:
|
|
220
|
+
displayName: c,
|
|
214
221
|
password: u,
|
|
215
222
|
user: a,
|
|
216
223
|
register: l
|
|
217
|
-
}).then((f) => (
|
|
224
|
+
}).then((f) => (i("connectToServer then"), { ua: f, isSuccessful: !0 })).catch(async (f) => (i("connectToServer catch: error", f), h === !0 ? this.sipConnector.disconnect().then(() => X(f)).catch(() => X(f)) : X(f)));
|
|
218
225
|
};
|
|
219
226
|
callToServer = async (n) => {
|
|
220
227
|
const {
|
|
@@ -222,14 +229,14 @@ class vn {
|
|
|
222
229
|
mediaStream: o,
|
|
223
230
|
extraHeaders: s,
|
|
224
231
|
iceServers: r,
|
|
225
|
-
contentHint:
|
|
232
|
+
contentHint: c,
|
|
226
233
|
simulcastEncodings: a,
|
|
227
234
|
degradationPreference: u,
|
|
228
235
|
sendEncodings: l,
|
|
229
236
|
offerToReceiveAudio: h,
|
|
230
237
|
offerToReceiveVideo: f,
|
|
231
238
|
directionVideo: F,
|
|
232
|
-
directionAudio:
|
|
239
|
+
directionAudio: U,
|
|
233
240
|
setRemoteStreams: g,
|
|
234
241
|
onBeforeProgressCall: R,
|
|
235
242
|
onSuccessProgressCall: C,
|
|
@@ -253,16 +260,16 @@ class vn {
|
|
|
253
260
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
254
261
|
}
|
|
255
262
|
);
|
|
256
|
-
|
|
257
|
-
const N = async () => (
|
|
263
|
+
i("callToServer", n);
|
|
264
|
+
const N = async () => (i("startCall"), this.sipConnector.call({
|
|
258
265
|
mediaStream: o,
|
|
259
266
|
extraHeaders: s,
|
|
260
267
|
iceServers: r,
|
|
261
|
-
contentHint:
|
|
268
|
+
contentHint: c,
|
|
262
269
|
offerToReceiveAudio: h,
|
|
263
270
|
offerToReceiveVideo: f,
|
|
264
271
|
directionVideo: F,
|
|
265
|
-
directionAudio:
|
|
272
|
+
directionAudio: U,
|
|
266
273
|
sendEncodings: D({
|
|
267
274
|
mediaStream: o,
|
|
268
275
|
simulcastEncodings: a,
|
|
@@ -273,33 +280,33 @@ class vn {
|
|
|
273
280
|
ontrack: A
|
|
274
281
|
}));
|
|
275
282
|
let M = !1, b;
|
|
276
|
-
const B = (
|
|
277
|
-
|
|
283
|
+
const B = (i("subscribeEnterConference: onEnterConference", p), S ?? p ? this.sipConnector.on("api:enterRoom", ({ room: d }) => {
|
|
284
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, x(b) ? S && S() : p && p({ isSuccessProgressCall: M });
|
|
278
285
|
}) : () => {
|
|
279
|
-
}), L = (d) => (
|
|
286
|
+
}), L = (d) => (i("onSuccess"), M = !0, _().catch(I), C && C({ isPurgatory: x(b) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
280
287
|
B(), v && v();
|
|
281
288
|
}), d), H = (d) => {
|
|
282
|
-
throw
|
|
289
|
+
throw i("onFail"), E && E(), B(), d;
|
|
283
290
|
}, $ = () => {
|
|
284
|
-
|
|
291
|
+
i("onFinish"), T && T();
|
|
285
292
|
};
|
|
286
|
-
return
|
|
293
|
+
return i("onBeforeProgressCall"), R && R(t), N().then(L).catch((d) => H(d)).finally($);
|
|
287
294
|
};
|
|
288
|
-
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (
|
|
295
|
+
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (i("disconnectFromServer: then"), { isSuccessful: !0 })).catch((n) => (i("disconnectFromServer: catch", n), { isSuccessful: !1 }));
|
|
289
296
|
answerToIncomingCall = async (n) => {
|
|
290
297
|
const {
|
|
291
298
|
mediaStream: t,
|
|
292
299
|
extraHeaders: o,
|
|
293
300
|
iceServers: s,
|
|
294
301
|
contentHint: r,
|
|
295
|
-
simulcastEncodings:
|
|
302
|
+
simulcastEncodings: c,
|
|
296
303
|
degradationPreference: a,
|
|
297
304
|
sendEncodings: u,
|
|
298
305
|
offerToReceiveAudio: l,
|
|
299
306
|
offerToReceiveVideo: h,
|
|
300
307
|
directionVideo: f,
|
|
301
308
|
directionAudio: F,
|
|
302
|
-
setRemoteStreams:
|
|
309
|
+
setRemoteStreams: U,
|
|
303
310
|
onBeforeProgressCall: g,
|
|
304
311
|
onSuccessProgressCall: R,
|
|
305
312
|
onEnterPurgatory: C,
|
|
@@ -308,7 +315,7 @@ class vn {
|
|
|
308
315
|
onFinishProgressCall: E,
|
|
309
316
|
onEndedCall: T
|
|
310
317
|
} = n, v = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
311
|
-
onReadyRemoteStreams:
|
|
318
|
+
onReadyRemoteStreams: U
|
|
312
319
|
}), _ = this.resolveHandleReadyRemoteStreams({
|
|
313
320
|
onReadyRemoteStreams: () => {
|
|
314
321
|
v().catch(I);
|
|
@@ -322,7 +329,7 @@ class vn {
|
|
|
322
329
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
323
330
|
}
|
|
324
331
|
);
|
|
325
|
-
|
|
332
|
+
i("answerToIncomingCall", n);
|
|
326
333
|
const O = async () => this.sipConnector.answerToIncomingCall({
|
|
327
334
|
mediaStream: t,
|
|
328
335
|
extraHeaders: o,
|
|
@@ -334,7 +341,7 @@ class vn {
|
|
|
334
341
|
directionAudio: F,
|
|
335
342
|
sendEncodings: D({
|
|
336
343
|
mediaStream: t,
|
|
337
|
-
simulcastEncodings:
|
|
344
|
+
simulcastEncodings: c,
|
|
338
345
|
sendEncodings: u
|
|
339
346
|
}),
|
|
340
347
|
onAddedTransceiver: A,
|
|
@@ -344,17 +351,17 @@ class vn {
|
|
|
344
351
|
return d.incomingNumber;
|
|
345
352
|
};
|
|
346
353
|
let M = !1, b;
|
|
347
|
-
const B = (
|
|
348
|
-
|
|
354
|
+
const B = (i("subscribeEnterConference: onEnterConference", S), C ?? S ? this.sipConnector.on("api:enterRoom", (d) => {
|
|
355
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, x(b) ? C && C() : S && S({ isSuccessProgressCall: M });
|
|
349
356
|
}) : () => {
|
|
350
|
-
}), L = (d) => (
|
|
357
|
+
}), L = (d) => (i("onSuccess"), M = !0, v().catch(I), R && R({ isPurgatory: x(b) }), this.sipConnector.onceRace(["call:ended", "call:failed"], () => {
|
|
351
358
|
B(), T && T();
|
|
352
359
|
}), d), H = (d) => {
|
|
353
|
-
throw
|
|
360
|
+
throw i("onFail"), p && p(), B(), d;
|
|
354
361
|
}, $ = () => {
|
|
355
|
-
|
|
362
|
+
i("onFinish"), E && E();
|
|
356
363
|
};
|
|
357
|
-
if (
|
|
364
|
+
if (i("onBeforeProgressCall"), g) {
|
|
358
365
|
const d = N();
|
|
359
366
|
g(d);
|
|
360
367
|
}
|
|
@@ -366,21 +373,21 @@ class vn {
|
|
|
366
373
|
maxBitrate: o,
|
|
367
374
|
contentHint: s,
|
|
368
375
|
simulcastEncodings: r,
|
|
369
|
-
degradationPreference:
|
|
376
|
+
degradationPreference: c,
|
|
370
377
|
sendEncodings: a,
|
|
371
378
|
preferredMimeTypesVideoCodecs: u,
|
|
372
379
|
excludeMimeTypesVideoCodecs: l
|
|
373
380
|
}) => {
|
|
374
381
|
const h = P(
|
|
375
382
|
{
|
|
376
|
-
degradationPreference:
|
|
383
|
+
degradationPreference: c
|
|
377
384
|
},
|
|
378
385
|
{
|
|
379
386
|
preferredMimeTypesVideoCodecs: u,
|
|
380
387
|
excludeMimeTypesVideoCodecs: l
|
|
381
388
|
}
|
|
382
389
|
);
|
|
383
|
-
return
|
|
390
|
+
return i("updatePresentation"), this.sipConnector.updatePresentation(n, {
|
|
384
391
|
isP2P: t,
|
|
385
392
|
maxBitrate: o,
|
|
386
393
|
contentHint: s,
|
|
@@ -398,7 +405,7 @@ class vn {
|
|
|
398
405
|
maxBitrate: o,
|
|
399
406
|
contentHint: s,
|
|
400
407
|
simulcastEncodings: r,
|
|
401
|
-
degradationPreference:
|
|
408
|
+
degradationPreference: c,
|
|
402
409
|
sendEncodings: a,
|
|
403
410
|
preferredMimeTypesVideoCodecs: u,
|
|
404
411
|
excludeMimeTypesVideoCodecs: l,
|
|
@@ -406,14 +413,14 @@ class vn {
|
|
|
406
413
|
}) => {
|
|
407
414
|
const f = P(
|
|
408
415
|
{
|
|
409
|
-
degradationPreference:
|
|
416
|
+
degradationPreference: c
|
|
410
417
|
},
|
|
411
418
|
{
|
|
412
419
|
preferredMimeTypesVideoCodecs: u,
|
|
413
420
|
excludeMimeTypesVideoCodecs: l
|
|
414
421
|
}
|
|
415
422
|
);
|
|
416
|
-
return
|
|
423
|
+
return i("startPresentation"), this.sipConnector.startPresentation(n, {
|
|
417
424
|
isP2P: t,
|
|
418
425
|
maxBitrate: o,
|
|
419
426
|
contentHint: s,
|
|
@@ -426,33 +433,33 @@ class vn {
|
|
|
426
433
|
onAddedTransceiver: f
|
|
427
434
|
});
|
|
428
435
|
};
|
|
429
|
-
stopShareSipConnector = async ({ isP2P: n = !1 } = {}) => (
|
|
436
|
+
stopShareSipConnector = async ({ isP2P: n = !1 } = {}) => (i("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
430
437
|
isP2P: n
|
|
431
438
|
}).catch((t) => {
|
|
432
|
-
|
|
439
|
+
i(t);
|
|
433
440
|
}));
|
|
434
441
|
sendRefusalToTurnOnMic = async () => {
|
|
435
|
-
|
|
436
|
-
|
|
442
|
+
i("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((n) => {
|
|
443
|
+
i("sendRefusalToTurnOnMic: error", n);
|
|
437
444
|
});
|
|
438
445
|
};
|
|
439
446
|
sendRefusalToTurnOnCam = async () => {
|
|
440
|
-
|
|
441
|
-
|
|
447
|
+
i("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((n) => {
|
|
448
|
+
i("sendRefusalToTurnOnCam: error", n);
|
|
442
449
|
});
|
|
443
450
|
};
|
|
444
451
|
sendMediaState = async ({
|
|
445
452
|
isEnabledCam: n,
|
|
446
453
|
isEnabledMic: t
|
|
447
454
|
}) => {
|
|
448
|
-
|
|
455
|
+
i("sendMediaState"), await this.sipConnector.sendMediaState({ cam: n, mic: t });
|
|
449
456
|
};
|
|
450
457
|
replaceMediaStream = async (n, {
|
|
451
458
|
deleteExisting: t,
|
|
452
459
|
addMissing: o,
|
|
453
460
|
forceRenegotiation: s,
|
|
454
461
|
contentHint: r,
|
|
455
|
-
simulcastEncodings:
|
|
462
|
+
simulcastEncodings: c,
|
|
456
463
|
degradationPreference: a,
|
|
457
464
|
sendEncodings: u
|
|
458
465
|
} = {}) => {
|
|
@@ -465,39 +472,39 @@ class vn {
|
|
|
465
472
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
466
473
|
}
|
|
467
474
|
);
|
|
468
|
-
return
|
|
475
|
+
return i("replaceMediaStream"), this.sipConnector.replaceMediaStream(n, {
|
|
469
476
|
deleteExisting: t,
|
|
470
477
|
addMissing: o,
|
|
471
478
|
forceRenegotiation: s,
|
|
472
479
|
contentHint: r,
|
|
473
480
|
sendEncodings: D({
|
|
474
481
|
mediaStream: n,
|
|
475
|
-
simulcastEncodings:
|
|
482
|
+
simulcastEncodings: c,
|
|
476
483
|
sendEncodings: u
|
|
477
484
|
}),
|
|
478
485
|
onAddedTransceiver: l
|
|
479
486
|
});
|
|
480
487
|
};
|
|
481
488
|
askPermissionToEnableCam = async () => {
|
|
482
|
-
|
|
489
|
+
i("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam();
|
|
483
490
|
};
|
|
484
491
|
resolveHandleReadyRemoteStreamsDebounced = ({
|
|
485
492
|
onReadyRemoteStreams: n
|
|
486
493
|
}) => ue(() => {
|
|
487
494
|
const t = this.sipConnector.getRemoteStreams();
|
|
488
|
-
|
|
495
|
+
i("remoteStreams", t), t && n(t);
|
|
489
496
|
}, 200);
|
|
490
497
|
// eslint-disable-next-line class-methods-use-this
|
|
491
498
|
resolveHandleReadyRemoteStreams = ({
|
|
492
499
|
onReadyRemoteStreams: n
|
|
493
500
|
}) => ({ track: t }) => {
|
|
494
|
-
|
|
501
|
+
Fe(t) && n();
|
|
495
502
|
};
|
|
496
|
-
getRemoteStreams = () => (
|
|
497
|
-
onUseLicense = (n) => (
|
|
498
|
-
onMustStopPresentation = (n) => (
|
|
499
|
-
onMoveToSpectators = (n) => (
|
|
500
|
-
onMoveToParticipants = (n) => (
|
|
503
|
+
getRemoteStreams = () => (i("getRemoteStreams"), this.sipConnector.getRemoteStreams());
|
|
504
|
+
onUseLicense = (n) => (i("onUseLicense"), this.sipConnector.on("api:useLicense", n));
|
|
505
|
+
onMustStopPresentation = (n) => (i("onMustStopPresentation"), this.sipConnector.on("api:mustStopPresentation", n));
|
|
506
|
+
onMoveToSpectators = (n) => (i("onMoveToSpectators"), this.sipConnector.on("api:participant:move-request-to-spectators", n));
|
|
507
|
+
onMoveToParticipants = (n) => (i("onMoveToParticipants"), this.sipConnector.on("api:participant:move-request-to-participants", n));
|
|
501
508
|
}
|
|
502
509
|
const V = (e) => {
|
|
503
510
|
const { url: n, cause: t } = e;
|
|
@@ -505,7 +512,7 @@ const V = (e) => {
|
|
|
505
512
|
return (t === y.BAD_MEDIA_DESCRIPTION || t === y.NOT_FOUND) && (o = `${e.message.to.uri.user}@${e.message.to.uri.host}`), o;
|
|
506
513
|
};
|
|
507
514
|
var se = /* @__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))(se || {});
|
|
508
|
-
const ke = new Error("Unknown error"),
|
|
515
|
+
const ke = new Error("Unknown error"), Ve = (e = ke) => {
|
|
509
516
|
const { cause: n, socket: t } = e;
|
|
510
517
|
let o = "CONNECT_SERVER_FAILED";
|
|
511
518
|
switch (n) {
|
|
@@ -525,24 +532,24 @@ const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
|
525
532
|
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : V(e) !== void 0 && V(e) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
526
533
|
}
|
|
527
534
|
return o;
|
|
528
|
-
},
|
|
535
|
+
}, Le = (e) => {
|
|
529
536
|
let n = "";
|
|
530
537
|
try {
|
|
531
538
|
n = JSON.stringify(e);
|
|
532
539
|
} catch (t) {
|
|
533
|
-
|
|
540
|
+
i("failed to stringify message", t);
|
|
534
541
|
}
|
|
535
542
|
return n;
|
|
536
|
-
},
|
|
543
|
+
}, He = new Error("Unknown error"), $e = (e = He) => {
|
|
537
544
|
const { code: n, cause: t, message: o } = e, s = V(e), r = { code: "", cause: "", message: "" };
|
|
538
|
-
return typeof o == "object" && o !== null ? r.message =
|
|
539
|
-
},
|
|
545
|
+
return typeof o == "object" && o !== null ? r.message = Le(o) : o && (r.message = String(o)), s !== void 0 && s !== "" && (r.link = s), n !== void 0 && n !== "" && (r.code = n), t !== void 0 && t !== "" && (r.cause = t), r;
|
|
546
|
+
}, Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
540
547
|
__proto__: null,
|
|
541
548
|
EErrorTypes: se,
|
|
542
549
|
getLinkError: V,
|
|
543
|
-
getTypeFromError:
|
|
544
|
-
getValuesFromError:
|
|
545
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
550
|
+
getTypeFromError: Ve,
|
|
551
|
+
getValuesFromError: $e
|
|
552
|
+
}, Symbol.toStringTag, { value: "Module" })), Xe = ({
|
|
546
553
|
sessionId: e,
|
|
547
554
|
remoteAddress: n,
|
|
548
555
|
isMutedAudio: t,
|
|
@@ -550,41 +557,41 @@ const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
|
550
557
|
isRegistered: s,
|
|
551
558
|
isPresentationCall: r
|
|
552
559
|
}) => {
|
|
553
|
-
const
|
|
554
|
-
return
|
|
555
|
-
},
|
|
560
|
+
const c = [], a = t ? "0" : "1", u = o ? "0" : "1";
|
|
561
|
+
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), (s === !1 || s === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Session: ${e}`), r === !0 && c.push("X-Vinteo-Presentation-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Remote: ${n}`), c;
|
|
562
|
+
}, We = "[@*!|]", je = "_", Ge = (e) => {
|
|
556
563
|
let n = e;
|
|
557
|
-
return n = n.replaceAll(new RegExp(
|
|
558
|
-
},
|
|
564
|
+
return n = n.replaceAll(new RegExp(We, "g"), je), n;
|
|
565
|
+
}, Ke = ({
|
|
559
566
|
appName: e,
|
|
560
567
|
appVersion: n,
|
|
561
568
|
browserName: t,
|
|
562
569
|
browserVersion: o
|
|
563
570
|
}) => {
|
|
564
|
-
const r = `${
|
|
571
|
+
const r = `${Ge(e)} ${n}`;
|
|
565
572
|
return `ChromeNew - ${t === void 0 ? r : `${t} ${o}, ${r}`}`;
|
|
566
|
-
},
|
|
573
|
+
}, Ye = ({
|
|
567
574
|
isUnifiedSdpSemantic: e,
|
|
568
575
|
appVersion: n,
|
|
569
576
|
browserName: t,
|
|
570
577
|
browserVersion: o,
|
|
571
578
|
appName: s
|
|
572
|
-
}) => e ?
|
|
579
|
+
}) => e ? Ke({ appVersion: n, browserName: t, browserVersion: o, appName: s }) : "Chrome", qe = (e) => (n) => [...n].map((o) => async () => e(o)), ze = async ({
|
|
573
580
|
accumulatedKeys: e,
|
|
574
581
|
sendKey: n,
|
|
575
582
|
canRunTask: t
|
|
576
583
|
}) => {
|
|
577
|
-
const s =
|
|
584
|
+
const s = qe(n)(e);
|
|
578
585
|
return de(s, t);
|
|
579
|
-
},
|
|
586
|
+
}, Qe = (e) => (t) => (i("onStartMainCam"), e.on("api:admin-start-main-cam", t)), Ze = (e) => (t) => (i("onStartMic"), e.on("api:admin-start-mic", t)), en = (e) => (t) => (i("onStopMainCam"), e.on("api:admin-stop-main-cam", t)), nn = (e) => (t) => (i("onStopMic"), e.on("api:admin-stop-mic", t)), tn = ({ sipConnector: e }) => {
|
|
580
587
|
const n = (g, R) => ({ isSyncForced: C }) => {
|
|
581
588
|
if (C === !0) {
|
|
582
589
|
g();
|
|
583
590
|
return;
|
|
584
591
|
}
|
|
585
592
|
R();
|
|
586
|
-
}, t =
|
|
587
|
-
let
|
|
593
|
+
}, t = Qe(e), o = en(e), s = Ze(e), r = nn(e);
|
|
594
|
+
let c, a, u, l;
|
|
588
595
|
const h = ({
|
|
589
596
|
onStartMainCamForced: g,
|
|
590
597
|
onStartMainCamNotForced: R,
|
|
@@ -599,7 +606,7 @@ const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
|
599
606
|
g,
|
|
600
607
|
R
|
|
601
608
|
);
|
|
602
|
-
|
|
609
|
+
c = t(_);
|
|
603
610
|
const A = n(
|
|
604
611
|
C,
|
|
605
612
|
S
|
|
@@ -610,7 +617,7 @@ const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
|
610
617
|
const N = n(T, v);
|
|
611
618
|
l = r(N);
|
|
612
619
|
}, f = () => {
|
|
613
|
-
|
|
620
|
+
c?.(), a?.(), u?.(), l?.();
|
|
614
621
|
};
|
|
615
622
|
return {
|
|
616
623
|
start: (g) => {
|
|
@@ -620,18 +627,18 @@ const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
|
620
627
|
f();
|
|
621
628
|
}
|
|
622
629
|
};
|
|
623
|
-
},
|
|
630
|
+
}, bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
624
631
|
__proto__: null,
|
|
625
632
|
PURGATORY_CONFERENCE_NUMBER: oe,
|
|
626
|
-
createSyncMediaState:
|
|
627
|
-
error:
|
|
628
|
-
getExtraHeaders:
|
|
629
|
-
getUserAgent:
|
|
633
|
+
createSyncMediaState: tn,
|
|
634
|
+
error: Je,
|
|
635
|
+
getExtraHeaders: Xe,
|
|
636
|
+
getUserAgent: Ye,
|
|
630
637
|
hasPurgatory: x,
|
|
631
|
-
sendDtmfAccumulated:
|
|
638
|
+
sendDtmfAccumulated: ze
|
|
632
639
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
633
|
-
var
|
|
634
|
-
const
|
|
640
|
+
var on = /* @__PURE__ */ ((e) => (e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e))(on || {});
|
|
641
|
+
const sn = (e) => [...e.keys()].map((n) => e.get(n)), rn = (e, n) => sn(e).find((t) => t?.type === n), cn = async (e) => e.getStats().then((n) => rn(n, "codec")?.mimeType), an = (e) => e.find((n) => n.track?.kind === "video"), un = async (e, n, t) => {
|
|
635
642
|
const { isChanged: o, parameters: s } = await z(e, {
|
|
636
643
|
encodings: [
|
|
637
644
|
{
|
|
@@ -641,14 +648,14 @@ const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find(
|
|
|
641
648
|
]
|
|
642
649
|
});
|
|
643
650
|
return o && t && t(s), { isChanged: o, parameters: s };
|
|
644
|
-
}, re = le(),
|
|
645
|
-
|
|
646
|
-
}),
|
|
651
|
+
}, re = le(), dn = async () => re().catch((e) => {
|
|
652
|
+
i("videoSendingBalancer: error", e);
|
|
653
|
+
}), ln = async (e) => (re.add(e), dn()), W = async ({
|
|
647
654
|
sender: e,
|
|
648
655
|
scaleResolutionDownBy: n,
|
|
649
656
|
maxBitrate: t,
|
|
650
657
|
onSetParameters: o
|
|
651
|
-
}) =>
|
|
658
|
+
}) => ln(async () => un(e, { scaleResolutionDownBy: n, maxBitrate: t }, o)), fn = async ({ sender: e, codec: n }, t) => {
|
|
652
659
|
const s = Be(n);
|
|
653
660
|
return W({
|
|
654
661
|
sender: e,
|
|
@@ -656,30 +663,30 @@ const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find(
|
|
|
656
663
|
onSetParameters: t,
|
|
657
664
|
scaleResolutionDownBy: 200
|
|
658
665
|
});
|
|
659
|
-
},
|
|
666
|
+
}, k = async ({
|
|
660
667
|
sender: e,
|
|
661
668
|
videoTrack: n,
|
|
662
669
|
codec: t
|
|
663
670
|
}, o) => {
|
|
664
|
-
const
|
|
671
|
+
const c = n.getSettings().width, a = ne(c ?? 0, t);
|
|
665
672
|
return W({
|
|
666
673
|
sender: e,
|
|
667
674
|
maxBitrate: a,
|
|
668
675
|
onSetParameters: o,
|
|
669
676
|
scaleResolutionDownBy: 1
|
|
670
677
|
});
|
|
671
|
-
},
|
|
678
|
+
}, hn = async ({
|
|
672
679
|
sender: e,
|
|
673
680
|
videoTrack: n,
|
|
674
681
|
resolution: t,
|
|
675
682
|
codec: o
|
|
676
683
|
}, s) => {
|
|
677
|
-
const [r,
|
|
684
|
+
const [r, c] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = te({
|
|
678
685
|
videoTrack: n,
|
|
679
686
|
codec: o,
|
|
680
687
|
targetSize: {
|
|
681
688
|
width: Number(r),
|
|
682
|
-
height: Number(
|
|
689
|
+
height: Number(c)
|
|
683
690
|
}
|
|
684
691
|
});
|
|
685
692
|
return W({
|
|
@@ -688,7 +695,7 @@ const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find(
|
|
|
688
695
|
onSetParameters: s,
|
|
689
696
|
scaleResolutionDownBy: u
|
|
690
697
|
});
|
|
691
|
-
},
|
|
698
|
+
}, gn = async ({
|
|
692
699
|
mainCam: e,
|
|
693
700
|
resolutionMainCam: n,
|
|
694
701
|
sender: t,
|
|
@@ -697,20 +704,20 @@ const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find(
|
|
|
697
704
|
}, r) => {
|
|
698
705
|
switch (e) {
|
|
699
706
|
case w.PAUSE_MAIN_CAM:
|
|
700
|
-
return
|
|
707
|
+
return fn({ sender: t, codec: s }, r);
|
|
701
708
|
case w.RESUME_MAIN_CAM:
|
|
702
|
-
return
|
|
709
|
+
return k({ sender: t, videoTrack: o, codec: s }, r);
|
|
703
710
|
case w.MAX_MAIN_CAM_RESOLUTION:
|
|
704
|
-
return n !== void 0 ?
|
|
711
|
+
return n !== void 0 ? hn(
|
|
705
712
|
{ sender: t, videoTrack: o, codec: s, resolution: n },
|
|
706
713
|
r
|
|
707
|
-
) :
|
|
714
|
+
) : k({ sender: t, videoTrack: o, codec: s }, r);
|
|
708
715
|
case w.ADMIN_STOP_MAIN_CAM:
|
|
709
716
|
case w.ADMIN_START_MAIN_CAM:
|
|
710
717
|
case void 0:
|
|
711
|
-
return
|
|
718
|
+
return k({ sender: t, videoTrack: o, codec: s }, r);
|
|
712
719
|
default:
|
|
713
|
-
return
|
|
720
|
+
return k({ sender: t, videoTrack: o, codec: s }, r);
|
|
714
721
|
}
|
|
715
722
|
}, j = {
|
|
716
723
|
isChanged: !1,
|
|
@@ -728,21 +735,21 @@ const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find(
|
|
|
728
735
|
onSetParameters: o,
|
|
729
736
|
ignoreForCodec: s
|
|
730
737
|
}) => {
|
|
731
|
-
const r = t.getSenders(),
|
|
732
|
-
if (!
|
|
738
|
+
const r = t.getSenders(), c = an(r);
|
|
739
|
+
if (!c?.track)
|
|
733
740
|
return j;
|
|
734
|
-
const a = await
|
|
735
|
-
return Z(a, s) ? j :
|
|
741
|
+
const a = await cn(c);
|
|
742
|
+
return Z(a, s) ? j : gn(
|
|
736
743
|
{
|
|
737
744
|
mainCam: e,
|
|
738
745
|
resolutionMainCam: n,
|
|
739
|
-
sender:
|
|
746
|
+
sender: c,
|
|
740
747
|
codec: a,
|
|
741
|
-
videoTrack:
|
|
748
|
+
videoTrack: c.track
|
|
742
749
|
},
|
|
743
750
|
o
|
|
744
751
|
);
|
|
745
|
-
},
|
|
752
|
+
}, _n = (e, {
|
|
746
753
|
ignoreForCodec: n,
|
|
747
754
|
onSetParameters: t
|
|
748
755
|
} = {}) => {
|
|
@@ -789,17 +796,17 @@ const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find(
|
|
|
789
796
|
};
|
|
790
797
|
export {
|
|
791
798
|
y as ECallCause,
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
799
|
+
on as EMimeTypesVideoCodecs,
|
|
800
|
+
Nn as EUseLicense,
|
|
801
|
+
Bn as SipConnector,
|
|
802
|
+
Mn as SipConnectorFacade,
|
|
803
|
+
xn as debug,
|
|
804
|
+
wn as disableDebug,
|
|
805
|
+
Dn as enableDebug,
|
|
806
|
+
cn as getCodecFromSender,
|
|
807
|
+
vn as hasCanceledCallError,
|
|
808
|
+
Pn as hasCanceledStartPresentationError,
|
|
809
|
+
_n as resolveVideoSendingBalancer,
|
|
803
810
|
z as setParametersToSender,
|
|
804
|
-
|
|
811
|
+
bn as tools
|
|
805
812
|
};
|