@vkontakte/calls-sdk 2.8.13-dev.a071796a.0 → 2.8.13-dev.a0af4e62.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/CallsSDK.d.ts +5 -2
- package/calls-sdk.cjs.js +6 -6
- package/calls-sdk.esm.js +1198 -994
- package/classes/AudioOutput.d.ts +1 -0
- package/classes/CallRegistry.d.ts +17 -4
- package/classes/MediaSource.d.ts +2 -0
- package/classes/conversation/Conversation.d.ts +16 -6
- package/classes/conversation/Conversation.testUtils.d.ts +1 -0
- package/package.json +1 -1
- package/static/External.d.ts +4 -0
- package/static/Params.d.ts +12 -2
- package/types/FastHangup.d.ts +7 -5
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-dev.a0af4e62.0
|
|
3
|
+
* Mon, 16 Nov 2026 09:30:35 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -55,31 +55,31 @@ function h(e, t, n) {
|
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
//#region src/utils/DebugStorage.ts
|
|
58
|
-
var te = 25 * 1024 * 1024, ne = 10, re = "_okcls_logs_session_", ie = 3e4, ae = "ok-calls-sdk-debug-logs", oe = 1, g = "sessions",
|
|
59
|
-
function le() {
|
|
60
|
-
return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
61
|
-
}
|
|
58
|
+
var te = 25 * 1024 * 1024, ne = 10, re = "_okcls_logs_session_", ie = 3e4, ae = "ok-calls-sdk-debug-logs", oe = 1, g = "sessions", se = "chunks", ce = 120 * 1e3, le = new Set(["WARN", "ERROR"]);
|
|
62
59
|
function ue() {
|
|
63
|
-
|
|
64
|
-
return de(e), e;
|
|
60
|
+
return `${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
65
61
|
}
|
|
66
|
-
function de(
|
|
67
|
-
|
|
62
|
+
function de() {
|
|
63
|
+
let e = ue();
|
|
64
|
+
return fe(e), e;
|
|
68
65
|
}
|
|
69
66
|
function fe(e) {
|
|
70
|
-
|
|
67
|
+
Ue.has(e) || Ue.set(e, []), We.has(e) || We.set(e, 0), Ge.has(e) || Ge.set(e, null);
|
|
71
68
|
}
|
|
72
69
|
function pe(e) {
|
|
73
|
-
|
|
74
|
-
return Ue.set(e, t + 1), t;
|
|
70
|
+
return Ge.get(e) ?? null;
|
|
75
71
|
}
|
|
76
|
-
function me(e
|
|
72
|
+
function me(e) {
|
|
73
|
+
let t = We.get(e) ?? 0;
|
|
74
|
+
return We.set(e, t + 1), t;
|
|
75
|
+
}
|
|
76
|
+
function he(e, t) {
|
|
77
77
|
return `${e}:${String(t).padStart(12, "0")}`;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function ge(e) {
|
|
80
80
|
return new Blob([e]).size;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function _e() {
|
|
83
83
|
try {
|
|
84
84
|
let e = window.localStorage;
|
|
85
85
|
for (let t of Object.keys(e)) t.indexOf(re) === 0 && e.removeItem(t);
|
|
@@ -87,7 +87,7 @@ function ge() {
|
|
|
87
87
|
console.error("Storage is blocked", e);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
var
|
|
90
|
+
var _ = new class {
|
|
91
91
|
constructor() {
|
|
92
92
|
h(this, "_db", null), h(this, "_dbPromise", null), h(this, "_dbName", ae), h(this, "_supported", this.isSupported());
|
|
93
93
|
}
|
|
@@ -117,8 +117,8 @@ var v = new class {
|
|
|
117
117
|
if (this._supported = this.isSupported(), this._dbName === ae && (this._dbName = `${ae}-test-${Math.random().toString(36).slice(2)}`, this.close()), this._supported) {
|
|
118
118
|
let e = await this.open();
|
|
119
119
|
if (e) {
|
|
120
|
-
let t = e.transaction([g,
|
|
121
|
-
t.objectStore(g).clear(), t.objectStore(
|
|
120
|
+
let t = e.transaction([g, se], "readwrite");
|
|
121
|
+
t.objectStore(g).clear(), t.objectStore(se).clear(), await this.txDone(t).catch((e) => console.warn("Failed to clear debug log storage", e));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -143,7 +143,7 @@ var v = new class {
|
|
|
143
143
|
async getChunksBySession(e) {
|
|
144
144
|
let t = await this.open();
|
|
145
145
|
if (!t) return [];
|
|
146
|
-
let n = t.transaction(
|
|
146
|
+
let n = t.transaction(se, "readonly"), r = await this.requestToPromise(n.objectStore(se).index("sessionId").getAll(e));
|
|
147
147
|
return await this.txDone(n), r.sort((e, t) => e.sequence - t.sequence);
|
|
148
148
|
}
|
|
149
149
|
async putSession(e) {
|
|
@@ -155,8 +155,8 @@ var v = new class {
|
|
|
155
155
|
async putSessionAndChunk(e, t) {
|
|
156
156
|
let n = await this.open();
|
|
157
157
|
if (!n) return !1;
|
|
158
|
-
let r = n.transaction([g,
|
|
159
|
-
return r.objectStore(g).put(e), r.objectStore(
|
|
158
|
+
let r = n.transaction([g, se], "readwrite");
|
|
159
|
+
return r.objectStore(g).put(e), r.objectStore(se).put(t), await this.txDone(r), !0;
|
|
160
160
|
}
|
|
161
161
|
async updateSessionConversationId(e, t) {
|
|
162
162
|
let [n] = await this.getSessionBySessionId(e);
|
|
@@ -169,14 +169,14 @@ var v = new class {
|
|
|
169
169
|
async deleteSession(e) {
|
|
170
170
|
let t = await this.open();
|
|
171
171
|
if (!t) return 0;
|
|
172
|
-
let n = await this.getChunksBySession(e), r = t.transaction([g,
|
|
172
|
+
let n = await this.getChunksBySession(e), r = t.transaction([g, se], "readwrite"), i = r.objectStore(se), a = 0;
|
|
173
173
|
for (let e of n) a += e.bytes, i.delete(e.id);
|
|
174
174
|
return r.objectStore(g).delete(e), await this.txDone(r), a;
|
|
175
175
|
}
|
|
176
176
|
async deleteChunks(e) {
|
|
177
177
|
let t = await this.open();
|
|
178
178
|
if (!t || !e.length) return;
|
|
179
|
-
let n = t.transaction(
|
|
179
|
+
let n = t.transaction(se, "readwrite"), r = n.objectStore(se);
|
|
180
180
|
for (let t of e) r.delete(t.id);
|
|
181
181
|
await this.txDone(n);
|
|
182
182
|
}
|
|
@@ -210,7 +210,7 @@ var v = new class {
|
|
|
210
210
|
let t = e.createObjectStore(g, { keyPath: "sessionId" });
|
|
211
211
|
t.createIndex("conversationId", "conversationId", { unique: !1 }), t.createIndex("updatedAt", "updatedAt", { unique: !1 });
|
|
212
212
|
}
|
|
213
|
-
e.objectStoreNames.contains(
|
|
213
|
+
e.objectStoreNames.contains(se) || e.createObjectStore(se, { keyPath: "id" }).createIndex("sessionId", "sessionId", { unique: !1 });
|
|
214
214
|
}
|
|
215
215
|
isSupported() {
|
|
216
216
|
return typeof window < "u" && !!window.indexedDB;
|
|
@@ -281,15 +281,15 @@ var v = new class {
|
|
|
281
281
|
return i;
|
|
282
282
|
}
|
|
283
283
|
}();
|
|
284
|
-
async function
|
|
285
|
-
return e.sessionId ?
|
|
284
|
+
async function ve(e) {
|
|
285
|
+
return e.sessionId ? _.getSessionBySessionId(e.sessionId) : e.conversationId ? _.getSessionsByConversationId(e.conversationId) : [];
|
|
286
286
|
}
|
|
287
|
-
async function
|
|
287
|
+
async function ye(e, t, n, r) {
|
|
288
288
|
if (!r.length) return;
|
|
289
|
-
let i =
|
|
290
|
-
for (; s > te && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s =
|
|
289
|
+
let i = pe(e) || t, a = r, o = JSON.stringify(a), s = ge(o);
|
|
290
|
+
for (; s > te && a.length > 1;) a = a.slice(Math.floor(a.length / 2)), o = JSON.stringify(a), s = ge(o);
|
|
291
291
|
if (s > te) return;
|
|
292
|
-
let c = a[0].t, l = a[a.length - 1].t, [u] = await
|
|
292
|
+
let c = a[0].t, l = a[a.length - 1].t, [u] = await _.getSessionBySessionId(e), d = u || {
|
|
293
293
|
sessionId: e,
|
|
294
294
|
conversationId: i,
|
|
295
295
|
startTime: c,
|
|
@@ -306,7 +306,7 @@ async function ve(e, t, n, r) {
|
|
|
306
306
|
bytes: d.bytes + s,
|
|
307
307
|
entriesCount: d.entriesCount + a.length
|
|
308
308
|
}, p = {
|
|
309
|
-
id:
|
|
309
|
+
id: he(e, n),
|
|
310
310
|
sessionId: e,
|
|
311
311
|
sequence: n,
|
|
312
312
|
startTime: c,
|
|
@@ -314,9 +314,9 @@ async function ve(e, t, n, r) {
|
|
|
314
314
|
bytes: s,
|
|
315
315
|
items: a
|
|
316
316
|
};
|
|
317
|
-
await
|
|
317
|
+
await _.putSessionAndChunk(f, p) && await _.enforceRetentionPolicy();
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function be(e) {
|
|
320
320
|
let t = /* @__PURE__ */ new WeakSet();
|
|
321
321
|
try {
|
|
322
322
|
return JSON.parse(JSON.stringify(e, (e, n) => {
|
|
@@ -331,101 +331,101 @@ function ye(e) {
|
|
|
331
331
|
return e.map((e) => String(e));
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
let t =
|
|
336
|
-
if (!t?.length) return
|
|
337
|
-
let n = t.splice(0), r =
|
|
338
|
-
return
|
|
334
|
+
function xe(e) {
|
|
335
|
+
let t = Ue.get(e);
|
|
336
|
+
if (!t?.length) return Je;
|
|
337
|
+
let n = t.splice(0), r = pe(e), i = me(e);
|
|
338
|
+
return Je = Je.then(() => ye(e, r, i, n)).catch((e) => {
|
|
339
339
|
console.warn("Failed to write debug log to storage", e);
|
|
340
|
-
}),
|
|
340
|
+
}), Je;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
if (e) return
|
|
344
|
-
for (let e of
|
|
345
|
-
return
|
|
342
|
+
function Se(e) {
|
|
343
|
+
if (e) return xe(e);
|
|
344
|
+
for (let e of Ue.keys()) xe(e);
|
|
345
|
+
return Je;
|
|
346
346
|
}
|
|
347
|
-
async function
|
|
347
|
+
async function Ce(e) {
|
|
348
348
|
let t = [];
|
|
349
349
|
for (let n of e.sort((e, t) => e.startTime - t.startTime)) {
|
|
350
|
-
let e = await
|
|
350
|
+
let e = await _.getChunksBySession(n.sessionId);
|
|
351
351
|
for (let n of e) t.push(...n.items);
|
|
352
352
|
}
|
|
353
353
|
return t;
|
|
354
354
|
}
|
|
355
|
-
async function
|
|
356
|
-
let t = await
|
|
355
|
+
async function we(e) {
|
|
356
|
+
let t = await Ce(e);
|
|
357
357
|
if (!t.length) return t;
|
|
358
|
-
let n = t.sort(
|
|
359
|
-
return [...await
|
|
358
|
+
let n = t.sort(Ee), r = n[0].t, i = n[n.length - 1].t;
|
|
359
|
+
return [...await Te(r, i, new Set(e.map((e) => e.sessionId))), ...n].sort(Ee);
|
|
360
360
|
}
|
|
361
|
-
async function
|
|
362
|
-
let r = (await
|
|
361
|
+
async function Te(e, t, n) {
|
|
362
|
+
let r = (await _.getAllSessions()).filter((r) => !n.has(r.sessionId) && r.conversationId === null && r.endTime >= e - ce && r.startTime <= t), i = [];
|
|
363
363
|
for (let n of r) {
|
|
364
|
-
let r = await
|
|
365
|
-
for (let n of r) n.endTime < e -
|
|
364
|
+
let r = await _.getChunksBySession(n.sessionId);
|
|
365
|
+
for (let n of r) n.endTime < e - ce || n.startTime > t || i.push(...n.items.filter((n) => n.t >= e - ce && n.t <= e ? !0 : n.t >= e && n.t <= t && le.has(n.l)));
|
|
366
366
|
}
|
|
367
367
|
return i;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Ee(e, t) {
|
|
370
370
|
return e.t - t.t;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function De(e, t) {
|
|
373
373
|
let n = document.createElement("a"), r = new Blob([e], { type: "text/json" }), i = URL.createObjectURL(r);
|
|
374
374
|
n.href = i, n.download = t, n.click(), URL.revokeObjectURL(i);
|
|
375
375
|
}
|
|
376
|
-
function De() {
|
|
377
|
-
xe();
|
|
378
|
-
}
|
|
379
376
|
function Oe() {
|
|
380
|
-
|
|
377
|
+
Se();
|
|
381
378
|
}
|
|
382
|
-
function ke(
|
|
383
|
-
|
|
379
|
+
function ke() {
|
|
380
|
+
document.visibilityState === "hidden" && Se();
|
|
381
|
+
}
|
|
382
|
+
function Ae(e, t, n = Ke) {
|
|
383
|
+
He || je(), fe(n);
|
|
384
384
|
let r = /* @__PURE__ */ new Date(), i = {
|
|
385
385
|
t: r.getTime(),
|
|
386
386
|
l: e,
|
|
387
|
-
d:
|
|
387
|
+
d: be(t),
|
|
388
388
|
h: r.toLocaleString("ru-RU", {
|
|
389
389
|
dateStyle: "short",
|
|
390
390
|
timeStyle: "long"
|
|
391
391
|
})
|
|
392
392
|
};
|
|
393
|
-
return
|
|
394
|
-
|
|
393
|
+
return Ue.get(n)?.push(i), qe || (qe = window.setTimeout(() => {
|
|
394
|
+
qe = null, Se();
|
|
395
395
|
}, ie)), i;
|
|
396
396
|
}
|
|
397
|
-
function Ae() {
|
|
398
|
-
Ve || (Ve = !0, ge(), v.open(), window.addEventListener("pagehide", De), document.addEventListener("visibilitychange", Oe));
|
|
399
|
-
}
|
|
400
397
|
function je() {
|
|
401
|
-
|
|
398
|
+
He || (He = !0, _e(), _.open(), window.addEventListener("pagehide", Oe), document.addEventListener("visibilitychange", ke));
|
|
402
399
|
}
|
|
403
|
-
function Me(
|
|
404
|
-
|
|
400
|
+
function Me() {
|
|
401
|
+
return He || je(), Se(), de();
|
|
405
402
|
}
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
function Ne(e, t = Ke) {
|
|
404
|
+
t && (fe(t), Ge.set(t, e), e && _.updateSessionConversationId(t, e));
|
|
408
405
|
}
|
|
409
|
-
async function Pe(
|
|
410
|
-
return await
|
|
406
|
+
async function Pe() {
|
|
407
|
+
return await Se(), (await _.getAllSessions()).sort((e, t) => t.updatedAt - e.updatedAt);
|
|
411
408
|
}
|
|
412
409
|
async function Fe(e) {
|
|
413
|
-
return
|
|
410
|
+
return await Se(), we(await ve(e));
|
|
414
411
|
}
|
|
415
412
|
async function Ie(e) {
|
|
416
|
-
|
|
417
|
-
return Ee(t, n), n;
|
|
413
|
+
return JSON.stringify(await Fe(e));
|
|
418
414
|
}
|
|
419
415
|
async function Le(e) {
|
|
420
|
-
await
|
|
421
|
-
|
|
422
|
-
for (let e of t) await v.deleteSession(e.sessionId);
|
|
416
|
+
let t = await Ie(e), n = `logs_${e.sessionId || e.conversationId}_${Date.now()}.json`;
|
|
417
|
+
return De(t, n), n;
|
|
423
418
|
}
|
|
424
|
-
async function Re() {
|
|
425
|
-
await
|
|
426
|
-
let
|
|
419
|
+
async function Re(e) {
|
|
420
|
+
await Se();
|
|
421
|
+
let t = e ? await ve(e) : await _.getAllSessions();
|
|
422
|
+
for (let e of t) await _.deleteSession(e.sessionId);
|
|
423
|
+
}
|
|
424
|
+
async function ze() {
|
|
425
|
+
await Se();
|
|
426
|
+
let e = await _.getStorageSummary(), t = await _.estimateStorage();
|
|
427
427
|
return {
|
|
428
|
-
supported:
|
|
428
|
+
supported: _.supported,
|
|
429
429
|
callsCount: e.callsCount,
|
|
430
430
|
sessionsCount: e.sessions.length,
|
|
431
431
|
usedBytes: e.usedBytes,
|
|
@@ -435,20 +435,20 @@ async function Re() {
|
|
|
435
435
|
usageBytes: t?.usage
|
|
436
436
|
};
|
|
437
437
|
}
|
|
438
|
-
async function ze() {
|
|
439
|
-
await xe();
|
|
440
|
-
let e = await Se(await v.getAllSessions());
|
|
441
|
-
return JSON.stringify(e.sort(Te));
|
|
442
|
-
}
|
|
443
438
|
async function Be() {
|
|
444
|
-
|
|
445
|
-
|
|
439
|
+
await Se();
|
|
440
|
+
let e = await Ce(await _.getAllSessions());
|
|
441
|
+
return JSON.stringify(e.sort(Ee));
|
|
446
442
|
}
|
|
447
|
-
|
|
448
|
-
|
|
443
|
+
async function Ve() {
|
|
444
|
+
let e = await Be(), t = `logs_${Date.now()}.json`;
|
|
445
|
+
return De(e, t), t;
|
|
446
|
+
}
|
|
447
|
+
var He = !1, Ue = /* @__PURE__ */ new Map(), We = /* @__PURE__ */ new Map(), Ge = /* @__PURE__ */ new Map(), Ke = de(), qe = null, Je = Promise.resolve();
|
|
448
|
+
window.__VKCallsSDKLogs__ = (e = !1) => (He || je(), e ? Be() : Ve());
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region src/static/AuthData.ts
|
|
451
|
-
var
|
|
451
|
+
var v = class e {
|
|
452
452
|
static get sessionKey() {
|
|
453
453
|
return e._sessionKey;
|
|
454
454
|
}
|
|
@@ -488,10 +488,10 @@ var y = class e {
|
|
|
488
488
|
})), e._reauthorizePromise;
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
|
-
h(
|
|
491
|
+
h(v, "_sessionKey", void 0), h(v, "_sessionSecretKey", void 0), h(v, "_accessToken", void 0), h(v, "_userId", null), h(v, "_selfExternalId", null), h(v, "_reauthorizePromise", null);
|
|
492
492
|
//#endregion
|
|
493
493
|
//#region src/classes/EventEmitter.ts
|
|
494
|
-
var
|
|
494
|
+
var Ye = class {
|
|
495
495
|
constructor() {
|
|
496
496
|
h(this, "_handlers", {}), h(this, "_listeners", []);
|
|
497
497
|
}
|
|
@@ -517,41 +517,41 @@ var Je = class {
|
|
|
517
517
|
e.dispose();
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
|
-
},
|
|
520
|
+
}, Xe = /* @__PURE__ */ function(e) {
|
|
521
521
|
return e.MICROPHONE = "MICROPHONE", e.CAMERA = "CAMERA", e.SCREEN = "SCREEN", e.ANIMOJI = "ANIMOJI", e;
|
|
522
|
-
}(
|
|
522
|
+
}(Xe || {}), y = /* @__PURE__ */ function(e) {
|
|
523
523
|
return e.MIC_CAMERA_PERMISSION = "mic_camera", e.CAMERA_PERMISSION = "camera", e.MIC_PERMISSION = "mic", e.CAMERA_ACCESS = "cameralock", e.MIC_ACCESS = "miclock", e.MIC_NOT_FOUND = "nomic", e.SCREEN_PERMISSION = "screenpermission", e.SCREEN_ACCESS = "screenlock", e.CONNECTION = "connection", e.NETWORK = "network", e.UNKNOWN = "unknown", e.UNSUPPORTED = "unsupported", e.SIGNALING_FAILED = "signalingfailed", e.API = "api", e.AUTH = "auth", e.OVERCONSTRAINED = "overconstrained", e;
|
|
524
|
-
}(
|
|
524
|
+
}(y || {}), b = /* @__PURE__ */ function(e) {
|
|
525
525
|
return e.AUDIO = "AUDIO", e.VIDEO = "VIDEO", e.SCREEN_SHARING = "SCREEN_SHARING", e.MOVIE_SHARING = "MOVIE_SHARING", e.AUDIO_SHARING = "AUDIO_SHARING", e.ANIMOJI = "ANIMOJI", e;
|
|
526
|
-
}(
|
|
526
|
+
}(b || {}), x = /* @__PURE__ */ function(e) {
|
|
527
527
|
return e.ACCEPT_CONCURRENT = "callAcceptConcurrent", e.ACCEPT_INCOMING = "callAcceptIncoming", e.ACCEPTED_OUTGOING = "callAcceptedOutgoing", e.ADD_PARTICIPANT = "callAddParticipant", e.CALL_SPEC_ERROR = "callSpecError", e.DECLINE_INCOMING = "callDeclineIncoming", e.DEVICE_CHANGED = "callDeviceChanged", e.DEVICES = "callDevices", e.ERROR = "callError", e.HANGUP = "callHangup", e.ICE_CONNECTION_STATE = "callIceConnectionState", e.ICE_CONNECTION_TYPE = "callIceConnectionType", e.ICE_RESTART = "callIceRestart", e.JOIN_CONVERSATION = "callJoinConversation", e.MEDIA_STATUS = "callMediaStatus", e.OUTGOING_CALL = "callStart", e.OUTGOING_MULTIPARTY_CALL = "callStartMultiparty", e.PAT_ALLOCATED = "patAllocate", e.PAT_DEALLOCATED = "patDeallocate", e.PAT_ERROR = "patError", e.PAT_OUTDATED_RESPONSE = "patOutdatedResponse", e.PAT_WAITING_TIME_ERROR = "patWaitingTimeError", e.POOR_CONNECTION = "callPoorConnection", e.PUSH = "callPush", e.RECONNECT = "callReconnect", e.RELAY_POLICY = "callForceRelay", e.REMOVE_PARTICIPANT = "callRemoveParticipant", e.SOCKET_ACTION = "callSocketAction", e.TOPOLOGY_CHANGE_REQUESTED = "callTopologyChangeRequested", e;
|
|
528
|
-
}(
|
|
529
|
-
function
|
|
530
|
-
return
|
|
531
|
-
let e, t = !1, n = 0, r = "0", i =
|
|
528
|
+
}(x || {}), Ze = null, Qe = "", $e = null, et = [], tt = navigator.appVersion, nt = navigator.appName, rt = navigator.userAgent;
|
|
529
|
+
function it() {
|
|
530
|
+
return et.length || (et = (() => {
|
|
531
|
+
let e, t = !1, n = 0, r = "0", i = rt.match(/(opera|chrome|safari|firefox)\/?\s*(\d+)/i) || [];
|
|
532
532
|
if (i[1] === "Safari") {
|
|
533
|
-
if (e =
|
|
533
|
+
if (e = rt.match(/\bCriOS\/(\d+)/), e) return [
|
|
534
534
|
"Chrome",
|
|
535
535
|
e[1],
|
|
536
536
|
!0,
|
|
537
537
|
Number(e[1]),
|
|
538
538
|
r
|
|
539
539
|
];
|
|
540
|
-
if (e =
|
|
540
|
+
if (e = rt.match(/\bFxiOS\/(\d+)/), e) return [
|
|
541
541
|
"Firefox",
|
|
542
542
|
e[1],
|
|
543
543
|
!1,
|
|
544
544
|
n,
|
|
545
545
|
r
|
|
546
546
|
];
|
|
547
|
-
if (e =
|
|
547
|
+
if (e = rt.match(/\bYaBrowser\/(\d+)/), e) return [
|
|
548
548
|
"Yandex",
|
|
549
549
|
e[1],
|
|
550
550
|
!1,
|
|
551
551
|
n,
|
|
552
552
|
r
|
|
553
553
|
];
|
|
554
|
-
if (e =
|
|
554
|
+
if (e = rt.match(/\bOPT\/(\d+)/), e) return [
|
|
555
555
|
"Opera",
|
|
556
556
|
e[1],
|
|
557
557
|
!1,
|
|
@@ -560,28 +560,28 @@ function rt() {
|
|
|
560
560
|
];
|
|
561
561
|
}
|
|
562
562
|
if (i[1] === "Chrome") {
|
|
563
|
-
if (t = !0, n = Number(i[2]), e =
|
|
563
|
+
if (t = !0, n = Number(i[2]), e = rt.match(/\bOPR\/(\d+)/), e) return [
|
|
564
564
|
"Opera",
|
|
565
565
|
e[1] || "Unknown",
|
|
566
566
|
t,
|
|
567
567
|
n,
|
|
568
568
|
r
|
|
569
569
|
];
|
|
570
|
-
if (e =
|
|
570
|
+
if (e = rt.match(/\bYaBrowser\/(\d+)/), e) return [
|
|
571
571
|
"Yandex",
|
|
572
572
|
e[1] || "Unknown",
|
|
573
573
|
t,
|
|
574
574
|
n,
|
|
575
575
|
r
|
|
576
576
|
];
|
|
577
|
-
if (e =
|
|
577
|
+
if (e = rt.match(/\bSferum\/((\d+)(?:\.\d+)*)/), e) return [
|
|
578
578
|
"Sferum",
|
|
579
579
|
e[1] || "Unknown",
|
|
580
580
|
t,
|
|
581
581
|
n,
|
|
582
582
|
r
|
|
583
583
|
];
|
|
584
|
-
if (e =
|
|
584
|
+
if (e = rt.match(/\bEdge?\/(\d+)/), e) return [
|
|
585
585
|
"Edge",
|
|
586
586
|
e[1] || "Unknown",
|
|
587
587
|
t,
|
|
@@ -596,16 +596,16 @@ function rt() {
|
|
|
596
596
|
r
|
|
597
597
|
];
|
|
598
598
|
}
|
|
599
|
-
return e =
|
|
600
|
-
i[2] ? i[1] :
|
|
601
|
-
e && e[1] || i[2] ||
|
|
599
|
+
return e = rt.match(/version\/(\d+)(?:(?:\.)(\d+))?/i), e && e[2] !== void 0 && (r = e[2]), [
|
|
600
|
+
i[2] ? i[1] : nt,
|
|
601
|
+
e && e[1] || i[2] || tt,
|
|
602
602
|
t,
|
|
603
603
|
n,
|
|
604
604
|
r
|
|
605
605
|
];
|
|
606
|
-
})()),
|
|
606
|
+
})()), et;
|
|
607
607
|
}
|
|
608
|
-
var
|
|
608
|
+
var S;
|
|
609
609
|
(function(e) {
|
|
610
610
|
async function t(e) {
|
|
611
611
|
if ("userAgentData" in navigator) try {
|
|
@@ -615,7 +615,7 @@ var C;
|
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
617
|
let n = parseInt(t.split(".")[0]);
|
|
618
|
-
|
|
618
|
+
$e = isNaN(n) ? null : n;
|
|
619
619
|
} catch (t) {
|
|
620
620
|
e("Failed to get OS version", t);
|
|
621
621
|
}
|
|
@@ -645,42 +645,42 @@ var C;
|
|
|
645
645
|
e.canSelectAudioInput = a;
|
|
646
646
|
function o() {
|
|
647
647
|
if (typeof HTMLMediaElement > "u" || typeof HTMLMediaElement.prototype.setSinkId != "function") return !1;
|
|
648
|
-
let e =
|
|
648
|
+
let e = S.os();
|
|
649
649
|
if (["iPhone", "iPad"].includes(e) || e === "MacOS" && navigator.maxTouchPoints > 1) return !1;
|
|
650
|
-
if (
|
|
651
|
-
let t = Number(
|
|
650
|
+
if (S.browserName() !== "Safari") return !0;
|
|
651
|
+
let t = Number(S.browserVersion()), n = Number(S.browserSubVersion());
|
|
652
652
|
return e === "MacOS" && (t > 18 || t === 18 && n >= 4);
|
|
653
653
|
}
|
|
654
654
|
e.canSelectAudioOutput = o;
|
|
655
655
|
function s() {
|
|
656
|
-
let e =
|
|
656
|
+
let e = S.browserName() === "Opera", t = S.browserName() === "Yandex";
|
|
657
657
|
return e || t;
|
|
658
658
|
}
|
|
659
659
|
e.isBrokenH264Decoder = s;
|
|
660
660
|
function c() {
|
|
661
|
-
return
|
|
661
|
+
return S.browserName() === "Yandex" && S.os() === "Windows";
|
|
662
662
|
}
|
|
663
663
|
e.isBrokenVP9Encoder = c;
|
|
664
664
|
function l() {
|
|
665
|
-
let e =
|
|
665
|
+
let e = S.browserName() === "Safari" && Number(S.browserVersion()) === 17 && [
|
|
666
666
|
4,
|
|
667
667
|
5,
|
|
668
668
|
6
|
|
669
|
-
].includes(Number(
|
|
669
|
+
].includes(Number(S.browserSubVersion())), t = S.osVersion(), n = S.os() === "Windows" && t != null && t > 0 && t < 13;
|
|
670
670
|
return e || n;
|
|
671
671
|
}
|
|
672
672
|
e.isBrokenVP9Decoder = l;
|
|
673
673
|
function u() {
|
|
674
|
-
return !(
|
|
674
|
+
return !(S.baseChromeVersion() && S.isMobile());
|
|
675
675
|
}
|
|
676
676
|
e.canPreferH264 = u;
|
|
677
677
|
function d() {
|
|
678
|
-
let e =
|
|
678
|
+
let e = S.browserName(), t = Number(S.browserVersion());
|
|
679
679
|
return e === "Safari" ? t >= 18 : e === "Firefox" ? t >= 134 : !0;
|
|
680
680
|
}
|
|
681
681
|
e.isSimulcastSupportedByBrowser = d;
|
|
682
682
|
function f() {
|
|
683
|
-
return
|
|
683
|
+
return Qe || (Qe = (() => {
|
|
684
684
|
let e = {
|
|
685
685
|
Windows: /Win/,
|
|
686
686
|
Android: /Android/,
|
|
@@ -697,41 +697,41 @@ var C;
|
|
|
697
697
|
OS2: /OS\/2/,
|
|
698
698
|
Bot: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/
|
|
699
699
|
};
|
|
700
|
-
for (let t in e) if (Object.hasOwn(e, t) && e[t].test(
|
|
700
|
+
for (let t in e) if (Object.hasOwn(e, t) && e[t].test(rt)) return t;
|
|
701
701
|
return "Unknown";
|
|
702
|
-
})()),
|
|
702
|
+
})()), Qe;
|
|
703
703
|
}
|
|
704
704
|
e.os = f;
|
|
705
705
|
function p() {
|
|
706
|
-
return
|
|
706
|
+
return $e;
|
|
707
707
|
}
|
|
708
708
|
e.osVersion = p;
|
|
709
709
|
function m() {
|
|
710
|
-
return
|
|
710
|
+
return Ze === null && (Ze = /Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(tt)), Ze;
|
|
711
711
|
}
|
|
712
712
|
e.isMobile = m;
|
|
713
713
|
function ee() {
|
|
714
|
-
return
|
|
714
|
+
return it()[0];
|
|
715
715
|
}
|
|
716
716
|
e.browserName = ee;
|
|
717
717
|
function h() {
|
|
718
|
-
return
|
|
718
|
+
return it()[1];
|
|
719
719
|
}
|
|
720
720
|
e.browserVersion = h;
|
|
721
721
|
function te() {
|
|
722
|
-
return
|
|
722
|
+
return it()[3];
|
|
723
723
|
}
|
|
724
724
|
e.baseChromeVersion = te;
|
|
725
725
|
function ne() {
|
|
726
|
-
return
|
|
726
|
+
return it()[4];
|
|
727
727
|
}
|
|
728
728
|
e.browserSubVersion = ne;
|
|
729
729
|
function re() {
|
|
730
|
-
return
|
|
730
|
+
return S.baseChromeVersion() >= 105 && !S.isMobile();
|
|
731
731
|
}
|
|
732
732
|
e.isAudioShareSupported = re;
|
|
733
|
-
})(
|
|
734
|
-
var
|
|
733
|
+
})(S || (S = {}));
|
|
734
|
+
var C = S, at = (e) => e.stop(), w = (e) => e.getTracks().forEach(at), ot = (e) => e.getVideoTracks().forEach(at);
|
|
735
735
|
async function st(e, t) {
|
|
736
736
|
try {
|
|
737
737
|
let n = typeof t.width == "number" ? t.width : void 0, r = typeof t.height == "number" ? t.height : void 0;
|
|
@@ -757,7 +757,7 @@ var ct = class {
|
|
|
757
757
|
h(this, "_cameraPermissionStatus", void 0), h(this, "_microphonePermissionStatus", void 0), h(this, "_listener", void 0);
|
|
758
758
|
}
|
|
759
759
|
static isSupported() {
|
|
760
|
-
return
|
|
760
|
+
return C.browserName() !== "Firefox" && "permissions" in navigator && "PermissionStatus" in window;
|
|
761
761
|
}
|
|
762
762
|
async init(e) {
|
|
763
763
|
try {
|
|
@@ -853,7 +853,7 @@ var Lt = class {
|
|
|
853
853
|
};
|
|
854
854
|
let t = T.getMicrophones(), n, r;
|
|
855
855
|
if (wt && (r = wt.groupId, n = wt.deviceId), typeof e == "string") r = t.find((t) => t.deviceId === e)?.groupId, n = e;
|
|
856
|
-
else if (!wt &&
|
|
856
|
+
else if (!wt && C.os() === "MacOS" && t.find((e) => e.label.includes("iPhone"))) {
|
|
857
857
|
let e = t.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
|
|
858
858
|
e && (r = e.groupId, n = e.deviceId);
|
|
859
859
|
}
|
|
@@ -877,7 +877,7 @@ var Lt = class {
|
|
|
877
877
|
};
|
|
878
878
|
let e = T.getCameras(), a, s;
|
|
879
879
|
if (Ct && (s = Ct.groupId, a = Ct.deviceId), typeof t == "string") s = e.find((e) => e.deviceId === t)?.groupId, a = t;
|
|
880
|
-
else if (!Ct &&
|
|
880
|
+
else if (!Ct && C.os() === "MacOS" && e.find((e) => e.label.includes("iPhone"))) {
|
|
881
881
|
let t = e.find((e) => !e.label.includes("Virtual") && !e.label.includes("iPhone"));
|
|
882
882
|
t && (s = t.groupId, a = t.deviceId);
|
|
883
883
|
}
|
|
@@ -906,8 +906,8 @@ var Lt = class {
|
|
|
906
906
|
}
|
|
907
907
|
}, Rt = class extends Lt {
|
|
908
908
|
constructor(e, t, n, r) {
|
|
909
|
-
if (super(!1, !0), h(this, "captureController", void 0), this.captureController = "CaptureController" in window ? new CaptureController() : null, typeof this.video == "object" ? (delete this.video.deviceId, delete this.video.groupId, delete this.video.aspectRatio, delete this.video.frameRate, delete this.video.facingMode, delete this.video.width, delete this.video.height) : this.video = {}, this.video.cursor = "motion", e && (this.video.width = e), t && (this.video.height = t), this.video.frameRate = n, this.video.displaySurface = N.displaySurface,
|
|
910
|
-
let n = Number(
|
|
909
|
+
if (super(!1, !0), h(this, "captureController", void 0), this.captureController = "CaptureController" in window ? new CaptureController() : null, typeof this.video == "object" ? (delete this.video.deviceId, delete this.video.groupId, delete this.video.aspectRatio, delete this.video.frameRate, delete this.video.facingMode, delete this.video.width, delete this.video.height) : this.video = {}, this.video.cursor = "motion", e && (this.video.width = e), t && (this.video.height = t), this.video.frameRate = n, this.video.displaySurface = N.displaySurface, C.browserName() === "Safari") {
|
|
910
|
+
let n = Number(C.browserVersion());
|
|
911
911
|
n === 16 ? (e && (this.video.width = { max: e }), t && (this.video.height = { max: t })) : n === 17 && (delete this.video.width, delete this.video.height);
|
|
912
912
|
}
|
|
913
913
|
r && (this.audio = {
|
|
@@ -928,7 +928,7 @@ var Lt = class {
|
|
|
928
928
|
h(this, "_lockId", Math.round(Math.random() * 99998) + 1);
|
|
929
929
|
}
|
|
930
930
|
busy(t = null) {
|
|
931
|
-
if (e._lockId) throw t?.log(
|
|
931
|
+
if (e._lockId) throw t?.log(x.ERROR, "change_device"), z.warn("Device change failed: MediaSource is busy"), Error("MediaSource is busy");
|
|
932
932
|
e._lockId = this._lockId;
|
|
933
933
|
}
|
|
934
934
|
free() {
|
|
@@ -989,30 +989,30 @@ async function Wt(e, t, n = z, r = null) {
|
|
|
989
989
|
case "SecurityError":
|
|
990
990
|
case "DOMException":
|
|
991
991
|
case "NotFoundError":
|
|
992
|
-
t = e.isVideoRequested() ?
|
|
992
|
+
t = e.isVideoRequested() ? y.CAMERA_PERMISSION : y.MIC_PERMISSION;
|
|
993
993
|
break;
|
|
994
994
|
case "OverconstrainedError":
|
|
995
|
-
t =
|
|
995
|
+
t = y.OVERCONSTRAINED;
|
|
996
996
|
break;
|
|
997
997
|
case "TypeError":
|
|
998
|
-
t =
|
|
998
|
+
t = y.UNKNOWN;
|
|
999
999
|
break;
|
|
1000
1000
|
case "AbortError":
|
|
1001
1001
|
case "NotReadableError":
|
|
1002
|
-
t = e.isVideoRequested() ?
|
|
1002
|
+
t = e.isVideoRequested() ? y.CAMERA_ACCESS : y.MIC_ACCESS;
|
|
1003
1003
|
break;
|
|
1004
1004
|
case "Error": if (i.message === "MediaSource is busy") {
|
|
1005
|
-
t = e.isVideoRequested() ?
|
|
1005
|
+
t = e.isVideoRequested() ? y.CAMERA_ACCESS : y.MIC_ACCESS;
|
|
1006
1006
|
break;
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
1009
|
if (e.canSimplify()) return Wt(e.simplify(), t, n, r);
|
|
1010
|
-
let o = t ||
|
|
1010
|
+
let o = t || y.UNKNOWN;
|
|
1011
1011
|
throw R.onPermissionsError(o, i), o;
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
1014
|
async function Gt(e = z) {
|
|
1015
|
-
if (!(jt ||
|
|
1015
|
+
if (!(jt || C.browserName() !== "Firefox" || !navigator.mediaDevices?.getUserMedia)) try {
|
|
1016
1016
|
T.hasMicrophonePermission() || R.onPermissionsRequested(), jt = await navigator.mediaDevices.getUserMedia({
|
|
1017
1017
|
audio: !0,
|
|
1018
1018
|
video: !1
|
|
@@ -1040,9 +1040,9 @@ async function Kt(e, t = z, n = null) {
|
|
|
1040
1040
|
switch (e.name) {
|
|
1041
1041
|
case "PermissionDeniedError":
|
|
1042
1042
|
case "NotAllowedError":
|
|
1043
|
-
case "SecurityError": throw
|
|
1043
|
+
case "SecurityError": throw y.SCREEN_PERMISSION;
|
|
1044
1044
|
case "AbortError":
|
|
1045
|
-
case "NotReadableError": throw
|
|
1045
|
+
case "NotReadableError": throw y.SCREEN_ACCESS;
|
|
1046
1046
|
default: throw e;
|
|
1047
1047
|
}
|
|
1048
1048
|
} finally {
|
|
@@ -1052,7 +1052,7 @@ async function Kt(e, t = z, n = null) {
|
|
|
1052
1052
|
var T;
|
|
1053
1053
|
(function(e) {
|
|
1054
1054
|
async function t() {
|
|
1055
|
-
await Ht(), await
|
|
1055
|
+
await Ht(), await C.initOsVersion(z.warn);
|
|
1056
1056
|
}
|
|
1057
1057
|
e.init = t;
|
|
1058
1058
|
function n() {
|
|
@@ -1117,7 +1117,7 @@ var T;
|
|
|
1117
1117
|
}
|
|
1118
1118
|
e.hasPermissions = h;
|
|
1119
1119
|
function te() {
|
|
1120
|
-
jt && (
|
|
1120
|
+
jt && (w(jt), jt = null);
|
|
1121
1121
|
}
|
|
1122
1122
|
e.releaseFirefoxMicrophonePermissionWarmup = te;
|
|
1123
1123
|
async function ne(e = !1, t = !0, n = !0, r = z, i = null) {
|
|
@@ -1155,53 +1155,53 @@ var T;
|
|
|
1155
1155
|
return st(n, t);
|
|
1156
1156
|
}
|
|
1157
1157
|
e.setResolution = g;
|
|
1158
|
-
async function
|
|
1158
|
+
async function se(e, t) {
|
|
1159
1159
|
let n = (await Ht()).find((n) => n.kind === e && n.deviceId === t);
|
|
1160
1160
|
return n ? (e === "videoinput" ? Ct = n : e === "audioinput" ? wt = n : e === "audiooutput" && (Tt = n), ht.set(e, t), n) : null;
|
|
1161
1161
|
}
|
|
1162
|
-
e._saveDeviceId =
|
|
1163
|
-
function
|
|
1162
|
+
e._saveDeviceId = se;
|
|
1163
|
+
function ce() {
|
|
1164
1164
|
if (!At || At.readyState === "ended") {
|
|
1165
1165
|
let e = T.getAudioContext(), t = e.createMediaStreamDestination(), n = e.createGain();
|
|
1166
|
-
n.gain.value = 1e-5, n.connect(t),
|
|
1166
|
+
n.gain.value = 1e-5, n.connect(t), C.browserName() === "Safari" && n.connect(e.destination);
|
|
1167
1167
|
let r = e.createOscillator();
|
|
1168
1168
|
r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), At = t.stream.getAudioTracks()[0];
|
|
1169
1169
|
}
|
|
1170
1170
|
return Object.assign(At.clone(), { enabled: !1 });
|
|
1171
1171
|
}
|
|
1172
|
-
e.getSilentMediaTrack =
|
|
1173
|
-
function
|
|
1172
|
+
e.getSilentMediaTrack = ce;
|
|
1173
|
+
function le(e = N.videoMinWidth, t = N.videoMinHeight) {
|
|
1174
1174
|
kt || (kt = document.createElement("canvas")), kt.width = e, kt.height = t;
|
|
1175
1175
|
let n = kt.getContext("2d");
|
|
1176
1176
|
return n.rect(0, 0, e, t), n.fillStyle = "black", n.fill(), (!Ot || Ot.readyState === "ended") && (Ot = kt.captureStream(N.videoFrameRate).getVideoTracks()[0]), Object.assign(Ot.clone(), { enabled: !1 });
|
|
1177
1177
|
}
|
|
1178
|
-
e.getBlackMediaTrack =
|
|
1179
|
-
function
|
|
1178
|
+
e.getBlackMediaTrack = le;
|
|
1179
|
+
function ue(e) {
|
|
1180
1180
|
Pt.add(e), Mt && T.getAudioContext();
|
|
1181
1181
|
}
|
|
1182
|
-
e.retainAudioContext =
|
|
1183
|
-
function
|
|
1182
|
+
e.retainAudioContext = ue;
|
|
1183
|
+
function de(e) {
|
|
1184
1184
|
Pt.delete(e) && Pt.size === 0 && Mt?.suspend().catch((e) => z.warn("Failed to suspend AudioContext", e));
|
|
1185
1185
|
}
|
|
1186
|
-
e.releaseAudioContext =
|
|
1187
|
-
function
|
|
1186
|
+
e.releaseAudioContext = de;
|
|
1187
|
+
function fe() {
|
|
1188
1188
|
return Mt || (Mt = new (window.AudioContext || window.webkitAudioContext)()), Mt.resume().catch(() => {
|
|
1189
1189
|
z.warn("Failed to resume AudioContext");
|
|
1190
1190
|
}), Mt;
|
|
1191
1191
|
}
|
|
1192
|
-
e.getAudioContext =
|
|
1193
|
-
function
|
|
1192
|
+
e.getAudioContext = fe;
|
|
1193
|
+
function pe(e, t) {
|
|
1194
1194
|
Nt[e] || (Nt[e] = []), Nt[e].push(t);
|
|
1195
1195
|
}
|
|
1196
|
-
e.addEventListener =
|
|
1197
|
-
function
|
|
1196
|
+
e.addEventListener = pe;
|
|
1197
|
+
function me(e, t) {
|
|
1198
1198
|
if (Nt[e]) if (!t) delete Nt[e];
|
|
1199
1199
|
else {
|
|
1200
1200
|
let n = Nt[e].indexOf(t);
|
|
1201
1201
|
n > -1 && Nt[e].splice(n, 1);
|
|
1202
1202
|
}
|
|
1203
1203
|
}
|
|
1204
|
-
e.removeEventListener =
|
|
1204
|
+
e.removeEventListener = me;
|
|
1205
1205
|
})(T || (T = {}));
|
|
1206
1206
|
var E = T;
|
|
1207
1207
|
//#endregion
|
|
@@ -1231,7 +1231,7 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1231
1231
|
}
|
|
1232
1232
|
}, Jt = /* @__PURE__ */ function(e) {
|
|
1233
1233
|
return e.FpsLimit = "fps-limit", e;
|
|
1234
|
-
}({}), Yt = class extends
|
|
1234
|
+
}({}), Yt = class extends Ye {
|
|
1235
1235
|
constructor(e = z) {
|
|
1236
1236
|
super(), h(this, "FPS_LIMITS", [
|
|
1237
1237
|
13,
|
|
@@ -1277,15 +1277,15 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1277
1277
|
return e.audio = "audio", e.video = "video", e.screen = "screen", e.audioshare = "audioshare", e;
|
|
1278
1278
|
}({}), Zt = /* @__PURE__ */ function(e) {
|
|
1279
1279
|
return e[e.CAMERA = 1] = "CAMERA", e[e.SCREEN = 2] = "SCREEN", e;
|
|
1280
|
-
}({}), Qt = class extends
|
|
1280
|
+
}({}), Qt = class extends Ye {
|
|
1281
1281
|
constructor(e = z, t = null) {
|
|
1282
|
-
super(), h(this, "_stream", null), h(this, "_screenTrack", null), h(this, "_audioShareTrack", null), h(this, "_screenShareTrack", null), h(this, "_sendVideoTrack", null), h(this, "_cameraVideoTrack", null), h(this, "_micAudioTrack", null), h(this, "_audioEffectsTrack", null), h(this, "_mediaSettings", D()), h(this, "_lastMediaSettings", null), h(this, "_videoStatusOnScreenCapturingEnabled", !1), h(this, "_effect", null), h(this, "_audioEffectParams", null), h(this, "_onDeviceChange", void 0), h(this, "_animojiEnabled", !1), h(this, "_videoEffectsFpsLimiter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_cameraTrackSetAt", 0), h(this, "_cameraMuteRecoveredAt", 0), h(this, "_micTrackSetAt", 0), h(this, "_micMuteRecoveredAt", 0), h(this, "videoTrackMuteHandler", () => {
|
|
1283
|
-
!this._mediaSettings.isVideoEnabled || this._cameraMuteRecoveredAt >= this._cameraTrackSetAt ||
|
|
1284
|
-
this._logger?.log(
|
|
1282
|
+
super(), h(this, "_stream", null), h(this, "_screenTrack", null), h(this, "_audioShareTrack", null), h(this, "_screenShareTrack", null), h(this, "_screenCaptureRequest", 0), h(this, "_destroyed", !1), h(this, "_sendVideoTrack", null), h(this, "_cameraVideoTrack", null), h(this, "_micAudioTrack", null), h(this, "_audioEffectsTrack", null), h(this, "_mediaSettings", D()), h(this, "_lastMediaSettings", null), h(this, "_videoStatusOnScreenCapturingEnabled", !1), h(this, "_effect", null), h(this, "_audioEffectParams", null), h(this, "_onDeviceChange", void 0), h(this, "_animojiEnabled", !1), h(this, "_videoEffectsFpsLimiter", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_cameraTrackSetAt", 0), h(this, "_cameraMuteRecoveredAt", 0), h(this, "_micTrackSetAt", 0), h(this, "_micMuteRecoveredAt", 0), h(this, "videoTrackMuteHandler", () => {
|
|
1283
|
+
!this._mediaSettings.isVideoEnabled || this._cameraMuteRecoveredAt >= this._cameraTrackSetAt || C.browserName() !== "Safari" || (this._cameraMuteRecoveredAt = Date.now(), this._logger?.log(x.ERROR, "camera_mute_recover"), this._debug.log("[MediaSource] Safari camera mute recovery"), this.toggleVideo(!0).then(() => this._logger?.log(x.ERROR, "camera_mute_recover_success")).catch((e) => {
|
|
1284
|
+
this._logger?.log(x.ERROR, "camera_mute_recover_fail"), this._debug.warn("[MediaSource] Camera mute recovery failed", e);
|
|
1285
1285
|
}));
|
|
1286
1286
|
}), h(this, "micTrackMuteHandler", () => {
|
|
1287
|
-
!this._mediaSettings.isAudioEnabled || this._micMuteRecoveredAt >= this._micTrackSetAt ||
|
|
1288
|
-
this._logger?.log(
|
|
1287
|
+
!this._mediaSettings.isAudioEnabled || this._micMuteRecoveredAt >= this._micTrackSetAt || C.browserName() !== "Safari" || (this._micMuteRecoveredAt = Date.now(), this._logger?.log(x.ERROR, "mic_mute_recover"), this._debug.log("[MediaSource] Safari mic mute recovery"), this.toggleAudio(!0).then(() => this._logger?.log(x.ERROR, "mic_mute_recover_success")).catch((e) => {
|
|
1288
|
+
this._logger?.log(x.ERROR, "mic_mute_recover_fail"), this._debug.warn("[MediaSource] Mic mute recovery failed", e);
|
|
1289
1289
|
}));
|
|
1290
1290
|
}), this._debug = e, this._logger = t, this._initDeviceChangeListener(), N.audioShare && (this._audioShareTrack = this.getSilentAudioShareTrack()), N.enableVideoEffectsFpsDegradation && (this._videoEffectsFpsLimiter = new Yt(this._debug), this._videoEffectsFpsLimiter.addEventListener(Jt.FpsLimit, this.handleVideoEffectsLowFps.bind(this))), E.retainAudioContext(this);
|
|
1291
1291
|
}
|
|
@@ -1293,18 +1293,23 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1293
1293
|
return this._cameraVideoTrack;
|
|
1294
1294
|
}
|
|
1295
1295
|
set cameraVideoTrack(e) {
|
|
1296
|
-
this._cameraVideoTrack && this._cameraVideoTrack.removeEventListener("mute", this.videoTrackMuteHandler), this._cameraVideoTrack = e, this._cameraVideoTrack && (this._cameraTrackSetAt = Date.now(), this._cameraVideoTrack.addEventListener("mute", this.videoTrackMuteHandler)), N.consumerFastScreenShare && (this._screenShareTrack = this.getBlackScreenShareTrack());
|
|
1296
|
+
this._cameraVideoTrack && this._cameraVideoTrack.removeEventListener("mute", this.videoTrackMuteHandler), this._cameraVideoTrack = e, this._cameraVideoTrack && (this._cameraTrackSetAt = Date.now(), this._cameraVideoTrack.addEventListener("mute", this.videoTrackMuteHandler)), N.consumerFastScreenShare && !this._screenShareTrack && (this._screenShareTrack = this.getBlackScreenShareTrack());
|
|
1297
1297
|
}
|
|
1298
|
-
async request(e = [
|
|
1299
|
-
if (this._stream) return;
|
|
1300
|
-
let n = e.includes(
|
|
1301
|
-
if (a) throw new k(
|
|
1298
|
+
async request(e = [b.AUDIO], t = !0) {
|
|
1299
|
+
if (this._stream || this._destroyed) return;
|
|
1300
|
+
let n = e.includes(b.VIDEO), r = e.includes(b.AUDIO), i = e.includes(b.ANIMOJI), a = C.getBrowserSupportFailure();
|
|
1301
|
+
if (a) throw new k(y.UNSUPPORTED, { callError: {
|
|
1302
1302
|
scope: "internal",
|
|
1303
1303
|
code: "environment",
|
|
1304
1304
|
description: a
|
|
1305
1305
|
} });
|
|
1306
1306
|
try {
|
|
1307
|
-
|
|
1307
|
+
let e = await E.getUserMedia(n, r, t, this._debug, this._logger);
|
|
1308
|
+
if (this._destroyed) {
|
|
1309
|
+
w(e);
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
this._stream = e, this.cameraVideoTrack?.stop(), this.cameraVideoTrack = this._stream.getVideoTracks()[0], this._micAudioTrack?.stop(), this._setMicAudioTrack(this._stream.getAudioTracks()[0]), this._audioEffectsTrack?.stop(), this._mediaSettings.isVideoEnabled = n && this._stream.getVideoTracks().filter((e) => e.enabled).length > 0 || !1, this._mediaSettings.isAudioEnabled = r && this._stream.getAudioTracks().filter((e) => e.enabled).length > 0 || !1, this._mediaSettings.isAnimojiEnabled = i && !this._mediaSettings.isVideoEnabled || !1, this._animojiEnabled = i, this._mediaSettings.isAudioSharingEnabled && this._audioShareTrack && this._stream.addTrack(this._audioShareTrack), this._triggerEvent("SOURCE_READY");
|
|
1308
1313
|
} catch (e) {
|
|
1309
1314
|
throw new k(e);
|
|
1310
1315
|
}
|
|
@@ -1338,7 +1343,7 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1338
1343
|
}
|
|
1339
1344
|
get activeFeatures() {
|
|
1340
1345
|
let e = [];
|
|
1341
|
-
return this._mediaSettings.isAudioEnabled && e.push(
|
|
1346
|
+
return this._mediaSettings.isAudioEnabled && e.push(Xe.MICROPHONE), this._mediaSettings.isVideoEnabled && e.push(Xe.CAMERA), (this._mediaSettings.isScreenSharingEnabled || this._mediaSettings.isFastScreenSharingEnabled) && e.push(Xe.SCREEN), this._mediaSettings.isAnimojiEnabled && e.push(Xe.ANIMOJI), e;
|
|
1342
1347
|
}
|
|
1343
1348
|
async changeDevice(e) {
|
|
1344
1349
|
switch (e) {
|
|
@@ -1348,7 +1353,7 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1348
1353
|
case "audioinput":
|
|
1349
1354
|
if (this._mediaSettings.isAudioEnabled) return this._changeAudioInput();
|
|
1350
1355
|
break;
|
|
1351
|
-
default: return Promise.reject(
|
|
1356
|
+
default: return Promise.reject(y.UNKNOWN);
|
|
1352
1357
|
}
|
|
1353
1358
|
}
|
|
1354
1359
|
stopVideoTrack() {
|
|
@@ -1373,61 +1378,106 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1373
1378
|
this._onDeviceChange && E.removeEventListener("devicechange", this._onDeviceChange);
|
|
1374
1379
|
}
|
|
1375
1380
|
async _changeVideoInput(e) {
|
|
1381
|
+
if (this._destroyed) {
|
|
1382
|
+
e && w(e);
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1376
1385
|
try {
|
|
1377
1386
|
let t = e ? "stream" : "video", n = e || await E._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
|
|
1378
|
-
if (this.
|
|
1387
|
+
if (this._destroyed) {
|
|
1388
|
+
w(n);
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
if (this.cameraVideoTrack?.stop(), this.cameraVideoTrack = n.getVideoTracks()[0], !this._stream) w(n);
|
|
1379
1392
|
else {
|
|
1380
1393
|
let e = await this._setEffect(this._effect, this.cameraVideoTrack);
|
|
1381
|
-
|
|
1394
|
+
if (this._destroyed) {
|
|
1395
|
+
e.stop();
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (this._logger?.log(x.DEVICE_CHANGED, t), this._debug.log("Video stream changed"), await this._replaceLocalTrack(e), this._destroyed) return;
|
|
1399
|
+
this._mediaSettings.isVideoEnabled = !0, this._triggerEvent("SOURCE_CHANGED", { kind: "video" });
|
|
1382
1400
|
}
|
|
1383
1401
|
} catch (e) {
|
|
1384
|
-
throw this._logger?.log(
|
|
1402
|
+
throw this._logger?.log(x.ERROR, "change_video"), this._debug.warn("Camera change failed", e), e;
|
|
1385
1403
|
}
|
|
1386
1404
|
}
|
|
1387
1405
|
async setAudioStream(e) {
|
|
1388
1406
|
return this._changeAudioInput(e);
|
|
1389
1407
|
}
|
|
1390
1408
|
async _changeAudioInput(e = null) {
|
|
1409
|
+
if (this._destroyed) {
|
|
1410
|
+
e && w(e);
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1391
1413
|
try {
|
|
1392
1414
|
let t = e || await E.getUserAudio(void 0, this._debug, this._logger);
|
|
1393
|
-
if (this.
|
|
1415
|
+
if (this._destroyed) {
|
|
1416
|
+
w(t);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
if (this._micAudioTrack?.stop(), this._setMicAudioTrack(t.getAudioTracks()[0]), !this._stream) w(t);
|
|
1394
1420
|
else {
|
|
1395
1421
|
let e = await this._applyAudioEffect();
|
|
1396
|
-
|
|
1422
|
+
if (this._destroyed) {
|
|
1423
|
+
e?.stop();
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
if (this._logger?.log(x.DEVICE_CHANGED, "audio"), this._debug.log("Audio stream changed", e), await this._replaceLocalTrack(e), this._destroyed) return;
|
|
1427
|
+
this._mediaSettings.isAudioEnabled = !0, this._triggerEvent("SOURCE_CHANGED", { kind: "audio" });
|
|
1397
1428
|
}
|
|
1398
1429
|
} catch (e) {
|
|
1399
|
-
throw this._logger?.log(
|
|
1430
|
+
throw this._logger?.log(x.ERROR, "change_audio"), this._debug.error("Microphone change failed", e), e;
|
|
1400
1431
|
}
|
|
1401
1432
|
}
|
|
1402
1433
|
async _changeScreen(e, t, n) {
|
|
1434
|
+
let r = ++this._screenCaptureRequest;
|
|
1435
|
+
if (this._destroyed) {
|
|
1436
|
+
n && w(n);
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1403
1439
|
try {
|
|
1404
|
-
if (n = n || await E.getScreenMedia(e, t, this._debug, this._logger),
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1440
|
+
if (n = n || await E.getScreenMedia(e, t, this._debug, this._logger), r !== this._screenCaptureRequest || this._destroyed) {
|
|
1441
|
+
w(n);
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
let i = n.getVideoTracks()[0];
|
|
1445
|
+
if (!i) throw Error("Screen video track not found");
|
|
1446
|
+
if (this._screenTrack && (await this._disableScreenCapture(), r !== this._screenCaptureRequest || this._destroyed)) {
|
|
1447
|
+
w(n);
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
if (i.addEventListener("ended", () => {
|
|
1451
|
+
this._screenTrack === i && this.disableScreenCapturing();
|
|
1452
|
+
}, !1), this._screenTrack = i, n.getAudioTracks().length > 0) {
|
|
1453
|
+
let e = n.getAudioTracks()[0];
|
|
1454
|
+
e.contentHint = "music";
|
|
1455
|
+
let t = this._audioShareTrack;
|
|
1456
|
+
if (t?.stop(), this._audioShareTrack = e, this._mediaSettings.isAudioSharingEnabled = !0, t ? await this._replaceTrack(t, e) : await this._addLocalTrack(e), r !== this._screenCaptureRequest || this._destroyed) {
|
|
1457
|
+
w(n), this._screenTrack === i && await this._disableScreenCapture();
|
|
1458
|
+
return;
|
|
1412
1459
|
}
|
|
1413
|
-
t && !this._mediaSettings.isAudioSharingEnabled && this._debug.debug("Audio share requested but not captured"), this._triggerEvent("SCREEN_STATUS", { track: r }), this._triggerEvent("SOURCE_CHANGED", { kind: "screen" });
|
|
1414
1460
|
}
|
|
1461
|
+
this._mediaSettings.isScreenSharingEnabled = !0, this._mediaSettings.isFastScreenSharingEnabled = e, N.consumerFastScreenShare && e && (this._screenShareTrack?.stop(), i.contentHint = "motion", this._screenShareTrack = i), t && !this._mediaSettings.isAudioSharingEnabled && this._debug.debug("Audio share requested but not captured"), this._logger?.log(x.DEVICE_CHANGED, "screen"), this._debug.log("Screen capturing started"), this._triggerEvent("SCREEN_STATUS", { track: i }), this._triggerEvent("SOURCE_CHANGED", { kind: "screen" });
|
|
1415
1462
|
} catch (e) {
|
|
1416
|
-
throw this._logger?.log(
|
|
1463
|
+
throw n && (w(n), this._screenTrack && n.getVideoTracks().includes(this._screenTrack) && await this._disableScreenCapture().catch((e) => this._debug.warn("Screen capture cleanup failed", e))), this._logger?.log(x.ERROR, "screen"), this._debug.warn("Screen capturing failed", e), e;
|
|
1417
1464
|
}
|
|
1418
1465
|
}
|
|
1419
1466
|
async _disableScreenCapture() {
|
|
1420
|
-
this._sendVideoTrack && (this._sendVideoTrack.stop(), this._sendVideoTrack = null), this._screenTrack && (this._screenTrack.stop(), this._screenTrack = null), this._screenShareTrack && (this._screenShareTrack.stop(), this._screenShareTrack = this.getBlackScreenShareTrack())
|
|
1467
|
+
this._sendVideoTrack && (this._sendVideoTrack.stop(), this._sendVideoTrack = null), this._screenTrack && (this._screenTrack.stop(), this._screenTrack = null), this._screenShareTrack && (this._screenShareTrack.stop(), this._screenShareTrack = this.getBlackScreenShareTrack());
|
|
1468
|
+
let e = this.stopAudioShareTrack();
|
|
1469
|
+
this._mediaSettings.isScreenSharingEnabled && (this._mediaSettings.isScreenSharingEnabled = !1, this._mediaSettings.isFastScreenSharingEnabled = !1, this._triggerEvent("SCREEN_STATUS", { track: null }), this._triggerEvent("SOURCE_CHANGED", { kind: "screen" })), await e;
|
|
1421
1470
|
}
|
|
1422
1471
|
async stopAudioShareTrack() {
|
|
1423
1472
|
if (this._audioShareTrack) {
|
|
1424
|
-
let e = this.getSilentAudioShareTrack();
|
|
1425
|
-
|
|
1473
|
+
let e = this._audioShareTrack, t = this.getSilentAudioShareTrack();
|
|
1474
|
+
e.stop(), this._audioShareTrack = t, this._mediaSettings.isAudioSharingEnabled = !1, await this._replaceTrack(e, t);
|
|
1426
1475
|
}
|
|
1427
1476
|
}
|
|
1428
1477
|
async _applyAudioEffect() {
|
|
1429
1478
|
if (!N.audioEffects || !this._audioEffectParams) return N.audioEffects?.pause(), this._micAudioTrack;
|
|
1430
|
-
N.audioEffects.isInitialized || await N.audioEffects.init(),
|
|
1479
|
+
if (N.audioEffects.isInitialized || await N.audioEffects.init(), this._destroyed) return this._micAudioTrack;
|
|
1480
|
+
N.audioEffects.resume(), N.audioEffects.setEffects(this._audioEffectParams.effects, this._audioEffectParams.isPreset), N.audioEffects.setSource(this._micAudioTrack);
|
|
1431
1481
|
let e = N.audioEffects.outputStream.getAudioTracks()[0];
|
|
1432
1482
|
return (!this._audioEffectsTrack || this._audioEffectsTrack.id !== e.id) && (this._audioEffectsTrack = e), this._audioEffectsTrack;
|
|
1433
1483
|
}
|
|
@@ -1440,14 +1490,26 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1440
1490
|
return e.contentHint = "motion", e.stop(), e;
|
|
1441
1491
|
}
|
|
1442
1492
|
async _replaceLocalTrack(e, t) {
|
|
1493
|
+
if (this._destroyed) {
|
|
1494
|
+
e.stop(), t?.stop();
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1443
1497
|
if (!this._stream) return;
|
|
1444
1498
|
let n = this._stream.getTracks().filter((t) => t.kind === e.kind), r = n.find((t) => t.contentHint === e.contentHint) ?? n.find((e) => e !== this._audioEffectsTrack);
|
|
1445
1499
|
r?.id !== e.id && (r ? await this._replaceTrack(r, e, t) : await this._addLocalTrack(e, t));
|
|
1446
1500
|
}
|
|
1447
1501
|
async _replaceTrack(e, t, n) {
|
|
1502
|
+
if (this._destroyed) {
|
|
1503
|
+
t.stop(), n?.stop();
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1448
1506
|
this._stream && (e !== this._audioEffectsTrack && e.stop(), this._stream.removeTrack(e), this._stream.addTrack(t), this._triggerEvent("TRACK_REPLACED", t, n));
|
|
1449
1507
|
}
|
|
1450
1508
|
async _addLocalTrack(e, t) {
|
|
1509
|
+
if (this._destroyed) {
|
|
1510
|
+
e.stop(), t?.stop();
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1451
1513
|
this._stream && (this._stream.addTrack(e), this._triggerEvent("TRACK_REPLACED", e, t));
|
|
1452
1514
|
}
|
|
1453
1515
|
async _setEffect(e, t) {
|
|
@@ -1466,22 +1528,22 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1466
1528
|
}
|
|
1467
1529
|
}
|
|
1468
1530
|
destroy() {
|
|
1469
|
-
this._destroyDeviceChangeListener(), E.releaseFirefoxMicrophonePermissionWarmup(), N.videoEffects && (this._effect = null, N.videoEffects.destroy()), N.audioEffects && N.audioEffects.destroy(), this._stream && (
|
|
1531
|
+
this._destroyed || (this._destroyed = !0, this._screenCaptureRequest++, this._destroyDeviceChangeListener(), E.releaseFirefoxMicrophonePermissionWarmup(), N.videoEffects && (this._effect = null, N.videoEffects.destroy()), N.audioEffects && N.audioEffects.destroy(), this._stream && (w(this._stream), this._stream = null), this.cameraVideoTrack?.stop(), this._micAudioTrack?.stop(), this._audioEffectsTrack?.stop(), this._disableScreenCapture(), E.releaseAudioContext(this), this._videoEffectsFpsLimiter?.destroy());
|
|
1470
1532
|
}
|
|
1471
1533
|
async stopLocalMedia() {
|
|
1472
|
-
this._mediaSettings.isScreenSharingEnabled && await this.disableScreenCapturing(), this._stream && (this._lastMediaSettings = { ...this._mediaSettings }, this._stream.getAudioTracks().length > 0 && await this.toggleAudio(!1), this._stream.getVideoTracks().length > 0 && await this.toggleVideo(!1), this.cameraVideoTrack = null, this._setMicAudioTrack(null));
|
|
1534
|
+
this._screenCaptureRequest++, (this._screenTrack || this._mediaSettings.isScreenSharingEnabled) && await this.disableScreenCapturing(), this._stream && (this._lastMediaSettings ?? (this._lastMediaSettings = { ...this._mediaSettings }), this._stream.getAudioTracks().length > 0 && await this.toggleAudio(!1), this._stream.getVideoTracks().length > 0 && await this.toggleVideo(!1), this.cameraVideoTrack = null, this._setMicAudioTrack(null));
|
|
1473
1535
|
}
|
|
1474
1536
|
async resumeLocalMedia(e) {
|
|
1475
1537
|
if (!this._lastMediaSettings) return;
|
|
1476
1538
|
let t = [];
|
|
1477
|
-
if ((e ? e.isAudioEnabled : this._lastMediaSettings.isAudioEnabled) && (t.push(
|
|
1539
|
+
if ((e ? e.isAudioEnabled : this._lastMediaSettings.isAudioEnabled) && (t.push(b.AUDIO), await this.toggleAudio(!0)), await this.request(t), this._lastMediaSettings = null, this._stream) for (let e of this._stream.getTracks()) this._triggerEvent("TRACK_REPLACED", e);
|
|
1478
1540
|
}
|
|
1479
1541
|
async toggleScreenCapturing(e) {
|
|
1480
1542
|
if (e.captureScreen) {
|
|
1481
1543
|
await this._changeScreen(e.fastScreenSharing, e.captureAudio);
|
|
1482
1544
|
return;
|
|
1483
1545
|
}
|
|
1484
|
-
return this._disableScreenCapture();
|
|
1546
|
+
return this._screenCaptureRequest++, this._disableScreenCapture();
|
|
1485
1547
|
}
|
|
1486
1548
|
async disableScreenCapturing() {
|
|
1487
1549
|
return this.toggleScreenCapturing({
|
|
@@ -1491,30 +1553,44 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1491
1553
|
});
|
|
1492
1554
|
}
|
|
1493
1555
|
async toggleVideo(e) {
|
|
1494
|
-
if (!this._stream) return;
|
|
1556
|
+
if (this._destroyed || !this._stream) return;
|
|
1495
1557
|
this.cameraVideoTrack?.stop();
|
|
1496
1558
|
let t;
|
|
1497
1559
|
if (e) {
|
|
1498
1560
|
let e = await E._getUserVideo(!!this._effect, this._frameRate, this._debug, this._logger);
|
|
1561
|
+
if (this._destroyed) {
|
|
1562
|
+
w(e);
|
|
1563
|
+
return;
|
|
1564
|
+
}
|
|
1499
1565
|
this.cameraVideoTrack = e.getVideoTracks()[0], t = await this._setEffect(this._effect, this.cameraVideoTrack);
|
|
1500
1566
|
} else t = E.getBlackMediaTrack(N.videoMinWidth, N.videoMinHeight), this._stopEffect();
|
|
1501
|
-
if (this.
|
|
1502
|
-
|
|
1567
|
+
if (this._destroyed) {
|
|
1568
|
+
t.stop();
|
|
1503
1569
|
return;
|
|
1504
1570
|
}
|
|
1505
|
-
this.
|
|
1571
|
+
if (this._mediaSettings.isVideoEnabled = e, await this._replaceLocalTrack(t), !this._destroyed) {
|
|
1572
|
+
if (this._animojiEnabled) {
|
|
1573
|
+
this._triggerEvent("ANIMOJI_STATUS", !e);
|
|
1574
|
+
return;
|
|
1575
|
+
}
|
|
1576
|
+
this._triggerEvent("SOURCE_CHANGED", { kind: "video" });
|
|
1577
|
+
}
|
|
1506
1578
|
}
|
|
1507
1579
|
async toggleAudio(e) {
|
|
1508
|
-
if (!this._stream) return;
|
|
1580
|
+
if (this._destroyed || !this._stream) return;
|
|
1509
1581
|
this._micAudioTrack?.stop();
|
|
1510
1582
|
let t = async (e, t) => {
|
|
1511
|
-
await this._replaceLocalTrack(e), this._mediaSettings.isAudioEnabled = t, this._triggerEvent("SOURCE_CHANGED", { kind: "audio" });
|
|
1583
|
+
await this._replaceLocalTrack(e), !this._destroyed && (this._mediaSettings.isAudioEnabled = t, this._triggerEvent("SOURCE_CHANGED", { kind: "audio" }));
|
|
1512
1584
|
};
|
|
1513
1585
|
if (e) try {
|
|
1514
1586
|
let e = await E.getUserAudio(void 0, this._debug, this._logger);
|
|
1587
|
+
if (this._destroyed) {
|
|
1588
|
+
w(e);
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1515
1591
|
this._setMicAudioTrack(e.getAudioTracks()[0]), await t(await this._applyAudioEffect(), !0);
|
|
1516
1592
|
} catch (e) {
|
|
1517
|
-
throw N.audioEffects?.pause(), await t(E.getSilentMediaTrack(), !1), typeof e == "string" ? Error(e) : e;
|
|
1593
|
+
throw this._destroyed ? e : (N.audioEffects?.pause(), await t(E.getSilentMediaTrack(), !1), typeof e == "string" ? Error(e) : e);
|
|
1518
1594
|
}
|
|
1519
1595
|
else N.audioEffects?.pause(), await t(E.getSilentMediaTrack(), !1);
|
|
1520
1596
|
}
|
|
@@ -1541,40 +1617,46 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1541
1617
|
if (e.enabled) return e.applyConstraints({ noiseSuppression: N.noiseSuppression });
|
|
1542
1618
|
}
|
|
1543
1619
|
async videoEffect(e) {
|
|
1544
|
-
if (!
|
|
1545
|
-
|
|
1546
|
-
this.
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
let e = this.cameraVideoTrack.clone(), t = new MediaStream([e]);
|
|
1554
|
-
await this._applyVideoConstraints(e), await this._changeVideoInput(t);
|
|
1555
|
-
} catch (e) {
|
|
1556
|
-
this._effect = t;
|
|
1620
|
+
if (!this._destroyed) {
|
|
1621
|
+
if (!N.videoEffects) throw Error("Video Effects library is not set");
|
|
1622
|
+
if (this._logger?.log(x.DEVICE_CHANGED, `effect_${e?.effect || "none"}`), !this._mediaSettings.isVideoEnabled) {
|
|
1623
|
+
this._effect = e;
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
if (this._stream && e !== this._effect && this.cameraVideoTrack) {
|
|
1627
|
+
let t = this._effect;
|
|
1628
|
+
this._effect = e;
|
|
1557
1629
|
let n = this.cameraVideoTrack.clone(), r = new MediaStream([n]);
|
|
1558
|
-
|
|
1630
|
+
try {
|
|
1631
|
+
await this._applyVideoConstraints(n), await this._changeVideoInput(r);
|
|
1632
|
+
} catch (e) {
|
|
1633
|
+
if (this._destroyed) throw w(r), e;
|
|
1634
|
+
this._effect = t;
|
|
1635
|
+
let n = this.cameraVideoTrack.clone(), i = new MediaStream([n]);
|
|
1636
|
+
throw await this._changeVideoInput(i), e;
|
|
1637
|
+
}
|
|
1559
1638
|
}
|
|
1560
1639
|
}
|
|
1561
1640
|
}
|
|
1562
1641
|
async audioEffect(e) {
|
|
1563
|
-
if (!
|
|
1564
|
-
|
|
1565
|
-
this.
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1642
|
+
if (!this._destroyed) {
|
|
1643
|
+
if (!N.audioEffects) throw Error("Audio Effects library is not set");
|
|
1644
|
+
if (!this._mediaSettings.isAudioEnabled) {
|
|
1645
|
+
this._audioEffectParams = e;
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
if (this._stream && (!e && this._audioEffectParams || e && !this._audioEffectParams || !M.isArraysEquals(e?.effects || [], this._audioEffectParams?.effects || [])) && this._micAudioTrack) {
|
|
1649
|
+
let t = this._audioEffectParams;
|
|
1650
|
+
this._audioEffectParams = e;
|
|
1651
|
+
try {
|
|
1652
|
+
let e = this._micAudioTrack.clone(), t = new MediaStream([e]);
|
|
1653
|
+
await this._changeAudioInput(t);
|
|
1654
|
+
} catch (e) {
|
|
1655
|
+
if (this._destroyed) throw e;
|
|
1656
|
+
this._audioEffectParams = t;
|
|
1657
|
+
let n = this._micAudioTrack.clone(), r = new MediaStream([n]);
|
|
1658
|
+
throw await this._changeAudioInput(r), e;
|
|
1659
|
+
}
|
|
1578
1660
|
}
|
|
1579
1661
|
}
|
|
1580
1662
|
}
|
|
@@ -1893,15 +1975,15 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
1893
1975
|
if (e.decorativeUserId) return ie(e.decorativeUserId, e.idType || j.USER, e.deviceIdx);
|
|
1894
1976
|
}
|
|
1895
1977
|
e.composeDecorativeId = g;
|
|
1896
|
-
function _(e) {
|
|
1897
|
-
return e.participant ? oe(e.participant) : ie(e.participantId, e.participantType || j.USER, e.deviceIdx);
|
|
1898
|
-
}
|
|
1899
|
-
e.composeMessageId = _;
|
|
1900
1978
|
function se(e) {
|
|
1901
|
-
return
|
|
1979
|
+
return e.participant ? oe(e.participant) : ie(e.participantId, e.participantType || j.USER, e.deviceIdx);
|
|
1902
1980
|
}
|
|
1903
|
-
e.
|
|
1981
|
+
e.composeMessageId = se;
|
|
1904
1982
|
function ce(e) {
|
|
1983
|
+
return typeof e == "string" ? le(ue(e).compositeUserId).id : e;
|
|
1984
|
+
}
|
|
1985
|
+
e.extractOkId = ce;
|
|
1986
|
+
function le(e) {
|
|
1905
1987
|
let t = String(e), n = t.match(ne);
|
|
1906
1988
|
return n ? {
|
|
1907
1989
|
id: Number(n[2]),
|
|
@@ -1911,24 +1993,24 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
1911
1993
|
type: j.USER
|
|
1912
1994
|
});
|
|
1913
1995
|
}
|
|
1914
|
-
e.decomposeId =
|
|
1915
|
-
function
|
|
1996
|
+
e.decomposeId = le;
|
|
1997
|
+
function ue(e) {
|
|
1916
1998
|
let t = e.split(":d");
|
|
1917
1999
|
return {
|
|
1918
2000
|
compositeUserId: t[0],
|
|
1919
2001
|
deviceIdx: t.length > 1 ? parseInt(t[1], 10) : 0
|
|
1920
2002
|
};
|
|
1921
2003
|
}
|
|
1922
|
-
e.decomposeParticipantId =
|
|
1923
|
-
function
|
|
2004
|
+
e.decomposeParticipantId = ue;
|
|
2005
|
+
function de() {
|
|
1924
2006
|
let e = window.crypto?.randomUUID?.();
|
|
1925
2007
|
if (e) return e;
|
|
1926
2008
|
let t = "0123456789abcdefghijklmnopqrstuvwxyz".split(""), n = Array(36), r = 0, i, a;
|
|
1927
2009
|
for (a = 0; a < 36; a++) a === 8 || a === 13 || a === 18 || a === 23 ? n[a] = "-" : a === 14 ? n[a] = "4" : (r <= 2 && (r = 33554432 + Math.random() * 16777216 | 0), i = r & 15, r >>= 4, n[a] = t[a === 19 ? i & 3 | 8 : i]);
|
|
1928
2010
|
return n.join("");
|
|
1929
2011
|
}
|
|
1930
|
-
e.uuid =
|
|
1931
|
-
function
|
|
2012
|
+
e.uuid = de;
|
|
2013
|
+
function fe(e, t) {
|
|
1932
2014
|
let n;
|
|
1933
2015
|
function r(...r) {
|
|
1934
2016
|
let i = this;
|
|
@@ -1938,8 +2020,8 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
1938
2020
|
}
|
|
1939
2021
|
return r;
|
|
1940
2022
|
}
|
|
1941
|
-
e.debounce =
|
|
1942
|
-
function
|
|
2023
|
+
e.debounce = fe;
|
|
2024
|
+
function pe(e) {
|
|
1943
2025
|
if (!window.BigInt) return null;
|
|
1944
2026
|
let t = "", n = mn(e);
|
|
1945
2027
|
for (let e of n) if (e.startsWith("a=fingerprint")) {
|
|
@@ -1957,8 +2039,8 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
1957
2039
|
}
|
|
1958
2040
|
return BigInt.asIntN(64, i);
|
|
1959
2041
|
}
|
|
1960
|
-
e.sdpFingerprint =
|
|
1961
|
-
async function
|
|
2042
|
+
e.sdpFingerprint = pe;
|
|
2043
|
+
async function me(e, { signal: t } = {}) {
|
|
1962
2044
|
return new Promise((n, r) => {
|
|
1963
2045
|
if (t?.aborted) return r(t.reason);
|
|
1964
2046
|
let i = setTimeout(() => {
|
|
@@ -1969,13 +2051,13 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
1969
2051
|
t?.addEventListener("abort", a, { once: !0 });
|
|
1970
2052
|
});
|
|
1971
2053
|
}
|
|
1972
|
-
e.delay =
|
|
1973
|
-
function
|
|
2054
|
+
e.delay = me;
|
|
2055
|
+
function he(e, t, n, r = z) {
|
|
1974
2056
|
let i = [];
|
|
1975
|
-
return e.getSenders().forEach((e) =>
|
|
2057
|
+
return e.getSenders().forEach((e) => ge(t, e, e.track, n, i, r)), i;
|
|
1976
2058
|
}
|
|
1977
|
-
e.applySettings =
|
|
1978
|
-
function
|
|
2059
|
+
e.applySettings = he;
|
|
2060
|
+
function ge(e, t, n, r, i, a = z) {
|
|
1979
2061
|
if (!RTCRtpSender.prototype.getParameters || !RTCRtpSender.prototype.setParameters || !e || !n || n.kind !== A.video) return;
|
|
1980
2062
|
let o = n.getSettings();
|
|
1981
2063
|
if (!o) return;
|
|
@@ -2009,21 +2091,21 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
2009
2091
|
a.error("Failed to set sender parameters", m, e);
|
|
2010
2092
|
});
|
|
2011
2093
|
}
|
|
2012
|
-
e.applyVideoTrackSettings =
|
|
2013
|
-
function
|
|
2094
|
+
e.applyVideoTrackSettings = ge;
|
|
2095
|
+
function _e(e, t) {
|
|
2014
2096
|
Array.isArray(t) || (t = [t]);
|
|
2015
2097
|
for (let n of t) if (e.includes(n)) return !0;
|
|
2016
2098
|
return !1;
|
|
2017
2099
|
}
|
|
2018
|
-
e.includesOneOf =
|
|
2019
|
-
function
|
|
2100
|
+
e.includesOneOf = _e;
|
|
2101
|
+
function _(e) {
|
|
2020
2102
|
return Object.entries(e.participantState?.state || {}).reduce((t, [n, r]) => (e.participantState && (t[n] = {
|
|
2021
2103
|
ts: e.participantState.stateUpdateTs[n],
|
|
2022
2104
|
state: r
|
|
2023
2105
|
}), t), {});
|
|
2024
2106
|
}
|
|
2025
|
-
e.mapParticipantState =
|
|
2026
|
-
function
|
|
2107
|
+
e.mapParticipantState = _;
|
|
2108
|
+
function ve(e) {
|
|
2027
2109
|
let t = e.map((e) => ({
|
|
2028
2110
|
uid: e.externalId,
|
|
2029
2111
|
mediaSettings: e.mediaSettings,
|
|
@@ -2037,37 +2119,37 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
2037
2119
|
}));
|
|
2038
2120
|
return N.filterObservers ? t.filter((e) => !e.uid.observer) : t;
|
|
2039
2121
|
}
|
|
2040
|
-
e.mapSharedParticipants =
|
|
2041
|
-
function
|
|
2122
|
+
e.mapSharedParticipants = ve;
|
|
2123
|
+
function ye(e, t) {
|
|
2042
2124
|
let n = Object.keys(e), r = Object.keys(t);
|
|
2043
2125
|
if (n.length !== r.length) return !1;
|
|
2044
2126
|
for (let i of n) if (!Object.hasOwn(r, i) || e[i].state !== t[i].state || e[i].ts !== t[i].ts) return !1;
|
|
2045
2127
|
return !0;
|
|
2046
2128
|
}
|
|
2047
|
-
e.isEqualParticipantState =
|
|
2048
|
-
function
|
|
2129
|
+
e.isEqualParticipantState = ye;
|
|
2130
|
+
function be(e, t, n = !1) {
|
|
2049
2131
|
let r = Object.keys(e), i = Object.keys(t);
|
|
2050
2132
|
if (r.length !== i.length) return !1;
|
|
2051
2133
|
for (let i of r) {
|
|
2052
2134
|
if (!Object.hasOwn(t, i)) return !1;
|
|
2053
2135
|
let r = e[i], a = t[i];
|
|
2054
|
-
if (n &&
|
|
2136
|
+
if (n && Ee(r) && Ee(a)) return be(r, a, n);
|
|
2055
2137
|
if (r !== a) return !1;
|
|
2056
2138
|
}
|
|
2057
2139
|
return !0;
|
|
2058
2140
|
}
|
|
2059
|
-
e.isObjectsEquals =
|
|
2060
|
-
function
|
|
2141
|
+
e.isObjectsEquals = be;
|
|
2142
|
+
function xe(e, t) {
|
|
2061
2143
|
if (e.length !== t.length) return !1;
|
|
2062
2144
|
for (let n of e) if (t.indexOf(n) < 0) return !1;
|
|
2063
2145
|
return !0;
|
|
2064
2146
|
}
|
|
2065
|
-
e.isArraysEquals =
|
|
2066
|
-
function
|
|
2147
|
+
e.isArraysEquals = xe;
|
|
2148
|
+
function Se(e) {
|
|
2067
2149
|
return !Object.keys(e).length;
|
|
2068
2150
|
}
|
|
2069
|
-
e.isEmptyObject =
|
|
2070
|
-
function
|
|
2151
|
+
e.isEmptyObject = Se;
|
|
2152
|
+
function Ce(e, t) {
|
|
2071
2153
|
if (!e && !t) return 0;
|
|
2072
2154
|
if (!e || !t) return e ? -1 : 1;
|
|
2073
2155
|
return r(t.rank, e.rank) || r(e.ts, t.ts) || n(e, t);
|
|
@@ -2075,24 +2157,24 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
2075
2157
|
let n = {
|
|
2076
2158
|
[j.USER]: 0,
|
|
2077
2159
|
[j.GROUP]: 1
|
|
2078
|
-
}, { compositeUserId: i, deviceIdx: a } =
|
|
2160
|
+
}, { compositeUserId: i, deviceIdx: a } = ue(e.id), { compositeUserId: o, deviceIdx: s } = ue(t.id), { id: c, type: l } = le(i), { id: u, type: d } = le(o);
|
|
2079
2161
|
return r(n[l], n[d]) || r(c, u) || r(a, s);
|
|
2080
2162
|
}
|
|
2081
2163
|
function r(e, t) {
|
|
2082
2164
|
return e < t ? -1 : e === t ? 0 : 1;
|
|
2083
2165
|
}
|
|
2084
2166
|
}
|
|
2085
|
-
e.participantMarkerCompare =
|
|
2086
|
-
function
|
|
2167
|
+
e.participantMarkerCompare = Ce;
|
|
2168
|
+
function we(e, t) {
|
|
2087
2169
|
return dn(Object.entries(e).filter(([, e]) => Array.isArray(t) ? !t.includes(e) : e !== t));
|
|
2088
2170
|
}
|
|
2089
|
-
e.objectFilterOutValues =
|
|
2090
|
-
function
|
|
2171
|
+
e.objectFilterOutValues = we;
|
|
2172
|
+
function Te(e, t, n) {
|
|
2091
2173
|
let r = n;
|
|
2092
2174
|
for (let n in e) Object.hasOwn(e, n) && (r = t(r, e[n], n));
|
|
2093
2175
|
return r;
|
|
2094
2176
|
}
|
|
2095
|
-
e.objectReduce =
|
|
2177
|
+
e.objectReduce = Te, e.setImmediate = (() => {
|
|
2096
2178
|
let e = 1, t = {}, n = null;
|
|
2097
2179
|
return typeof MessageChannel < "u" && (n = new MessageChannel(), n.port1.onmessage = (e) => {
|
|
2098
2180
|
let n = e.data;
|
|
@@ -2108,10 +2190,10 @@ var gn = 533, _n = "a=fmtp:", vn = "sps-pps-idr-in-keyframe=1", yn;
|
|
|
2108
2190
|
return () => clearTimeout(i);
|
|
2109
2191
|
};
|
|
2110
2192
|
})();
|
|
2111
|
-
function
|
|
2193
|
+
function Ee(e) {
|
|
2112
2194
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
2113
2195
|
}
|
|
2114
|
-
e.isObject =
|
|
2196
|
+
e.isObject = Ee;
|
|
2115
2197
|
})(yn || (yn = {}));
|
|
2116
2198
|
var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
|
|
2117
2199
|
set(e, t) {
|
|
@@ -2200,7 +2282,7 @@ var M = yn, bn = "__CALLS_SDK_DEVTOOLS_", xn = class {
|
|
|
2200
2282
|
h(Cn, "instance", null);
|
|
2201
2283
|
var wn = Cn.getInstance(), N = class e {
|
|
2202
2284
|
static set(t) {
|
|
2203
|
-
Object.hasOwn(t, "voiceParams") && (Object.assign(e._params.voiceParams, t.voiceParams), delete t.voiceParams), Object.hasOwn(t, "specListenerParams") && (Object.assign(e._params.specListenerParams, t.specListenerParams), delete t.specListenerParams), Object.hasOwn(t, "apiAuth") && (
|
|
2285
|
+
Object.hasOwn(t, "voiceParams") && (Object.assign(e._params.voiceParams, t.voiceParams), delete t.voiceParams), Object.hasOwn(t, "specListenerParams") && (Object.assign(e._params.specListenerParams, t.specListenerParams), delete t.specListenerParams), Object.hasOwn(t, "apiAuth") && (v.accessToken = t.apiAuth.accessToken, v.sessionKey = t.apiAuth.sessionKey, v.sessionSecretKey = t.apiAuth.sessionSecretKey, v.selfExternalId = null);
|
|
2204
2286
|
let n = wn.params.applyOverrides(t);
|
|
2205
2287
|
Object.assign(e._params, M.objectFilterOutValues(n, void 0));
|
|
2206
2288
|
}
|
|
@@ -2220,7 +2302,7 @@ var wn = Cn.getInstance(), N = class e {
|
|
|
2220
2302
|
return 1.1;
|
|
2221
2303
|
}
|
|
2222
2304
|
static get sdkVersion() {
|
|
2223
|
-
return "2.8.13-dev.
|
|
2305
|
+
return "2.8.13-dev.a0af4e62.0";
|
|
2224
2306
|
}
|
|
2225
2307
|
static get debug() {
|
|
2226
2308
|
return e._params.debug;
|
|
@@ -2400,7 +2482,7 @@ var wn = Cn.getInstance(), N = class e {
|
|
|
2400
2482
|
return e._params.videoFrameRate;
|
|
2401
2483
|
}
|
|
2402
2484
|
static get videoFacingMode() {
|
|
2403
|
-
return e._params.videoFacingMode || (
|
|
2485
|
+
return e._params.videoFacingMode || (C.isMobile() ? It.USER : null);
|
|
2404
2486
|
}
|
|
2405
2487
|
static set videoFacingMode(t) {
|
|
2406
2488
|
e._params.videoFacingMode = t;
|
|
@@ -2568,7 +2650,7 @@ var wn = Cn.getInstance(), N = class e {
|
|
|
2568
2650
|
return e._params.preserveAudioTracks;
|
|
2569
2651
|
}
|
|
2570
2652
|
static get audioShare() {
|
|
2571
|
-
return
|
|
2653
|
+
return C.isAudioShareSupported() && e._params.audioShare;
|
|
2572
2654
|
}
|
|
2573
2655
|
static get audioShareWindowInclude() {
|
|
2574
2656
|
return e._params.audioShareWindowInclude;
|
|
@@ -2610,7 +2692,7 @@ var wn = Cn.getInstance(), N = class e {
|
|
|
2610
2692
|
return e._params.enableVideoEffectsFpsDegradation;
|
|
2611
2693
|
}
|
|
2612
2694
|
static get simulcast() {
|
|
2613
|
-
return
|
|
2695
|
+
return C.isSimulcastSupportedByBrowser() && e._params.simulcast;
|
|
2614
2696
|
}
|
|
2615
2697
|
static get webtransport() {
|
|
2616
2698
|
return e._params.webtransport;
|
|
@@ -2912,164 +2994,164 @@ var En;
|
|
|
2912
2994
|
I("onRemoteSharedUrl", e, t, n, r);
|
|
2913
2995
|
}
|
|
2914
2996
|
e.onRemoteSharedUrl = g;
|
|
2915
|
-
function
|
|
2997
|
+
function se(e, t, n) {
|
|
2916
2998
|
I("onParticipantAdded", e, t, n);
|
|
2917
2999
|
}
|
|
2918
|
-
e.onParticipantAdded =
|
|
2919
|
-
function
|
|
3000
|
+
e.onParticipantAdded = se;
|
|
3001
|
+
function ce(e, t, n) {
|
|
2920
3002
|
I("onParticipantJoined", e, t, n);
|
|
2921
3003
|
}
|
|
2922
|
-
e.onParticipantJoined =
|
|
2923
|
-
function
|
|
3004
|
+
e.onParticipantJoined = ce;
|
|
3005
|
+
function le(e, t = !1, n) {
|
|
2924
3006
|
F("onLocalParticipantState", L(e), t, n);
|
|
2925
3007
|
}
|
|
2926
|
-
e.onLocalParticipantState =
|
|
2927
|
-
function
|
|
3008
|
+
e.onLocalParticipantState = le;
|
|
3009
|
+
function ue(e, t, n, r) {
|
|
2928
3010
|
I("onRemoteParticipantState", e, L(t), n, r);
|
|
2929
3011
|
}
|
|
2930
|
-
e.onRemoteParticipantState =
|
|
2931
|
-
function
|
|
3012
|
+
e.onRemoteParticipantState = ue;
|
|
3013
|
+
function de(e, t, n) {
|
|
2932
3014
|
F("onRemoteParticipantsState", e, t, n);
|
|
2933
3015
|
}
|
|
2934
|
-
e.onRemoteParticipantsState =
|
|
2935
|
-
function
|
|
3016
|
+
e.onRemoteParticipantsState = de;
|
|
3017
|
+
function fe(e, t, n = null, r) {
|
|
2936
3018
|
z.debug("Remote status:", t, e), I("onRemoteStatus", e, t, n, r);
|
|
2937
3019
|
}
|
|
2938
|
-
e.onRemoteStatus =
|
|
2939
|
-
function
|
|
3020
|
+
e.onRemoteStatus = fe;
|
|
3021
|
+
function pe() {
|
|
2940
3022
|
F("onPermissionsRequested");
|
|
2941
3023
|
}
|
|
2942
|
-
e.onPermissionsRequested =
|
|
2943
|
-
function
|
|
3024
|
+
e.onPermissionsRequested = pe;
|
|
3025
|
+
function me(e, t) {
|
|
2944
3026
|
F("onPermissionsError", e, t);
|
|
2945
3027
|
}
|
|
2946
|
-
e.onPermissionsError =
|
|
2947
|
-
function
|
|
3028
|
+
e.onPermissionsError = me;
|
|
3029
|
+
function he(e, t, n) {
|
|
2948
3030
|
I("onRemoteRemoved", e, t, n);
|
|
2949
3031
|
}
|
|
2950
|
-
e.onRemoteRemoved =
|
|
2951
|
-
function
|
|
3032
|
+
e.onRemoteRemoved = he;
|
|
3033
|
+
function ge(e, t, n, r) {
|
|
2952
3034
|
F("onCallState", e, t, L(n), r);
|
|
2953
3035
|
}
|
|
2954
|
-
e.onCallState =
|
|
2955
|
-
function
|
|
3036
|
+
e.onCallState = ge;
|
|
3037
|
+
function _e(e, t, n) {
|
|
2956
3038
|
F("onDeviceSwitched", e, t, n);
|
|
2957
3039
|
}
|
|
2958
|
-
e.onDeviceSwitched =
|
|
2959
|
-
function
|
|
3040
|
+
e.onDeviceSwitched = _e;
|
|
3041
|
+
function _(e, t, n, r = !1, i = !1, a = null, o = null, s, c, l = null, u) {
|
|
2960
3042
|
let d = c ? Tn(c) : void 0;
|
|
2961
3043
|
F("onMuteStates", L(e), Tn(t), Tn(n), r, i, a, o, s, d, l, u);
|
|
2962
3044
|
}
|
|
2963
|
-
e.onMuteStates =
|
|
2964
|
-
function
|
|
3045
|
+
e.onMuteStates = _;
|
|
3046
|
+
function ve(e, t, n = !1, r) {
|
|
2965
3047
|
I("onRolesChanged", e, Tn(t), n, r);
|
|
2966
3048
|
}
|
|
2967
|
-
e.onRolesChanged =
|
|
2968
|
-
function
|
|
3049
|
+
e.onRolesChanged = ve;
|
|
3050
|
+
function ye(e, t = !1, n) {
|
|
2969
3051
|
F("onLocalRolesChanged", Tn(e), t, n);
|
|
2970
3052
|
}
|
|
2971
|
-
e.onLocalRolesChanged =
|
|
2972
|
-
function
|
|
3053
|
+
e.onLocalRolesChanged = ye;
|
|
3054
|
+
function be(e, t, n, r, i) {
|
|
2973
3055
|
I("onPinnedParticipant", e, t, n, r, i);
|
|
2974
3056
|
}
|
|
2975
|
-
e.onPinnedParticipant =
|
|
2976
|
-
function
|
|
3057
|
+
e.onPinnedParticipant = be;
|
|
3058
|
+
function xe(e, t, n) {
|
|
2977
3059
|
F("onLocalPin", e, t, n);
|
|
2978
3060
|
}
|
|
2979
|
-
e.onLocalPin =
|
|
2980
|
-
function
|
|
3061
|
+
e.onLocalPin = xe;
|
|
3062
|
+
function Se(e, t) {
|
|
2981
3063
|
F("onOptionsChanged", Tn(e), t);
|
|
2982
3064
|
}
|
|
2983
|
-
e.onOptionsChanged =
|
|
2984
|
-
function
|
|
3065
|
+
e.onOptionsChanged = Se;
|
|
3066
|
+
function Ce(e) {
|
|
2985
3067
|
F("onCallAccepted", e);
|
|
2986
3068
|
}
|
|
2987
|
-
e.onCallAccepted =
|
|
2988
|
-
function
|
|
3069
|
+
e.onCallAccepted = Ce;
|
|
3070
|
+
function we(e) {
|
|
2989
3071
|
F("onCallActive", e);
|
|
2990
3072
|
}
|
|
2991
|
-
e.onCallActive =
|
|
2992
|
-
function
|
|
3073
|
+
e.onCallActive = we;
|
|
3074
|
+
function Te(e, t, n) {
|
|
2993
3075
|
I("onAcceptedCall", e, t, n);
|
|
2994
3076
|
}
|
|
2995
|
-
e.onAcceptedCall =
|
|
2996
|
-
function
|
|
3077
|
+
e.onAcceptedCall = Te;
|
|
3078
|
+
function Ee(e) {
|
|
2997
3079
|
F("onRateNeeded", e);
|
|
2998
3080
|
}
|
|
2999
|
-
e.onRateNeeded =
|
|
3000
|
-
function
|
|
3081
|
+
e.onRateNeeded = Ee;
|
|
3082
|
+
function De(e, t) {
|
|
3001
3083
|
I("onSpeakerChanged", e, t);
|
|
3002
3084
|
}
|
|
3003
|
-
e.onSpeakerChanged =
|
|
3004
|
-
function
|
|
3085
|
+
e.onSpeakerChanged = De;
|
|
3086
|
+
function Oe(e, t) {
|
|
3005
3087
|
F("onVolumesDetected", Tn(e), t);
|
|
3006
3088
|
}
|
|
3007
|
-
e.onVolumesDetected =
|
|
3008
|
-
function
|
|
3089
|
+
e.onVolumesDetected = Oe;
|
|
3090
|
+
function ke(e, t) {
|
|
3009
3091
|
F("onLocalVolume", e, t);
|
|
3010
3092
|
}
|
|
3011
|
-
e.onLocalVolume =
|
|
3012
|
-
function
|
|
3093
|
+
e.onLocalVolume = ke;
|
|
3094
|
+
function Ae(e, t, n) {
|
|
3013
3095
|
F("onJoinStatus", e, t, n);
|
|
3014
3096
|
}
|
|
3015
|
-
e.onJoinStatus =
|
|
3016
|
-
function
|
|
3097
|
+
e.onJoinStatus = Ae;
|
|
3098
|
+
function je(e, t) {
|
|
3017
3099
|
F("onHangup", e, t);
|
|
3018
3100
|
}
|
|
3019
|
-
e.onHangup =
|
|
3020
|
-
function
|
|
3101
|
+
e.onHangup = je;
|
|
3102
|
+
function Me(e) {
|
|
3021
3103
|
F("onMultipartyChatCreated", L(e));
|
|
3022
3104
|
}
|
|
3023
|
-
e.onMultipartyChatCreated =
|
|
3024
|
-
function
|
|
3105
|
+
e.onMultipartyChatCreated = Me;
|
|
3106
|
+
function Ne() {
|
|
3025
3107
|
F("onDeviceChange");
|
|
3026
3108
|
}
|
|
3027
|
-
e.onDeviceChange =
|
|
3028
|
-
function
|
|
3109
|
+
e.onDeviceChange = Ne;
|
|
3110
|
+
function Pe(e) {
|
|
3029
3111
|
F("onFingerprintChange", e);
|
|
3030
3112
|
}
|
|
3031
|
-
e.onFingerprintChange =
|
|
3032
|
-
function
|
|
3113
|
+
e.onFingerprintChange = Pe;
|
|
3114
|
+
function Fe() {
|
|
3033
3115
|
F("onTokenExpired");
|
|
3034
3116
|
}
|
|
3035
|
-
e.onTokenExpired =
|
|
3036
|
-
function
|
|
3117
|
+
e.onTokenExpired = Fe;
|
|
3118
|
+
function Ie(e, t, n = !1, r) {
|
|
3037
3119
|
F("onChatMessage", e, t, n, r);
|
|
3038
3120
|
}
|
|
3039
|
-
e.onChatMessage =
|
|
3040
|
-
function
|
|
3121
|
+
e.onChatMessage = Ie;
|
|
3122
|
+
function Le(e, t, n = !1, r) {
|
|
3041
3123
|
F("onCustomData", e, t, n, r);
|
|
3042
3124
|
}
|
|
3043
|
-
e.onCustomData =
|
|
3044
|
-
function
|
|
3125
|
+
e.onCustomData = Le;
|
|
3126
|
+
function Re(e, t, n, r, i, a, o = null, s) {
|
|
3045
3127
|
F("onRecordStarted", e, t, n, r, i, a, o, s);
|
|
3046
3128
|
}
|
|
3047
|
-
e.onRecordStarted =
|
|
3048
|
-
function
|
|
3129
|
+
e.onRecordStarted = Re;
|
|
3130
|
+
function ze(e = null, t, n) {
|
|
3049
3131
|
F("onRecordStopped", e, t, n);
|
|
3050
3132
|
}
|
|
3051
|
-
e.onRecordStopped =
|
|
3052
|
-
function
|
|
3133
|
+
e.onRecordStopped = ze;
|
|
3134
|
+
function Be(e, t) {
|
|
3053
3135
|
F("onLocalNetworkStatusChanged", e, t);
|
|
3054
3136
|
}
|
|
3055
|
-
e.onLocalNetworkStatusChanged =
|
|
3056
|
-
function
|
|
3137
|
+
e.onLocalNetworkStatusChanged = Be;
|
|
3138
|
+
function Ve(e, t) {
|
|
3057
3139
|
F("onNetworkStatusChanged", e, t);
|
|
3058
3140
|
}
|
|
3059
|
-
e.onNetworkStatusChanged =
|
|
3060
|
-
function
|
|
3141
|
+
e.onNetworkStatusChanged = Ve;
|
|
3142
|
+
function He(e, ...t) {
|
|
3061
3143
|
F("onDebugMessage", e, ...t);
|
|
3062
3144
|
}
|
|
3063
|
-
e.onDebugMessage =
|
|
3064
|
-
function
|
|
3145
|
+
e.onDebugMessage = He;
|
|
3146
|
+
function Ue(e, t, ...n) {
|
|
3065
3147
|
F("onDebugMessageWithContext", e, t, ...n);
|
|
3066
3148
|
}
|
|
3067
|
-
e.onDebugMessageWithContext =
|
|
3068
|
-
function
|
|
3149
|
+
e.onDebugMessageWithContext = Ue;
|
|
3150
|
+
function We(e, t) {
|
|
3069
3151
|
F("onStatistics", Object.assign({}, e, { memory: t }));
|
|
3070
3152
|
}
|
|
3071
|
-
e.onStatistics =
|
|
3072
|
-
function
|
|
3153
|
+
e.onStatistics = We;
|
|
3154
|
+
function Ge(e) {
|
|
3073
3155
|
let t = N.get("onClientStats");
|
|
3074
3156
|
if (typeof t == "function") try {
|
|
3075
3157
|
t(e);
|
|
@@ -3077,99 +3159,103 @@ var En;
|
|
|
3077
3159
|
z.error("[CallsSDK] onClientStats callback failed", e);
|
|
3078
3160
|
}
|
|
3079
3161
|
}
|
|
3080
|
-
e.onClientStats =
|
|
3081
|
-
function
|
|
3162
|
+
e.onClientStats = Ge;
|
|
3163
|
+
function Ke() {
|
|
3082
3164
|
F("onAutoplayError");
|
|
3083
3165
|
}
|
|
3084
|
-
e.onAutoplayError =
|
|
3085
|
-
function
|
|
3166
|
+
e.onAutoplayError = Ke;
|
|
3167
|
+
function qe(e, t, n, r, i, a) {
|
|
3086
3168
|
F("onChatRoomUpdated", e, t, n, r, i, a);
|
|
3087
3169
|
}
|
|
3088
|
-
e.onChatRoomUpdated =
|
|
3089
|
-
function
|
|
3170
|
+
e.onChatRoomUpdated = qe;
|
|
3171
|
+
function Je(e, t) {
|
|
3090
3172
|
F("onPromoted", e, t);
|
|
3091
3173
|
}
|
|
3092
|
-
e.onPromoted =
|
|
3093
|
-
function
|
|
3174
|
+
e.onPromoted = Je;
|
|
3175
|
+
function v(e, t) {
|
|
3094
3176
|
F("onRemoteMixedAudioStream", e, t);
|
|
3095
3177
|
}
|
|
3096
|
-
e.onRemoteMixedAudioStream =
|
|
3097
|
-
function
|
|
3178
|
+
e.onRemoteMixedAudioStream = v;
|
|
3179
|
+
function Ye(e, t) {
|
|
3098
3180
|
F("onJoinLinkChanged", e, t);
|
|
3099
3181
|
}
|
|
3100
|
-
e.onJoinLinkChanged =
|
|
3101
|
-
function
|
|
3182
|
+
e.onJoinLinkChanged = Ye;
|
|
3183
|
+
function Xe(e, t) {
|
|
3102
3184
|
F("onRoomsUpdated", e, t);
|
|
3103
3185
|
}
|
|
3104
|
-
e.onRoomsUpdated =
|
|
3105
|
-
function
|
|
3186
|
+
e.onRoomsUpdated = Xe;
|
|
3187
|
+
function y(e, t, n, r, i) {
|
|
3106
3188
|
F("onRoomUpdated", e, t, n, r, i);
|
|
3107
3189
|
}
|
|
3108
|
-
e.onRoomUpdated =
|
|
3109
|
-
function
|
|
3190
|
+
e.onRoomUpdated = y;
|
|
3191
|
+
function b(e, t) {
|
|
3110
3192
|
F("onRoomParticipantsUpdated", e, t);
|
|
3111
3193
|
}
|
|
3112
|
-
e.onRoomParticipantsUpdated =
|
|
3113
|
-
function
|
|
3194
|
+
e.onRoomParticipantsUpdated = b;
|
|
3195
|
+
function x(e, t) {
|
|
3114
3196
|
F("onRoomSwitched", e, t);
|
|
3115
3197
|
}
|
|
3116
|
-
e.onRoomSwitched =
|
|
3117
|
-
function
|
|
3198
|
+
e.onRoomSwitched = x;
|
|
3199
|
+
function Ze(e, t) {
|
|
3118
3200
|
F("onRoomStart", e, t);
|
|
3119
3201
|
}
|
|
3120
|
-
e.onRoomStart =
|
|
3121
|
-
function
|
|
3202
|
+
e.onRoomStart = Ze;
|
|
3203
|
+
function Qe(e, t = null, n) {
|
|
3122
3204
|
F("onFeedback", e, t, n);
|
|
3123
3205
|
}
|
|
3124
|
-
e.onFeedback =
|
|
3125
|
-
function
|
|
3206
|
+
e.onFeedback = Qe;
|
|
3207
|
+
function $e(e, t) {
|
|
3126
3208
|
F("onFeaturesPerRoleChanged", e, t);
|
|
3127
3209
|
}
|
|
3128
|
-
e.onFeaturesPerRoleChanged =
|
|
3129
|
-
function
|
|
3210
|
+
e.onFeaturesPerRoleChanged = $e;
|
|
3211
|
+
function et(e, t) {
|
|
3130
3212
|
F("onParticipantVmojiUpdate", e, t);
|
|
3131
3213
|
}
|
|
3132
|
-
e.onParticipantVmojiUpdate =
|
|
3133
|
-
function
|
|
3214
|
+
e.onParticipantVmojiUpdate = et;
|
|
3215
|
+
function tt(e, t, n) {
|
|
3134
3216
|
F("onAsrSet", e, t, n);
|
|
3135
3217
|
}
|
|
3136
|
-
e.onAsrSet =
|
|
3137
|
-
function
|
|
3218
|
+
e.onAsrSet = tt;
|
|
3219
|
+
function nt(e, t, n, r) {
|
|
3138
3220
|
F("onAsrStarted", e, t, n, r);
|
|
3139
3221
|
}
|
|
3140
|
-
e.onAsrStarted =
|
|
3141
|
-
function
|
|
3222
|
+
e.onAsrStarted = nt;
|
|
3223
|
+
function rt(e, t) {
|
|
3142
3224
|
F("onAsrStopped", e, t);
|
|
3143
3225
|
}
|
|
3144
|
-
e.onAsrStopped =
|
|
3145
|
-
function
|
|
3226
|
+
e.onAsrStopped = rt;
|
|
3227
|
+
function it(e, t, n, r, i) {
|
|
3146
3228
|
F("onAsrTranscription", e, t, n, r, i);
|
|
3147
3229
|
}
|
|
3148
|
-
e.onAsrTranscription =
|
|
3149
|
-
function
|
|
3230
|
+
e.onAsrTranscription = it;
|
|
3231
|
+
function S(e, t, n) {
|
|
3150
3232
|
F("onParticipantIdChanged", e, t, n);
|
|
3151
3233
|
}
|
|
3152
|
-
e.onParticipantIdChanged =
|
|
3153
|
-
function
|
|
3234
|
+
e.onParticipantIdChanged = S;
|
|
3235
|
+
function C(e, t) {
|
|
3154
3236
|
F("onVideoSuspendSuggest", e, t);
|
|
3155
3237
|
}
|
|
3156
|
-
e.onVideoSuspendSuggest =
|
|
3157
|
-
function
|
|
3238
|
+
e.onVideoSuspendSuggest = C;
|
|
3239
|
+
function at(e) {
|
|
3240
|
+
F("onSignalingConnected", e);
|
|
3241
|
+
}
|
|
3242
|
+
e.onSignalingConnected = at;
|
|
3243
|
+
function w(e) {
|
|
3158
3244
|
F("onSignalingMessage", typeof e == "string" ? e : L(e));
|
|
3159
3245
|
}
|
|
3160
|
-
e.onSignalingMessage =
|
|
3161
|
-
function
|
|
3246
|
+
e.onSignalingMessage = w;
|
|
3247
|
+
function ot(e, t) {
|
|
3162
3248
|
F("onPromotionApproved", e, t);
|
|
3163
3249
|
}
|
|
3164
|
-
e.onPromotionApproved =
|
|
3165
|
-
function
|
|
3250
|
+
e.onPromotionApproved = ot;
|
|
3251
|
+
function st(e, t) {
|
|
3166
3252
|
F("onPeerRegistered", e, t);
|
|
3167
3253
|
}
|
|
3168
|
-
e.onPeerRegistered =
|
|
3169
|
-
function
|
|
3254
|
+
e.onPeerRegistered = st;
|
|
3255
|
+
function ct(e, t) {
|
|
3170
3256
|
F("onNonFatalError", e, t);
|
|
3171
3257
|
}
|
|
3172
|
-
e.onNonFatalError =
|
|
3258
|
+
e.onNonFatalError = ct;
|
|
3173
3259
|
})(En || (En = {}));
|
|
3174
3260
|
var R = En, Dn = /* @__PURE__ */ function(e) {
|
|
3175
3261
|
return e.DEBUG = "DEBUG", e.LOG = "LOG", e.WARN = "WARN", e.ERROR = "ERROR", e;
|
|
@@ -3191,7 +3277,7 @@ var R = En, Dn = /* @__PURE__ */ function(e) {
|
|
|
3191
3277
|
}
|
|
3192
3278
|
function u(e, t, n) {
|
|
3193
3279
|
let u = l(n);
|
|
3194
|
-
if (N.debugLog &&
|
|
3280
|
+
if (N.debugLog && Ae(e, t, u.sessionId || void 0), c) switch (e) {
|
|
3195
3281
|
case "DEBUG":
|
|
3196
3282
|
i(...t);
|
|
3197
3283
|
break;
|
|
@@ -3228,7 +3314,7 @@ var R = En, Dn = /* @__PURE__ */ function(e) {
|
|
|
3228
3314
|
}
|
|
3229
3315
|
e.enabled = ee;
|
|
3230
3316
|
function h(e) {
|
|
3231
|
-
c = e, N.debugLog &&
|
|
3317
|
+
c = e, N.debugLog && je();
|
|
3232
3318
|
}
|
|
3233
3319
|
e.toggle = h;
|
|
3234
3320
|
function te(e, ...t) {
|
|
@@ -3260,7 +3346,7 @@ var R = En, Dn = /* @__PURE__ */ function(e) {
|
|
|
3260
3346
|
function re(e = null) {
|
|
3261
3347
|
let t = null, n = e;
|
|
3262
3348
|
function r() {
|
|
3263
|
-
!N.debugLog || t || (t =
|
|
3349
|
+
!N.debugLog || t || (t = Me(), n && Ne(n, t));
|
|
3264
3350
|
}
|
|
3265
3351
|
let i = () => (r(), {
|
|
3266
3352
|
sessionId: t,
|
|
@@ -3274,7 +3360,7 @@ var R = En, Dn = /* @__PURE__ */ function(e) {
|
|
|
3274
3360
|
return n;
|
|
3275
3361
|
},
|
|
3276
3362
|
setConversationId(e) {
|
|
3277
|
-
n = e, t &&
|
|
3363
|
+
n = e, t && Ne(n, t);
|
|
3278
3364
|
},
|
|
3279
3365
|
send: (e, ...t) => u(e, t, i),
|
|
3280
3366
|
debug: (...e) => u("DEBUG", e, i),
|
|
@@ -3289,32 +3375,74 @@ var R = En, Dn = /* @__PURE__ */ function(e) {
|
|
|
3289
3375
|
})(On || (On = {}));
|
|
3290
3376
|
var z = On, B = new class {
|
|
3291
3377
|
constructor() {
|
|
3292
|
-
h(this, "_conversations", /* @__PURE__ */ new Map()), h(this, "
|
|
3378
|
+
h(this, "_conversations", /* @__PURE__ */ new Map()), h(this, "_pending", /* @__PURE__ */ new Set()), h(this, "_initialIds", /* @__PURE__ */ new Map()), h(this, "_hangups", /* @__PURE__ */ new Map()), h(this, "_activeId", null), h(this, "_selected", null), h(this, "_mutex", !1), h(this, "_pendingRemovals", /* @__PURE__ */ new Map());
|
|
3379
|
+
}
|
|
3380
|
+
addPending(e) {
|
|
3381
|
+
this._pending.add(e), e.id && this._initialIds.set(e, e.id);
|
|
3382
|
+
}
|
|
3383
|
+
selectPending(e) {
|
|
3384
|
+
let t = this._selected;
|
|
3385
|
+
return this._pending.has(e) && (this._selected = e), t;
|
|
3386
|
+
}
|
|
3387
|
+
isSelected(e) {
|
|
3388
|
+
return this._selected === e;
|
|
3293
3389
|
}
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3390
|
+
releaseSelection(e, t = this.getActive()) {
|
|
3391
|
+
this._selected === e && (this._selected = t && !this._pendingRemovals.has(t) && (this.get(t.id) === t || this._pending.has(t)) ? t : null);
|
|
3392
|
+
}
|
|
3393
|
+
selectIfNone(e) {
|
|
3394
|
+
this._selected ?? (this._selected = e);
|
|
3297
3395
|
}
|
|
3298
3396
|
add(e) {
|
|
3299
3397
|
let t = e.id;
|
|
3300
|
-
if (this._conversations.has(t)) {
|
|
3301
|
-
z.warn(`CallRegistry: conversation ${t} already exists, skip duplicate add`)
|
|
3398
|
+
if (this._pending.delete(e), this._conversations.has(t)) {
|
|
3399
|
+
z.warn(`CallRegistry: conversation ${t} already exists, skip duplicate add`);
|
|
3302
3400
|
return;
|
|
3303
3401
|
}
|
|
3304
|
-
this._conversations.set(t, e)
|
|
3402
|
+
this._conversations.set(t, e);
|
|
3305
3403
|
}
|
|
3306
3404
|
remove(e) {
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3405
|
+
this._pending.delete(e), this._initialIds.delete(e), this._selected === e && (this._selected = null);
|
|
3406
|
+
let t = e.id;
|
|
3407
|
+
if (this._conversations.get(t) === e) {
|
|
3408
|
+
if (this._mutex) {
|
|
3409
|
+
this._pendingRemovals.set(e, t);
|
|
3310
3410
|
return;
|
|
3311
3411
|
}
|
|
3312
|
-
this._conversations.delete(
|
|
3412
|
+
this._conversations.delete(t), this._activeId === t && (this._activeId = null);
|
|
3313
3413
|
}
|
|
3314
3414
|
}
|
|
3315
3415
|
get(e) {
|
|
3316
3416
|
return this._conversations.get(e);
|
|
3317
3417
|
}
|
|
3418
|
+
getPending(e) {
|
|
3419
|
+
let t = Array.from(this._pending).filter((t) => e === void 0 || e !== "" && t.id === e);
|
|
3420
|
+
return t.length === 1 ? t[0] : null;
|
|
3421
|
+
}
|
|
3422
|
+
isPending(e) {
|
|
3423
|
+
return this._pending.has(e);
|
|
3424
|
+
}
|
|
3425
|
+
getLocal(e) {
|
|
3426
|
+
if (e !== void 0) {
|
|
3427
|
+
let t = this.get(e);
|
|
3428
|
+
if (t || !e) return t ?? null;
|
|
3429
|
+
let n = Array.from(this._pending).filter((t) => t.id === e);
|
|
3430
|
+
if (n.length) return n.length === 1 ? n[0] : null;
|
|
3431
|
+
let r = Array.from(this._initialIds).filter(([, t]) => t === e);
|
|
3432
|
+
return r.length === 1 ? r[0][0] : null;
|
|
3433
|
+
}
|
|
3434
|
+
return this.getActive() ?? this.getFirst() ?? this.getPending();
|
|
3435
|
+
}
|
|
3436
|
+
trackHangup(e, t) {
|
|
3437
|
+
this._hangups.set(t, [e.id, this._initialIds.get(e) ?? ""]);
|
|
3438
|
+
}
|
|
3439
|
+
getHangup(e) {
|
|
3440
|
+
let t = Array.from(this._hangups).filter(([, t]) => e === void 0 || e !== "" && t.includes(e));
|
|
3441
|
+
return e === void 0 ? t.length === 1 ? t[0][0] : void 0 : t[t.length - 1]?.[0];
|
|
3442
|
+
}
|
|
3443
|
+
removeHangup(e) {
|
|
3444
|
+
this._hangups.delete(e);
|
|
3445
|
+
}
|
|
3318
3446
|
getActive() {
|
|
3319
3447
|
return this._activeId ? this._conversations.get(this._activeId) ?? null : null;
|
|
3320
3448
|
}
|
|
@@ -3324,8 +3452,9 @@ var z = On, B = new class {
|
|
|
3324
3452
|
getActiveId() {
|
|
3325
3453
|
return this._activeId;
|
|
3326
3454
|
}
|
|
3327
|
-
has(e) {
|
|
3328
|
-
|
|
3455
|
+
has(e, t) {
|
|
3456
|
+
let n = this._conversations.get(e);
|
|
3457
|
+
return !!(n && n !== t || Array.from(this._pending).some((n) => n !== t && n.id === e) || Array.from(this._initialIds).some(([n, r]) => n !== t && r === e));
|
|
3329
3458
|
}
|
|
3330
3459
|
getAll() {
|
|
3331
3460
|
return Array.from(this._conversations.values());
|
|
@@ -3334,41 +3463,41 @@ var z = On, B = new class {
|
|
|
3334
3463
|
return this._conversations.size;
|
|
3335
3464
|
}
|
|
3336
3465
|
async setActive(e) {
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
}
|
|
3348
|
-
}
|
|
3349
|
-
this._conversations.has(e) && (this._activeId = e, R.onCallActive(e));
|
|
3350
|
-
let r = this._conversations.get(e);
|
|
3351
|
-
if (r && r?.isCallHeld) try {
|
|
3352
|
-
await r.hold(!1, n);
|
|
3466
|
+
let t = this.get(e) ?? this.getPending(e);
|
|
3467
|
+
if (!t || this._mutex) return;
|
|
3468
|
+
let n = this._selected;
|
|
3469
|
+
this._selected = t, this._mutex = !0;
|
|
3470
|
+
try {
|
|
3471
|
+
let r = this.getActive(), i;
|
|
3472
|
+
for (let e of new Set([r, n])) if (!(!e || e === t || e !== r && !this._pending.has(e))) {
|
|
3473
|
+
i ?? (i = e.mediaSettings);
|
|
3474
|
+
try {
|
|
3475
|
+
await e.hold(!0);
|
|
3353
3476
|
} catch (e) {
|
|
3354
|
-
throw z.error(`Can't hold
|
|
3477
|
+
throw z.error(`Can't hold previous active, error: ${e}`), Error("Cannot switch call: hold failed");
|
|
3355
3478
|
}
|
|
3356
|
-
} finally {
|
|
3357
|
-
this._mutex = !1, this._flushPendingRemovals();
|
|
3358
3479
|
}
|
|
3480
|
+
if (this._selected !== t || this._pendingRemovals.has(t)) return;
|
|
3481
|
+
if (this._conversations.get(e) === t && this._activeId !== e && (this._activeId = e, R.onCallActive(e)), t.isCallHeld) try {
|
|
3482
|
+
await t.hold(!1, i);
|
|
3483
|
+
} catch (e) {
|
|
3484
|
+
throw z.error(`Can't hold next active, error: ${e}`), Error("Cannot switch call: hold failed");
|
|
3485
|
+
}
|
|
3486
|
+
} finally {
|
|
3487
|
+
this._mutex = !1, this._flushPendingRemovals();
|
|
3359
3488
|
}
|
|
3360
3489
|
}
|
|
3361
3490
|
async setHold(e) {
|
|
3362
|
-
|
|
3363
|
-
|
|
3491
|
+
let t = this.get(e) ?? this.getPending(e);
|
|
3492
|
+
if (!(!t || this._activeId !== e && this._selected !== t || this._mutex)) {
|
|
3493
|
+
this._selected = null, this._mutex = !0;
|
|
3364
3494
|
try {
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
await e.hold(!0);
|
|
3495
|
+
try {
|
|
3496
|
+
await t.hold(!0);
|
|
3368
3497
|
} catch (e) {
|
|
3369
3498
|
throw z.error(`Can't hold previous active, error: ${e}`), Error("Cannot switch call: hold failed");
|
|
3370
3499
|
}
|
|
3371
|
-
this._activeId = null;
|
|
3500
|
+
this._activeId === e && (this._activeId = null);
|
|
3372
3501
|
} finally {
|
|
3373
3502
|
this._mutex = !1, this._flushPendingRemovals();
|
|
3374
3503
|
}
|
|
@@ -3378,11 +3507,11 @@ var z = On, B = new class {
|
|
|
3378
3507
|
this._activeId === e ? await this.setHold(e) : await this.setActive(e);
|
|
3379
3508
|
}
|
|
3380
3509
|
clear() {
|
|
3381
|
-
this._conversations.clear(), this.
|
|
3510
|
+
this._conversations.clear(), this._pending.clear(), this._initialIds.clear(), this._hangups.clear(), this._pendingRemovals.clear(), this._activeId = null, this._selected = null;
|
|
3382
3511
|
}
|
|
3383
3512
|
_flushPendingRemovals() {
|
|
3384
3513
|
if (this._pendingRemovals.size !== 0) {
|
|
3385
|
-
for (let e of this._pendingRemovals) this._conversations.delete(
|
|
3514
|
+
for (let [e, t] of this._pendingRemovals) this._conversations.get(t) === e && (this._conversations.delete(t), this._activeId === t && (this._activeId = null));
|
|
3386
3515
|
this._pendingRemovals.clear();
|
|
3387
3516
|
}
|
|
3388
3517
|
}
|
|
@@ -3394,7 +3523,7 @@ var z = On, B = new class {
|
|
|
3394
3523
|
constructor(e) {
|
|
3395
3524
|
super(e ? `Producer connection closed. Command ${e}` : "Producer connection closed"), this.name = "ProducerConnectionClosedError";
|
|
3396
3525
|
}
|
|
3397
|
-
}, jn = class extends
|
|
3526
|
+
}, jn = class extends Ye {
|
|
3398
3527
|
constructor(...e) {
|
|
3399
3528
|
super(...e), h(this, "_abortSignal", void 0);
|
|
3400
3529
|
}
|
|
@@ -4190,7 +4319,7 @@ var ei = class {
|
|
|
4190
4319
|
this._timer = null, this._poll();
|
|
4191
4320
|
}, this._pollIntervalMs));
|
|
4192
4321
|
}
|
|
4193
|
-
}, ti = class extends
|
|
4322
|
+
}, ti = class extends Ye {
|
|
4194
4323
|
constructor(e, t, n = null) {
|
|
4195
4324
|
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", q.IDLE), h(this, "_pc", null), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbe", null), h(this, "_firstMediaSentProbeStopped", !1), this._signaling = e, this._mediaSource = t, this._onFirstMediaSent = n;
|
|
4196
4325
|
}
|
|
@@ -4224,7 +4353,7 @@ var ei = class {
|
|
|
4224
4353
|
getValue() {
|
|
4225
4354
|
return this.value;
|
|
4226
4355
|
}
|
|
4227
|
-
}, ri = .25, ii = .35, ai = 85, oi = .1, si = 1.5, ci = .1, li = 1, ui = .6, di = .3, fi = class extends
|
|
4356
|
+
}, ri = .25, ii = .35, ai = 85, oi = .1, si = 1.5, ci = .1, li = 1, ui = .6, di = .3, fi = class extends Ye {
|
|
4228
4357
|
constructor(e, t = z) {
|
|
4229
4358
|
super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
|
|
4230
4359
|
badNet: {
|
|
@@ -4325,7 +4454,7 @@ var ei = class {
|
|
|
4325
4454
|
try {
|
|
4326
4455
|
this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
|
|
4327
4456
|
} catch (e) {
|
|
4328
|
-
this._logger?.log(
|
|
4457
|
+
this._logger?.log(x.ERROR, "addTrack-direct"), this._debug.error("Unable to add media source tracks", e, { participantId: this._participantId }), this._failedOnCreate = e;
|
|
4329
4458
|
return;
|
|
4330
4459
|
}
|
|
4331
4460
|
this._createOffer(!1).catch((e) => {
|
|
@@ -4359,7 +4488,7 @@ var ei = class {
|
|
|
4359
4488
|
if (this._debug.debug("DirectTransport: Open transport", { participantId: this._participantId }), this._isOpen = !0, this._remotePeerId = e, this._connectionStartedAt = Date.now(), !this._isMaster) try {
|
|
4360
4489
|
this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
|
|
4361
4490
|
} catch (e) {
|
|
4362
|
-
this._logger?.log(
|
|
4491
|
+
this._logger?.log(x.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
|
|
4363
4492
|
return;
|
|
4364
4493
|
}
|
|
4365
4494
|
this._startFirstMediaSentProbe(), this._setState(q.OPENED);
|
|
@@ -4472,7 +4601,7 @@ var ei = class {
|
|
|
4472
4601
|
try {
|
|
4473
4602
|
await this._pc.addIceCandidate(new RTCIceCandidate(t));
|
|
4474
4603
|
} catch (e) {
|
|
4475
|
-
throw this._logger?.log(
|
|
4604
|
+
throw this._logger?.log(x.ERROR, "addIceCandidate-direct"), this._peerConnectionStats.logIceCandidateAddFailed(t, e), this._debug.error("Unable to add remote ice candidate", e, {
|
|
4476
4605
|
participantId: this._participantId,
|
|
4477
4606
|
candidate: t
|
|
4478
4607
|
}), e;
|
|
@@ -4503,7 +4632,7 @@ var ei = class {
|
|
|
4503
4632
|
try {
|
|
4504
4633
|
await this._pc.setRemoteDescription(n), await this._setRemoteCandidates(t), this._processAnimojiProtocolVersion(this._remoteAnimojiVersion);
|
|
4505
4634
|
} catch (e) {
|
|
4506
|
-
throw this._logger?.log(
|
|
4635
|
+
throw this._logger?.log(x.ERROR, "setRemoteDescription-direct"), this._sdpStats.logSetRemoteFailed(n, e), this._debug.error("Unable to set remote description", e, {
|
|
4507
4636
|
participantId: this._participantId,
|
|
4508
4637
|
sdp: n
|
|
4509
4638
|
}), e;
|
|
@@ -4554,17 +4683,17 @@ var ei = class {
|
|
|
4554
4683
|
participantId: this._participantId,
|
|
4555
4684
|
connectionState: this._pc?.connectionState,
|
|
4556
4685
|
iceConnectionState: this._pc?.iceConnectionState
|
|
4557
|
-
}), this._logger?.log(
|
|
4686
|
+
}), this._logger?.log(x.ERROR, "iceConnectionState-fallback"), this._markConnected());
|
|
4558
4687
|
break;
|
|
4559
4688
|
}
|
|
4560
4689
|
}
|
|
4561
4690
|
_markConnected() {
|
|
4562
4691
|
this._serverRequestedOnNoConnection && (this._networkAdaptationStats.logServerTopologyRequested(Yr.SUCCESS_CONNECTION, Date.now() - this._connectionStartedAt), this._serverRequestedOnNoConnection = !1), this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
|
|
4563
|
-
e?.local && (this._logger?.log(
|
|
4692
|
+
e?.local && (this._logger?.log(x.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
|
|
4564
4693
|
}), this._startStatInterval();
|
|
4565
4694
|
}
|
|
4566
4695
|
_onConnectionStateChange() {
|
|
4567
|
-
switch (this._debug.debug(`DirectTransport: Connection state changed to ${this._pc?.connectionState}`, { participantId: this._participantId }), this._logger?.log(
|
|
4696
|
+
switch (this._debug.debug(`DirectTransport: Connection state changed to ${this._pc?.connectionState}`, { participantId: this._participantId }), this._logger?.log(x.ICE_CONNECTION_STATE, this._pc?.connectionState), this._pc?.connectionState) {
|
|
4568
4697
|
case "connected":
|
|
4569
4698
|
this._markConnected();
|
|
4570
4699
|
break;
|
|
@@ -4595,8 +4724,8 @@ var ei = class {
|
|
|
4595
4724
|
this._reconnectionTimeout && (clearTimeout(this._reconnectionTimeout), this._reconnectionTimeout = null), this._iceRestartTimeout && (clearTimeout(this._iceRestartTimeout), this._iceRestartTimeout = null);
|
|
4596
4725
|
}
|
|
4597
4726
|
_startIceRestart() {
|
|
4598
|
-
this._isMaster ? (this._peerConnectionStats.logIceRestart(), this._logger?.log(
|
|
4599
|
-
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(
|
|
4727
|
+
this._isMaster ? (this._peerConnectionStats.logIceRestart(), this._logger?.log(x.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
|
|
4728
|
+
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(x.ERROR, "iceRestart-direct"), this._requestTopologySwitch({
|
|
4600
4729
|
reason: Yr.CONNECTION_FAILED,
|
|
4601
4730
|
fromAnySide: N.switchTopologyOnReconnectFromAnySide
|
|
4602
4731
|
});
|
|
@@ -4619,7 +4748,7 @@ var ei = class {
|
|
|
4619
4748
|
offer: r
|
|
4620
4749
|
}), this._sdpStats.logSdpGenerated("offer"), r = e._patchLocalDescription(r);
|
|
4621
4750
|
} catch (e) {
|
|
4622
|
-
throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(
|
|
4751
|
+
throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(x.ERROR, "createOffer-direct"), this._sdpStats.logCreateFailed("offer", e), e;
|
|
4623
4752
|
}
|
|
4624
4753
|
try {
|
|
4625
4754
|
return this._debug.debug("Set local description", {
|
|
@@ -4627,7 +4756,7 @@ var ei = class {
|
|
|
4627
4756
|
offer: r
|
|
4628
4757
|
}), this._calcFingerprint(r.sdp), await this._pc?.setLocalDescription(r), r;
|
|
4629
4758
|
} catch (e) {
|
|
4630
|
-
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(
|
|
4759
|
+
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(x.ERROR, "setLocalDescription-direct"), this._sdpStats.logSetLocalFailed(r, e), e;
|
|
4631
4760
|
}
|
|
4632
4761
|
}
|
|
4633
4762
|
async _createAnswer() {
|
|
@@ -4639,7 +4768,7 @@ var ei = class {
|
|
|
4639
4768
|
answer: t
|
|
4640
4769
|
}), this._sdpStats.logSdpGenerated("answer"), t = e._patchLocalDescription(t);
|
|
4641
4770
|
} catch (e) {
|
|
4642
|
-
throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(
|
|
4771
|
+
throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(x.ERROR, "createAnswer-direct"), this._sdpStats.logCreateFailed("answer", e), e;
|
|
4643
4772
|
}
|
|
4644
4773
|
try {
|
|
4645
4774
|
return this._debug.debug("Set local description", {
|
|
@@ -4647,20 +4776,20 @@ var ei = class {
|
|
|
4647
4776
|
answer: t
|
|
4648
4777
|
}), this._calcFingerprint(t.sdp), await this._pc?.setLocalDescription(t), t;
|
|
4649
4778
|
} catch (e) {
|
|
4650
|
-
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(
|
|
4779
|
+
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(x.ERROR, "setLocalDescription-direct"), this._sdpStats.logSetLocalFailed(t, e), e;
|
|
4651
4780
|
}
|
|
4652
4781
|
}
|
|
4653
4782
|
static _patchLocalDescription(e) {
|
|
4654
|
-
let t = !!
|
|
4655
|
-
return e.sdp = M.patchLocalSDP(e.sdp, N.preferH264 &&
|
|
4783
|
+
let t = !!C.baseChromeVersion();
|
|
4784
|
+
return e.sdp = M.patchLocalSDP(e.sdp, N.preferH264 && C.canPreferH264(), C.isBrokenH264Decoder(), N.preferVP9, t && N.audioNack), e;
|
|
4656
4785
|
}
|
|
4657
4786
|
static _patchRemoteDescription(e) {
|
|
4658
|
-
return e.sdp = M.patchRemoteSDP(e.sdp, !1, !1, N.preferVP9,
|
|
4787
|
+
return e.sdp = M.patchRemoteSDP(e.sdp, !1, !1, N.preferVP9, C.isBrokenVP9Encoder() || N.simulcast, C.isBrokenVP9Decoder()), e;
|
|
4659
4788
|
}
|
|
4660
4789
|
_onReplacedTrack(e) {
|
|
4661
4790
|
this._pc && (this._pc.getSenders().forEach((t) => {
|
|
4662
4791
|
t.track && t.track.kind === e.kind && t.track.contentHint === e.contentHint && t.replaceTrack(e).catch((e) => {
|
|
4663
|
-
this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(
|
|
4792
|
+
this._debug.error("DirectTransport: Unable to replace track", e, { participantId: this._participantId }), this._logger?.log(x.ERROR, "replaceTrack-direct");
|
|
4664
4793
|
});
|
|
4665
4794
|
}), this._applySettings());
|
|
4666
4795
|
}
|
|
@@ -5016,7 +5145,7 @@ var bi = class {
|
|
|
5016
5145
|
this._debug.debug(e.data.message);
|
|
5017
5146
|
break;
|
|
5018
5147
|
case xi.LOG_ERROR:
|
|
5019
|
-
this._logger?.log(
|
|
5148
|
+
this._logger?.log(x.ERROR, e.data.message);
|
|
5020
5149
|
break;
|
|
5021
5150
|
}
|
|
5022
5151
|
}, this._sendToWorker(xi.INIT, r, i);
|
|
@@ -5087,7 +5216,7 @@ var bi = class {
|
|
|
5087
5216
|
this._removeWorker(), this._debug.debug("WebCodecsDecoder destroyed");
|
|
5088
5217
|
}
|
|
5089
5218
|
static isBrowserSupported() {
|
|
5090
|
-
return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !
|
|
5219
|
+
return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !C.isBrokenVP9Decoder() && C.browserName() !== "Firefox";
|
|
5091
5220
|
}
|
|
5092
5221
|
}, Ti = class {
|
|
5093
5222
|
constructor(e = null, t = 0) {
|
|
@@ -5242,7 +5371,7 @@ var bi = class {
|
|
|
5242
5371
|
this._removeStream(), this._debug.debug("CanvasRenderer destroyed");
|
|
5243
5372
|
}
|
|
5244
5373
|
static isBrowserSupported() {
|
|
5245
|
-
return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(
|
|
5374
|
+
return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(C.browserName() === "Safari" && Number(C.browserVersion()) === 15);
|
|
5246
5375
|
}
|
|
5247
5376
|
}, Mi = class extends Ai {
|
|
5248
5377
|
constructor(e, t = z) {
|
|
@@ -6072,7 +6201,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6072
6201
|
this._debug.error("SimulcastSender: Failed to sync replaced track", e);
|
|
6073
6202
|
});
|
|
6074
6203
|
}).catch((e) => {
|
|
6075
|
-
this._debug.error("SimulcastSender: Unable to replace track", e), this._logger?.log(
|
|
6204
|
+
this._debug.error("SimulcastSender: Unable to replace track", e), this._logger?.log(x.ERROR, "replaceTrack-single");
|
|
6076
6205
|
}), !0;
|
|
6077
6206
|
}
|
|
6078
6207
|
reset() {
|
|
@@ -6227,7 +6356,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6227
6356
|
try {
|
|
6228
6357
|
this._mediaSource.addTrackToPeerConnection(this._pc, this._observer, !1), this._prevConsumerSettings = {}, this._prevConsumerFastSharingSettings = {}, this._applyConsumerSettings();
|
|
6229
6358
|
} catch (e) {
|
|
6230
|
-
this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(
|
|
6359
|
+
this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(x.ERROR, "addTrack-single"), this.close(e);
|
|
6231
6360
|
return;
|
|
6232
6361
|
}
|
|
6233
6362
|
this._startFirstMediaSentProbe(), this._createDataChannel(this._pc, Rr.consumerScreenShare, (e) => {
|
|
@@ -6408,26 +6537,26 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6408
6537
|
try {
|
|
6409
6538
|
await this._pc.setRemoteDescription(e);
|
|
6410
6539
|
} catch (t) {
|
|
6411
|
-
throw this._debug.error("[single] unable to set remote offer", t), this._logger?.log(
|
|
6540
|
+
throw this._debug.error("[single] unable to set remote offer", t), this._logger?.log(x.ERROR, "setRemoteDescription-single"), this._sdpStats.logSetRemoteFailed(e, t), t;
|
|
6412
6541
|
}
|
|
6413
6542
|
if (await this._simulcast.configureFromRemoteOffer(this._pc), await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
|
|
6414
6543
|
let n;
|
|
6415
6544
|
try {
|
|
6416
6545
|
n = await this._pc.createAnswer(), this._sdpStats.logSdpGenerated("answer");
|
|
6417
6546
|
} catch (e) {
|
|
6418
|
-
throw this._debug.error("[single] unable to create answer", e), this._logger?.log(
|
|
6547
|
+
throw this._debug.error("[single] unable to create answer", e), this._logger?.log(x.ERROR, "createAnswer-single"), this._sdpStats.logCreateFailed("answer", e), e;
|
|
6419
6548
|
}
|
|
6420
6549
|
try {
|
|
6421
6550
|
if (!this._pc) throw Error("Interrupt allocation");
|
|
6422
|
-
n.sdp = M.patchLocalSDP(n.sdp, !1,
|
|
6551
|
+
n.sdp = M.patchLocalSDP(n.sdp, !1, C.isBrokenH264Decoder(), !1), this._debug.debug("[single] set local answer", { answer: n }), await this._pc.setLocalDescription(n);
|
|
6423
6552
|
} catch (e) {
|
|
6424
|
-
throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(
|
|
6553
|
+
throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(x.ERROR, "setLocalDescription-single"), this._sdpStats.logSetLocalFailed(n, e), e;
|
|
6425
6554
|
}
|
|
6426
6555
|
n.sdp = this._simulcast.finalizeAnswer(n.sdp);
|
|
6427
6556
|
try {
|
|
6428
6557
|
this._debug.debug("[single] transmit local answer", { answer: n }), this._updateSSRCMap(e), await this._signaling.acceptProducer(n, Object.keys(this._ssrcMap), t), this._debug.debug("[single] remote offer has been processed");
|
|
6429
6558
|
} catch (e) {
|
|
6430
|
-
this._debug.warn("[single] unable to send local answer", e), this._logger?.log(
|
|
6559
|
+
this._debug.warn("[single] unable to send local answer", e), this._logger?.log(x.ERROR, "acceptProducer");
|
|
6431
6560
|
}
|
|
6432
6561
|
await this._simulcast.sync({ force: !0 });
|
|
6433
6562
|
}
|
|
@@ -6439,7 +6568,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6439
6568
|
this._producerOfferIsProcessing = !0;
|
|
6440
6569
|
let n = {
|
|
6441
6570
|
type: "offer",
|
|
6442
|
-
sdp: M.patchRemoteSDP(e, !1, !1, !1,
|
|
6571
|
+
sdp: M.patchRemoteSDP(e, !1, !1, !1, C.isBrokenVP9Encoder() || N.simulcast, C.isBrokenVP9Decoder())
|
|
6443
6572
|
};
|
|
6444
6573
|
if (this._debug.debug("[single] set remote offer", { offer: n }), !this._pc) throw Error("Interrupt allocation");
|
|
6445
6574
|
try {
|
|
@@ -6478,7 +6607,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6478
6607
|
try {
|
|
6479
6608
|
e.direction = "sendonly", await e.sender.replaceTrack(this._newAudioShareTrack), this._newAudioShareTrack = null;
|
|
6480
6609
|
} catch (e) {
|
|
6481
|
-
this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(
|
|
6610
|
+
this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(x.ERROR, "replaceTrack-single");
|
|
6482
6611
|
}
|
|
6483
6612
|
}
|
|
6484
6613
|
async _handleScreenShareTrack() {
|
|
@@ -6522,13 +6651,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6522
6651
|
}), n.getTracks().find((e) => e.id === t.track.id) || (this._debug.warn("[single] remote track missing from stream, re-adding", {
|
|
6523
6652
|
streamId: n.id,
|
|
6524
6653
|
trackId: t.track.id
|
|
6525
|
-
}), this._logger?.log(
|
|
6654
|
+
}), this._logger?.log(x.ERROR, "ontrack-empty-stream"), n.addTrack(t.track)), this._rtpReceiversByStreamId[n.id] = t.receiver, this._triggerEvent(Y.REMOTE_TRACK_ADDED, n.id, n, t.track)) : this._debug.error("[single] unable to get media stream from track event");
|
|
6526
6655
|
}
|
|
6527
6656
|
_onSignalingStateChange(e, t) {
|
|
6528
6657
|
this._debug.debug("[single] signaling state changed", { state: e.signalingState }, t);
|
|
6529
6658
|
}
|
|
6530
6659
|
_onConnectionStateChange(e, t) {
|
|
6531
|
-
switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(
|
|
6660
|
+
switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(x.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
|
|
6532
6661
|
case "failed":
|
|
6533
6662
|
this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection failed")) : this._reconnect(!0);
|
|
6534
6663
|
break;
|
|
@@ -6541,7 +6670,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6541
6670
|
break;
|
|
6542
6671
|
case "connected":
|
|
6543
6672
|
this._setState(q.CONNECTED), M.getPeerConnectionHostInfo(e).then((e) => {
|
|
6544
|
-
e?.local && (this._logger?.log(
|
|
6673
|
+
e?.local && (this._logger?.log(x.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
|
|
6545
6674
|
});
|
|
6546
6675
|
break;
|
|
6547
6676
|
}
|
|
@@ -6551,7 +6680,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6551
6680
|
this._debug.debug(`_onReplacedTrack: newTrack=${e}, sendTrack=${t}`), t && (e = t);
|
|
6552
6681
|
let n = (e, t) => {
|
|
6553
6682
|
e.replaceTrack(t).catch((e) => {
|
|
6554
|
-
this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(
|
|
6683
|
+
this._debug.error("ServerTransport: Unable to replace track", e), this._logger?.log(x.ERROR, "replaceTrack-single");
|
|
6555
6684
|
});
|
|
6556
6685
|
};
|
|
6557
6686
|
if (this._debug.log(`_onReplacedTrack: newTrack=${e.getSettings().width}x${e.getSettings().height}`), !this._simulcast.replaceTrack(e)) {
|
|
@@ -6565,14 +6694,14 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6565
6694
|
e === A.screen && N.consumerFastScreenShare && this._mediaSource.mediaSettings.isFastScreenSharingEnabled && await this._replaceScreenShareTrack(), this._applyConsumerSettings();
|
|
6566
6695
|
}
|
|
6567
6696
|
getStreamWaitingTimeMs(e, t) {
|
|
6568
|
-
if (!this._pc) return this._logger?.log(
|
|
6569
|
-
if (!RTCRtpReceiver.prototype.getSynchronizationSources) return this._logger?.log(
|
|
6697
|
+
if (!this._pc) return this._logger?.log(x.PAT_WAITING_TIME_ERROR, "noConnection"), this._debug.error("Cannot get stream waiting time, peer connection is not initialized"), 0;
|
|
6698
|
+
if (!RTCRtpReceiver.prototype.getSynchronizationSources) return this._logger?.log(x.PAT_WAITING_TIME_ERROR, "oldBrowser"), this._debug.error("Cannot get stream waiting time, RTCRtpReceiver.getSynchronizationSources is not supported"), 0;
|
|
6570
6699
|
let n = this._rtpReceiversByStreamId[e];
|
|
6571
|
-
if (!n) return this._logger?.log(
|
|
6700
|
+
if (!n) return this._logger?.log(x.PAT_WAITING_TIME_ERROR, "noReceiver"), this._debug.error(`Cannot get stream waiting time, cannot find RTP receiver by stream ID: ${e}`), 0;
|
|
6572
6701
|
let r = n.getSynchronizationSources();
|
|
6573
6702
|
if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
|
|
6574
6703
|
let i = r[0].rtpTimestamp;
|
|
6575
|
-
if (!Number.isInteger(i)) return this._logger?.log(
|
|
6704
|
+
if (!Number.isInteger(i)) return this._logger?.log(x.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
|
|
6576
6705
|
let a = t - i & Aa, o = Math.ceil(a / ka);
|
|
6577
6706
|
return Math.min(100, Math.max(0, o));
|
|
6578
6707
|
}
|
|
@@ -6608,7 +6737,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6608
6737
|
}
|
|
6609
6738
|
}, Y = /* @__PURE__ */ function(e) {
|
|
6610
6739
|
return e.REMOTE_TRACK_ADDED = "REMOTE_TRACK_ADDED", e.REMOTE_TRACK_REMOVED = "REMOTE_TRACK_REMOVED", e.REMOTE_STREAM_SECOND = "REMOTE_STREAM_SECOND", e.AUDIO_MIX_STALL = "AUDIO_MIX_STALL", e.REMOTE_DATA_STATS = "REMOTE_DATA_STATS", e.STATE_CHANGED = "STATE_CHANGED", e.LOCAL_STATE_CHANGED = "LOCAL_STATE_CHANGED", e.SIGNALLED_ACTIVE_PARTICIPANTS = "SIGNALLED_ACTIVE_PARTICIPANTS", e.SIGNALLED_SPEAKER_CHANGED = "SIGNALLED_SPEAKER_CHANGED", e.SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS", e.TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED", e.NETWORK_STATUS = "NETWORK_STATUS", e.PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED", e.ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION", e.ANIMOJI_STREAM = "ANIMOJI_STREAM", e.ANIMOJI_ERROR = "ANIMOJI_ERROR", e.SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT", e;
|
|
6611
|
-
}({}), Ma = class extends
|
|
6740
|
+
}({}), Ma = class extends Ye {
|
|
6612
6741
|
constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
|
|
6613
6742
|
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_pendingServerAudio", /* @__PURE__ */ new Map()), h(this, "_serverAudioController", new AbortController()), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "_vadController", null), h(this, "_updateVadTrack", () => {
|
|
6614
6743
|
this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
|
|
@@ -6710,7 +6839,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6710
6839
|
}
|
|
6711
6840
|
_onTopologyChanged(e) {
|
|
6712
6841
|
if (e.topology !== this._topology) {
|
|
6713
|
-
if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(
|
|
6842
|
+
if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && this._serverTransport.open())), this._topology === J.DIRECT) {
|
|
6714
6843
|
let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? M.composeParticipantId(t[0], n[0], r[0]) : null;
|
|
6715
6844
|
if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
|
|
6716
6845
|
this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
|
|
@@ -6852,9 +6981,9 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6852
6981
|
this._animojiSender?.destroy(), this._animojiSender = null, this._animojiReceiver?.destroy(), this._animojiReceiver = null;
|
|
6853
6982
|
}
|
|
6854
6983
|
getStreamWaitingTimeMs(e, t) {
|
|
6855
|
-
return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(
|
|
6984
|
+
return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(x.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(x.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
|
|
6856
6985
|
}
|
|
6857
|
-
}, Na = "videochat-epi", Pa = 32767, Fa = 1e4, Ia = 5e3, La = 500, Ra = 6e4, za = 1e4, Ba = 1e3, Va = 3e5, Ha = class extends
|
|
6986
|
+
}, Na = "videochat-epi", Pa = 32767, Fa = 1e4, Ia = 5e3, La = 500, Ra = 6e4, za = 1e4, Ba = 1e3, Va = 3e5, Ha = class extends Ye {
|
|
6858
6987
|
constructor(e, t, n = null, r = !1, i = z) {
|
|
6859
6988
|
super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCounters", /* @__PURE__ */ new Map()), h(this, "_previousRemoteInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousOutboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousCandidatePair", null), h(this, "_screenShareStats", []), h(this, "_signaling", void 0), h(this, "_directTopology", void 0), h(this, "_debug", void 0), h(this, "_statAggregator", void 0), h(this, "_handleScreenSharingStat", (e) => {
|
|
6860
6989
|
this._screenShareStats.push(e);
|
|
@@ -7250,7 +7379,7 @@ var Ja = qa, Ya = {
|
|
|
7250
7379
|
}
|
|
7251
7380
|
}, ao = class {
|
|
7252
7381
|
static isBrowserSupported() {
|
|
7253
|
-
return !(!("WebTransport" in window && typeof WebTransport == "function") ||
|
|
7382
|
+
return !(!("WebTransport" in window && typeof WebTransport == "function") || C.browserName() === "Safari");
|
|
7254
7383
|
}
|
|
7255
7384
|
constructor(e, t = {}, n = z) {
|
|
7256
7385
|
h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new ro(this.compression), this.decoder = new io(this.compression), this.connect();
|
|
@@ -7612,7 +7741,7 @@ var ho = new Set([
|
|
|
7612
7741
|
async connect(e) {
|
|
7613
7742
|
return new Promise((t, n) => {
|
|
7614
7743
|
if (this.transport.readyState !== null && this.transport.readyState < WebSocket.CLOSING) {
|
|
7615
|
-
this._logger?.log(
|
|
7744
|
+
this._logger?.log(x.SOCKET_ACTION, "already_opened"), n(Error("Socket already opened"));
|
|
7616
7745
|
return;
|
|
7617
7746
|
}
|
|
7618
7747
|
this.conversationResolve = (e) => {
|
|
@@ -7894,10 +8023,10 @@ var ho = new Set([
|
|
|
7894
8023
|
break;
|
|
7895
8024
|
case "websocket":
|
|
7896
8025
|
if (this.transport.readyState === null) {
|
|
7897
|
-
this._logger?.log(
|
|
8026
|
+
this._logger?.log(x.SOCKET_ACTION, "not_opened"), this._debug.warn("[signaling] socket is not opened"), t.reject(/* @__PURE__ */ Error(`Socket not opened [${e}]`), !0);
|
|
7898
8027
|
return;
|
|
7899
8028
|
}
|
|
7900
|
-
this.transport.readyState > WebSocket.OPEN && (this._logger?.log(
|
|
8029
|
+
this.transport.readyState > WebSocket.OPEN && (this._logger?.log(x.SOCKET_ACTION, "invalid_state"), this._debug.warn(`[signaling] socket is not opened, state ${this.transport.readyState}`)), this.websocketCommandsQueue.push(t), this.transport.readyState === WebSocket.OPEN && this._handleCommandsQueue(this.websocketCommandsQueue);
|
|
7901
8030
|
}
|
|
7902
8031
|
};
|
|
7903
8032
|
return new Promise((a, o) => {
|
|
@@ -7923,7 +8052,7 @@ var ho = new Set([
|
|
|
7923
8052
|
return this.producerCommandDataChannelEnabled ? e === V.UPDATE_DISPLAY_LAYOUT || e === V.REPORT_PERF_STAT || e === V.REPORT_SHARING_STAT || e === V.REQUEST_ASR || e === V.ENABLE_VIDEO_SUSPEND || e === V.ENABLE_VIDEO_SUSPEND_SUGGEST || e === V.REPORT_NETWORK_STAT || e === V.CHANGE_SIMULCAST : !1;
|
|
7924
8053
|
}
|
|
7925
8054
|
_onOpen() {
|
|
7926
|
-
this._debug.debug("[signaling] socket opened"), this._logger?.log(
|
|
8055
|
+
this._debug.debug("[signaling] socket opened"), this._logger?.log(x.SOCKET_ACTION, "opened"), this._waitConnectionMessage(), this._logTransportStatSinceMark(this.connectionType === Cr.RETRY ? Er.RECONNECTED : Er.CONNECTED);
|
|
7927
8056
|
}
|
|
7928
8057
|
_onMessage(e) {
|
|
7929
8058
|
if (e.data === "ping") {
|
|
@@ -7934,7 +8063,7 @@ var ho = new Set([
|
|
|
7934
8063
|
let t = JSON.parse(e.data);
|
|
7935
8064
|
R.onSignalingMessage(t), this._handleMessage(t);
|
|
7936
8065
|
} catch (t) {
|
|
7937
|
-
this._logger?.log(
|
|
8066
|
+
this._logger?.log(x.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", t, e.data);
|
|
7938
8067
|
}
|
|
7939
8068
|
}
|
|
7940
8069
|
_handleMessage(e) {
|
|
@@ -7954,12 +8083,12 @@ var ho = new Set([
|
|
|
7954
8083
|
case "error":
|
|
7955
8084
|
this._handleErrorMessage(e);
|
|
7956
8085
|
break;
|
|
7957
|
-
default: this._logger?.log(
|
|
8086
|
+
default: this._logger?.log(x.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
|
|
7958
8087
|
}
|
|
7959
8088
|
e.stamp && (this.lastStamp = e.stamp, this.transport.setLastStamp(e.stamp));
|
|
7960
8089
|
}
|
|
7961
8090
|
_handleErrorMessage(e) {
|
|
7962
|
-
this._logger?.log(
|
|
8091
|
+
this._logger?.log(x.SOCKET_ACTION, `error-${e.error}`);
|
|
7963
8092
|
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = mo(e, "Unknown signaling error");
|
|
7964
8093
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
7965
8094
|
case fo.SERVICE_UNAVAILABLE:
|
|
@@ -7975,7 +8104,7 @@ var ho = new Set([
|
|
|
7975
8104
|
});
|
|
7976
8105
|
break;
|
|
7977
8106
|
case fo.CONVERSATION_ENDED:
|
|
7978
|
-
this.conversationReject ? this.conversationReject(new k(e.reason ||
|
|
8107
|
+
this.conversationReject ? this.conversationReject(new k(e.reason || y.SIGNALING_FAILED, {
|
|
7979
8108
|
callError: n,
|
|
7980
8109
|
message: r,
|
|
7981
8110
|
remote: !0
|
|
@@ -7987,7 +8116,7 @@ var ho = new Set([
|
|
|
7987
8116
|
break;
|
|
7988
8117
|
case fo.ILLEGAL_PARTICIPANT_STATE:
|
|
7989
8118
|
case fo.PARTICIPANT_NOT_FOUND:
|
|
7990
|
-
this._throwError(new k(
|
|
8119
|
+
this._throwError(new k(y.SIGNALING_FAILED, {
|
|
7991
8120
|
callError: n,
|
|
7992
8121
|
message: r,
|
|
7993
8122
|
remote: !0
|
|
@@ -8003,7 +8132,7 @@ var ho = new Set([
|
|
|
8003
8132
|
case fo.INVALID_TOKEN:
|
|
8004
8133
|
default:
|
|
8005
8134
|
if (e.sequence || t === Tr.WEBTRANSPORT) break;
|
|
8006
|
-
if (this.connected) this._throwError(new k(e.reason ||
|
|
8135
|
+
if (this.connected) this._throwError(new k(e.reason || y.SIGNALING_FAILED, {
|
|
8007
8136
|
callError: n ?? {
|
|
8008
8137
|
scope: "unknown",
|
|
8009
8138
|
description: "signaling-unrecognized-error"
|
|
@@ -8012,7 +8141,7 @@ var ho = new Set([
|
|
|
8012
8141
|
remote: !0
|
|
8013
8142
|
}));
|
|
8014
8143
|
else if (!e.sequence) {
|
|
8015
|
-
let t = new k(e.reason ||
|
|
8144
|
+
let t = new k(e.reason || y.SIGNALING_FAILED, {
|
|
8016
8145
|
callError: n ?? {
|
|
8017
8146
|
scope: "unknown",
|
|
8018
8147
|
description: "signaling-unrecognized-error"
|
|
@@ -8035,14 +8164,14 @@ var ho = new Set([
|
|
|
8035
8164
|
this._triggerEvent(wr.FAILED, e);
|
|
8036
8165
|
}
|
|
8037
8166
|
_onError(e) {
|
|
8038
|
-
this._logger?.log(
|
|
8167
|
+
this._logger?.log(x.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(Er.FAILED_EXCEPTIONS, { string_value: this._describeErrorEvent(e) });
|
|
8039
8168
|
}
|
|
8040
8169
|
_describeErrorEvent(e) {
|
|
8041
8170
|
let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
|
|
8042
8171
|
return (i ? `${i}: ${r}` : r).slice(0, lo);
|
|
8043
8172
|
}
|
|
8044
8173
|
_onClose(e) {
|
|
8045
|
-
this._logger?.log(
|
|
8174
|
+
this._logger?.log(x.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
|
|
8046
8175
|
code: e.code,
|
|
8047
8176
|
reason: e.reason
|
|
8048
8177
|
}), this.connected = !1;
|
|
@@ -8094,7 +8223,7 @@ var ho = new Set([
|
|
|
8094
8223
|
let r = this.responseHandlers[n.sequence];
|
|
8095
8224
|
window.clearTimeout(r.responseTimer);
|
|
8096
8225
|
let i = G.measureMark(r.statMarkName);
|
|
8097
|
-
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(
|
|
8226
|
+
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-error"), r.reject(Error(mo(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-timeout"), r.reject(Error(mo(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
8098
8227
|
}
|
|
8099
8228
|
_handleCommandsQueue(e) {
|
|
8100
8229
|
for (; e.length > 0;) {
|
|
@@ -8164,7 +8293,7 @@ var ho = new Set([
|
|
|
8164
8293
|
_waitConnectionMessage() {
|
|
8165
8294
|
let t = this._getSocketType();
|
|
8166
8295
|
this.connectionMessageWaitTimer = window.setTimeout(() => {
|
|
8167
|
-
this.conversationReject && this.conversationReject(new k(
|
|
8296
|
+
this.conversationReject && this.conversationReject(new k(y.SIGNALING_FAILED, {
|
|
8168
8297
|
callError: {
|
|
8169
8298
|
scope: "network",
|
|
8170
8299
|
source: t,
|
|
@@ -8186,7 +8315,7 @@ var ho = new Set([
|
|
|
8186
8315
|
_onTransportFailed(e) {
|
|
8187
8316
|
switch (e.failure) {
|
|
8188
8317
|
case oo.EMPTY_ENDPOINT:
|
|
8189
|
-
this.conversationReject?.(new k(
|
|
8318
|
+
this.conversationReject?.(new k(y.SIGNALING_FAILED, {
|
|
8190
8319
|
callError: {
|
|
8191
8320
|
scope: "internal",
|
|
8192
8321
|
code: "configuration",
|
|
@@ -8218,7 +8347,7 @@ var ho = new Set([
|
|
|
8218
8347
|
}
|
|
8219
8348
|
}
|
|
8220
8349
|
_onTransportReconnectScheduled(e) {
|
|
8221
|
-
this.connectionType = Cr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(
|
|
8350
|
+
this.connectionType = Cr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(x.SOCKET_ACTION, "reconnect"), e.count === 1 && (this.reconnectStartedAt = performance.now());
|
|
8222
8351
|
}
|
|
8223
8352
|
_logReconnectTimeout() {
|
|
8224
8353
|
this.reconnectStartedAt !== null && (this._logTransportStat(Er.TIMEOUT, { value: Math.round(performance.now() - this.reconnectStartedAt) }), this.reconnectStartedAt = null);
|
|
@@ -8452,10 +8581,10 @@ function Io(e) {
|
|
|
8452
8581
|
}
|
|
8453
8582
|
function Lo(e, t) {
|
|
8454
8583
|
switch (e) {
|
|
8455
|
-
case
|
|
8456
|
-
case
|
|
8457
|
-
case
|
|
8458
|
-
case
|
|
8584
|
+
case b.AUDIO: return !!t.isAudioEnabled;
|
|
8585
|
+
case b.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
|
|
8586
|
+
case b.VIDEO: return !!t.isVideoEnabled;
|
|
8587
|
+
case b.SCREEN_SHARING: return !!t.isFastScreenSharingEnabled || !!t.isScreenSharingEnabled;
|
|
8459
8588
|
default: return !1;
|
|
8460
8589
|
}
|
|
8461
8590
|
}
|
|
@@ -8561,10 +8690,10 @@ var Go = class {
|
|
|
8561
8690
|
_fixAudioDeviceNoPackets(e) {
|
|
8562
8691
|
if (!(this._fixNoPacketsApplied && this._fixNoPacketsChecked)) {
|
|
8563
8692
|
if (this._fixNoPacketsApplied && !this._fixNoPacketsChecked) {
|
|
8564
|
-
this._fixNoPacketsChecked = !0, this._logger?.log(
|
|
8693
|
+
this._fixNoPacketsChecked = !0, this._logger?.log(x.ERROR, `audio_device_recover_${e.bandwidth ? "success" : "fail"}`);
|
|
8565
8694
|
return;
|
|
8566
8695
|
}
|
|
8567
|
-
!this._fixNoPacketsApplied && !e.bandwidth && e.packetsSent > 0 && (this._fixNoPacketsApplied = !0, this._logger?.log(
|
|
8696
|
+
!this._fixNoPacketsApplied && !e.bandwidth && e.packetsSent > 0 && (this._fixNoPacketsApplied = !0, this._logger?.log(x.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (no packets)"), this._toggleAudioPromise = this._mediaSource.toggleAudio(E.getMicrophonePermissionState() !== "denied"), this._toggleAudioPromise.catch(() => void 0));
|
|
8568
8697
|
}
|
|
8569
8698
|
}
|
|
8570
8699
|
_fixAudioDeviceTooManyPackets(e) {
|
|
@@ -8573,7 +8702,7 @@ var Go = class {
|
|
|
8573
8702
|
if (!this._lastPacketsSentTime) e.packetsSent > 0 && (this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent);
|
|
8574
8703
|
else if (t - this._lastPacketsSentTime > 500) {
|
|
8575
8704
|
let n = (e.packetsSent - this._lastPacketsSent) * 1e3 / (t - this._lastPacketsSentTime);
|
|
8576
|
-
this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent, this._fixTooManyPacketsApplied ? n > 75 ? (this._debug.log("[AudioFix] Failed to fix RV"), this._logger?.log(
|
|
8705
|
+
this._lastPacketsSentTime = t, this._lastPacketsSent = e.packetsSent, this._fixTooManyPacketsApplied ? n > 75 ? (this._debug.log("[AudioFix] Failed to fix RV"), this._logger?.log(x.ERROR, "audio_device_recover_rv_fail"), this._fixTooManyPacketsFailed = !0) : t - this._fixTooManyPacketsTime > 6e4 && (this._debug.log("[AudioFix] Fixed RV"), this._logger?.log(x.ERROR, "audio_device_recover_rv_success"), this._fixTooManyPacketsSucceeded = !0) : n > 75 && (this._fixTooManyPacketsApplied = !0, this._logger?.log(x.ERROR, "audio_device_recover"), this._debug.log("[AudioFix] Trying to fix RV (too many packets)"), this._mediaSource.toggleAudio(!0).catch((e) => {
|
|
8577
8706
|
this._debug.warn("[AudioFix] Failed to fix RV (too many packets)", e);
|
|
8578
8707
|
}), this._fixTooManyPacketsTime = t);
|
|
8579
8708
|
}
|
|
@@ -8594,7 +8723,7 @@ var Go = class {
|
|
|
8594
8723
|
}
|
|
8595
8724
|
}, Ko = class {
|
|
8596
8725
|
constructor(e, t = !1, n = z, r = null) {
|
|
8597
|
-
h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), h(this, "_autoplayRecoveryController", null), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
|
|
8726
|
+
h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), h(this, "_autoplayRecoveryController", null), h(this, "_refreshAudioElement", null), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
|
|
8598
8727
|
}
|
|
8599
8728
|
add(e, t, n = !1) {
|
|
8600
8729
|
if (n || !this._allowMultipleTracks) {
|
|
@@ -8602,7 +8731,7 @@ var Go = class {
|
|
|
8602
8731
|
t.enabled = !1, this._addTrackToAudioElement(t), this._clearTracks(t), t.enabled = e;
|
|
8603
8732
|
}
|
|
8604
8733
|
let r = this._audioTracks.get(e);
|
|
8605
|
-
r && r !== t && (this._removeTrackFromAudioElement(r), r.stop()), this._audioTracks.set(e, t), this._audioElement ? this._addTrackToAudioElement(t) : this._initAudioElement();
|
|
8734
|
+
r && r !== t && (this._removeTrackFromAudioElement(r), r.stop()), this._audioTracks.set(e, t), this._audioElement ? r !== t && this._audioTracks.size > 1 ? this._refreshAudioElement?.() : this._addTrackToAudioElement(t) : this._initAudioElement();
|
|
8606
8735
|
}
|
|
8607
8736
|
remove(e, t) {
|
|
8608
8737
|
let n = this._audioTracks.get(e);
|
|
@@ -8636,7 +8765,7 @@ var Go = class {
|
|
|
8636
8765
|
let e = E.getSavedOutput();
|
|
8637
8766
|
e && (await this._audioElement.setSinkId?.(e.deviceId), this._debug.debug("[audio] Output device changed", e));
|
|
8638
8767
|
} catch (e) {
|
|
8639
|
-
throw this._logger?.log(
|
|
8768
|
+
throw this._logger?.log(x.ERROR, "change_output"), this._debug.error("[audio] Output change failed", e), e;
|
|
8640
8769
|
}
|
|
8641
8770
|
}
|
|
8642
8771
|
_getTracks() {
|
|
@@ -8648,10 +8777,10 @@ var Go = class {
|
|
|
8648
8777
|
if (!e.length) return;
|
|
8649
8778
|
let t = this._preparedAudioElement ?? this._prepareAudioElement() ?? this._createAudioElement();
|
|
8650
8779
|
t.muted = !1, t.volume = this._volume, t.preload = "auto";
|
|
8651
|
-
let n = () => {
|
|
8652
|
-
this._audioElement === t && this._stopAutoplayRecovery();
|
|
8653
|
-
}, r = (e) => {
|
|
8654
|
-
if (this._audioElement
|
|
8780
|
+
let n = (e) => {
|
|
8781
|
+
this._audioElement === t && t.srcObject === e && this._stopAutoplayRecovery();
|
|
8782
|
+
}, r = (e, n) => {
|
|
8783
|
+
if (!(this._audioElement !== t || t.srcObject !== n)) {
|
|
8655
8784
|
if (this._debug.warn("[audio] Error on play audio", e), e?.name === "NotAllowedError" && !this._autoplayRecoveryController) {
|
|
8656
8785
|
this._autoplayRecoveryController = new AbortController();
|
|
8657
8786
|
for (let e of [
|
|
@@ -8666,7 +8795,8 @@ var Go = class {
|
|
|
8666
8795
|
R.onAutoplayError();
|
|
8667
8796
|
}
|
|
8668
8797
|
}, i = () => {
|
|
8669
|
-
t.
|
|
8798
|
+
let e = t.srcObject;
|
|
8799
|
+
t.play()?.then(() => n(e), (t) => r(t, e));
|
|
8670
8800
|
}, a = (e) => {
|
|
8671
8801
|
this._debug.debug("[audio] Play audio"), t.srcObject = null, t.srcObject = new MediaStream(e), t.load(), i();
|
|
8672
8802
|
}, o = () => {
|
|
@@ -8676,7 +8806,9 @@ var Go = class {
|
|
|
8676
8806
|
};
|
|
8677
8807
|
t.onpause = o, t.onstalled = o, t.onerror = o, t.onloadeddata = () => {
|
|
8678
8808
|
this._statFirstMediaReceived.measure();
|
|
8679
|
-
}, this._audioElement = t,
|
|
8809
|
+
}, this._audioElement = t, this._refreshAudioElement = () => {
|
|
8810
|
+
t.srcObject = new MediaStream(this._getTracks()), i();
|
|
8811
|
+
}, a(e);
|
|
8680
8812
|
let s = E.getChosenOutput();
|
|
8681
8813
|
s ? t.setSinkId?.(s.deviceId).then(() => {
|
|
8682
8814
|
this._debug.debug("[audio] Output device", s);
|
|
@@ -8685,18 +8817,18 @@ var Go = class {
|
|
|
8685
8817
|
}) : this._debug.debug("[audio] Output device: system default");
|
|
8686
8818
|
}
|
|
8687
8819
|
_stopAudioElement() {
|
|
8688
|
-
this._stopAutoplayRecovery(), this._audioElement && (this._audioElement.onpause = null, this._audioElement.onstalled = null, this._audioElement.onerror = null, this._audioElement.onloadeddata = null, this._audioElement.pause(), this._audioElement.srcObject = null);
|
|
8820
|
+
this._stopAutoplayRecovery(), this._refreshAudioElement = null, this._audioElement && (this._audioElement.onpause = null, this._audioElement.onstalled = null, this._audioElement.onerror = null, this._audioElement.onloadeddata = null, this._audioElement.pause(), this._audioElement.srcObject = null);
|
|
8689
8821
|
for (let e of this._audioTracks.values()) e.stop();
|
|
8690
8822
|
}
|
|
8691
8823
|
_stopAutoplayRecovery() {
|
|
8692
8824
|
this._autoplayRecoveryController?.abort(), this._autoplayRecoveryController = null;
|
|
8693
8825
|
}
|
|
8694
8826
|
_createAudioElement() {
|
|
8695
|
-
let e =
|
|
8827
|
+
let e = C.browserName() !== "Safari" || C.isMobile() || N.safariAudioElement;
|
|
8696
8828
|
return document.createElement(e ? "audio" : "video");
|
|
8697
8829
|
}
|
|
8698
8830
|
_prepareAudioElement() {
|
|
8699
|
-
if (N.muteMode ||
|
|
8831
|
+
if (N.muteMode || C.browserName() !== "Safari" || C.isMobile()) return null;
|
|
8700
8832
|
let e = this._createAudioElement();
|
|
8701
8833
|
return e.load(), e;
|
|
8702
8834
|
}
|
|
@@ -8741,7 +8873,7 @@ function Yo(e, t) {
|
|
|
8741
8873
|
}
|
|
8742
8874
|
//#endregion
|
|
8743
8875
|
//#region src/classes/DebugInfo.ts
|
|
8744
|
-
var Xo = 90, Zo = 3, Qo = class extends
|
|
8876
|
+
var Xo = 90, Zo = 3, Qo = class extends Ye {
|
|
8745
8877
|
constructor(e = z) {
|
|
8746
8878
|
super(), h(this, "_lastMemoryStat", {
|
|
8747
8879
|
percent: 0,
|
|
@@ -8880,7 +9012,7 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
8880
9012
|
try {
|
|
8881
9013
|
E.retainAudioContext(this);
|
|
8882
9014
|
let e = E.getAudioContext();
|
|
8883
|
-
this._analyser = e.createAnalyser(), this._analyser.fftSize = 1024, this._analyser.smoothingTimeConstant = 0,
|
|
9015
|
+
this._analyser = e.createAnalyser(), this._analyser.fftSize = 1024, this._analyser.smoothingTimeConstant = 0, C.browserName() === "Safari" && (this._gainNode = e.createGain(), this._gainNode.gain.value = 1e-5, this._gainNode.connect(e.destination), this._analyser.connect(this._gainNode)), this._fftBins = new Uint8Array(this._analyser.frequencyBinCount), this._mediaStreamSource = e.createMediaStreamSource(this._stream), this._mediaStreamSource.connect(this._analyser);
|
|
8884
9016
|
} catch {
|
|
8885
9017
|
this.destroy();
|
|
8886
9018
|
}
|
|
@@ -8907,7 +9039,7 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
8907
9039
|
destroy() {
|
|
8908
9040
|
this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track), E.releaseAudioContext(this);
|
|
8909
9041
|
}
|
|
8910
|
-
}, ns = class extends
|
|
9042
|
+
}, ns = class extends Ye {
|
|
8911
9043
|
constructor(e) {
|
|
8912
9044
|
super(), h(this, "_detector", null), h(this, "_interval", null);
|
|
8913
9045
|
let t = () => {
|
|
@@ -8953,7 +9085,7 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
8953
9085
|
}
|
|
8954
9086
|
}, is = /* @__PURE__ */ function(e) {
|
|
8955
9087
|
return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
|
|
8956
|
-
}({}), as = class extends
|
|
9088
|
+
}({}), as = class extends Ye {
|
|
8957
9089
|
constructor(e) {
|
|
8958
9090
|
super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, Y.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8959
9091
|
}
|
|
@@ -9017,7 +9149,7 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
9017
9149
|
}
|
|
9018
9150
|
}, os = /* @__PURE__ */ function(e) {
|
|
9019
9151
|
return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
|
|
9020
|
-
}({}), ss = class extends
|
|
9152
|
+
}({}), ss = class extends Ye {
|
|
9021
9153
|
constructor(e, t, n) {
|
|
9022
9154
|
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, is.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, Y.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
9023
9155
|
}
|
|
@@ -9041,7 +9173,7 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
9041
9173
|
_onTopologyChanged(e) {
|
|
9042
9174
|
this._serverSideSpeakerDetection = e === J.SERVER;
|
|
9043
9175
|
}
|
|
9044
|
-
}, cs = 15e3, ls = 15e3, us = class extends
|
|
9176
|
+
}, cs = 15e3, ls = 15e3, us = class extends Ye {
|
|
9045
9177
|
constructor(e, t, n, r = z, i = null) {
|
|
9046
9178
|
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, is.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
|
|
9047
9179
|
}
|
|
@@ -9061,7 +9193,7 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
9061
9193
|
return this._transport.getTopology() === J.DIRECT ? ls : N.specListenerParams.volumeTimeout;
|
|
9062
9194
|
}
|
|
9063
9195
|
_onTransportStateChanged(e, t) {
|
|
9064
|
-
t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(
|
|
9196
|
+
t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
|
|
9065
9197
|
}
|
|
9066
9198
|
_onVolumesDetected(e) {
|
|
9067
9199
|
Object.keys(e).forEach((t) => {
|
|
@@ -9081,14 +9213,14 @@ var Xo = 90, Zo = 3, Qo = class extends Je {
|
|
|
9081
9213
|
}
|
|
9082
9214
|
t = !0;
|
|
9083
9215
|
}
|
|
9084
|
-
}), this._connectionTimeoutSuppressed = e && !t, t && (this._debug.warn("There is not connected transport, send callSpecError"), this._logger?.log(
|
|
9216
|
+
}), this._connectionTimeoutSuppressed = e && !t, t && (this._debug.warn("There is not connected transport, send callSpecError"), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
|
|
9085
9217
|
}
|
|
9086
9218
|
_onVolumeTimeout() {
|
|
9087
9219
|
let e = [];
|
|
9088
9220
|
Object.keys(this._volumes).forEach((t) => {
|
|
9089
9221
|
if (this._volumes[t] > 0 || this._participants[t]?.isOnHold) return;
|
|
9090
9222
|
let n = "UNKNOWN", r = this._participants[t];
|
|
9091
|
-
r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(
|
|
9223
|
+
r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(x.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
|
|
9092
9224
|
}), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
|
|
9093
9225
|
}
|
|
9094
9226
|
}, ds = /* @__PURE__ */ function(e) {
|
|
@@ -9339,7 +9471,7 @@ async function js(e, t = {}, n = !1) {
|
|
|
9339
9471
|
return Ms(r, void 0, new Blob([r]).size <= ws);
|
|
9340
9472
|
}
|
|
9341
9473
|
async function Ms(e, t, n = !1) {
|
|
9342
|
-
let r = `${t ?? Ss}/fb.do`, i = new AbortController(), a = new k(
|
|
9474
|
+
let r = `${t ?? Ss}/fb.do`, i = new AbortController(), a = new k(y.NETWORK, { callError: {
|
|
9343
9475
|
scope: "network",
|
|
9344
9476
|
source: "api",
|
|
9345
9477
|
code: "timeout",
|
|
@@ -9358,7 +9490,7 @@ async function Ms(e, t, n = !1) {
|
|
|
9358
9490
|
} catch {
|
|
9359
9491
|
o = { result: a };
|
|
9360
9492
|
}
|
|
9361
|
-
if (!t.ok && !Ns(o)) throw new k(
|
|
9493
|
+
if (!t.ok && !Ns(o)) throw new k(y.API, { callError: {
|
|
9362
9494
|
scope: "server",
|
|
9363
9495
|
source: "api",
|
|
9364
9496
|
code: `http-${t.status}`,
|
|
@@ -9367,7 +9499,7 @@ async function Ms(e, t, n = !1) {
|
|
|
9367
9499
|
if (Ns(o)) throw o;
|
|
9368
9500
|
return o;
|
|
9369
9501
|
} catch (e) {
|
|
9370
|
-
throw e instanceof k ? e : i.signal.aborted ? a : Ns(e) ? e : new k(
|
|
9502
|
+
throw e instanceof k ? e : i.signal.aborted ? a : Ns(e) ? e : new k(y.NETWORK, { callError: {
|
|
9371
9503
|
scope: "network",
|
|
9372
9504
|
source: "api",
|
|
9373
9505
|
code: "fetch-failed",
|
|
@@ -9396,7 +9528,7 @@ async function Ps(e, t) {
|
|
|
9396
9528
|
}
|
|
9397
9529
|
}
|
|
9398
9530
|
function Fs(e, t = {}, n = !1) {
|
|
9399
|
-
t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (
|
|
9531
|
+
t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (v.sessionKey ? t.session_key = v.sessionKey : v.accessToken && (t.access_token = v.accessToken));
|
|
9400
9532
|
for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
|
|
9401
9533
|
let r = "";
|
|
9402
9534
|
for (let [e, n] of Object.entries(t)) r && (r += "&"), r += `${e}=${encodeURIComponent(n)}`;
|
|
@@ -9475,7 +9607,7 @@ var Is = "sessions", Ls = 5, Rs = class e {
|
|
|
9475
9607
|
e._api = null, e._delta = null, e._pending = null, e._idsAwaitingDelta = [], e._lastFailureAt = null;
|
|
9476
9608
|
}
|
|
9477
9609
|
static _hasCredentials() {
|
|
9478
|
-
return !!
|
|
9610
|
+
return !!v.sessionKey || !!v.accessToken;
|
|
9479
9611
|
}
|
|
9480
9612
|
static async _measure() {
|
|
9481
9613
|
let t;
|
|
@@ -9611,7 +9743,7 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
|
|
|
9611
9743
|
Bs.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
|
|
9612
9744
|
}
|
|
9613
9745
|
static _currentUserId() {
|
|
9614
|
-
return
|
|
9746
|
+
return v.userId;
|
|
9615
9747
|
}
|
|
9616
9748
|
static async _drainCurrent(t, n) {
|
|
9617
9749
|
if (e._isSessionBlocked()) return 0;
|
|
@@ -9649,13 +9781,13 @@ var Us = 500, Ws = 100, Gs = 3e4, Ks = 1e3, qs = 5e3, Js = 3e3, Ys = "okcls-stat
|
|
|
9649
9781
|
return fs(e?.error_code);
|
|
9650
9782
|
}
|
|
9651
9783
|
static _isReauthorizeFailure(e) {
|
|
9652
|
-
return e?.error ===
|
|
9784
|
+
return e?.error === y.AUTH;
|
|
9653
9785
|
}
|
|
9654
9786
|
static _blockSession() {
|
|
9655
|
-
e._blockedSession = { key:
|
|
9787
|
+
e._blockedSession = { key: v.sessionKey };
|
|
9656
9788
|
}
|
|
9657
9789
|
static _isSessionBlocked() {
|
|
9658
|
-
return e._blockedSession ? e._blockedSession.key ===
|
|
9790
|
+
return e._blockedSession ? e._blockedSession.key === v.sessionKey ? !0 : (e._blockedSession = null, !1) : !1;
|
|
9659
9791
|
}
|
|
9660
9792
|
static _isAuthError(t) {
|
|
9661
9793
|
let n = t?.error_code;
|
|
@@ -9854,7 +9986,7 @@ var Zs = class extends f {
|
|
|
9854
9986
|
ts: i,
|
|
9855
9987
|
delta: Bs.delta(),
|
|
9856
9988
|
ev: a
|
|
9857
|
-
}, s =
|
|
9989
|
+
}, s = v.userId;
|
|
9858
9990
|
if (s === null) {
|
|
9859
9991
|
e._remember(o);
|
|
9860
9992
|
return;
|
|
@@ -9948,7 +10080,7 @@ var $s = class {
|
|
|
9948
10080
|
}
|
|
9949
10081
|
this._destroyed || (this._battery = t, t.addEventListener("levelchange", this._handleLevelChange), t.addEventListener("chargingchange", this._handleChargingChange));
|
|
9950
10082
|
}
|
|
9951
|
-
}, nc = "invalid-error-metadata", rc = 64, ic = new Set(Object.values(O)), ac = new Set(Object.values(
|
|
10083
|
+
}, nc = "invalid-error-metadata", rc = 64, ic = new Set(Object.values(O)), ac = new Set(Object.values(y)), oc = {
|
|
9952
10084
|
[O.CANCELED]: {
|
|
9953
10085
|
type: "semantic",
|
|
9954
10086
|
reason: "canceled"
|
|
@@ -10070,7 +10202,7 @@ var $s = class {
|
|
|
10070
10202
|
reason: "obsolete_client"
|
|
10071
10203
|
}
|
|
10072
10204
|
}, sc = {
|
|
10073
|
-
[
|
|
10205
|
+
[y.MIC_CAMERA_PERMISSION]: {
|
|
10074
10206
|
type: "direct-error",
|
|
10075
10207
|
error: {
|
|
10076
10208
|
scope: "internal",
|
|
@@ -10078,7 +10210,7 @@ var $s = class {
|
|
|
10078
10210
|
description: "mic-camera-permission"
|
|
10079
10211
|
}
|
|
10080
10212
|
},
|
|
10081
|
-
[
|
|
10213
|
+
[y.CAMERA_PERMISSION]: {
|
|
10082
10214
|
type: "direct-error",
|
|
10083
10215
|
error: {
|
|
10084
10216
|
scope: "internal",
|
|
@@ -10086,7 +10218,7 @@ var $s = class {
|
|
|
10086
10218
|
description: "camera-permission"
|
|
10087
10219
|
}
|
|
10088
10220
|
},
|
|
10089
|
-
[
|
|
10221
|
+
[y.MIC_PERMISSION]: {
|
|
10090
10222
|
type: "direct-error",
|
|
10091
10223
|
error: {
|
|
10092
10224
|
scope: "internal",
|
|
@@ -10094,7 +10226,7 @@ var $s = class {
|
|
|
10094
10226
|
description: "microphone-permission"
|
|
10095
10227
|
}
|
|
10096
10228
|
},
|
|
10097
|
-
[
|
|
10229
|
+
[y.CAMERA_ACCESS]: {
|
|
10098
10230
|
type: "direct-error",
|
|
10099
10231
|
error: {
|
|
10100
10232
|
scope: "internal",
|
|
@@ -10102,7 +10234,7 @@ var $s = class {
|
|
|
10102
10234
|
description: "camera-access"
|
|
10103
10235
|
}
|
|
10104
10236
|
},
|
|
10105
|
-
[
|
|
10237
|
+
[y.MIC_ACCESS]: {
|
|
10106
10238
|
type: "direct-error",
|
|
10107
10239
|
error: {
|
|
10108
10240
|
scope: "internal",
|
|
@@ -10110,7 +10242,7 @@ var $s = class {
|
|
|
10110
10242
|
description: "microphone-access"
|
|
10111
10243
|
}
|
|
10112
10244
|
},
|
|
10113
|
-
[
|
|
10245
|
+
[y.MIC_NOT_FOUND]: {
|
|
10114
10246
|
type: "direct-error",
|
|
10115
10247
|
error: {
|
|
10116
10248
|
scope: "internal",
|
|
@@ -10118,7 +10250,7 @@ var $s = class {
|
|
|
10118
10250
|
description: "microphone-not-found"
|
|
10119
10251
|
}
|
|
10120
10252
|
},
|
|
10121
|
-
[
|
|
10253
|
+
[y.SCREEN_PERMISSION]: {
|
|
10122
10254
|
type: "direct-error",
|
|
10123
10255
|
error: {
|
|
10124
10256
|
scope: "internal",
|
|
@@ -10126,7 +10258,7 @@ var $s = class {
|
|
|
10126
10258
|
description: "screen-permission"
|
|
10127
10259
|
}
|
|
10128
10260
|
},
|
|
10129
|
-
[
|
|
10261
|
+
[y.SCREEN_ACCESS]: {
|
|
10130
10262
|
type: "direct-error",
|
|
10131
10263
|
error: {
|
|
10132
10264
|
scope: "internal",
|
|
@@ -10134,7 +10266,7 @@ var $s = class {
|
|
|
10134
10266
|
description: "screen-access"
|
|
10135
10267
|
}
|
|
10136
10268
|
},
|
|
10137
|
-
[
|
|
10269
|
+
[y.CONNECTION]: {
|
|
10138
10270
|
type: "direct-error",
|
|
10139
10271
|
error: {
|
|
10140
10272
|
scope: "network",
|
|
@@ -10143,13 +10275,13 @@ var $s = class {
|
|
|
10143
10275
|
description: "connection-failed"
|
|
10144
10276
|
}
|
|
10145
10277
|
},
|
|
10146
|
-
[
|
|
10147
|
-
[
|
|
10148
|
-
[
|
|
10149
|
-
[
|
|
10150
|
-
[
|
|
10151
|
-
[
|
|
10152
|
-
[
|
|
10278
|
+
[y.NETWORK]: { type: "requires-call-error" },
|
|
10279
|
+
[y.UNKNOWN]: { type: "failed" },
|
|
10280
|
+
[y.UNSUPPORTED]: { type: "requires-call-error" },
|
|
10281
|
+
[y.SIGNALING_FAILED]: { type: "requires-call-error" },
|
|
10282
|
+
[y.API]: { type: "requires-call-error" },
|
|
10283
|
+
[y.AUTH]: { type: "requires-call-error" },
|
|
10284
|
+
[y.OVERCONSTRAINED]: {
|
|
10153
10285
|
type: "direct-error",
|
|
10154
10286
|
error: {
|
|
10155
10287
|
scope: "internal",
|
|
@@ -10661,14 +10793,16 @@ function jc(e, t, n, r) {
|
|
|
10661
10793
|
message: r
|
|
10662
10794
|
});
|
|
10663
10795
|
}
|
|
10664
|
-
var Mc = 15, $ = class e extends
|
|
10796
|
+
var Mc = 15, $ = class e extends Ye {
|
|
10665
10797
|
constructor(e, t) {
|
|
10666
|
-
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Gr()), h(this, "_serverTimeOffset", 0), h(this, "
|
|
10667
|
-
|
|
10798
|
+
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Gr()), h(this, "_serverTimeOffset", 0), h(this, "_serverConversationId", null), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_hangupReason", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_pendingId", null), h(this, "_resolveSignalingInitialization", void 0), h(this, "_signalingInitialization", new Promise((e) => {
|
|
10799
|
+
this._resolveSignalingInitialization = e;
|
|
10800
|
+
})), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Wo((e) => {
|
|
10801
|
+
if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
10668
10802
|
})), h(this, "_toggleLocalAudio", Wo((e) => {
|
|
10669
|
-
if (this._mediaSource) return this._stats.logger.log(
|
|
10803
|
+
if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
|
|
10670
10804
|
})), h(this, "_changeMediaSettings", M.debounce(async (e) => {
|
|
10671
|
-
if (this._signaling.ready) try {
|
|
10805
|
+
if (!(!this._signaling.ready || !this._transport || this.isCallHeld)) try {
|
|
10672
10806
|
await this._signaling.changeMediaSettings(e);
|
|
10673
10807
|
} catch (e) {
|
|
10674
10808
|
if (this._debug.warn("changeMediaSettings failed with error", e), e.message === "chatRoom.maxShareCountExceeded") return this.toggleScreenCapturing({
|
|
@@ -10698,24 +10832,11 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10698
10832
|
static current() {
|
|
10699
10833
|
return B.getActive() ?? (N.hold ? null : B.getFirst());
|
|
10700
10834
|
}
|
|
10701
|
-
static hangupAfterInit(e) {
|
|
10702
|
-
let t = Nc;
|
|
10703
|
-
if (t) {
|
|
10704
|
-
if (typeof e == "function" && (t._onFastHangup = e), t._delayedHangup === !1 && !t._conversation) {
|
|
10705
|
-
t._delayedHangup = !0, t._abortController?.abort(new k(O.CANCELED));
|
|
10706
|
-
return;
|
|
10707
|
-
}
|
|
10708
|
-
t._conversation && t.hangup({
|
|
10709
|
-
onFastHangup: e,
|
|
10710
|
-
reason: O.CANCELED
|
|
10711
|
-
});
|
|
10712
|
-
}
|
|
10713
|
-
}
|
|
10714
10835
|
static id() {
|
|
10715
10836
|
return B.getActiveId();
|
|
10716
10837
|
}
|
|
10717
10838
|
get id() {
|
|
10718
|
-
return this._conversation?.id ?? "";
|
|
10839
|
+
return this._conversation?.id ?? this._pendingId ?? "";
|
|
10719
10840
|
}
|
|
10720
10841
|
get externalId() {
|
|
10721
10842
|
return this._conversation?.externalId;
|
|
@@ -10772,16 +10893,18 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10772
10893
|
this._stats.lifecycle.markInitializationStarted({
|
|
10773
10894
|
source: "outgoing",
|
|
10774
10895
|
conversationId: u
|
|
10775
|
-
}), this._debug.setConversationId(u),
|
|
10896
|
+
}), this._debug.setConversationId(u), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10776
10897
|
try {
|
|
10777
|
-
this._mediaSource = this._createMediaSource(),
|
|
10778
|
-
let l = this.
|
|
10779
|
-
|
|
10780
|
-
let d =
|
|
10898
|
+
this._registerPending(u), this._mediaSource = this._createMediaSource(), B.selectPending(this);
|
|
10899
|
+
let l = await this._requestLocalMedia(n);
|
|
10900
|
+
this._throwIfClosed();
|
|
10901
|
+
let d = this._mediaSource.mediaSettings;
|
|
10902
|
+
t === vo.CHAT || e && e.length > 1 ? this._logWithMediaSettings(x.OUTGOING_MULTIPARTY_CALL, d) : this._logWithMediaSettings(x.OUTGOING_CALL, d);
|
|
10903
|
+
let p = await this._startConversation({
|
|
10781
10904
|
opponentIds: e,
|
|
10782
10905
|
opponentType: t,
|
|
10783
10906
|
direction: _o.OUTGOING,
|
|
10784
|
-
mediaOptions:
|
|
10907
|
+
mediaOptions: l,
|
|
10785
10908
|
payload: r,
|
|
10786
10909
|
joiningAllowed: i,
|
|
10787
10910
|
requireAuthToJoin: a,
|
|
@@ -10790,66 +10913,70 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10790
10913
|
onFastStart: c,
|
|
10791
10914
|
conversationId: u
|
|
10792
10915
|
});
|
|
10793
|
-
if (!this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10916
|
+
if (this._throwIfClosed(), !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10794
10917
|
scope: "internal",
|
|
10795
10918
|
code: "conversation",
|
|
10796
10919
|
description: "not-initialized-after-start"
|
|
10797
10920
|
} });
|
|
10798
|
-
if (this._participantState = X.ACCEPTED,
|
|
10799
|
-
if (this._debug.debug("Outgoing call", {
|
|
10800
|
-
opponentIds: e,
|
|
10801
|
-
opponentType: t,
|
|
10802
|
-
mediaOptions: n
|
|
10803
|
-
}), this._processConnectionSharedMovieInfo(d), this._processConversationUrlSharingInfo(d), R.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), void 0, this.id), this._onConversationParticipantListChunk(d), this._processPinnedParticipants(d), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), this._conversation?.concurrent) {
|
|
10921
|
+
if (this._participantState = X.ACCEPTED, await this._processConnection(p), this._throwIfClosed(), this._conversation?.concurrent) {
|
|
10804
10922
|
let e = B.get(this._conversation.id);
|
|
10805
10923
|
e && e !== this && e._close(new k(O.HUNGUP, { remote: !0 }));
|
|
10806
10924
|
}
|
|
10807
|
-
return
|
|
10925
|
+
return await this._applyInitialActiveSelection(), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._changeMediaSettings(this._mediaSource.mediaSettings), this._signaling.readyToSend(), this._throwIfClosed(), this._debug.debug("Outgoing call", {
|
|
10926
|
+
opponentIds: e,
|
|
10927
|
+
opponentType: t,
|
|
10928
|
+
mediaOptions: n
|
|
10929
|
+
}), this._processConnectionSharedMovieInfo(p), this._processConversationUrlSharingInfo(p), R.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), void 0, this.id), this._onConversationParticipantListChunk(p), this._processPinnedParticipants(p), R.onLocalStatus(this.isCallHeld ? P.ONHOLD : P.WAITING, this.id), this._toggleJoinAvailability(), this._changeFeatureSet(), this._changeNeedRate(), this._conversation.concurrent && (await this._acceptConcurrent(), this._throwIfClosed()), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
|
|
10808
10930
|
this._calleeUnavailableTimer = null, this._close(new k(O.CALLEE_UNAVAILABLE), { signalingReason: O.CANCELED });
|
|
10809
|
-
}, f)), this._conversation;
|
|
10931
|
+
}, f)), this._completeSignalingInitialization(), this._conversation;
|
|
10810
10932
|
} catch (e) {
|
|
10811
|
-
throw
|
|
10933
|
+
throw this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
|
|
10812
10934
|
}
|
|
10813
10935
|
}
|
|
10814
10936
|
async onJoin(e) {
|
|
10815
10937
|
this._stats.lifecycle.markInitializationStarted({
|
|
10816
10938
|
source: e.anonymous ? "anonym_join" : "join",
|
|
10817
10939
|
conversationId: e.conversationId
|
|
10818
|
-
}),
|
|
10940
|
+
}), this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10819
10941
|
try {
|
|
10942
|
+
this._registerPending(e.conversationId);
|
|
10820
10943
|
let t = !!e.observedIds?.length;
|
|
10821
10944
|
if (t && N.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new k(O.UNSUPPORTED, { callError: {
|
|
10822
10945
|
scope: "internal",
|
|
10823
10946
|
code: "observer-mode",
|
|
10824
10947
|
description: "video-tracks-count-must-be-zero"
|
|
10825
10948
|
} });
|
|
10826
|
-
this._mediaSource = this._createMediaSource()
|
|
10827
|
-
let n = this.
|
|
10828
|
-
this.
|
|
10829
|
-
let
|
|
10830
|
-
|
|
10949
|
+
this._mediaSource = this._createMediaSource();
|
|
10950
|
+
let n = B.selectPending(this), r = await this._requestLocalMedia(e.mediaOptions, !t);
|
|
10951
|
+
this._throwIfClosed();
|
|
10952
|
+
let i = this._mediaSource.mediaSettings;
|
|
10953
|
+
this._logWithMediaSettings(x.JOIN_CONVERSATION, i);
|
|
10954
|
+
let a = await this._joinConversation({
|
|
10955
|
+
...e,
|
|
10956
|
+
mediaOptions: r
|
|
10957
|
+
});
|
|
10958
|
+
if (this._throwIfClosed(), !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10831
10959
|
scope: "internal",
|
|
10832
10960
|
code: "conversation",
|
|
10833
10961
|
description: "not-initialized-after-join"
|
|
10834
10962
|
} });
|
|
10835
|
-
return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(),
|
|
10963
|
+
return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), this._mediaSource.mediaSettings, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this), B.releaseSelection(this, n), this._signaling.readyToSend(), R.onLocalStatus(this._conversation.waitForAdmin ? P.WAIT_FOR_ADMIN : P.WAITING_HALL, this.id)) : await this._onJoinPart2(a), this._completeSignalingInitialization(), this._conversation;
|
|
10836
10964
|
} catch (e) {
|
|
10837
|
-
throw
|
|
10965
|
+
throw this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
10838
10966
|
}
|
|
10839
10967
|
}
|
|
10840
10968
|
async _onJoinPart2(e, t = !0, n = !1) {
|
|
10841
10969
|
this._debug.debug("Join conversation part 2");
|
|
10842
10970
|
try {
|
|
10843
|
-
if (this._participantState = X.ACCEPTED, !this._conversation || !this._mediaSource) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10971
|
+
if (this._throwIfClosed(), this._participantState = X.ACCEPTED, !this._conversation || !this._mediaSource) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10844
10972
|
scope: "internal",
|
|
10845
10973
|
code: "join",
|
|
10846
10974
|
description: "runtime-not-initialized"
|
|
10847
10975
|
} });
|
|
10848
|
-
if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology),
|
|
10849
|
-
|
|
10850
|
-
this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
10976
|
+
if (this._statFirstMediaReceived.markOnJoin(this._conversation.topology), await this._processConnection(e), this._throwIfClosed(), t && (this.isCallHeld ? this._previousState = "ACTIVE" : this._state = "ACTIVE", n ? (await this._holdLocally(), B.add(this), B.releaseSelection(this)) : await this._applyInitialActiveSelection(), this._throwIfClosed(), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener()), !this.isCallHeld && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(this._mediaSource.mediaSettings), this._signaling.readyToSend(), this._state === "CLOSE") return this._conversation;
|
|
10977
|
+
this._throwIfClosed(), this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
10851
10978
|
let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
|
|
10852
|
-
R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(),
|
|
10979
|
+
R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(t && this.isCallHeld ? P.ONHOLD : P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._changeFeatureSet();
|
|
10853
10980
|
let i = this._extractLocalParticipantFromConnection(e);
|
|
10854
10981
|
if (i) {
|
|
10855
10982
|
let e = M.mapParticipantState(i);
|
|
@@ -10857,7 +10984,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10857
10984
|
}
|
|
10858
10985
|
return t && this._openTransport(Object.values(this._participants), !1), this._conversation;
|
|
10859
10986
|
} catch (e) {
|
|
10860
|
-
throw
|
|
10987
|
+
throw this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
10861
10988
|
}
|
|
10862
10989
|
}
|
|
10863
10990
|
_extractExternalRooms(e) {
|
|
@@ -10873,22 +11000,22 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10873
11000
|
return t && (n.roomId = t), n;
|
|
10874
11001
|
}
|
|
10875
11002
|
async onPush(e, t = j.USER, n, r, i, a) {
|
|
10876
|
-
|
|
10877
|
-
B.reserve(e), this._reservedId = e, a && this._api.setUserId(a), this._stats.lifecycle.markInitializationStarted({
|
|
11003
|
+
this._registerPending(e), this._serverConversationId = e, a && this._api.setUserId(a), this._stats.lifecycle.markInitializationStarted({
|
|
10878
11004
|
source: "incoming",
|
|
10879
11005
|
conversationId: e
|
|
10880
|
-
}), this._debug.setConversationId(e),
|
|
11006
|
+
}), this._debug.setConversationId(e), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10881
11007
|
try {
|
|
11008
|
+
this._mediaSource = this._createMediaSource();
|
|
10882
11009
|
let a = await this._prepareConversation(e, t, n, r, i);
|
|
10883
|
-
if (this.
|
|
11010
|
+
if (this._throwIfClosed(), !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10884
11011
|
scope: "internal",
|
|
10885
11012
|
code: "conversation",
|
|
10886
11013
|
description: "incoming-not-initialized"
|
|
10887
11014
|
} });
|
|
10888
|
-
if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(
|
|
10889
|
-
|
|
11015
|
+
if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(x.PUSH, "rejected"), new k(O.REJECTED);
|
|
11016
|
+
await this._processConnection(a), this._throwIfClosed(), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(x.PUSH, "accepted"), B.add(this), this._completeSignalingInitialization();
|
|
10890
11017
|
} catch (e) {
|
|
10891
|
-
throw
|
|
11018
|
+
throw this._cleanupRegistry(), this._close(e, {
|
|
10892
11019
|
errorText: "Unable to handle inbound call push",
|
|
10893
11020
|
signalingReason: e instanceof k && e.hangup === O.BUSY ? O.BUSY : void 0
|
|
10894
11021
|
}), e;
|
|
@@ -10913,16 +11040,16 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10913
11040
|
return this._conversation?.audienceMode && this._conversation?.restricted;
|
|
10914
11041
|
}
|
|
10915
11042
|
async _acceptConcurrent() {
|
|
10916
|
-
if (!this._mediaSource || !this._conversation
|
|
11043
|
+
if (!this._mediaSource || !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10917
11044
|
scope: "internal",
|
|
10918
11045
|
code: "accept",
|
|
10919
11046
|
description: "runtime-not-initialized"
|
|
10920
11047
|
} });
|
|
10921
|
-
this._state = "PROCESSING";
|
|
11048
|
+
this.isCallHeld || (this._state = "PROCESSING");
|
|
10922
11049
|
let e = this._mediaSource.mediaSettings;
|
|
10923
|
-
this._logWithMediaSettings(
|
|
11050
|
+
this._logWithMediaSettings(x.ACCEPT_CONCURRENT, e), this._debug.debug("Concurrent call", { conversationId: this._conversation.id });
|
|
10924
11051
|
try {
|
|
10925
|
-
this._statFirstMediaReceived.markAcceptCall(this.
|
|
11052
|
+
this._statFirstMediaReceived.markAcceptCall(this._conversation.topology), await this._signaling.acceptCall(this._mediaSource.mediaSettings), this._throwIfClosed(), this._stats.lifecycle.markIncomingAccepted(!0), R.onCallAccepted(this.id), this.isCallHeld ? this._previousState = "ACTIVE" : this._state = "ACTIVE", this._participantState = X.ACCEPTED, this._changeFeatureSet(), this._openTransport(Object.values(this._participants), !0);
|
|
10926
11053
|
} catch (e) {
|
|
10927
11054
|
this._close(e, { errorText: "Unable to accept concurrent call" });
|
|
10928
11055
|
}
|
|
@@ -10955,7 +11082,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10955
11082
|
}
|
|
10956
11083
|
}
|
|
10957
11084
|
async accept(e) {
|
|
10958
|
-
if (this._state !== "IDLE") throw this._stats.logger.log(
|
|
11085
|
+
if (this._state !== "IDLE") throw this._stats.logger.log(x.ERROR, "acceptIncoming"), this._debug.error("Unable to accept a call - invalid state"), Error("Unable to accept a call - invalid state");
|
|
10959
11086
|
if (!this._mediaSource || !this._conversation || !this._transport) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
10960
11087
|
scope: "internal",
|
|
10961
11088
|
code: "accept",
|
|
@@ -10963,9 +11090,9 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10963
11090
|
} });
|
|
10964
11091
|
this._state = "PROCESSING", this._debug.setConversationId(this._conversation.id), this._debug.debug("Accept incoming call", e);
|
|
10965
11092
|
try {
|
|
10966
|
-
await this.
|
|
11093
|
+
await this._requestLocalMedia(e), this._throwIfClosed();
|
|
10967
11094
|
let t = this._mediaSource.mediaSettings;
|
|
10968
|
-
this._logWithMediaSettings(
|
|
11095
|
+
this._logWithMediaSettings(x.ACCEPT_INCOMING, t), this._changeMediaSettings(t), this._statFirstMediaReceived.markAcceptCall(this._transport.getTopology()), await this._signaling.acceptCall(t), this._throwIfClosed(), this._stats.lifecycle.markIncomingAccepted(!1), this._participantState = X.ACCEPTED;
|
|
10969
11096
|
let n = this._getMuteStatesForCurrentRoom(), r = Object.keys(n);
|
|
10970
11097
|
r.length && this._onMuteParticipant({
|
|
10971
11098
|
muteStates: n,
|
|
@@ -10974,7 +11101,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10974
11101
|
stateUpdated: !0
|
|
10975
11102
|
}), this._registerParticipantLocalMuteState({ muteStates: this._conversation.muteStatesPersonal });
|
|
10976
11103
|
let i = await this._signaling.getRooms(this._isCallAdmin());
|
|
10977
|
-
if (i.rooms?.rooms?.length) {
|
|
11104
|
+
if (this._throwIfClosed(), i.rooms?.rooms?.length) {
|
|
10978
11105
|
let e = this._participants;
|
|
10979
11106
|
i.rooms.rooms.forEach((t) => {
|
|
10980
11107
|
t.participantIds?.forEach((t) => {
|
|
@@ -10984,39 +11111,54 @@ var Mc = 15, $ = class e extends Je {
|
|
|
10984
11111
|
}
|
|
10985
11112
|
this._conversation.roomId = i.rooms?.roomId || null;
|
|
10986
11113
|
let a = this._extractExternalRoomsData(i.rooms?.rooms, i.rooms?.roomId);
|
|
10987
|
-
if (R.onCallAccepted(this.id), R.onLocalStream(this._mediaSource.getStream(), t, this.id), R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), a, this.id), await this._emitHeldParticipantsStatus(), N.useParticipantListChunk) {
|
|
10988
|
-
let e = await this._getInitialParticiapntListChunk()
|
|
11114
|
+
if (R.onCallAccepted(this.id), R.onLocalStream(this._mediaSource.getStream(), t, this.id), R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), a, this.id), await this._emitHeldParticipantsStatus(), this._throwIfClosed(), N.useParticipantListChunk) {
|
|
11115
|
+
let e = await this._getInitialParticiapntListChunk();
|
|
11116
|
+
this._throwIfClosed();
|
|
11117
|
+
let t = this._participants;
|
|
10989
11118
|
e?.participants?.forEach((e) => {
|
|
10990
11119
|
let n = t[M.composeId(e)];
|
|
10991
11120
|
n && (n.movieShareInfos = e.movieShareInfos);
|
|
10992
11121
|
}), this._onConversationParticipantListChunk({ participants: e });
|
|
10993
11122
|
}
|
|
10994
|
-
return R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), this._openTransport(Object.values(this._participants), !0), this._processConversationUrlSharingInfo(), this._processConnectionAsrInfo(),
|
|
10995
|
-
this._debug.error(e), this._close(e, { errorText: "Unable to activated accepted call" });
|
|
10996
|
-
}), this._conversation;
|
|
11123
|
+
return R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), this._state = "ACTIVE", this._changeFeatureSet(), await B.setActive(this.id), this._throwIfClosed(), this._openTransport(Object.values(this._participants), !0), this._processConversationUrlSharingInfo(), this._processConnectionAsrInfo(), this._conversation;
|
|
10997
11124
|
} catch (e) {
|
|
10998
11125
|
throw this._close(e, { errorText: "Unable to accept call" }), e;
|
|
10999
11126
|
}
|
|
11000
11127
|
}
|
|
11001
11128
|
async decline(e) {
|
|
11002
|
-
if (this._state !== "IDLE") throw this._stats.logger.log(
|
|
11129
|
+
if (this._state !== "IDLE") throw this._stats.logger.log(x.ERROR, "declineIncoming"), this._debug.error("Unable to decline a call - invalid state"), Error("Unable to decline a call - invalid state");
|
|
11003
11130
|
let t = e?.reason;
|
|
11004
|
-
this._state = "PROCESSING", this._debug.debug("Decline incoming call"), this._logWithMediaSettings(
|
|
11131
|
+
this._state = "PROCESSING", this._debug.debug("Decline incoming call"), this._logWithMediaSettings(x.DECLINE_INCOMING, this.mediaSettings), this._participantState = X.HUNGUP;
|
|
11005
11132
|
let n = t ?? O.REJECTED, r = new k(n);
|
|
11006
11133
|
this._finishLifecycle(r), this._onFastHangup = e?.onFastHangup ?? this._onFastHangup;
|
|
11007
11134
|
let i = this._conversation?.id;
|
|
11008
|
-
i && typeof this._onFastHangup == "function" && this._sendHangup(i, n, this._onFastHangup), this._close(r, { signalingReason: n });
|
|
11135
|
+
i && typeof this._onFastHangup == "function" && this._sendHangup(i, n, this._onFastHangup, this._abortController?.signal).catch((e) => this._debug.error("Fast hangup error", e)), this._close(r, { signalingReason: n });
|
|
11009
11136
|
}
|
|
11010
11137
|
hangup(e) {
|
|
11011
11138
|
if (this._hangupPromise) return this._hangupPromise;
|
|
11012
|
-
let t = e?.reason;
|
|
11013
|
-
this.
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11139
|
+
let t = e?.reason ?? (this._state === "ACTIVE" || this._state === "HELD" ? O.HUNGUP : O.CANCELED), n = new k(t), r = this.id, i = this._conversation?.id ?? this._serverConversationId, a = !!this._conversation && this._signaling.ready, o = new AbortController();
|
|
11140
|
+
return this._onFastHangup = e?.onFastHangup ?? this._onFastHangup, this._hangupPromise = Promise.resolve().then(async () => {
|
|
11141
|
+
let e = [];
|
|
11142
|
+
a && e.push(Promise.resolve().then(() => this._signaling.hangup(t)).catch((e) => {
|
|
11143
|
+
if (!(e instanceof kn)) throw e;
|
|
11144
|
+
})), i && e.push(this._sendHangup(i, t, this._onFastHangup, o.signal));
|
|
11145
|
+
let n = (await this._waitForHangup(Promise.allSettled(e), o)).find((e) => e.status === "rejected");
|
|
11146
|
+
if (n?.status === "rejected") throw n.reason;
|
|
11147
|
+
}).finally(() => {
|
|
11148
|
+
o.abort(), this._signaling.dispose(), B.removeHangup(this._hangupPromise);
|
|
11149
|
+
}), B.trackHangup(this, this._hangupPromise), this._hangupReason = n, this._state = "CLOSE", this._participantState = X.HUNGUP, this._resolveSignalingInitialization(!1), this._abortController?.abort(n), this._emitHangupOnce(n, r || null), this._stats.logger.log(x.HANGUP, t), this._finishLifecycle(n), this._stats.flushCallMetrics(), this._cleanupTransport(), this._destroy(void 0, !0), this._hangupPromise;
|
|
11150
|
+
}
|
|
11151
|
+
async _waitForHangup(e, t) {
|
|
11152
|
+
let n;
|
|
11153
|
+
try {
|
|
11154
|
+
return await Promise.race([e, new Promise((e, r) => {
|
|
11155
|
+
n = window.setTimeout(() => {
|
|
11156
|
+
t.abort(), r(/* @__PURE__ */ Error("Hangup timed out"));
|
|
11157
|
+
}, N.waitResponseDelay);
|
|
11158
|
+
})]);
|
|
11159
|
+
} finally {
|
|
11160
|
+
window.clearTimeout(n);
|
|
11161
|
+
}
|
|
11020
11162
|
}
|
|
11021
11163
|
async addParticipant(e, t) {
|
|
11022
11164
|
if (!this._signaling.ready) {
|
|
@@ -11058,7 +11200,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11058
11200
|
this._transport && this._transport.updateStatisticsInterval();
|
|
11059
11201
|
}
|
|
11060
11202
|
_openTransport(e, t) {
|
|
11061
|
-
if (!this._transport) return;
|
|
11203
|
+
if (!this._transport || this.isCallHeld || this._state === "CLOSE") return;
|
|
11062
11204
|
let n = new Set(this._transport.opened()), r = [];
|
|
11063
11205
|
for (let i of e) (i.state === X.CALLED || i.state === X.ACCEPTED) && (this._transport.isAllocated(i.id) || this._allocateParticipantTransport(i.id, t)), i.state === X.ACCEPTED && !n.has(i.id) && r.push(i.id);
|
|
11064
11206
|
r.length ? this._transport.open(r, null, !!this._conversation?.observer) : this._transport.getTopology() === J.SERVER && this._forceOpenTransportForAloneInCall();
|
|
@@ -11070,8 +11212,21 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11070
11212
|
let t = this._transport?.getTopology() === J.DIRECT && this._transport.opened().includes(e);
|
|
11071
11213
|
this._transport?.close(e), t && (this._directTransportIsMaster = void 0);
|
|
11072
11214
|
}
|
|
11215
|
+
_registerPending(e) {
|
|
11216
|
+
if (e && B.has(e)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11217
|
+
this._pendingId = e ?? null, B.addPending(this);
|
|
11218
|
+
}
|
|
11073
11219
|
_cleanupRegistry() {
|
|
11074
|
-
B.remove(this
|
|
11220
|
+
B.remove(this), this._pendingId = null;
|
|
11221
|
+
}
|
|
11222
|
+
async _applyInitialActiveSelection() {
|
|
11223
|
+
N.hold && !B.isSelected(this) && await this.hold(!0);
|
|
11224
|
+
let e = !1;
|
|
11225
|
+
for (; e !== this.isCallHeld;) {
|
|
11226
|
+
let t = this.isCallHeld;
|
|
11227
|
+
await this._signaling.hold(t), this._throwIfClosed(), e = t;
|
|
11228
|
+
}
|
|
11229
|
+
B.add(this), !this.isCallHeld && (B.isSelected(this) || !N.hold) && await B.setActive(this.id), N.hold && !B.isSelected(this) && await this.hold(!0), this._throwIfClosed();
|
|
11075
11230
|
}
|
|
11076
11231
|
_emitHangupOnce(e, t) {
|
|
11077
11232
|
this._hangupEmitted || (this._hangupEmitted = !0, R.onHangup(e, t));
|
|
@@ -11081,9 +11236,10 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11081
11236
|
n != null && (r.peerId = String(n)), this._api.hangupConversation(e, t, r);
|
|
11082
11237
|
}
|
|
11083
11238
|
_close(e, t = {}) {
|
|
11084
|
-
|
|
11239
|
+
if (this._hangupPromise) return;
|
|
11240
|
+
this._resolveSignalingInitialization(!1), this._clearCalleeUnavailableWatchdog(), t.errorText && this._debug.error(t.errorText, e), this._debug.debug("Close conversation", e), this._finishLifecycle(e), this._stats.flushCallMetrics();
|
|
11085
11241
|
let n = t.signalingReason ?? (e.error ? O.FAILED : void 0), r = n && this._signaling.ready ? this._signaling.hangup(n) : void 0;
|
|
11086
|
-
this._signaling.readyToSend(!1), e.error || this._stats.logger.log(
|
|
11242
|
+
this._signaling.readyToSend(!1), e.error || this._stats.logger.log(x.ERROR, e.hangup);
|
|
11087
11243
|
let i = this._conversation && this._conversation.id;
|
|
11088
11244
|
if ([
|
|
11089
11245
|
O.CANCELED,
|
|
@@ -11113,33 +11269,37 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11113
11269
|
this._disposeSignaling(r), this._cleanupMediaSource();
|
|
11114
11270
|
return;
|
|
11115
11271
|
}
|
|
11116
|
-
this._state = "CLOSE", this._participantState = X.HUNGUP, this._changeFeatureSet(), this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._disposeSignaling(r), this._api.cleanup(), this._api.setAbortSignal(void 0), this._stats.destroy(), this._cleanupRegistry(), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this.
|
|
11272
|
+
this._state = "CLOSE", this._participantState = X.HUNGUP, this._changeFeatureSet(), this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), this._disposeSignaling(r), this._api.cleanup(), this._api.setAbortSignal(void 0), this._stats.destroy(), this._cleanupRegistry(), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._abortController = null, this._emitHangupOnce(e || new k(O.UNKNOWN_ERROR), i);
|
|
11117
11273
|
}
|
|
11118
|
-
_sendHangup(e, t, n) {
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
}
|
|
11126
|
-
|
|
11127
|
-
|
|
11274
|
+
async _sendHangup(e, t, n, r) {
|
|
11275
|
+
if (n) {
|
|
11276
|
+
if (!(await n({
|
|
11277
|
+
conversationId: e,
|
|
11278
|
+
reason: t,
|
|
11279
|
+
internalParams: this._buildInternalParams()
|
|
11280
|
+
}, r))?.success) throw Error("Fast hangup was not successful");
|
|
11281
|
+
} else this._sendHangupApi(e, t);
|
|
11282
|
+
}
|
|
11283
|
+
_throwIfClosed() {
|
|
11284
|
+
if (this._state === "CLOSE" || this._abortController?.signal.aborted) throw new k(O.CANCELED);
|
|
11285
|
+
}
|
|
11286
|
+
_applyServerConversation(e) {
|
|
11287
|
+
if (this._serverConversationId = e, this._state === "CLOSE") {
|
|
11288
|
+
let t = new AbortController();
|
|
11289
|
+
throw this._waitForHangup(this._sendHangup(e, this._hangupReason?.hangup ?? O.CANCELED, this._onFastHangup, t.signal), t).catch((e) => this._debug.warn("Unable to cancel late conversation", e)), new k(O.CANCELED);
|
|
11290
|
+
}
|
|
11128
11291
|
}
|
|
11129
11292
|
destroy() {
|
|
11130
11293
|
this._destroy();
|
|
11131
11294
|
}
|
|
11132
|
-
_destroy(e) {
|
|
11133
|
-
this._clearCalleeUnavailableWatchdog();
|
|
11134
|
-
let
|
|
11135
|
-
|
|
11136
|
-
this._sendHangup(t, O.CANCELED, this._onFastHangup);
|
|
11137
|
-
} catch {}
|
|
11138
|
-
this._api.cleanup(), this._api.setAbortSignal(void 0), this._cleanupListeners(), this._stats.destroy(), this._cleanupRegistry(), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._delayedHangup = !1, this._abortController = null;
|
|
11295
|
+
_destroy(e, t = !1) {
|
|
11296
|
+
this._resolveSignalingInitialization(!1), this._clearCalleeUnavailableWatchdog();
|
|
11297
|
+
let n = this._conversation && this._conversation.id;
|
|
11298
|
+
this._debug.debug("Destroy conversation", { conversationId: n }), this._stopFirstMediaSentProbe(), this._cooldownQueueCleanupTimer !== null && (window.clearInterval(this._cooldownQueueCleanupTimer), this._cooldownQueueCleanupTimer = null), this._state = "CLOSE", this._participantState = X.HUNGUP, this._cleanupMediaSource(), this._cleanupParticipants(), this._cleanupParticipantAgnosticStreams(), this._cleanupTransport(), this._cleanupSpeakerDetector(), this._cleanupSpecListener(), t || this._disposeSignaling(e), this._api.cleanup(), this._api.setAbortSignal(void 0), this._cleanupListeners(), this._stats.destroy(), this._cleanupRegistry(), this._conversation = null, this._myLastRequestedLayouts = {}, this._displayLayoutRequester.clear(), this._abortController = null;
|
|
11139
11299
|
}
|
|
11140
11300
|
async _getConversationParams(e) {
|
|
11141
11301
|
let t = await this._api.getConversationParams(e);
|
|
11142
|
-
this._debug.debug("Api.getConversationParams", t);
|
|
11302
|
+
this._throwIfClosed(), this._debug.debug("Api.getConversationParams", t);
|
|
11143
11303
|
let { turn_server: n, stun_server: r } = t;
|
|
11144
11304
|
return N.iceServers = Ho(r, n), N.wssBase = t.endpoint, t.wt_endpoint && (N.wtsBase = t.wt_endpoint), N.wssToken = t.token, t.client_type && (N.clientType = t.client_type), t.external_user_type && (N.externalUserType = t.external_user_type), t;
|
|
11145
11305
|
}
|
|
@@ -11156,14 +11316,13 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11156
11316
|
async _startConversation({ opponentIds: e, opponentType: t, direction: n, mediaOptions: r, payload: i = "", joiningAllowed: a = !1, requireAuthToJoin: o = !1, onlyAdminCanShareMovie: s, externalIds: c, onFastStart: l, conversationId: u }) {
|
|
11157
11317
|
G.setMark(U.SIGNALING_CONNECTED);
|
|
11158
11318
|
let d = u ?? M.uuid();
|
|
11159
|
-
|
|
11160
|
-
B.reserve(d), this._reservedId = d, this._debug.debug("Conversation: start", {
|
|
11319
|
+
this._debug.debug("Conversation: start", {
|
|
11161
11320
|
conversationId: d,
|
|
11162
11321
|
opponentIds: e,
|
|
11163
11322
|
opponentType: t,
|
|
11164
11323
|
direction: n
|
|
11165
11324
|
});
|
|
11166
|
-
let f = r.includes(
|
|
11325
|
+
let f = r.includes(b.VIDEO), p, m;
|
|
11167
11326
|
if (l) {
|
|
11168
11327
|
let e;
|
|
11169
11328
|
try {
|
|
@@ -11183,7 +11342,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11183
11342
|
throw jc(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
11184
11343
|
}
|
|
11185
11344
|
} catch (e) {
|
|
11186
|
-
throw this.
|
|
11345
|
+
throw this._state === "CLOSE" ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_START_ERROR, { message: e.message }) : new k(O.FAST_START_ERROR, { message: String(e) });
|
|
11187
11346
|
}
|
|
11188
11347
|
try {
|
|
11189
11348
|
let t = JSON.parse(e.internalCallerParams);
|
|
@@ -11205,9 +11364,9 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11205
11364
|
throw jc(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
11206
11365
|
}
|
|
11207
11366
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
|
|
11208
|
-
qo(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
11367
|
+
qo(p, m), this._applyServerConversation(p.id), this._pendingId = p.id, this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
11209
11368
|
let ee = await this._connectSignaling(Cr.START, p);
|
|
11210
|
-
return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
11369
|
+
return this._throwIfClosed(), this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
11211
11370
|
}
|
|
11212
11371
|
async _joinConversation(e) {
|
|
11213
11372
|
G.setMark(U.SIGNALING_CONNECTED);
|
|
@@ -11216,8 +11375,8 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11216
11375
|
conversationId: t,
|
|
11217
11376
|
joinLink: i,
|
|
11218
11377
|
observedIds: a
|
|
11219
|
-
}), t && B.has(t)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11220
|
-
let c = n.includes(
|
|
11378
|
+
}), t && B.has(t, this)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11379
|
+
let c = n.includes(b.VIDEO), l, u;
|
|
11221
11380
|
if (s) {
|
|
11222
11381
|
if (!i) throw new k(O.FAST_JOIN_ERROR, { callError: {
|
|
11223
11382
|
scope: "internal",
|
|
@@ -11234,11 +11393,11 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11234
11393
|
if (!e.internalCallerParams) throw jc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
11235
11394
|
if (!e.conversationId) throw jc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
11236
11395
|
} catch (e) {
|
|
11237
|
-
throw this.
|
|
11396
|
+
throw this._state === "CLOSE" ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_JOIN_ERROR, { message: e.message }) : new k(O.FAST_JOIN_ERROR, { message: String(e) });
|
|
11238
11397
|
}
|
|
11239
11398
|
try {
|
|
11240
11399
|
let t = JSON.parse(e.internalCallerParams);
|
|
11241
|
-
if (B.has(e.conversationId)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11400
|
+
if (B.has(e.conversationId, this)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11242
11401
|
l = {
|
|
11243
11402
|
endpoint: t.endpoint,
|
|
11244
11403
|
wt_endpoint: t.wtEndpoint,
|
|
@@ -11259,13 +11418,13 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11259
11418
|
code: "join",
|
|
11260
11419
|
description: "target-missing"
|
|
11261
11420
|
} });
|
|
11262
|
-
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), qo(l, u), l.id) {
|
|
11263
|
-
if (B.has(l.id)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11264
|
-
|
|
11421
|
+
if (this._applyServerConversation(l.id), this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), qo(l, u), l.id) {
|
|
11422
|
+
if (B.has(l.id, this)) throw new k(O.HAS_ACTIVE_CALL);
|
|
11423
|
+
this._pendingId = l.id;
|
|
11265
11424
|
}
|
|
11266
11425
|
this._setConversationParams(l);
|
|
11267
11426
|
let d = await this._connectSignaling(Cr.JOIN, l);
|
|
11268
|
-
return this._setConversation(l, d, _o.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
11427
|
+
return this._throwIfClosed(), this._setConversation(l, d, _o.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
11269
11428
|
}
|
|
11270
11429
|
async _prepareConversation(e, t = j.USER, n, r, i) {
|
|
11271
11430
|
G.setMark(U.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -11327,7 +11486,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11327
11486
|
}), l.wt_endpoint = c);
|
|
11328
11487
|
}
|
|
11329
11488
|
let u = await this._connectSignaling(Cr.ACCEPT, l);
|
|
11330
|
-
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(
|
|
11489
|
+
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(x.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._throwIfClosed(), this._setConversation(l, u, _o.INCOMING, t), u);
|
|
11331
11490
|
}
|
|
11332
11491
|
_createParticipant(e, t, n = !0) {
|
|
11333
11492
|
let r = Object.assign({
|
|
@@ -11373,33 +11532,38 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11373
11532
|
});
|
|
11374
11533
|
}
|
|
11375
11534
|
_setConversation(e, t, n, r = j.USER) {
|
|
11376
|
-
let { participants: i } = t.conversation;
|
|
11535
|
+
let { participants: i } = t.conversation, a = t.conversation.id || e.id;
|
|
11536
|
+
if (!a) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
11537
|
+
scope: "internal",
|
|
11538
|
+
code: "conversation",
|
|
11539
|
+
description: "id-missing"
|
|
11540
|
+
} });
|
|
11377
11541
|
t.conversationParams?.serverTime && (this._serverTimeOffset = t.conversationParams.serverTime - Date.now()), this._cacheParticipantExternalIds(i);
|
|
11378
|
-
let
|
|
11379
|
-
if (!
|
|
11380
|
-
if (!
|
|
11542
|
+
let o = this._api.getUserId(), s = this._extractLocalParticipantFromConnection(t), c = e.device_idx || 0;
|
|
11543
|
+
if (!o) {
|
|
11544
|
+
if (!s) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
11381
11545
|
scope: "internal",
|
|
11382
11546
|
code: "conversation",
|
|
11383
11547
|
description: "anonymous-local-participant-missing"
|
|
11384
11548
|
} });
|
|
11385
|
-
|
|
11549
|
+
o = Number(s.id), s.idType && (r = s.idType), s.deviceIdx && (c = s.deviceIdx), this._api.setUserId(o);
|
|
11386
11550
|
}
|
|
11387
|
-
let
|
|
11551
|
+
let l = M.composeParticipantId(o, r, c);
|
|
11388
11552
|
this._conversation = {
|
|
11389
|
-
userId:
|
|
11390
|
-
compositeUserId:
|
|
11391
|
-
externalId: this._getExternalIdByParticipantId(
|
|
11553
|
+
userId: o,
|
|
11554
|
+
compositeUserId: l,
|
|
11555
|
+
externalId: this._getExternalIdByParticipantId(l),
|
|
11392
11556
|
acceptTime: t.conversation.acceptTime,
|
|
11393
11557
|
features: t.conversation.features || [],
|
|
11394
11558
|
featuresPerRole: t.conversation.featuresPerRole,
|
|
11395
|
-
id:
|
|
11559
|
+
id: a,
|
|
11396
11560
|
participantsLimit: t.conversation.participantsLimit || 30,
|
|
11397
11561
|
topology: t.conversation.topology || J.DIRECT,
|
|
11398
11562
|
direction: n,
|
|
11399
11563
|
concurrent: t.isConcurrent || e.is_concurrent || !1,
|
|
11400
11564
|
needRate: !1,
|
|
11401
11565
|
chatId: t.conversation.multichatId,
|
|
11402
|
-
roles:
|
|
11566
|
+
roles: s?.roles ?? [],
|
|
11403
11567
|
recordsInfoByRoom: /* @__PURE__ */ new Map(),
|
|
11404
11568
|
asrInfoByRoom: /* @__PURE__ */ new Map(),
|
|
11405
11569
|
muteStates: /* @__PURE__ */ new Map(),
|
|
@@ -11417,9 +11581,9 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11417
11581
|
audienceMode: this._isAudienceMode(t),
|
|
11418
11582
|
restricted: this._isRestricted(t),
|
|
11419
11583
|
urlSharingInfoByRoom: /* @__PURE__ */ new Map()
|
|
11420
|
-
}, this._debug.setConversationId(t.conversation.id || e.id), e.p2p_forbidden && (N.forceRelayPolicy = e.p2p_forbidden), this._stats.logger.log(
|
|
11421
|
-
let
|
|
11422
|
-
if (
|
|
11584
|
+
}, this._debug.setConversationId(t.conversation.id || e.id), e.p2p_forbidden && (N.forceRelayPolicy = e.p2p_forbidden), this._stats.logger.log(x.RELAY_POLICY, N.forceRelayPolicy ? "1" : "0");
|
|
11585
|
+
let u = B.get(this._conversation.id);
|
|
11586
|
+
if (u && u !== this) this._conversation.concurrent = !0;
|
|
11423
11587
|
else if (!N.hold && B.callsLength > 0) throw new k(O.HAS_ACTIVE_CALL);
|
|
11424
11588
|
this._changeFeatureSet(), this._changeFeaturesPerRole(), this._logDevices();
|
|
11425
11589
|
}
|
|
@@ -11431,17 +11595,53 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11431
11595
|
} });
|
|
11432
11596
|
this._conversation.acceptTime = e.conversation.acceptTime, this._conversation.features = e.conversation.features || [], this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._conversation.participantsLimit = e.conversation.participantsLimit || 30, this._conversation.topology = e.conversation.topology || J.DIRECT, this._conversation.concurrent = e.isConcurrent || !1, this._conversation.chatId = e.conversation.multichatId, this._conversation.mediaModifiers = e.mediaModifiers, this._conversation.waitingHall = !1, this._conversation.waitForAdmin = !1, this._conversation.restricted = !1, this._cacheParticipantExternalIds(e.conversation.participants ?? []);
|
|
11433
11597
|
}
|
|
11598
|
+
async _requestLocalMedia(e, t = !0) {
|
|
11599
|
+
let n = this._mediaSource, r = new Set(e);
|
|
11600
|
+
for (let [e, t] of [[b.AUDIO, this._requestedLocalAudio], [b.VIDEO, this._requestedLocalVideo]]) t === !0 ? r.add(e) : t === !1 && r.delete(e);
|
|
11601
|
+
this._requestingLocalMedia = !0;
|
|
11602
|
+
try {
|
|
11603
|
+
for (await n.request([...r], t);;) {
|
|
11604
|
+
if (this._state === "CLOSE" || this._abortController?.signal.aborted) throw n.destroy(), new k(O.CANCELED);
|
|
11605
|
+
let e = this._requestedLocalAudio, t = this._requestedLocalVideo;
|
|
11606
|
+
if (e !== void 0 && e !== n.mediaSettings.isAudioEnabled) {
|
|
11607
|
+
try {
|
|
11608
|
+
await this._toggleLocalAudio(e);
|
|
11609
|
+
} catch (t) {
|
|
11610
|
+
if (e === this._requestedLocalAudio) throw t;
|
|
11611
|
+
}
|
|
11612
|
+
continue;
|
|
11613
|
+
}
|
|
11614
|
+
if (t !== void 0 && t !== n.mediaSettings.isVideoEnabled) {
|
|
11615
|
+
try {
|
|
11616
|
+
await this._toggleLocalVideo(t);
|
|
11617
|
+
} catch (e) {
|
|
11618
|
+
if (t === this._requestedLocalVideo) throw e;
|
|
11619
|
+
}
|
|
11620
|
+
continue;
|
|
11621
|
+
}
|
|
11622
|
+
break;
|
|
11623
|
+
}
|
|
11624
|
+
this.isCallHeld && (await n.stopLocalMedia(), this._throwIfClosed());
|
|
11625
|
+
for (let [e, t] of [[b.AUDIO, n.mediaSettings.isAudioEnabled], [b.VIDEO, n.mediaSettings.isVideoEnabled]]) t ? r.add(e) : r.delete(e);
|
|
11626
|
+
return R.onLocalStream(n.getStream(), n.mediaSettings, this.id), [...r];
|
|
11627
|
+
} finally {
|
|
11628
|
+
this._requestingLocalMedia = !1;
|
|
11629
|
+
}
|
|
11630
|
+
}
|
|
11434
11631
|
_createMediaSource() {
|
|
11435
11632
|
let e = new Qt(this._debug, this._stats.logger);
|
|
11436
11633
|
return this.subscribe(e, Xt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Go(e, this._debug, this._stats.logger), e;
|
|
11437
11634
|
}
|
|
11438
11635
|
async _connectSignaling(e, t) {
|
|
11439
|
-
this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, wr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, wr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, wr.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
11636
|
+
this._throwIfClosed(), this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, wr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, wr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, wr.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
11440
11637
|
let n = await this._signaling.connect(e, t);
|
|
11441
|
-
return this._stats.statAggregator.logEventualStatSinceMark({ name: U.SIGNALING_CONNECTED }), n;
|
|
11638
|
+
return this._throwIfClosed(), this._stats.statAggregator.logEventualStatSinceMark({ name: U.SIGNALING_CONNECTED }), n;
|
|
11639
|
+
}
|
|
11640
|
+
_completeSignalingInitialization() {
|
|
11641
|
+
this._throwIfClosed(), R.onSignalingConnected(this.id), this._resolveSignalingInitialization(!0);
|
|
11442
11642
|
}
|
|
11443
11643
|
async _processConnection(e) {
|
|
11444
|
-
await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(yo.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
11644
|
+
this._throwIfClosed(), await this._registerConnectionParticipants(e), this._throwIfClosed(), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(yo.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
11445
11645
|
}
|
|
11446
11646
|
_onConversationParticipantListChunk(e) {
|
|
11447
11647
|
let t = e.participants;
|
|
@@ -11497,6 +11697,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11497
11697
|
n && (N.externalUserType = n);
|
|
11498
11698
|
let r = this._participants;
|
|
11499
11699
|
for (let n of e) {
|
|
11700
|
+
this._throwIfClosed();
|
|
11500
11701
|
let e = M.composeId(n);
|
|
11501
11702
|
if (z.test("Conversation:RegisterParticipant", e), this._isMe(e)) {
|
|
11502
11703
|
this._conversation.roles = n.roles || [], this._conversation.roles.length && (this._debug.debug(`Local roles changed: ${n.roles}`), R.onLocalRolesChanged(this._conversation.roles, !0, this.id)), this._registerParticipantLocalMuteState(n);
|
|
@@ -11653,7 +11854,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11653
11854
|
for (let t of e.rooms?.rooms ?? []) t.pinnedParticipantId ? this._onPinParticipant(t.pinnedParticipantId, !1, void 0, t.id) : this._conversation?.pinnedParticipantIdByRoom.delete(t.id);
|
|
11654
11855
|
}
|
|
11655
11856
|
_allocateTransport() {
|
|
11656
|
-
if (!this._conversation || !this._mediaSource) return;
|
|
11857
|
+
if (!this._conversation || !this._mediaSource || this.isCallHeld || this._transport) return;
|
|
11657
11858
|
this._transport = new Ma(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new Qo(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
11658
11859
|
let e = this._conversation.direction === _o.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
11659
11860
|
for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
@@ -11666,7 +11867,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11666
11867
|
}
|
|
11667
11868
|
_logDevices() {
|
|
11668
11869
|
let e = E.getCameras().length, t = E.getMicrophones().length;
|
|
11669
|
-
this._debug.debug("Cameras: " + e + (E.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (E.hasMicrophonePermission() ? "✔" : "✖")), this._debug.debug("Devices", E.getDevices()), this._stats.logger.log(
|
|
11870
|
+
this._debug.debug("Cameras: " + e + (E.hasCameraPermission() ? "✔" : "✖") + ", Microphones: " + t + (E.hasMicrophonePermission() ? "✔" : "✖")), this._debug.debug("Devices", E.getDevices()), this._stats.logger.log(x.DEVICES, `${e}_${t}`);
|
|
11670
11871
|
}
|
|
11671
11872
|
_logWithMediaSettings(e, t) {
|
|
11672
11873
|
this._stats.logger.log(e, [t?.isAudioEnabled && "audio", t?.isVideoEnabled && "video"].filter(Boolean).join("_"));
|
|
@@ -11756,7 +11957,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11756
11957
|
observedIds: t.observedIds || []
|
|
11757
11958
|
}, n), r = this._getParticipant(e);
|
|
11758
11959
|
}
|
|
11759
|
-
this._setParticipantsStatus([r], P.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = X.HUNGUP, this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(
|
|
11960
|
+
this._setParticipantsStatus([r], P.WAITING), i && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(r), n ? (r.state = X.HUNGUP, this._removeParticipant(r, n)) : this._transport && (r.state = X.CALLED, this._allocateParticipantTransport(r.id, !0), this._stats.logger.log(x.ADD_PARTICIPANT), this._invokeRolesChangedCallbackIfNeeded(r));
|
|
11760
11961
|
}
|
|
11761
11962
|
_onRemoveParticipant(e) {
|
|
11762
11963
|
this._debug.debug(`Remove participant [${e}]`);
|
|
@@ -11770,19 +11971,19 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11770
11971
|
return;
|
|
11771
11972
|
}
|
|
11772
11973
|
for (let e of t) this._closeParticipantTransport(e.id);
|
|
11773
|
-
this._stats.logger.log(
|
|
11974
|
+
this._stats.logger.log(x.REMOVE_PARTICIPANT);
|
|
11774
11975
|
}
|
|
11775
11976
|
async changeDevice(e) {
|
|
11776
|
-
return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(
|
|
11977
|
+
return e === "audiooutput" ? this._audioOutput.changeOutput() : this._mediaSource ? this._mediaSource.changeDevice(e) : Promise.reject(y.UNKNOWN);
|
|
11777
11978
|
}
|
|
11778
11979
|
stopVideoTrack() {
|
|
11779
11980
|
return this._mediaSource?.stopVideoTrack();
|
|
11780
11981
|
}
|
|
11781
11982
|
async toggleScreenCapturing(e) {
|
|
11782
|
-
return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(
|
|
11983
|
+
return this._mediaSource ? this._mediaSource.toggleScreenCapturing(e) : Promise.reject(y.UNKNOWN);
|
|
11783
11984
|
}
|
|
11784
11985
|
async disableScreenCapturing() {
|
|
11785
|
-
return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(
|
|
11986
|
+
return this._mediaSource ? this._mediaSource.disableScreenCapturing() : Promise.reject(y.UNKNOWN);
|
|
11786
11987
|
}
|
|
11787
11988
|
toggleAnimojiCapturing(e) {
|
|
11788
11989
|
this._mediaSource && this._mediaSource.toggleAnimojiCapturing(e);
|
|
@@ -11814,10 +12015,10 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11814
12015
|
if (this._mediaSource) return this._mediaSource.setAudioStream(e);
|
|
11815
12016
|
}
|
|
11816
12017
|
toggleLocalVideo(e) {
|
|
11817
|
-
return this._toggleLocalVideo(e);
|
|
12018
|
+
return this._requestedLocalVideo = e, this._requestingLocalMedia || !this._mediaSource?.getStream() ? Promise.resolve() : this._toggleLocalVideo(e);
|
|
11818
12019
|
}
|
|
11819
12020
|
toggleLocalAudio(e) {
|
|
11820
|
-
return this._toggleLocalAudio(e);
|
|
12021
|
+
return this._requestedLocalAudio = e, this._requestingLocalMedia || !this._mediaSource?.getStream() ? Promise.resolve() : this._toggleLocalAudio(e);
|
|
11821
12022
|
}
|
|
11822
12023
|
async changePriorities(e) {
|
|
11823
12024
|
if (e.length < 2 || !this._signaling.ready) return;
|
|
@@ -11838,6 +12039,10 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11838
12039
|
t && !this._isCallAdmin() && (t = void 0), await this._signaling.changeParticipantState(e, t);
|
|
11839
12040
|
}
|
|
11840
12041
|
async hold(e, t) {
|
|
12042
|
+
if (this._throwIfClosed(), B.isPending(this)) {
|
|
12043
|
+
e ? await this._holdLocally() : await this._resumeLocalMedia(t, P.WAITING);
|
|
12044
|
+
return;
|
|
12045
|
+
}
|
|
11841
12046
|
if (e) {
|
|
11842
12047
|
if (this._state === "HELD") return;
|
|
11843
12048
|
if (this._isWaitingForPromotion()) {
|
|
@@ -11852,7 +12057,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11852
12057
|
return;
|
|
11853
12058
|
}
|
|
11854
12059
|
let n = Ja.get();
|
|
11855
|
-
await this._signaling.hold(!1, n), this._restoreStateAfterHold();
|
|
12060
|
+
await this._signaling.hold(!1, n), this._throwIfClosed(), this._restoreStateAfterHold();
|
|
11856
12061
|
let r = null;
|
|
11857
12062
|
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._participants), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
11858
12063
|
let e = this._conversation?.direction === _o.OUTGOING && !this._conversation.concurrent;
|
|
@@ -11860,12 +12065,12 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11860
12065
|
}
|
|
11861
12066
|
}
|
|
11862
12067
|
async _holdLocally() {
|
|
11863
|
-
this._state !== "HELD" && (this._previousState = this._state, this._state = "HELD");
|
|
12068
|
+
this._throwIfClosed(), this._state !== "HELD" && (this._previousState = this._state, this._state = "HELD");
|
|
11864
12069
|
let e = this._mediaSource?.stopLocalMedia();
|
|
11865
12070
|
this._cleanupTransportForHold(), R.onLocalStatus(P.ONHOLD, this.id), await e;
|
|
11866
12071
|
}
|
|
11867
12072
|
async _resumeLocalMedia(e, t) {
|
|
11868
|
-
this._restoreStateAfterHold(), await this._mediaSource?.resumeLocalMedia(e), R.onLocalStatus(t, this.id), this._mediaSource && R.onLocalStream(this._mediaSource?.getStream() ?? null, this._mediaSource.mediaSettings, this.id);
|
|
12073
|
+
this._restoreStateAfterHold(), await this._mediaSource?.resumeLocalMedia(e), this._throwIfClosed(), R.onLocalStatus(t, this.id), this._mediaSource && R.onLocalStream(this._mediaSource?.getStream() ?? null, this._mediaSource.mediaSettings, this.id);
|
|
11869
12074
|
}
|
|
11870
12075
|
_restoreStateAfterHold() {
|
|
11871
12076
|
this._state === "HELD" && (this._state = this._previousState || "ACTIVE", this._previousState = null);
|
|
@@ -11958,7 +12163,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11958
12163
|
R.onRemoteScreenStream(r.externalId, null, this.id);
|
|
11959
12164
|
break;
|
|
11960
12165
|
}
|
|
11961
|
-
this._stats.logger.log(
|
|
12166
|
+
this._stats.logger.log(x.PAT_DEALLOCATED);
|
|
11962
12167
|
} else this._debug.log(`Cannot find participant to stop streaming: ${n.participantId}`);
|
|
11963
12168
|
}
|
|
11964
12169
|
this._streamIdByStreamDescription.delete(e);
|
|
@@ -11984,7 +12189,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
11984
12189
|
});
|
|
11985
12190
|
}
|
|
11986
12191
|
}
|
|
11987
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
12192
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Nc("Could not allocate one or more participants", r);
|
|
11988
12193
|
}
|
|
11989
12194
|
async _cleanupCooldownQueue() {
|
|
11990
12195
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -12006,7 +12211,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12006
12211
|
}
|
|
12007
12212
|
}
|
|
12008
12213
|
async _onParticipantPromoted(e) {
|
|
12009
|
-
this._conversation && this._conversation.audienceMode ? (this._debug.log("Promoted in audience mode", !e.demote), this._conversation.restricted = e.demote, this._processRecordInfos(e), !e.demote && this._mediaSource && this._changeMediaSettings(this._mediaSource.mediaSettings)) : (this._debug.log("Promoted in waiting hall", !e.demote), e.demote ? (this._debug.log("Kicked from waiting hall"), this._close(new k(O.REMOVED))) : (this._updateConversation(e), this._waitingHallHoldPending ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !1), this._waitingHallHoldPending = !1) : B.getActive() && N.hold ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !0, !0), this._waitingHallHoldPending = !1) : await this._onJoinPart2(e))), R.onPromoted(e.demote, this.id);
|
|
12214
|
+
this._conversation && this._conversation.audienceMode ? (this._debug.log("Promoted in audience mode", !e.demote), this._conversation.restricted = e.demote, this._processRecordInfos(e), !e.demote && this._mediaSource && this._changeMediaSettings(this._mediaSource.mediaSettings)) : (this._debug.log("Promoted in waiting hall", !e.demote), e.demote ? (this._debug.log("Kicked from waiting hall"), this._close(new k(O.REMOVED))) : (this._updateConversation(e), this._waitingHallHoldPending ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !1), this._waitingHallHoldPending = !1) : B.getActive() && N.hold ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !0, !0), this._waitingHallHoldPending = !1) : (B.selectIfNone(this), await this._onJoinPart2(e)))), R.onPromoted(e.demote, this.id);
|
|
12010
12215
|
}
|
|
12011
12216
|
_onChatRoomUpdated(e, t = 0, n = [], r, i) {
|
|
12012
12217
|
this._debug.log(`Chat room updated: ${e}`);
|
|
@@ -12128,7 +12333,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12128
12333
|
}
|
|
12129
12334
|
let a = Ln(t), o = this._sequenceNumberByStreamDescription.get(a);
|
|
12130
12335
|
if (o && o > e.sequenceNumber) {
|
|
12131
|
-
this._debug.warn(`Participant ${r} received outdated PAT response: sequence number ${e.sequenceNumber}; last sent sequence number for given participant is ${o}`), this._stats.logger.log(
|
|
12336
|
+
this._debug.warn(`Participant ${r} received outdated PAT response: sequence number ${e.sequenceNumber}; last sent sequence number for given participant is ${o}`), this._stats.logger.log(x.PAT_OUTDATED_RESPONSE);
|
|
12132
12337
|
return;
|
|
12133
12338
|
}
|
|
12134
12339
|
i && e.suspend !== void 0 && n && (this._debug.debug(`participant-sources-update: mediaType=${n}, suspend=${e.suspend}`), R.onRemoteStreamSuspended(i.externalId, n, e.suspend, this.id));
|
|
@@ -12137,15 +12342,15 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12137
12342
|
this._streamWaitTimerByStreamDescription.delete(a);
|
|
12138
12343
|
let t = this._conversation?.externalId, n = this._isMe(r);
|
|
12139
12344
|
if (!i && !n) {
|
|
12140
|
-
this._stats.logger.log(
|
|
12345
|
+
this._stats.logger.log(x.PAT_ERROR, "participantMissing"), this._debug.error(`Could not find participant by ID: ${r}`);
|
|
12141
12346
|
return;
|
|
12142
12347
|
}
|
|
12143
12348
|
let o = n ? t : i.externalId, c = this._streamByStreamId.get(s);
|
|
12144
12349
|
if (!c) {
|
|
12145
|
-
this._stats.logger.log(
|
|
12350
|
+
this._stats.logger.log(x.PAT_ERROR, "streamNotFound"), this._debug.error(`Could not find stream by ID: ${s}`);
|
|
12146
12351
|
return;
|
|
12147
12352
|
}
|
|
12148
|
-
this._stats.logger.log(
|
|
12353
|
+
this._stats.logger.log(x.PAT_ALLOCATED), this._streamIdByStreamDescription.set(a, s);
|
|
12149
12354
|
let l = e.participantStreamDescription?.mediaType;
|
|
12150
12355
|
if (l === H.STREAM || l === H.MOVIE) {
|
|
12151
12356
|
if (e.participantStreamDescription?.streamName) {
|
|
@@ -12452,9 +12657,9 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12452
12657
|
return this._debug.debug("Get initial participant list chunk", n.chunk), n.chunk;
|
|
12453
12658
|
}
|
|
12454
12659
|
_onLocalMediaStreamChanged(e) {
|
|
12455
|
-
if (!this.
|
|
12660
|
+
if (!this._mediaSource) return;
|
|
12456
12661
|
let t = this._mediaSource.mediaSettings;
|
|
12457
|
-
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Go(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation
|
|
12662
|
+
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Go(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), e.kind === A.video && !this._requestingLocalMedia && this._state !== "CLOSE" && R.onLocalStream(this._mediaSource.getStream(), t, this.id), this._conversation && !this._conversation.waitingHall && !this._conversation.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
|
|
12458
12663
|
}
|
|
12459
12664
|
_onScreenSharingStatus(e) {
|
|
12460
12665
|
let t = this.mediaSettings;
|
|
@@ -12515,7 +12720,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12515
12720
|
this._state === "ACTIVE" && e.roles && e.roles.length && (this._debug.debug(`Roles for participant [${e.id}] changed: ${e.roles}`), R.onRolesChanged(e.externalId, e.roles, !0, this.id));
|
|
12516
12721
|
}
|
|
12517
12722
|
_onSignalingNotification(e) {
|
|
12518
|
-
switch (e.notification) {
|
|
12723
|
+
if (this._state !== "CLOSE") switch (e.notification) {
|
|
12519
12724
|
case K.ACCEPTED_CALL: return this._onAcceptedCall(e);
|
|
12520
12725
|
case K.HUNGUP: return this._onHungup(e);
|
|
12521
12726
|
case K.PARTICIPANT_ADDED: return this._onAddedParticipant(e);
|
|
@@ -12576,7 +12781,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12576
12781
|
R.onPromotionApproved(t, this.id);
|
|
12577
12782
|
}
|
|
12578
12783
|
async _onSignalingReconnect(e) {
|
|
12579
|
-
if (!this._conversation) return;
|
|
12784
|
+
if (!await this._signalingInitialization || this._state === "CLOSE" || !this._conversation) return;
|
|
12580
12785
|
e.conversationParams?.serverTime && (this._serverTimeOffset = e.conversationParams.serverTime - Date.now()), e.conversation.acceptTime && (this._conversation.acceptTime = e.conversation.acceptTime), e.conversation.participantsLimit && (this._conversation.participantsLimit = e.conversation.participantsLimit), e.conversation.features && (this._conversation.features = e.conversation.features, this._conversation.featuresPerRole = e.conversation.featuresPerRole, this._changeFeatureSet(), this._changeFeaturesPerRole()), this._processPinnedParticipants(e), e.conversation.state;
|
|
12581
12786
|
let t = null;
|
|
12582
12787
|
if (e.conversation.participants) {
|
|
@@ -12594,30 +12799,29 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12594
12799
|
}
|
|
12595
12800
|
r.push(e);
|
|
12596
12801
|
let a = this._getParticipant(e);
|
|
12597
|
-
if (
|
|
12598
|
-
participantId: n.id,
|
|
12599
|
-
participant: n,
|
|
12600
|
-
mediaSettings: n.mediaSettings
|
|
12601
|
-
});
|
|
12602
|
-
else {
|
|
12802
|
+
if (a) {
|
|
12603
12803
|
this._updateParticipantSessionState(a, e, n.sessionState);
|
|
12604
12804
|
let t = D(n.mediaSettings);
|
|
12605
12805
|
qt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
12606
12806
|
let r = M.mapParticipantState(n), o = a.participantState;
|
|
12607
|
-
M.isEqualParticipantState(r, o)
|
|
12608
|
-
|
|
12807
|
+
if (!M.isEqualParticipantState(r, o) && (await this._changeRemoteParticipantState(e, r), !this._conversation)) return;
|
|
12808
|
+
ko(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? P.ONHOLD : P.CONNECTED));
|
|
12809
|
+
} else if (await this._onJoinedParticipant({
|
|
12810
|
+
participantId: n.id,
|
|
12811
|
+
participant: n,
|
|
12812
|
+
mediaSettings: n.mediaSettings
|
|
12813
|
+
}), !this._conversation) return;
|
|
12609
12814
|
}
|
|
12610
12815
|
let i = this._participants;
|
|
12611
12816
|
for (let e of n) r.indexOf(e) < 0 && i[e] && this._removeParticipant(i[e], O.HUNGUP);
|
|
12612
12817
|
}
|
|
12613
12818
|
let n = [...e.participants?.participants ?? [], ...e.rooms?.rooms.flatMap((e) => e.participants?.participants ?? []) ?? []];
|
|
12614
|
-
await this._reconcileParticipantSessionStates(n);
|
|
12819
|
+
if (await this._reconcileParticipantSessionStates(n), !this._conversation) return;
|
|
12615
12820
|
let r = e.rooms?.roomId ?? null;
|
|
12616
|
-
if (
|
|
12617
|
-
this.
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
this._conversation.roomId === r ? this._processMuteStates(e, !0) : await this._onRoomSwitched(r), t?.(), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options);
|
|
12821
|
+
if (this._conversation.roomId !== r) {
|
|
12822
|
+
if (await this._onRoomSwitched(r), !this._conversation) return;
|
|
12823
|
+
} else this._processMuteStates(e, !0);
|
|
12824
|
+
t?.(), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), R.onSignalingConnected(this.id);
|
|
12621
12825
|
}
|
|
12622
12826
|
_onSignalingFailed(e) {
|
|
12623
12827
|
this._debug.error("Signaling failed", e), this._close(e);
|
|
@@ -12642,7 +12846,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12642
12846
|
let t = Z.fromSignaling(e.externalId, e.deviceIdx);
|
|
12643
12847
|
r.externalId = t, this._api.cacheExternalId(r.id, t);
|
|
12644
12848
|
}
|
|
12645
|
-
r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(
|
|
12849
|
+
r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(x.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === _o.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
|
|
12646
12850
|
let i = Object.keys(r.muteStates);
|
|
12647
12851
|
if (i.length && this._onMuteParticipant({
|
|
12648
12852
|
muteStates: r.muteStates,
|
|
@@ -12851,7 +13055,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
12851
13055
|
n && (n.clientType = e.clientType, n.platform = e.platform, R.onPeerRegistered(this.id, [n.externalId]));
|
|
12852
13056
|
}
|
|
12853
13057
|
async _onMicSwitched(e) {
|
|
12854
|
-
R.onDeviceSwitched(
|
|
13058
|
+
R.onDeviceSwitched(b.AUDIO, !e.mute, this.id), await this.toggleLocalAudio(!e.mute);
|
|
12855
13059
|
}
|
|
12856
13060
|
_onChatMessage(e) {
|
|
12857
13061
|
let t = M.composeMessageId(e), n = this._getExternalIdByParticipantId(t);
|
|
@@ -13016,17 +13220,17 @@ var Mc = 15, $ = class e extends Je {
|
|
|
13016
13220
|
for (let [e, i] of d) {
|
|
13017
13221
|
let a = this._isCallAdmin() && n;
|
|
13018
13222
|
if (!(i !== wo.MUTE && i !== wo.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === wo.MUTE_PERMANENT && !n && (l[e] = wo.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
13019
|
-
case
|
|
13020
|
-
u.isVideoEnabled && (R.onDeviceSwitched(
|
|
13223
|
+
case b.VIDEO:
|
|
13224
|
+
u.isVideoEnabled && (R.onDeviceSwitched(b.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
|
|
13021
13225
|
break;
|
|
13022
|
-
case
|
|
13023
|
-
u.isAudioEnabled && (R.onDeviceSwitched(
|
|
13226
|
+
case b.AUDIO:
|
|
13227
|
+
u.isAudioEnabled && (R.onDeviceSwitched(b.AUDIO, !1, this.id), await this.toggleLocalAudio(!1));
|
|
13024
13228
|
break;
|
|
13025
|
-
case
|
|
13026
|
-
u.isScreenSharingEnabled && (R.onDeviceSwitched(
|
|
13229
|
+
case b.SCREEN_SHARING:
|
|
13230
|
+
u.isScreenSharingEnabled && (R.onDeviceSwitched(b.SCREEN_SHARING, !1, this.id), await this.disableScreenCapturing());
|
|
13027
13231
|
break;
|
|
13028
|
-
case
|
|
13029
|
-
u.isAudioSharingEnabled && (R.onDeviceSwitched(
|
|
13232
|
+
case b.AUDIO_SHARING:
|
|
13233
|
+
u.isAudioSharingEnabled && (R.onDeviceSwitched(b.AUDIO_SHARING, !1, this.id), await this.toggleScreenCapturing({
|
|
13030
13234
|
captureScreen: u.isScreenSharingEnabled,
|
|
13031
13235
|
fastScreenSharing: u.isFastScreenSharingEnabled,
|
|
13032
13236
|
captureAudio: !1
|
|
@@ -13508,11 +13712,11 @@ var Mc = 15, $ = class e extends Je {
|
|
|
13508
13712
|
_getParticipant(e) {
|
|
13509
13713
|
return this._participants[e];
|
|
13510
13714
|
}
|
|
13511
|
-
}, Nc =
|
|
13715
|
+
}, Nc = class e extends Error {
|
|
13512
13716
|
constructor(t, n) {
|
|
13513
13717
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
13514
13718
|
}
|
|
13515
|
-
},
|
|
13719
|
+
}, Pc = class {
|
|
13516
13720
|
constructor() {
|
|
13517
13721
|
h(this, "_abortSignal", void 0), h(this, "_apiCallStats", null);
|
|
13518
13722
|
}
|
|
@@ -13557,7 +13761,7 @@ var Mc = 15, $ = class e extends Je {
|
|
|
13557
13761
|
async getInbounds() {
|
|
13558
13762
|
return [];
|
|
13559
13763
|
}
|
|
13560
|
-
},
|
|
13764
|
+
}, Fc = class e {
|
|
13561
13765
|
constructor() {
|
|
13562
13766
|
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
13563
13767
|
}
|
|
@@ -13592,27 +13796,27 @@ var Mc = 15, $ = class e extends Je {
|
|
|
13592
13796
|
clear() {
|
|
13593
13797
|
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
13594
13798
|
}
|
|
13595
|
-
},
|
|
13596
|
-
function
|
|
13799
|
+
}, Ic = "anonymLogin:", Lc = 700, Rc = 3e3;
|
|
13800
|
+
function zc(e) {
|
|
13597
13801
|
let t = e.error_code;
|
|
13598
13802
|
switch (t) {
|
|
13599
|
-
case 2: return
|
|
13600
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
13601
|
-
case 300: return
|
|
13602
|
-
case 1101: return
|
|
13603
|
-
case 1102: return
|
|
13604
|
-
case 1103: return
|
|
13605
|
-
case 1104: return
|
|
13606
|
-
case 1106: return
|
|
13607
|
-
case 1113: return
|
|
13803
|
+
case 2: return Bc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
13804
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? Bc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Bc(y.API, t, "request-error");
|
|
13805
|
+
case 300: return Bc(O.NOT_FOUND, t, "not-found");
|
|
13806
|
+
case 1101: return Bc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
13807
|
+
case 1102: return Bc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
13808
|
+
case 1103: return Bc(O.NOT_FRIENDS, t, "friendship-required");
|
|
13809
|
+
case 1104: return Hc(t, "youla-api-error");
|
|
13810
|
+
case 1106: return Hc(t, "vk-api-error");
|
|
13811
|
+
case 1113: return Bc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
13608
13812
|
case 1114: {
|
|
13609
13813
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
13610
|
-
return
|
|
13814
|
+
return Bc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
13611
13815
|
}
|
|
13612
|
-
default: return
|
|
13816
|
+
default: return Bc(y.API, t, "api-error");
|
|
13613
13817
|
}
|
|
13614
13818
|
}
|
|
13615
|
-
function
|
|
13819
|
+
function Bc(e, t, n, r) {
|
|
13616
13820
|
return {
|
|
13617
13821
|
type: e,
|
|
13618
13822
|
callError: {
|
|
@@ -13624,10 +13828,10 @@ function Vc(e, t, n, r) {
|
|
|
13624
13828
|
message: r
|
|
13625
13829
|
};
|
|
13626
13830
|
}
|
|
13627
|
-
function
|
|
13831
|
+
function Vc(e) {
|
|
13628
13832
|
return e?.error_code === void 0 ? e instanceof k && e.callError && "code" in e.callError ? String(e.callError.code) : e instanceof Error ? e.name : "network" : String(e.error_code);
|
|
13629
13833
|
}
|
|
13630
|
-
function
|
|
13834
|
+
function Hc(e, t) {
|
|
13631
13835
|
return {
|
|
13632
13836
|
type: O.EXTERNAL_API_ERROR,
|
|
13633
13837
|
callError: {
|
|
@@ -13638,9 +13842,9 @@ function Uc(e, t) {
|
|
|
13638
13842
|
}
|
|
13639
13843
|
};
|
|
13640
13844
|
}
|
|
13641
|
-
var
|
|
13845
|
+
var Uc = class extends Pc {
|
|
13642
13846
|
constructor() {
|
|
13643
|
-
super(), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
13847
|
+
super(), h(this, "_uuid", void 0), h(this, "_idCache", new Fc()), this._cacheSelfExternalId();
|
|
13644
13848
|
}
|
|
13645
13849
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
13646
13850
|
let r = async (i) => {
|
|
@@ -13649,10 +13853,10 @@ var Wc = class extends Fc {
|
|
|
13649
13853
|
let r = await As(e, t, n);
|
|
13650
13854
|
return this._apiCallStats?.log(e, performance.now() - a), r;
|
|
13651
13855
|
} catch (t) {
|
|
13652
|
-
if (this._apiCallStats?.log(e, performance.now() - a,
|
|
13856
|
+
if (this._apiCallStats?.log(e, performance.now() - a, Vc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
13653
13857
|
i++;
|
|
13654
13858
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
13655
|
-
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i *
|
|
13859
|
+
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * Lc, Rc), { signal: this._abortSignal }), r(i);
|
|
13656
13860
|
}
|
|
13657
13861
|
throw z.warn(e, "error", t), t;
|
|
13658
13862
|
}
|
|
@@ -13669,22 +13873,22 @@ var Wc = class extends Fc {
|
|
|
13669
13873
|
message: i?.error_msg,
|
|
13670
13874
|
code: i?.error_code
|
|
13671
13875
|
};
|
|
13672
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
13673
|
-
let e =
|
|
13876
|
+
if (i.custom_error && (a.custom_error = i.custom_error), Wc(i)) {
|
|
13877
|
+
let e = zc(i);
|
|
13674
13878
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
|
|
13675
13879
|
}
|
|
13676
|
-
throw new k(
|
|
13880
|
+
throw new k(y.API, a);
|
|
13677
13881
|
}
|
|
13678
13882
|
}
|
|
13679
13883
|
userId(e) {
|
|
13680
|
-
if (
|
|
13884
|
+
if (v.isEmpty()) {
|
|
13681
13885
|
let { compositeUserId: t } = M.decomposeParticipantId(e), { id: n } = M.decomposeId(t);
|
|
13682
13886
|
return Z.fromId(String(n));
|
|
13683
13887
|
}
|
|
13684
13888
|
return this._idCache.getExternalId(e);
|
|
13685
13889
|
}
|
|
13686
13890
|
async authorize() {
|
|
13687
|
-
if (this._ensureUuid(), !N.apiKey) throw new k(
|
|
13891
|
+
if (this._ensureUuid(), !N.apiKey) throw new k(y.API, {
|
|
13688
13892
|
message: "Required argument apiAppKey not passed",
|
|
13689
13893
|
callError: {
|
|
13690
13894
|
scope: "internal",
|
|
@@ -13700,7 +13904,7 @@ var Wc = class extends Fc {
|
|
|
13700
13904
|
return this._anonymLogin(N.authToken).then((e) => {
|
|
13701
13905
|
this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
|
|
13702
13906
|
}).catch((e) => {
|
|
13703
|
-
throw e instanceof k ? e : (e?.error_code === ds.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(
|
|
13907
|
+
throw e instanceof k ? e : (e?.error_code === ds.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(y.AUTH, {
|
|
13704
13908
|
message: e?.error_msg,
|
|
13705
13909
|
code: e?.error_code,
|
|
13706
13910
|
callError: {
|
|
@@ -13722,22 +13926,22 @@ var Wc = class extends Fc {
|
|
|
13722
13926
|
return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
|
|
13723
13927
|
}
|
|
13724
13928
|
_getAnonymLoginCacheKey() {
|
|
13725
|
-
return N.authToken ? `${
|
|
13929
|
+
return N.authToken ? `${Ic}${N.authToken}` : null;
|
|
13726
13930
|
}
|
|
13727
13931
|
_getCachedAnonymLogin() {
|
|
13728
13932
|
let e = this._getAnonymLoginCacheKey();
|
|
13729
13933
|
if (!e) return null;
|
|
13730
13934
|
let t = ht.get(e);
|
|
13731
|
-
return
|
|
13935
|
+
return qc(t) ? t : (t && ht.remove(e), null);
|
|
13732
13936
|
}
|
|
13733
13937
|
_setCachedAnonymLogin(e) {
|
|
13734
13938
|
let t = this._getAnonymLoginCacheKey();
|
|
13735
|
-
if (!t || !
|
|
13939
|
+
if (!t || !Gc(e)) return;
|
|
13736
13940
|
let n = {
|
|
13737
13941
|
session_key: e.session_key,
|
|
13738
13942
|
session_secret_key: e.session_secret_key,
|
|
13739
13943
|
uid: e.uid,
|
|
13740
|
-
external_user_id:
|
|
13944
|
+
external_user_id: Kc(e)
|
|
13741
13945
|
};
|
|
13742
13946
|
ht.set(t, n);
|
|
13743
13947
|
}
|
|
@@ -13746,12 +13950,12 @@ var Wc = class extends Fc {
|
|
|
13746
13950
|
e && ht.remove(e);
|
|
13747
13951
|
}
|
|
13748
13952
|
_reauthorize() {
|
|
13749
|
-
return this._removeCachedAnonymLogin(),
|
|
13953
|
+
return this._removeCachedAnonymLogin(), v.reauthorize(() => this.authorize());
|
|
13750
13954
|
}
|
|
13751
13955
|
_applyAnonymLogin(e) {
|
|
13752
|
-
e.uid && (
|
|
13753
|
-
let t =
|
|
13754
|
-
|
|
13956
|
+
e.uid && (v.userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
|
|
13957
|
+
let t = Kc(e);
|
|
13958
|
+
v.selfExternalId = e.uid && t !== null ? {
|
|
13755
13959
|
participantId: M.composeParticipantId(Number(e.uid), j.USER, 0),
|
|
13756
13960
|
externalId: Z.fromId(t, Mo.USER, 0)
|
|
13757
13961
|
} : null, this._cacheSelfExternalId(), N.statQueueEnabled && e.uid && Rs.remember(Number(e.uid), {
|
|
@@ -13760,7 +13964,7 @@ var Wc = class extends Fc {
|
|
|
13760
13964
|
});
|
|
13761
13965
|
}
|
|
13762
13966
|
_cacheSelfExternalId() {
|
|
13763
|
-
let e =
|
|
13967
|
+
let e = v.selfExternalId;
|
|
13764
13968
|
e && this._idCache.cache(e.participantId, e.externalId);
|
|
13765
13969
|
}
|
|
13766
13970
|
_buildClientStatsData(e) {
|
|
@@ -13895,7 +14099,7 @@ var Wc = class extends Fc {
|
|
|
13895
14099
|
let n = { joinLink: e };
|
|
13896
14100
|
t && (n.anonymName = t);
|
|
13897
14101
|
let r = await this._call("vchat.getAnonymTokenByLink", n);
|
|
13898
|
-
return
|
|
14102
|
+
return v.userId = Number(r.uid), r.token;
|
|
13899
14103
|
}
|
|
13900
14104
|
async joinConversationByLink(e, t = !1, n, r) {
|
|
13901
14105
|
let i = {
|
|
@@ -13929,11 +14133,11 @@ var Wc = class extends Fc {
|
|
|
13929
14133
|
return N.anonymToken && (t.anonymToken = N.anonymToken), e && (t.conversationId = e), this._call("vchat.getConversationParams", t);
|
|
13930
14134
|
}
|
|
13931
14135
|
getUserId() {
|
|
13932
|
-
return
|
|
14136
|
+
return v.userId;
|
|
13933
14137
|
}
|
|
13934
14138
|
setUserId(e) {
|
|
13935
|
-
|
|
13936
|
-
sessionKey:
|
|
14139
|
+
v.userId = e, N.statQueueEnabled && v.sessionKey && Rs.remember(Number(e), {
|
|
14140
|
+
sessionKey: v.sessionKey,
|
|
13937
14141
|
endpoint: Rs.currentEndpoint()
|
|
13938
14142
|
});
|
|
13939
14143
|
}
|
|
@@ -13958,26 +14162,26 @@ var Wc = class extends Fc {
|
|
|
13958
14162
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
13959
14163
|
}
|
|
13960
14164
|
};
|
|
13961
|
-
function
|
|
14165
|
+
function Wc(e) {
|
|
13962
14166
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
13963
14167
|
}
|
|
13964
|
-
function
|
|
14168
|
+
function Gc(e) {
|
|
13965
14169
|
return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
|
|
13966
14170
|
}
|
|
13967
|
-
function
|
|
14171
|
+
function Kc(e) {
|
|
13968
14172
|
let t = e?.external_user_id;
|
|
13969
14173
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
13970
14174
|
}
|
|
13971
|
-
function
|
|
13972
|
-
return
|
|
14175
|
+
function qc(e) {
|
|
14176
|
+
return Gc(e) && "external_user_id" in e && (typeof e.external_user_id == "string" || e.external_user_id === null);
|
|
13973
14177
|
}
|
|
13974
14178
|
//#endregion
|
|
13975
14179
|
//#region src/enums/RecordRole.ts
|
|
13976
|
-
var
|
|
14180
|
+
var Jc = /* @__PURE__ */ function(e) {
|
|
13977
14181
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
13978
|
-
}(
|
|
14182
|
+
}(Jc || {}), Yc = /* @__PURE__ */ function(e) {
|
|
13979
14183
|
return e.OFF = "0", e.ON = "1", e;
|
|
13980
|
-
}({}),
|
|
14184
|
+
}({}), Xc = class {
|
|
13981
14185
|
constructor(e) {
|
|
13982
14186
|
h(this, "_queue", void 0), h(this, "_readCursor", void 0), h(this, "_writeCursor", void 0), h(this, "_moveReadCursor", void 0), h(this, "_left", void 0), this._queue = Array(e).fill(null), this._readCursor = this._writeCursor = this._left = 0, this._moveReadCursor = !1;
|
|
13983
14187
|
}
|
|
@@ -14000,7 +14204,7 @@ var Yc = /* @__PURE__ */ function(e) {
|
|
|
14000
14204
|
let e = this._queue[this._readCursor];
|
|
14001
14205
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
14002
14206
|
}
|
|
14003
|
-
},
|
|
14207
|
+
}, Zc = class {
|
|
14004
14208
|
constructor(e, t, n, r = null) {
|
|
14005
14209
|
h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
|
|
14006
14210
|
}
|
|
@@ -14026,7 +14230,7 @@ var Yc = /* @__PURE__ */ function(e) {
|
|
|
14026
14230
|
};
|
|
14027
14231
|
t?.peerId && (n.peerId = t.peerId), await As("vchat.hangupConversation", n, !0, await Ds(this._baseApiUrl, this._apiEnv));
|
|
14028
14232
|
}
|
|
14029
|
-
}, $c
|
|
14233
|
+
}, Qc, $c = null, el = !1, tl = {
|
|
14030
14234
|
getCameras: E.getCameras,
|
|
14031
14235
|
getMicrophones: E.getMicrophones,
|
|
14032
14236
|
getOutput: E.getOutput,
|
|
@@ -14043,59 +14247,59 @@ var Yc = /* @__PURE__ */ function(e) {
|
|
|
14043
14247
|
getUserVideo: E.getUserVideo,
|
|
14044
14248
|
getUserAudio: E.getUserAudio,
|
|
14045
14249
|
setResolution: E.setResolution,
|
|
14046
|
-
isBrowserSupported:
|
|
14047
|
-
isScreenCapturingSupported:
|
|
14048
|
-
canSelectAudioInput:
|
|
14049
|
-
canSelectAudioOutput:
|
|
14050
|
-
os:
|
|
14051
|
-
isMobile:
|
|
14052
|
-
browserName:
|
|
14053
|
-
browserVersion:
|
|
14054
|
-
baseChromeVersion:
|
|
14250
|
+
isBrowserSupported: C.isBrowserSupported,
|
|
14251
|
+
isScreenCapturingSupported: C.isScreenCapturingSupported,
|
|
14252
|
+
canSelectAudioInput: C.canSelectAudioInput,
|
|
14253
|
+
canSelectAudioOutput: C.canSelectAudioOutput,
|
|
14254
|
+
os: C.os,
|
|
14255
|
+
isMobile: C.isMobile,
|
|
14256
|
+
browserName: C.browserName,
|
|
14257
|
+
browserVersion: C.browserVersion,
|
|
14258
|
+
baseChromeVersion: C.baseChromeVersion,
|
|
14055
14259
|
getAudioContext: E.getAudioContext,
|
|
14056
|
-
isAudioShareSupported:
|
|
14057
|
-
},
|
|
14058
|
-
function
|
|
14059
|
-
|
|
14260
|
+
isAudioShareSupported: C.isAudioShareSupported
|
|
14261
|
+
}, nl = { participantMarkerCompare: M.participantMarkerCompare };
|
|
14262
|
+
function rl(e) {
|
|
14263
|
+
$c = e;
|
|
14060
14264
|
}
|
|
14061
|
-
function
|
|
14265
|
+
function il(e) {
|
|
14062
14266
|
N.videoEffects = e;
|
|
14063
14267
|
}
|
|
14064
|
-
function
|
|
14268
|
+
function al(e) {
|
|
14065
14269
|
N.audioEffects = e;
|
|
14066
14270
|
}
|
|
14067
|
-
function
|
|
14271
|
+
function ol(e, t = {}) {
|
|
14068
14272
|
N.vad = e, N.vadOptions = t;
|
|
14069
14273
|
}
|
|
14070
|
-
function
|
|
14274
|
+
function sl(e, t = null, n = {}, r = 1) {
|
|
14071
14275
|
N.vmoji = e, N.vmojiOptions = {
|
|
14072
14276
|
protocolVersion: r,
|
|
14073
14277
|
renderingOptions: n
|
|
14074
14278
|
}, t && e.setSDK(t);
|
|
14075
14279
|
}
|
|
14076
|
-
async function
|
|
14077
|
-
N.set(t),
|
|
14078
|
-
let n =
|
|
14079
|
-
if (n) throw new k(
|
|
14280
|
+
async function cl(t) {
|
|
14281
|
+
N.set(t), Qc || (Qc = new Uc()), N.statQueueEnabled && (Bs.setApi(Qc), N.autoStartStats && hl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
|
|
14282
|
+
let n = C.getBrowserSupportFailure();
|
|
14283
|
+
if (n) throw new k(y.UNSUPPORTED, { callError: {
|
|
14080
14284
|
scope: "internal",
|
|
14081
14285
|
code: "environment",
|
|
14082
14286
|
description: n
|
|
14083
14287
|
} });
|
|
14084
14288
|
z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${E.hasCameraPermission()}, Mic: ${E.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
|
|
14085
14289
|
}
|
|
14086
|
-
async function
|
|
14290
|
+
async function ll(e, t = [b.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
14087
14291
|
let c = [];
|
|
14088
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
14292
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), dl([], vo.USER, t, n, r, i, a, c, o, s);
|
|
14089
14293
|
}
|
|
14090
|
-
function
|
|
14294
|
+
function ul(e, t = []) {
|
|
14091
14295
|
let n = e.getIncomingCallerExternalId();
|
|
14092
14296
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
14093
14297
|
}
|
|
14094
|
-
async function
|
|
14298
|
+
async function dl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
14095
14299
|
if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
14096
14300
|
let u = B.getAll().find((e) => e.isIncomingRinging);
|
|
14097
|
-
if (!N.hold && u && !
|
|
14098
|
-
return new $(new
|
|
14301
|
+
if (!N.hold && u && !ul(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
|
|
14302
|
+
return new $(new Uc(), $c).onStart({
|
|
14099
14303
|
opponentIds: e,
|
|
14100
14304
|
opponentType: t,
|
|
14101
14305
|
mediaOptions: n,
|
|
@@ -14108,49 +14312,49 @@ async function fl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
14108
14312
|
conversationId: l
|
|
14109
14313
|
});
|
|
14110
14314
|
}
|
|
14111
|
-
async function
|
|
14112
|
-
return
|
|
14315
|
+
async function fl(e, t) {
|
|
14316
|
+
return pl(e, j.USER, void 0, t);
|
|
14113
14317
|
}
|
|
14114
|
-
async function
|
|
14318
|
+
async function pl(e, t = j.USER, n, r, i, a) {
|
|
14115
14319
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
14116
|
-
return new $(new
|
|
14320
|
+
return new $(new Uc(), $c).onPush(e, t, n, r, i, a);
|
|
14117
14321
|
}
|
|
14118
|
-
async function
|
|
14119
|
-
return
|
|
14322
|
+
async function ml() {
|
|
14323
|
+
return Qc.getInbounds();
|
|
14120
14324
|
}
|
|
14121
|
-
function
|
|
14325
|
+
function hl() {
|
|
14122
14326
|
if (N.statQueueEnabled) {
|
|
14123
|
-
if (
|
|
14327
|
+
if (!Qc) {
|
|
14124
14328
|
z.error("[CallsSDK] startStats() called before init()");
|
|
14125
14329
|
return;
|
|
14126
14330
|
}
|
|
14127
|
-
|
|
14331
|
+
el || (el = !0, Xs.start(Qc));
|
|
14128
14332
|
}
|
|
14129
14333
|
}
|
|
14130
|
-
async function
|
|
14131
|
-
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Ts()),
|
|
14334
|
+
async function gl(e, t) {
|
|
14335
|
+
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Ts()), Qc.authorize();
|
|
14132
14336
|
}
|
|
14133
|
-
async function
|
|
14134
|
-
return
|
|
14337
|
+
async function _l(e = [b.AUDIO], t) {
|
|
14338
|
+
return Hu(t).accept(e);
|
|
14135
14339
|
}
|
|
14136
|
-
async function
|
|
14137
|
-
let t =
|
|
14340
|
+
async function vl(e) {
|
|
14341
|
+
let t = zu(e?.conversationId);
|
|
14138
14342
|
if (t) return t.decline(e);
|
|
14139
14343
|
}
|
|
14140
|
-
async function
|
|
14141
|
-
return
|
|
14344
|
+
async function yl(e, t = [b.AUDIO]) {
|
|
14345
|
+
return bl(e, t);
|
|
14142
14346
|
}
|
|
14143
|
-
async function
|
|
14347
|
+
async function bl(e, t, n) {
|
|
14144
14348
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
14145
|
-
return new $(new
|
|
14349
|
+
return new $(new Uc(), $c).onJoin({
|
|
14146
14350
|
conversationId: e,
|
|
14147
14351
|
mediaOptions: t,
|
|
14148
14352
|
chatId: n
|
|
14149
14353
|
});
|
|
14150
14354
|
}
|
|
14151
|
-
async function
|
|
14355
|
+
async function xl(e, t = [b.AUDIO], n, r, i, a) {
|
|
14152
14356
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
14153
|
-
return n && (N.anonymToken = n), new $(new
|
|
14357
|
+
return n && (N.anonymToken = n), new $(new Uc(), $c).onJoin({
|
|
14154
14358
|
joinLink: e,
|
|
14155
14359
|
mediaOptions: t,
|
|
14156
14360
|
observedIds: r,
|
|
@@ -14159,30 +14363,30 @@ async function Sl(e, t = [x.AUDIO], n, r, i, a) {
|
|
|
14159
14363
|
anonymous: !!N.anonymToken
|
|
14160
14364
|
});
|
|
14161
14365
|
}
|
|
14162
|
-
function
|
|
14163
|
-
let t =
|
|
14164
|
-
return t ? t.hangup(e) : (
|
|
14366
|
+
function Sl(e) {
|
|
14367
|
+
let t = B.getLocal(e?.conversationId);
|
|
14368
|
+
return t ? t.hangup(e) : B.getHangup(e?.conversationId) ?? Promise.resolve();
|
|
14165
14369
|
}
|
|
14166
|
-
async function
|
|
14370
|
+
async function Cl(e, t) {
|
|
14167
14371
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
14168
14372
|
if (r) return r.addParticipant(n, t);
|
|
14169
14373
|
}
|
|
14170
|
-
async function
|
|
14374
|
+
async function wl(e, t) {
|
|
14171
14375
|
let n = $.current();
|
|
14172
14376
|
if (n) {
|
|
14173
14377
|
let r = e.map((e) => M.composeUserId(e));
|
|
14174
14378
|
await n.addParticipantLegacy(r, t);
|
|
14175
14379
|
}
|
|
14176
14380
|
}
|
|
14177
|
-
async function
|
|
14178
|
-
let n =
|
|
14381
|
+
async function Tl(e, t = !1) {
|
|
14382
|
+
let n = Uu(e, "removeParticipant");
|
|
14179
14383
|
if (n) try {
|
|
14180
14384
|
await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
14181
14385
|
} catch (e) {
|
|
14182
14386
|
z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
14183
14387
|
}
|
|
14184
14388
|
}
|
|
14185
|
-
async function
|
|
14389
|
+
async function El(e, t = !1) {
|
|
14186
14390
|
let n = $.current();
|
|
14187
14391
|
if (n) try {
|
|
14188
14392
|
await n.removeParticipant(M.composeUserId(e), t);
|
|
@@ -14190,13 +14394,13 @@ async function Dl(e, t = !1) {
|
|
|
14190
14394
|
z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
14191
14395
|
}
|
|
14192
14396
|
}
|
|
14193
|
-
async function
|
|
14397
|
+
async function Dl(e, t) {
|
|
14194
14398
|
let n = $.current();
|
|
14195
|
-
if (e === "videoinput" && It.contains(t)) return N.videoFacingMode = t, n ? (
|
|
14399
|
+
if (e === "videoinput" && It.contains(t)) return N.videoFacingMode = t, n ? (C.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
14196
14400
|
if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
14197
14401
|
if (n) return n.changeDevice(e);
|
|
14198
14402
|
}
|
|
14199
|
-
async function
|
|
14403
|
+
async function Ol(e, t) {
|
|
14200
14404
|
let n = typeof e == "object" ? {
|
|
14201
14405
|
...e,
|
|
14202
14406
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -14205,40 +14409,40 @@ async function kl(e, t) {
|
|
|
14205
14409
|
captureScreen: e,
|
|
14206
14410
|
fastScreenSharing: !1,
|
|
14207
14411
|
captureAudio: !1
|
|
14208
|
-
}, r =
|
|
14412
|
+
}, r = B.getLocal(t);
|
|
14209
14413
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
14210
14414
|
}
|
|
14211
|
-
function
|
|
14415
|
+
function kl(e) {
|
|
14212
14416
|
let t = $.current();
|
|
14213
14417
|
t && t.toggleAnimojiCapturing(e);
|
|
14214
14418
|
}
|
|
14215
|
-
async function
|
|
14419
|
+
async function Al(e, t = !1) {
|
|
14216
14420
|
let n = $.current();
|
|
14217
14421
|
n && await n.setVideoStream(e, t);
|
|
14218
14422
|
}
|
|
14219
|
-
async function
|
|
14220
|
-
let n =
|
|
14423
|
+
async function jl(e, t) {
|
|
14424
|
+
let n = B.getLocal(t);
|
|
14221
14425
|
n && await n.toggleLocalVideo(e);
|
|
14222
14426
|
}
|
|
14223
|
-
async function
|
|
14224
|
-
let n =
|
|
14427
|
+
async function Ml(e, t) {
|
|
14428
|
+
let n = B.getLocal(t);
|
|
14225
14429
|
n && await n.toggleLocalAudio(e);
|
|
14226
14430
|
}
|
|
14227
|
-
async function
|
|
14431
|
+
async function Nl(e) {
|
|
14228
14432
|
let t = $.current();
|
|
14229
14433
|
if (t) return t.setLocalResolution(e);
|
|
14230
14434
|
}
|
|
14231
|
-
async function
|
|
14435
|
+
async function Pl(e) {
|
|
14232
14436
|
let t = $.current();
|
|
14233
14437
|
t && await t.changePriorities(e);
|
|
14234
14438
|
}
|
|
14235
|
-
async function
|
|
14439
|
+
async function Fl(e, t) {
|
|
14236
14440
|
let n = $.current();
|
|
14237
14441
|
if (n) {
|
|
14238
14442
|
if (t) {
|
|
14239
14443
|
let r = n.getCachedParticipantIdByExternalId(t);
|
|
14240
14444
|
if (!r) {
|
|
14241
|
-
|
|
14445
|
+
Bu(t, "changeParticipantState", n);
|
|
14242
14446
|
return;
|
|
14243
14447
|
}
|
|
14244
14448
|
await n.changeParticipantState(e, r);
|
|
@@ -14247,161 +14451,161 @@ async function Il(e, t) {
|
|
|
14247
14451
|
await n.changeParticipantState(e);
|
|
14248
14452
|
}
|
|
14249
14453
|
}
|
|
14250
|
-
async function
|
|
14454
|
+
async function Il() {
|
|
14251
14455
|
let e = $.current();
|
|
14252
14456
|
e && await e.putHandsDown();
|
|
14253
14457
|
}
|
|
14254
|
-
async function
|
|
14458
|
+
async function Ll(e) {
|
|
14255
14459
|
let t = $.current();
|
|
14256
14460
|
t && await t.updateDisplayLayout(e);
|
|
14257
14461
|
}
|
|
14258
|
-
async function
|
|
14462
|
+
async function Rl(e) {
|
|
14259
14463
|
let t = $.current();
|
|
14260
14464
|
t && await t.requestDisplayLayout(e);
|
|
14261
14465
|
}
|
|
14262
|
-
async function
|
|
14263
|
-
let r =
|
|
14466
|
+
async function zl(e, t, n = !1) {
|
|
14467
|
+
let r = Uu(e, "grantRoles");
|
|
14264
14468
|
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
14265
14469
|
}
|
|
14266
|
-
async function
|
|
14470
|
+
async function Bl(e, t, n, r = !1) {
|
|
14267
14471
|
let i = $.current();
|
|
14268
14472
|
i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
|
|
14269
14473
|
}
|
|
14270
|
-
async function
|
|
14474
|
+
async function Vl({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
14271
14475
|
if (e) {
|
|
14272
|
-
let i =
|
|
14476
|
+
let i = Uu(e, "muteParticipant");
|
|
14273
14477
|
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
14274
14478
|
}
|
|
14275
14479
|
let i = $.current();
|
|
14276
14480
|
i && await i.muteParticipant(null, t, n, r);
|
|
14277
14481
|
}
|
|
14278
|
-
async function
|
|
14482
|
+
async function Hl({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
14279
14483
|
let a = $.current();
|
|
14280
14484
|
if (a) {
|
|
14281
14485
|
let o = e ? M.composeParticipantId(e, j.USER, r) : null;
|
|
14282
14486
|
await a.muteParticipant(o, t, n, i);
|
|
14283
14487
|
}
|
|
14284
14488
|
}
|
|
14285
|
-
async function
|
|
14286
|
-
let r =
|
|
14489
|
+
async function Ul(e, t = !1, n = null) {
|
|
14490
|
+
let r = Uu(e, "pinParticipant");
|
|
14287
14491
|
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
14288
14492
|
}
|
|
14289
|
-
async function
|
|
14493
|
+
async function Wl(e, t = !1, n = 0, r = null) {
|
|
14290
14494
|
let i = $.current();
|
|
14291
14495
|
i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
|
|
14292
14496
|
}
|
|
14293
|
-
async function
|
|
14497
|
+
async function Gl(e) {
|
|
14294
14498
|
let t = $.current();
|
|
14295
14499
|
t && await t.updateMediaModifiers(e);
|
|
14296
14500
|
}
|
|
14297
|
-
async function
|
|
14501
|
+
async function Kl(e) {
|
|
14298
14502
|
let t = $.current();
|
|
14299
14503
|
t && await t.enableVideoSuspend(e);
|
|
14300
14504
|
}
|
|
14301
|
-
async function
|
|
14505
|
+
async function ql(e) {
|
|
14302
14506
|
let t = $.current();
|
|
14303
14507
|
t && await t.enableVideoSuspendSuggest(e);
|
|
14304
14508
|
}
|
|
14305
|
-
async function
|
|
14509
|
+
async function Jl(e) {
|
|
14306
14510
|
let t = $.current();
|
|
14307
14511
|
t && await t.changeOptions(e);
|
|
14308
14512
|
}
|
|
14309
|
-
async function
|
|
14513
|
+
async function Yl(e, t = null) {
|
|
14310
14514
|
if (t) {
|
|
14311
|
-
let n =
|
|
14515
|
+
let n = Uu(t, "chatMessage");
|
|
14312
14516
|
return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
14313
14517
|
}
|
|
14314
14518
|
let n = $.current();
|
|
14315
14519
|
n && await n.chatMessage(e, null);
|
|
14316
14520
|
}
|
|
14317
|
-
async function
|
|
14521
|
+
async function Xl(e, t = null) {
|
|
14318
14522
|
let n = $.current();
|
|
14319
14523
|
if (n) {
|
|
14320
14524
|
let r = t ? M.composeUserId(t) : null;
|
|
14321
14525
|
await n.chatMessage(e, r);
|
|
14322
14526
|
}
|
|
14323
14527
|
}
|
|
14324
|
-
async function
|
|
14528
|
+
async function Zl(e = 10) {
|
|
14325
14529
|
let t = $.current();
|
|
14326
14530
|
if (t) return t.chatHistory(e);
|
|
14327
14531
|
}
|
|
14328
|
-
async function
|
|
14532
|
+
async function Ql(e, t = null) {
|
|
14329
14533
|
if (t) {
|
|
14330
|
-
let n =
|
|
14534
|
+
let n = Uu(t, "customData");
|
|
14331
14535
|
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
14332
14536
|
}
|
|
14333
14537
|
let n = $.current();
|
|
14334
14538
|
n && await n.customData(e, null);
|
|
14335
14539
|
}
|
|
14336
|
-
async function
|
|
14540
|
+
async function $l(e, t = null, n = 0) {
|
|
14337
14541
|
let r = $.current();
|
|
14338
14542
|
if (r) {
|
|
14339
14543
|
let i = t ? M.composeParticipantId(t, j.USER, n) : null;
|
|
14340
14544
|
await r.customData(e, i);
|
|
14341
14545
|
}
|
|
14342
14546
|
}
|
|
14343
|
-
async function
|
|
14344
|
-
return (await
|
|
14547
|
+
async function eu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
14548
|
+
return (await Qc.createConversation(a ?? M.uuid(), e, t, {
|
|
14345
14549
|
onlyAdminCanShareMovie: n,
|
|
14346
14550
|
waitForAdmin: r,
|
|
14347
14551
|
closedConversation: i
|
|
14348
14552
|
})).join_link;
|
|
14349
14553
|
}
|
|
14350
|
-
async function
|
|
14554
|
+
async function tu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
14351
14555
|
let a = i.map((e) => Z.fromId(e));
|
|
14352
|
-
return (await
|
|
14556
|
+
return (await Qc.createConversation(M.uuid(), e, t, {
|
|
14353
14557
|
onlyAdminCanShareMovie: n,
|
|
14354
14558
|
audienceMode: !0,
|
|
14355
14559
|
audioOnly: r
|
|
14356
14560
|
}, a)).join_link;
|
|
14357
14561
|
}
|
|
14358
|
-
async function
|
|
14562
|
+
async function nu() {
|
|
14359
14563
|
let e = $.current();
|
|
14360
14564
|
return e ? e.createJoinLink() : Promise.reject();
|
|
14361
14565
|
}
|
|
14362
|
-
async function
|
|
14566
|
+
async function ru() {
|
|
14363
14567
|
let e = $.current();
|
|
14364
14568
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
14365
14569
|
}
|
|
14366
|
-
async function
|
|
14367
|
-
return
|
|
14570
|
+
async function iu(e, t) {
|
|
14571
|
+
return Qc.getAnonymTokenByLink(e, t);
|
|
14368
14572
|
}
|
|
14369
|
-
function
|
|
14573
|
+
function au(e) {
|
|
14370
14574
|
let t = $.current();
|
|
14371
14575
|
t && t.setVolume(e);
|
|
14372
14576
|
}
|
|
14373
|
-
function
|
|
14577
|
+
function ou(e) {
|
|
14374
14578
|
N.forceRelayPolicy = e;
|
|
14375
14579
|
}
|
|
14376
|
-
async function
|
|
14580
|
+
async function su(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
14377
14581
|
let o = $.current();
|
|
14378
14582
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
14379
14583
|
}
|
|
14380
|
-
async function
|
|
14584
|
+
async function cu(e = null, t) {
|
|
14381
14585
|
let n = $.current();
|
|
14382
14586
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
14383
14587
|
}
|
|
14384
|
-
async function
|
|
14588
|
+
async function lu(e = null) {
|
|
14385
14589
|
let t = $.current();
|
|
14386
14590
|
return t ? t.publishStream(e) : Promise.reject();
|
|
14387
14591
|
}
|
|
14388
|
-
async function
|
|
14592
|
+
async function uu() {
|
|
14389
14593
|
let e = $.current();
|
|
14390
14594
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
14391
14595
|
}
|
|
14392
|
-
async function
|
|
14596
|
+
async function du(e) {
|
|
14393
14597
|
let t = $.current();
|
|
14394
14598
|
return t ? t.addMovie(e) : Promise.reject();
|
|
14395
14599
|
}
|
|
14396
|
-
async function
|
|
14600
|
+
async function fu(e) {
|
|
14397
14601
|
let t = $.current();
|
|
14398
14602
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
14399
14603
|
}
|
|
14400
|
-
async function
|
|
14604
|
+
async function pu(e) {
|
|
14401
14605
|
let t = $.current();
|
|
14402
14606
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
14403
14607
|
}
|
|
14404
|
-
async function
|
|
14608
|
+
async function mu(e, t) {
|
|
14405
14609
|
let n = $.current();
|
|
14406
14610
|
if (n) {
|
|
14407
14611
|
let r = [], i = [];
|
|
@@ -14423,54 +14627,54 @@ async function hu(e, t) {
|
|
|
14423
14627
|
});
|
|
14424
14628
|
}
|
|
14425
14629
|
if (i.length) {
|
|
14426
|
-
|
|
14630
|
+
Vu(i, "updateRooms", n);
|
|
14427
14631
|
return;
|
|
14428
14632
|
}
|
|
14429
14633
|
return n.updateRooms(r, t);
|
|
14430
14634
|
}
|
|
14431
14635
|
return Promise.reject();
|
|
14432
14636
|
}
|
|
14433
|
-
async function
|
|
14637
|
+
async function hu(e, t) {
|
|
14434
14638
|
let n = $.current();
|
|
14435
14639
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
14436
14640
|
}
|
|
14437
|
-
async function
|
|
14641
|
+
async function gu(e = null, t = null) {
|
|
14438
14642
|
let n = $.current();
|
|
14439
14643
|
if (!n) return Promise.reject();
|
|
14440
14644
|
let r;
|
|
14441
14645
|
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
14442
|
-
|
|
14646
|
+
Bu(t, "switchRoom", n);
|
|
14443
14647
|
return;
|
|
14444
14648
|
}
|
|
14445
14649
|
return n.switchRoom(e, r);
|
|
14446
14650
|
}
|
|
14447
|
-
async function
|
|
14651
|
+
async function _u(e) {
|
|
14448
14652
|
let t = $.current();
|
|
14449
14653
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
14450
14654
|
}
|
|
14451
|
-
function
|
|
14655
|
+
function vu(e) {
|
|
14452
14656
|
N.statisticsInterval = e;
|
|
14453
14657
|
let t = $.current();
|
|
14454
14658
|
if (t) return t.updateStatisticsInterval();
|
|
14455
14659
|
}
|
|
14456
|
-
function
|
|
14660
|
+
function yu(t) {
|
|
14457
14661
|
e.disableLog(!t), z.toggle(t);
|
|
14458
14662
|
}
|
|
14459
|
-
function
|
|
14663
|
+
function bu(e, ...t) {
|
|
14460
14664
|
N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
|
|
14461
14665
|
}
|
|
14462
|
-
function
|
|
14666
|
+
function xu(e, t, ...n) {
|
|
14463
14667
|
N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
|
|
14464
14668
|
}
|
|
14465
|
-
var
|
|
14466
|
-
list:
|
|
14467
|
-
get:
|
|
14468
|
-
getJson:
|
|
14469
|
-
download:
|
|
14470
|
-
clear:
|
|
14471
|
-
stats:
|
|
14669
|
+
var Su = {
|
|
14670
|
+
list: Pe,
|
|
14671
|
+
get: Fe,
|
|
14672
|
+
getJson: Ie,
|
|
14673
|
+
download: Le,
|
|
14674
|
+
clear: Re,
|
|
14675
|
+
stats: ze
|
|
14472
14676
|
};
|
|
14473
|
-
function
|
|
14677
|
+
function Cu() {
|
|
14474
14678
|
let e = [
|
|
14475
14679
|
[`Calls SDK ${N.sdkVersion}`, N.toJSON()],
|
|
14476
14680
|
["UserAgent:", navigator.userAgent],
|
|
@@ -14488,139 +14692,139 @@ function wu() {
|
|
|
14488
14692
|
d: e
|
|
14489
14693
|
}));
|
|
14490
14694
|
}
|
|
14491
|
-
async function
|
|
14695
|
+
async function wu() {
|
|
14492
14696
|
let e = $.id(), t = $.debugSessionId();
|
|
14493
14697
|
if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
14494
|
-
let n = await
|
|
14698
|
+
let n = await Fe({ sessionId: t });
|
|
14495
14699
|
if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
14496
14700
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
14497
14701
|
try {
|
|
14498
|
-
return
|
|
14702
|
+
return Qc?.uploadDebugLogs(e, r, i, JSON.stringify([...Cu(), ...n]));
|
|
14499
14703
|
} catch (e) {
|
|
14500
14704
|
throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
14501
14705
|
}
|
|
14502
14706
|
}
|
|
14503
|
-
async function
|
|
14707
|
+
async function Tu(e) {
|
|
14504
14708
|
let t = $.current();
|
|
14505
14709
|
if (t) return t.videoEffect(e);
|
|
14506
14710
|
}
|
|
14507
|
-
async function
|
|
14711
|
+
async function Eu(e, t) {
|
|
14508
14712
|
let n = $.current();
|
|
14509
14713
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
14510
14714
|
}
|
|
14511
|
-
async function
|
|
14715
|
+
async function Du(e) {
|
|
14512
14716
|
let t = $.current();
|
|
14513
14717
|
t && await t.setAudioStream(e);
|
|
14514
14718
|
}
|
|
14515
|
-
async function
|
|
14719
|
+
async function Ou(e, t = null, n = null) {
|
|
14516
14720
|
let r = $.current();
|
|
14517
14721
|
if (!r) return;
|
|
14518
14722
|
let i = n ?? t?.id, a = null;
|
|
14519
14723
|
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
14520
|
-
|
|
14724
|
+
Bu(t, "setVmojiSvg", r);
|
|
14521
14725
|
return;
|
|
14522
14726
|
}
|
|
14523
14727
|
r.setAnimojiSvg(e, a, i);
|
|
14524
14728
|
}
|
|
14525
|
-
function
|
|
14729
|
+
function ku(e) {
|
|
14526
14730
|
let t = $.current();
|
|
14527
14731
|
t && t.setAnimojiFill(e);
|
|
14528
14732
|
}
|
|
14529
|
-
async function
|
|
14530
|
-
return
|
|
14733
|
+
async function Au(e = null, t, n = !1) {
|
|
14734
|
+
return Hu().getWaitingHall(e, t, n);
|
|
14531
14735
|
}
|
|
14532
|
-
async function
|
|
14533
|
-
return
|
|
14736
|
+
async function ju() {
|
|
14737
|
+
return Hu().getAudienceModeHands();
|
|
14534
14738
|
}
|
|
14535
|
-
async function
|
|
14536
|
-
let n =
|
|
14739
|
+
async function Mu(e, t = !1) {
|
|
14740
|
+
let n = Hu(), r;
|
|
14537
14741
|
if (e) {
|
|
14538
14742
|
let t = n.getCachedParticipantIdByExternalId(e);
|
|
14539
14743
|
if (!t) {
|
|
14540
|
-
|
|
14744
|
+
Bu(e, "promoteParticipant", n);
|
|
14541
14745
|
return;
|
|
14542
14746
|
}
|
|
14543
14747
|
r = M.decomposeParticipantId(t).compositeUserId;
|
|
14544
14748
|
}
|
|
14545
14749
|
return n.promoteParticipant(r, t);
|
|
14546
14750
|
}
|
|
14751
|
+
async function Nu(e = !1) {
|
|
14752
|
+
return Hu().requestPromotion(e);
|
|
14753
|
+
}
|
|
14547
14754
|
async function Pu(e = !1) {
|
|
14548
|
-
return
|
|
14755
|
+
return Hu().acceptPromotion(e);
|
|
14549
14756
|
}
|
|
14550
|
-
async function Fu(e
|
|
14551
|
-
return
|
|
14757
|
+
async function Fu(e) {
|
|
14758
|
+
return Hu().getParticipantListChunk(e);
|
|
14552
14759
|
}
|
|
14553
14760
|
async function Iu(e) {
|
|
14554
|
-
return
|
|
14761
|
+
return Hu().getParticipants(e);
|
|
14555
14762
|
}
|
|
14556
14763
|
async function Lu(e) {
|
|
14557
|
-
return
|
|
14764
|
+
return Hu().feedback(e);
|
|
14558
14765
|
}
|
|
14559
|
-
async function Ru(e) {
|
|
14560
|
-
return
|
|
14766
|
+
async function Ru(e, t, n) {
|
|
14767
|
+
return Hu(n).enableFeatureForRoles(e, t);
|
|
14561
14768
|
}
|
|
14562
|
-
|
|
14563
|
-
return Uu(n).enableFeatureForRoles(e, t);
|
|
14564
|
-
}
|
|
14565
|
-
function Bu(e) {
|
|
14769
|
+
function zu(e) {
|
|
14566
14770
|
return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
|
|
14567
14771
|
}
|
|
14568
|
-
function
|
|
14772
|
+
function Bu(e, t, n) {
|
|
14569
14773
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
14570
14774
|
}
|
|
14571
|
-
function
|
|
14775
|
+
function Vu(e, t, n) {
|
|
14572
14776
|
let r = Array.from(new Set(e));
|
|
14573
14777
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
14574
14778
|
}
|
|
14575
|
-
function
|
|
14576
|
-
let t =
|
|
14779
|
+
function Hu(e) {
|
|
14780
|
+
let t = zu(e);
|
|
14577
14781
|
if (!t) throw Error("Conversation not found");
|
|
14578
14782
|
return t;
|
|
14579
14783
|
}
|
|
14580
|
-
function
|
|
14784
|
+
function Uu(e, t) {
|
|
14581
14785
|
let n = $.current();
|
|
14582
14786
|
if (!n) return null;
|
|
14583
14787
|
let r = n.getCachedParticipantIdByExternalId(e);
|
|
14584
14788
|
return r ? {
|
|
14585
14789
|
conversation: n,
|
|
14586
14790
|
participantId: r
|
|
14587
|
-
} : (
|
|
14791
|
+
} : (Bu(e, t, n), null);
|
|
14588
14792
|
}
|
|
14589
|
-
async function
|
|
14590
|
-
await
|
|
14793
|
+
async function Wu(e) {
|
|
14794
|
+
await Qc.removeHistoryRecords(e);
|
|
14591
14795
|
}
|
|
14592
|
-
async function
|
|
14796
|
+
async function Gu(e) {
|
|
14593
14797
|
let t = $.current() ?? B.getFirst();
|
|
14594
14798
|
t && await t.startAsr(e);
|
|
14595
14799
|
}
|
|
14596
|
-
async function
|
|
14800
|
+
async function Ku(e) {
|
|
14597
14801
|
let t = $.current() ?? B.getFirst();
|
|
14598
14802
|
t && await t.stopAsr(e);
|
|
14599
14803
|
}
|
|
14600
|
-
async function
|
|
14804
|
+
async function qu(e) {
|
|
14601
14805
|
let t = $.current() ?? B.getFirst();
|
|
14602
14806
|
t && await t.requestAsr(e);
|
|
14603
14807
|
}
|
|
14604
|
-
async function
|
|
14808
|
+
async function Ju(e) {
|
|
14605
14809
|
let t = $.current();
|
|
14606
14810
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
14607
14811
|
}
|
|
14608
|
-
async function
|
|
14812
|
+
async function Yu() {
|
|
14609
14813
|
let e = $.current();
|
|
14610
14814
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
14611
14815
|
}
|
|
14612
|
-
async function
|
|
14816
|
+
async function Xu(e) {
|
|
14613
14817
|
await B.switchCall(e);
|
|
14614
14818
|
}
|
|
14615
|
-
function
|
|
14819
|
+
function Zu() {
|
|
14616
14820
|
return B.getActiveId();
|
|
14617
14821
|
}
|
|
14618
|
-
function
|
|
14822
|
+
function Qu() {
|
|
14619
14823
|
return $.getSyncedTime();
|
|
14620
14824
|
}
|
|
14621
|
-
function
|
|
14825
|
+
function $u() {
|
|
14622
14826
|
return N.sdkVersion;
|
|
14623
14827
|
}
|
|
14624
14828
|
typeof window < "u" && (window.__CALLS_SDK = wn);
|
|
14625
14829
|
//#endregion
|
|
14626
|
-
export {
|
|
14830
|
+
export { Uc as Api, Zc as ApiExternal, Xc as ArrayDequeue, v as AuthData, f as BaseLogger, _o as CallDirection, vo as CallType, yo as ChatRoomEventType, bo as ConversationFeature, xo as ConversationOption, Dn as DebugMessageType, Mo as ExternalIdType, It as FacingMode, y as FatalError, k as HangupReason, O as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, wo as MuteState, X as ParticipantState, Yc as ParticipantStateDataValue, P as ParticipantStatus, Jc as RecordRole, To as RoomsEventType, go as Signaling, V as SignalingCommandType, Cr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, Oo as UserRole, j as UserType, ts as VolumeDetector, _l as acceptCall, Pu as acceptPromotion, hu as activateRooms, du as addMovie, Cl as addParticipant, wl as addParticipantInternal, gl as authorize, tl as browser, dl as callInternal, ll as callTo, Ol as captureScreen, kl as captureVmoji, Eu as changeAudioEffect, Jl as changeConversationOptions, Dl as changeDevice, Fl as changeParticipantState, Pl as changePriorities, Tu as changeVideoEffect, Zl as chatHistory, Yl as chatMessage, Xl as chatMessageInternal, nu as createJoinLink, Ql as customData, $l as customDataInternal, yu as debug, Su as debugLogs, bu as debugMessage, xu as debugMessageWithContext, vl as declineCall, Ru as enableFeatureForRoles, Kl as enableVideoSuspend, ql as enableVideoSuspendSuggest, Lu as feedback, ou as forceRelayPolicy, Zu as getActiveCallId, iu as getAnonymTokenByLink, ju as getAudienceModeHands, ml as getInbounds, Fu as getParticipantListChunk, Iu as getParticipants, uu as getStreamInfo, Qu as getSyncedTime, Au as getWaitingHall, zl as grantRoles, Bl as grantRolesInternal, Sl as hangup, cl as init, yl as joinCall, xl as joinCallByLink, bl as joinCallInternal, Vl as muteParticipant, Hl as muteParticipantInternal, Ul as pinParticipant, Wl as pinParticipantInternal, fl as processPush, pl as processPushInternal, Mu as promoteParticipant, lu as publishStream, Il as putHandsDown, Wu as removeHistoryRecords, ru as removeJoinLink, pu as removeMovie, Tl as removeParticipant, El as removeParticipantInternal, _u as removeRooms, qu as requestAsr, Rl as requestDisplayLayout, Nu as requestPromotion, al as setAudioEffects, Du as setAudioStream, Nl as setLocalResolution, rl as setLogger, Gl as setMediaModifiers, vu as setStatisticsInterval, ol as setVad, il as setVideoEffects, Al as setVideoStream, sl as setVmoji, ku as setVmojiFill, Ou as setVmojiSvg, au as setVolume, Gu as startAsr, tu as startAudienceConversation, eu as startConversation, hl as startStats, su as startStream, Ju as startUrlSharing, Ku as stopAsr, cu as stopStream, Yu as stopUrlSharing, Xu as switchCall, gu as switchRoom, Ml as toggleLocalAudio, jl as toggleLocalVideo, Ll as updateDisplayLayout, fu as updateMovie, mu as updateRooms, wu as uploadDebugLogs, nl as utils, $u as version };
|