quickvo-sdk-js 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +387 -370
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomPeer.d.ts +2 -1
- package/dist/room/RoomUsers.d.ts +4 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ht = Object.defineProperty;
|
|
2
|
+
var Bt = (s) => {
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var zt = (s, $, u) => $ in s ? Ht(s, $, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[$] = u;
|
|
6
|
+
var K = (s, $, u) => zt(s, typeof $ != "symbol" ? $ + "" : $, u), Pt = (s, $, u) => $.has(s) || Bt("Cannot " + u);
|
|
7
|
+
var G = (s, $, u) => (Pt(s, $, "read from private field"), u ? u.call(s) : $.get(s)), ct = (s, $, u) => $.has(s) ? Bt("Cannot add the same private member more than once") : $ instanceof WeakSet ? $.add(s) : $.set(s, u), dt = (s, $, u, A) => (Pt(s, $, "write to private field"), A ? A.call(s, u) : $.set(s, u), u);
|
|
8
8
|
const E = (s, $ = []) => {
|
|
9
9
|
const u = { ...s }, A = Object.keys(u);
|
|
10
10
|
for (const h of A)
|
|
@@ -580,9 +580,9 @@ function requireParser() {
|
|
|
580
580
|
var D = U[0], L = U.slice(2);
|
|
581
581
|
D === "m" && (N.push({ rtp: [], fmtp: [] }), q = N[N.length - 1]);
|
|
582
582
|
for (var Z = 0; Z < (h[D] || []).length; Z += 1) {
|
|
583
|
-
var
|
|
584
|
-
if (
|
|
585
|
-
return A(
|
|
583
|
+
var W = h[D][Z];
|
|
584
|
+
if (W.reg.test(L))
|
|
585
|
+
return A(W, q, L);
|
|
586
586
|
}
|
|
587
587
|
}), v.media = N, v;
|
|
588
588
|
};
|
|
@@ -829,16 +829,16 @@ function requireBase64() {
|
|
|
829
829
|
A[u[h] = h < 26 ? h + 65 : h < 52 ? h + 71 : h < 62 ? h - 4 : h - 59 | 43] = h++;
|
|
830
830
|
$.encode = function(o, v, N) {
|
|
831
831
|
for (var q = null, U = [], D = 0, L = 0, Z; v < N; ) {
|
|
832
|
-
var
|
|
832
|
+
var W = o[v++];
|
|
833
833
|
switch (L) {
|
|
834
834
|
case 0:
|
|
835
|
-
U[D++] = u[
|
|
835
|
+
U[D++] = u[W >> 2], Z = (W & 3) << 4, L = 1;
|
|
836
836
|
break;
|
|
837
837
|
case 1:
|
|
838
|
-
U[D++] = u[Z |
|
|
838
|
+
U[D++] = u[Z | W >> 4], Z = (W & 15) << 2, L = 2;
|
|
839
839
|
break;
|
|
840
840
|
case 2:
|
|
841
|
-
U[D++] = u[Z |
|
|
841
|
+
U[D++] = u[Z | W >> 6], U[D++] = u[W & 63], L = 0;
|
|
842
842
|
break;
|
|
843
843
|
}
|
|
844
844
|
D > 8191 && ((q || (q = [])).push(String.fromCharCode.apply(String, U)), D = 0);
|
|
@@ -915,11 +915,11 @@ function requireFloat() {
|
|
|
915
915
|
function s(k) {
|
|
916
916
|
return typeof Float32Array < "u" ? function() {
|
|
917
917
|
var t = new Float32Array([-0]), o = new Uint8Array(t.buffer), v = o[3] === 128;
|
|
918
|
-
function N(L, Z,
|
|
919
|
-
t[0] = L, Z[
|
|
918
|
+
function N(L, Z, W) {
|
|
919
|
+
t[0] = L, Z[W] = o[0], Z[W + 1] = o[1], Z[W + 2] = o[2], Z[W + 3] = o[3];
|
|
920
920
|
}
|
|
921
|
-
function q(L, Z,
|
|
922
|
-
t[0] = L, Z[
|
|
921
|
+
function q(L, Z, W) {
|
|
922
|
+
t[0] = L, Z[W] = o[3], Z[W + 1] = o[2], Z[W + 2] = o[1], Z[W + 3] = o[0];
|
|
923
923
|
}
|
|
924
924
|
k.writeFloatLE = v ? N : q, k.writeFloatBE = v ? q : N;
|
|
925
925
|
function U(L, Z) {
|
|
@@ -959,11 +959,11 @@ function requireFloat() {
|
|
|
959
959
|
k.readFloatLE = o.bind(null, A), k.readFloatBE = o.bind(null, h);
|
|
960
960
|
}(), typeof Float64Array < "u" ? function() {
|
|
961
961
|
var t = new Float64Array([-0]), o = new Uint8Array(t.buffer), v = o[7] === 128;
|
|
962
|
-
function N(L, Z,
|
|
963
|
-
t[0] = L, Z[
|
|
962
|
+
function N(L, Z, W) {
|
|
963
|
+
t[0] = L, Z[W] = o[0], Z[W + 1] = o[1], Z[W + 2] = o[2], Z[W + 3] = o[3], Z[W + 4] = o[4], Z[W + 5] = o[5], Z[W + 6] = o[6], Z[W + 7] = o[7];
|
|
964
964
|
}
|
|
965
|
-
function q(L, Z,
|
|
966
|
-
t[0] = L, Z[
|
|
965
|
+
function q(L, Z, W) {
|
|
966
|
+
t[0] = L, Z[W] = o[7], Z[W + 1] = o[6], Z[W + 2] = o[5], Z[W + 3] = o[4], Z[W + 4] = o[3], Z[W + 5] = o[2], Z[W + 6] = o[1], Z[W + 7] = o[0];
|
|
967
967
|
}
|
|
968
968
|
k.writeDoubleLE = v ? N : q, k.writeDoubleBE = v ? q : N;
|
|
969
969
|
function U(L, Z) {
|
|
@@ -989,19 +989,19 @@ function requireFloat() {
|
|
|
989
989
|
else if (U > 17976931348623157e292)
|
|
990
990
|
v(0, D, L + N), v((Z << 31 | 2146435072) >>> 0, D, L + q);
|
|
991
991
|
else {
|
|
992
|
-
var
|
|
992
|
+
var W;
|
|
993
993
|
if (U < 22250738585072014e-324)
|
|
994
|
-
|
|
994
|
+
W = U / 5e-324, v(W >>> 0, D, L + N), v((Z << 31 | W / 4294967296) >>> 0, D, L + q);
|
|
995
995
|
else {
|
|
996
996
|
var H = Math.floor(Math.log(U) / Math.LN2);
|
|
997
|
-
H === 1024 && (H = 1023),
|
|
997
|
+
H === 1024 && (H = 1023), W = U * Math.pow(2, -H), v(W * 4503599627370496 >>> 0, D, L + N), v((Z << 31 | H + 1023 << 20 | W * 1048576 & 1048575) >>> 0, D, L + q);
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
1001
|
k.writeDoubleLE = t.bind(null, $, 0, 4), k.writeDoubleBE = t.bind(null, u, 4, 0);
|
|
1002
1002
|
function o(v, N, q, U, D) {
|
|
1003
|
-
var L = v(U, D + N), Z = v(U, D + q),
|
|
1004
|
-
return H === 2047 ? F ? NaN :
|
|
1003
|
+
var L = v(U, D + N), Z = v(U, D + q), W = (Z >> 31) * 2 + 1, H = Z >>> 20 & 2047, F = 4294967296 * (Z & 1048575) + L;
|
|
1004
|
+
return H === 2047 ? F ? NaN : W * (1 / 0) : H === 0 ? W * 5e-324 * F : W * Math.pow(2, H - 1075) * (F + 4503599627370496);
|
|
1005
1005
|
}
|
|
1006
1006
|
k.readDoubleLE = o.bind(null, A, 0, 4), k.readDoubleBE = o.bind(null, h, 4, 0);
|
|
1007
1007
|
}(), k;
|
|
@@ -1349,7 +1349,7 @@ function requireWriter() {
|
|
|
1349
1349
|
}, v.prototype.double = function(F) {
|
|
1350
1350
|
return this._push(s.float.writeDoubleLE, 8, F);
|
|
1351
1351
|
};
|
|
1352
|
-
var
|
|
1352
|
+
var W = s.Array.prototype.set ? function(F, z, V) {
|
|
1353
1353
|
z.set(F, V);
|
|
1354
1354
|
} : function(F, z, V) {
|
|
1355
1355
|
for (var J = 0; J < F.length; ++J)
|
|
@@ -1363,7 +1363,7 @@ function requireWriter() {
|
|
|
1363
1363
|
var V = v.alloc(z = A.length(F));
|
|
1364
1364
|
A.decode(F, V, 0), F = V;
|
|
1365
1365
|
}
|
|
1366
|
-
return this.uint32(z)._push(
|
|
1366
|
+
return this.uint32(z)._push(W, z, F);
|
|
1367
1367
|
}, v.prototype.string = function(F) {
|
|
1368
1368
|
var z = h.length(F);
|
|
1369
1369
|
return z ? this.uint32(z)._push(h.write, z, F) : this._push(q, 1, 0);
|
|
@@ -1435,8 +1435,8 @@ function requireReader() {
|
|
|
1435
1435
|
throw Error("illegal buffer");
|
|
1436
1436
|
}, o = function() {
|
|
1437
1437
|
return s.Buffer ? function(L) {
|
|
1438
|
-
return (k.create = function(
|
|
1439
|
-
return s.Buffer.isBuffer(
|
|
1438
|
+
return (k.create = function(W) {
|
|
1439
|
+
return s.Buffer.isBuffer(W) ? new $(W) : t(W);
|
|
1440
1440
|
})(L);
|
|
1441
1441
|
} : t;
|
|
1442
1442
|
};
|
|
@@ -1523,8 +1523,8 @@ function requireReader() {
|
|
|
1523
1523
|
if (this.pos += D, Array.isArray(this.buf))
|
|
1524
1524
|
return this.buf.slice(L, Z);
|
|
1525
1525
|
if (L === Z) {
|
|
1526
|
-
var
|
|
1527
|
-
return
|
|
1526
|
+
var W = s.Buffer;
|
|
1527
|
+
return W ? W.alloc(0) : new this.buf.constructor(0);
|
|
1528
1528
|
}
|
|
1529
1529
|
return this._slice.call(this.buf, L, Z);
|
|
1530
1530
|
}, k.prototype.string = function() {
|
|
@@ -4488,17 +4488,17 @@ const d_code = (s) => s < 256 ? _dist_code[s] : _dist_code[256 + (s >>> 7)], put
|
|
|
4488
4488
|
s.bi_valid === 16 ? (put_short(s, s.bi_buf), s.bi_buf = 0, s.bi_valid = 0) : s.bi_valid >= 8 && (s.pending_buf[s.pending++] = s.bi_buf & 255, s.bi_buf >>= 8, s.bi_valid -= 8);
|
|
4489
4489
|
}, gen_bitlen = (s, $) => {
|
|
4490
4490
|
const u = $.dyn_tree, A = $.max_code, h = $.stat_desc.static_tree, k = $.stat_desc.has_stree, t = $.stat_desc.extra_bits, o = $.stat_desc.extra_base, v = $.stat_desc.max_length;
|
|
4491
|
-
let N, q, U, D, L, Z,
|
|
4491
|
+
let N, q, U, D, L, Z, W = 0;
|
|
4492
4492
|
for (D = 0; D <= MAX_BITS$1; D++)
|
|
4493
4493
|
s.bl_count[D] = 0;
|
|
4494
4494
|
for (u[s.heap[s.heap_max] * 2 + 1] = 0, N = s.heap_max + 1; N < HEAP_SIZE$1; N++)
|
|
4495
|
-
q = s.heap[N], D = u[u[q * 2 + 1] * 2 + 1] + 1, D > v && (D = v,
|
|
4496
|
-
if (
|
|
4495
|
+
q = s.heap[N], D = u[u[q * 2 + 1] * 2 + 1] + 1, D > v && (D = v, W++), u[q * 2 + 1] = D, !(q > A) && (s.bl_count[D]++, L = 0, q >= o && (L = t[q - o]), Z = u[q * 2], s.opt_len += Z * (D + L), k && (s.static_len += Z * (h[q * 2 + 1] + L)));
|
|
4496
|
+
if (W !== 0) {
|
|
4497
4497
|
do {
|
|
4498
4498
|
for (D = v - 1; s.bl_count[D] === 0; )
|
|
4499
4499
|
D--;
|
|
4500
|
-
s.bl_count[D]--, s.bl_count[D + 1] += 2, s.bl_count[v]--,
|
|
4501
|
-
} while (
|
|
4500
|
+
s.bl_count[D]--, s.bl_count[D + 1] += 2, s.bl_count[v]--, W -= 2;
|
|
4501
|
+
} while (W > 0);
|
|
4502
4502
|
for (D = v; D !== 0; D--)
|
|
4503
4503
|
for (q = s.bl_count[D]; q !== 0; )
|
|
4504
4504
|
U = s.heap[--N], !(U > A) && (u[U * 2 + 1] !== D && (s.opt_len += (D - u[U * 2 + 1]) * u[U * 2], u[U * 2 + 1] = D), q--);
|
|
@@ -5284,12 +5284,12 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
|
|
|
5284
5284
|
};
|
|
5285
5285
|
const BAD$1 = 16209, TYPE$1 = 16191;
|
|
5286
5286
|
var inffast = function s($, u) {
|
|
5287
|
-
let A, h, k, t, o, v, N, q, U, D, L, Z,
|
|
5288
|
-
const
|
|
5289
|
-
A = $.next_in, tt = $.input, h = A + ($.avail_in - 5), k = $.next_out, Q = $.output, t = k - (u - $.avail_out), o = k + ($.avail_out - 257), v =
|
|
5287
|
+
let A, h, k, t, o, v, N, q, U, D, L, Z, W, H, F, z, V, J, X, et, Y, nt, tt, Q;
|
|
5288
|
+
const rt = $.state;
|
|
5289
|
+
A = $.next_in, tt = $.input, h = A + ($.avail_in - 5), k = $.next_out, Q = $.output, t = k - (u - $.avail_out), o = k + ($.avail_out - 257), v = rt.dmax, N = rt.wsize, q = rt.whave, U = rt.wnext, D = rt.window, L = rt.hold, Z = rt.bits, W = rt.lencode, H = rt.distcode, F = (1 << rt.lenbits) - 1, z = (1 << rt.distbits) - 1;
|
|
5290
5290
|
t:
|
|
5291
5291
|
do {
|
|
5292
|
-
Z < 15 && (L += tt[A++] << Z, Z += 8, L += tt[A++] << Z, Z += 8), V =
|
|
5292
|
+
Z < 15 && (L += tt[A++] << Z, Z += 8, L += tt[A++] << Z, Z += 8), V = W[L & F];
|
|
5293
5293
|
e:
|
|
5294
5294
|
for (; ; ) {
|
|
5295
5295
|
if (J = V >>> 24, L >>>= J, Z -= J, J = V >>> 16 & 255, J === 0)
|
|
@@ -5299,56 +5299,56 @@ var inffast = function s($, u) {
|
|
|
5299
5299
|
i:
|
|
5300
5300
|
for (; ; ) {
|
|
5301
5301
|
if (J = V >>> 24, L >>>= J, Z -= J, J = V >>> 16 & 255, J & 16) {
|
|
5302
|
-
if (
|
|
5303
|
-
$.msg = "invalid distance too far back",
|
|
5302
|
+
if (et = V & 65535, J &= 15, Z < J && (L += tt[A++] << Z, Z += 8, Z < J && (L += tt[A++] << Z, Z += 8)), et += L & (1 << J) - 1, et > v) {
|
|
5303
|
+
$.msg = "invalid distance too far back", rt.mode = BAD$1;
|
|
5304
5304
|
break t;
|
|
5305
5305
|
}
|
|
5306
|
-
if (L >>>= J, Z -= J, J = k - t,
|
|
5307
|
-
if (J =
|
|
5308
|
-
$.msg = "invalid distance too far back",
|
|
5306
|
+
if (L >>>= J, Z -= J, J = k - t, et > J) {
|
|
5307
|
+
if (J = et - J, J > q && rt.sane) {
|
|
5308
|
+
$.msg = "invalid distance too far back", rt.mode = BAD$1;
|
|
5309
5309
|
break t;
|
|
5310
5310
|
}
|
|
5311
|
-
if (
|
|
5312
|
-
if (
|
|
5311
|
+
if (Y = 0, nt = D, U === 0) {
|
|
5312
|
+
if (Y += N - J, J < X) {
|
|
5313
5313
|
X -= J;
|
|
5314
5314
|
do
|
|
5315
|
-
Q[k++] = D[
|
|
5315
|
+
Q[k++] = D[Y++];
|
|
5316
5316
|
while (--J);
|
|
5317
|
-
|
|
5317
|
+
Y = k - et, nt = Q;
|
|
5318
5318
|
}
|
|
5319
5319
|
} else if (U < J) {
|
|
5320
|
-
if (
|
|
5320
|
+
if (Y += N + U - J, J -= U, J < X) {
|
|
5321
5321
|
X -= J;
|
|
5322
5322
|
do
|
|
5323
|
-
Q[k++] = D[
|
|
5323
|
+
Q[k++] = D[Y++];
|
|
5324
5324
|
while (--J);
|
|
5325
|
-
if (
|
|
5325
|
+
if (Y = 0, U < X) {
|
|
5326
5326
|
J = U, X -= J;
|
|
5327
5327
|
do
|
|
5328
|
-
Q[k++] = D[
|
|
5328
|
+
Q[k++] = D[Y++];
|
|
5329
5329
|
while (--J);
|
|
5330
|
-
|
|
5330
|
+
Y = k - et, nt = Q;
|
|
5331
5331
|
}
|
|
5332
5332
|
}
|
|
5333
|
-
} else if (
|
|
5333
|
+
} else if (Y += U - J, J < X) {
|
|
5334
5334
|
X -= J;
|
|
5335
5335
|
do
|
|
5336
|
-
Q[k++] = D[
|
|
5336
|
+
Q[k++] = D[Y++];
|
|
5337
5337
|
while (--J);
|
|
5338
|
-
|
|
5338
|
+
Y = k - et, nt = Q;
|
|
5339
5339
|
}
|
|
5340
5340
|
for (; X > 2; )
|
|
5341
|
-
Q[k++] =
|
|
5342
|
-
X && (Q[k++] =
|
|
5341
|
+
Q[k++] = nt[Y++], Q[k++] = nt[Y++], Q[k++] = nt[Y++], X -= 3;
|
|
5342
|
+
X && (Q[k++] = nt[Y++], X > 1 && (Q[k++] = nt[Y++]));
|
|
5343
5343
|
} else {
|
|
5344
|
-
|
|
5344
|
+
Y = k - et;
|
|
5345
5345
|
do
|
|
5346
|
-
Q[k++] = Q[
|
|
5346
|
+
Q[k++] = Q[Y++], Q[k++] = Q[Y++], Q[k++] = Q[Y++], X -= 3;
|
|
5347
5347
|
while (X > 2);
|
|
5348
|
-
X && (Q[k++] = Q[
|
|
5348
|
+
X && (Q[k++] = Q[Y++], X > 1 && (Q[k++] = Q[Y++]));
|
|
5349
5349
|
}
|
|
5350
5350
|
} else if (J & 64) {
|
|
5351
|
-
$.msg = "invalid distance code",
|
|
5351
|
+
$.msg = "invalid distance code", rt.mode = BAD$1;
|
|
5352
5352
|
break t;
|
|
5353
5353
|
} else {
|
|
5354
5354
|
V = H[(V & 65535) + (L & (1 << J) - 1)];
|
|
@@ -5358,20 +5358,20 @@ var inffast = function s($, u) {
|
|
|
5358
5358
|
}
|
|
5359
5359
|
} else if (J & 64)
|
|
5360
5360
|
if (J & 32) {
|
|
5361
|
-
|
|
5361
|
+
rt.mode = TYPE$1;
|
|
5362
5362
|
break t;
|
|
5363
5363
|
} else {
|
|
5364
|
-
$.msg = "invalid literal/length code",
|
|
5364
|
+
$.msg = "invalid literal/length code", rt.mode = BAD$1;
|
|
5365
5365
|
break t;
|
|
5366
5366
|
}
|
|
5367
5367
|
else {
|
|
5368
|
-
V =
|
|
5368
|
+
V = W[(V & 65535) + (L & (1 << J) - 1)];
|
|
5369
5369
|
continue e;
|
|
5370
5370
|
}
|
|
5371
5371
|
break;
|
|
5372
5372
|
}
|
|
5373
5373
|
} while (A < h && k < o);
|
|
5374
|
-
X = Z >> 3, A -= X, Z -= X << 3, L &= (1 << Z) - 1, $.next_in = A, $.next_out = k, $.avail_in = A < h ? 5 + (h - A) : 5 - (A - h), $.avail_out = k < o ? 257 + (o - k) : 257 - (k - o),
|
|
5374
|
+
X = Z >> 3, A -= X, Z -= X << 3, L &= (1 << Z) - 1, $.next_in = A, $.next_out = k, $.avail_in = A < h ? 5 + (h - A) : 5 - (A - h), $.avail_out = k < o ? 257 + (o - k) : 257 - (k - o), rt.hold = L, rt.bits = Z;
|
|
5375
5375
|
};
|
|
5376
5376
|
const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS$1 = 1, DISTS$1 = 2, lbase = new Uint16Array([
|
|
5377
5377
|
/* Length codes 257..285 base */
|
|
@@ -5509,9 +5509,9 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
5509
5509
|
64
|
|
5510
5510
|
]), inflate_table = (s, $, u, A, h, k, t, o) => {
|
|
5511
5511
|
const v = o.bits;
|
|
5512
|
-
let N = 0, q = 0, U = 0, D = 0, L = 0, Z = 0,
|
|
5513
|
-
const Q = new Uint16Array(MAXBITS + 1),
|
|
5514
|
-
let _t = null, vt,
|
|
5512
|
+
let N = 0, q = 0, U = 0, D = 0, L = 0, Z = 0, W = 0, H = 0, F = 0, z = 0, V, J, X, et, Y, nt = null, tt;
|
|
5513
|
+
const Q = new Uint16Array(MAXBITS + 1), rt = new Uint16Array(MAXBITS + 1);
|
|
5514
|
+
let _t = null, vt, yt, mt;
|
|
5515
5515
|
for (N = 0; N <= MAXBITS; N++)
|
|
5516
5516
|
Q[N] = 0;
|
|
5517
5517
|
for (q = 0; q < A; q++)
|
|
@@ -5527,16 +5527,16 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
5527
5527
|
return -1;
|
|
5528
5528
|
if (H > 0 && (s === CODES$1 || D !== 1))
|
|
5529
5529
|
return -1;
|
|
5530
|
-
for (
|
|
5531
|
-
|
|
5530
|
+
for (rt[1] = 0, N = 1; N < MAXBITS; N++)
|
|
5531
|
+
rt[N + 1] = rt[N] + Q[N];
|
|
5532
5532
|
for (q = 0; q < A; q++)
|
|
5533
|
-
$[u + q] !== 0 && (t[
|
|
5534
|
-
if (s === CODES$1 ? (
|
|
5533
|
+
$[u + q] !== 0 && (t[rt[$[u + q]]++] = q);
|
|
5534
|
+
if (s === CODES$1 ? (nt = _t = t, tt = 20) : s === LENS$1 ? (nt = lbase, _t = lext, tt = 257) : (nt = dbase, _t = dext, tt = 0), z = 0, q = 0, N = U, Y = k, Z = L, W = 0, X = -1, F = 1 << L, et = F - 1, s === LENS$1 && F > ENOUGH_LENS$1 || s === DISTS$1 && F > ENOUGH_DISTS$1)
|
|
5535
5535
|
return 1;
|
|
5536
5536
|
for (; ; ) {
|
|
5537
|
-
vt = N -
|
|
5537
|
+
vt = N - W, t[q] + 1 < tt ? (yt = 0, mt = t[q]) : t[q] >= tt ? (yt = _t[t[q] - tt], mt = nt[t[q] - tt]) : (yt = 96, mt = 0), V = 1 << N - W, J = 1 << Z, U = J;
|
|
5538
5538
|
do
|
|
5539
|
-
J -= V, h[
|
|
5539
|
+
J -= V, h[Y + (z >> W) + J] = vt << 24 | yt << 16 | mt | 0;
|
|
5540
5540
|
while (J !== 0);
|
|
5541
5541
|
for (V = 1 << N - 1; z & V; )
|
|
5542
5542
|
V >>= 1;
|
|
@@ -5545,15 +5545,15 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
5545
5545
|
break;
|
|
5546
5546
|
N = $[u + t[q]];
|
|
5547
5547
|
}
|
|
5548
|
-
if (N > L && (z &
|
|
5549
|
-
for (
|
|
5548
|
+
if (N > L && (z & et) !== X) {
|
|
5549
|
+
for (W === 0 && (W = L), Y += U, Z = N - W, H = 1 << Z; Z + W < D && (H -= Q[Z + W], !(H <= 0)); )
|
|
5550
5550
|
Z++, H <<= 1;
|
|
5551
5551
|
if (F += 1 << Z, s === LENS$1 && F > ENOUGH_LENS$1 || s === DISTS$1 && F > ENOUGH_DISTS$1)
|
|
5552
5552
|
return 1;
|
|
5553
|
-
X = z &
|
|
5553
|
+
X = z & et, h[X] = L << 24 | Z << 16 | Y - k | 0;
|
|
5554
5554
|
}
|
|
5555
5555
|
}
|
|
5556
|
-
return z !== 0 && (h[
|
|
5556
|
+
return z !== 0 && (h[Y + z] = N - W << 24 | 64 << 16 | 0), o.bits = L, 0;
|
|
5557
5557
|
};
|
|
5558
5558
|
var inftrees = inflate_table;
|
|
5559
5559
|
const CODES = 0, LENS = 1, DISTS = 2, {
|
|
@@ -5624,16 +5624,16 @@ const fixedtables = (s) => {
|
|
|
5624
5624
|
const k = s.state;
|
|
5625
5625
|
return k.window === null && (k.wsize = 1 << k.wbits, k.wnext = 0, k.whave = 0, k.window = new Uint8Array(k.wsize)), A >= k.wsize ? (k.window.set($.subarray(u - k.wsize, u), 0), k.wnext = 0, k.whave = k.wsize) : (h = k.wsize - k.wnext, h > A && (h = A), k.window.set($.subarray(u - A, u - A + h), k.wnext), A -= h, A ? (k.window.set($.subarray(u - A, u), 0), k.wnext = A, k.whave = k.wsize) : (k.wnext += h, k.wnext === k.wsize && (k.wnext = 0), k.whave < k.wsize && (k.whave += h))), 0;
|
|
5626
5626
|
}, inflate$2 = (s, $) => {
|
|
5627
|
-
let u, A, h, k, t, o, v, N, q, U, D, L, Z,
|
|
5627
|
+
let u, A, h, k, t, o, v, N, q, U, D, L, Z, W, H = 0, F, z, V, J, X, et, Y, nt;
|
|
5628
5628
|
const tt = new Uint8Array(4);
|
|
5629
|
-
let Q,
|
|
5629
|
+
let Q, rt;
|
|
5630
5630
|
const _t = (
|
|
5631
5631
|
/* permutation of code lengths */
|
|
5632
5632
|
new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
|
|
5633
5633
|
);
|
|
5634
5634
|
if (inflateStateCheck(s) || !s.output || !s.input && s.avail_in !== 0)
|
|
5635
5635
|
return Z_STREAM_ERROR$1;
|
|
5636
|
-
u = s.state, u.mode === TYPE && (u.mode = TYPEDO), t = s.next_out, h = s.output, v = s.avail_out, k = s.next_in, A = s.input, o = s.avail_in, N = u.hold, q = u.bits, U = o, D = v,
|
|
5636
|
+
u = s.state, u.mode === TYPE && (u.mode = TYPEDO), t = s.next_out, h = s.output, v = s.avail_out, k = s.next_in, A = s.input, o = s.avail_in, N = u.hold, q = u.bits, U = o, D = v, nt = Z_OK$1;
|
|
5637
5637
|
t:
|
|
5638
5638
|
for (; ; )
|
|
5639
5639
|
switch (u.mode) {
|
|
@@ -5660,7 +5660,7 @@ const fixedtables = (s) => {
|
|
|
5660
5660
|
s.msg = "unknown compression method", u.mode = BAD;
|
|
5661
5661
|
break;
|
|
5662
5662
|
}
|
|
5663
|
-
if (N >>>= 4, q -= 4,
|
|
5663
|
+
if (N >>>= 4, q -= 4, Y = (N & 15) + 8, u.wbits === 0 && (u.wbits = Y), Y > 15 || Y > u.wbits) {
|
|
5664
5664
|
s.msg = "invalid window size", u.mode = BAD;
|
|
5665
5665
|
break;
|
|
5666
5666
|
}
|
|
@@ -5710,7 +5710,7 @@ const fixedtables = (s) => {
|
|
|
5710
5710
|
u.mode = EXTRA;
|
|
5711
5711
|
/* falls through */
|
|
5712
5712
|
case EXTRA:
|
|
5713
|
-
if (u.flags & 1024 && (L = u.length, L > o && (L = o), L && (u.head && (
|
|
5713
|
+
if (u.flags & 1024 && (L = u.length, L > o && (L = o), L && (u.head && (Y = u.head.extra_len - u.length, u.head.extra || (u.head.extra = new Uint8Array(u.head.extra_len)), u.head.extra.set(
|
|
5714
5714
|
A.subarray(
|
|
5715
5715
|
k,
|
|
5716
5716
|
// extra field is limited to 65536 bytes
|
|
@@ -5718,7 +5718,7 @@ const fixedtables = (s) => {
|
|
|
5718
5718
|
k + L
|
|
5719
5719
|
),
|
|
5720
5720
|
/*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
|
|
5721
|
-
|
|
5721
|
+
Y
|
|
5722
5722
|
)), u.flags & 512 && u.wrap & 4 && (u.check = crc32_1(u.check, A, L, k)), o -= L, k += L, u.length -= L), u.length))
|
|
5723
5723
|
break t;
|
|
5724
5724
|
u.length = 0, u.mode = NAME;
|
|
@@ -5729,9 +5729,9 @@ const fixedtables = (s) => {
|
|
|
5729
5729
|
break t;
|
|
5730
5730
|
L = 0;
|
|
5731
5731
|
do
|
|
5732
|
-
|
|
5733
|
-
while (
|
|
5734
|
-
if (u.flags & 512 && u.wrap & 4 && (u.check = crc32_1(u.check, A, L, k)), o -= L, k += L,
|
|
5732
|
+
Y = A[k + L++], u.head && Y && u.length < 65536 && (u.head.name += String.fromCharCode(Y));
|
|
5733
|
+
while (Y && L < o);
|
|
5734
|
+
if (u.flags & 512 && u.wrap & 4 && (u.check = crc32_1(u.check, A, L, k)), o -= L, k += L, Y)
|
|
5735
5735
|
break t;
|
|
5736
5736
|
} else u.head && (u.head.name = null);
|
|
5737
5737
|
u.length = 0, u.mode = COMMENT;
|
|
@@ -5742,9 +5742,9 @@ const fixedtables = (s) => {
|
|
|
5742
5742
|
break t;
|
|
5743
5743
|
L = 0;
|
|
5744
5744
|
do
|
|
5745
|
-
|
|
5746
|
-
while (
|
|
5747
|
-
if (u.flags & 512 && u.wrap & 4 && (u.check = crc32_1(u.check, A, L, k)), o -= L, k += L,
|
|
5745
|
+
Y = A[k + L++], u.head && Y && u.length < 65536 && (u.head.comment += String.fromCharCode(Y));
|
|
5746
|
+
while (Y && L < o);
|
|
5747
|
+
if (u.flags & 512 && u.wrap & 4 && (u.check = crc32_1(u.check, A, L, k)), o -= L, k += L, Y)
|
|
5748
5748
|
break t;
|
|
5749
5749
|
} else u.head && (u.head.comment = null);
|
|
5750
5750
|
u.mode = HCRC;
|
|
@@ -5857,7 +5857,7 @@ const fixedtables = (s) => {
|
|
|
5857
5857
|
}
|
|
5858
5858
|
for (; u.have < 19; )
|
|
5859
5859
|
u.lens[_t[u.have++]] = 0;
|
|
5860
|
-
if (u.lencode = u.lendyn, u.lenbits = 7, Q = { bits: u.lenbits },
|
|
5860
|
+
if (u.lencode = u.lendyn, u.lenbits = 7, Q = { bits: u.lenbits }, nt = inftrees(CODES, u.lens, 0, 19, u.lencode, 0, u.work, Q), u.lenbits = Q.bits, nt) {
|
|
5861
5861
|
s.msg = "invalid code lengths set", u.mode = BAD;
|
|
5862
5862
|
break;
|
|
5863
5863
|
}
|
|
@@ -5874,7 +5874,7 @@ const fixedtables = (s) => {
|
|
|
5874
5874
|
N >>>= F, q -= F, u.lens[u.have++] = V;
|
|
5875
5875
|
else {
|
|
5876
5876
|
if (V === 16) {
|
|
5877
|
-
for (
|
|
5877
|
+
for (rt = F + 2; q < rt; ) {
|
|
5878
5878
|
if (o === 0)
|
|
5879
5879
|
break t;
|
|
5880
5880
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5883,28 +5883,28 @@ const fixedtables = (s) => {
|
|
|
5883
5883
|
s.msg = "invalid bit length repeat", u.mode = BAD;
|
|
5884
5884
|
break;
|
|
5885
5885
|
}
|
|
5886
|
-
|
|
5886
|
+
Y = u.lens[u.have - 1], L = 3 + (N & 3), N >>>= 2, q -= 2;
|
|
5887
5887
|
} else if (V === 17) {
|
|
5888
|
-
for (
|
|
5888
|
+
for (rt = F + 3; q < rt; ) {
|
|
5889
5889
|
if (o === 0)
|
|
5890
5890
|
break t;
|
|
5891
5891
|
o--, N += A[k++] << q, q += 8;
|
|
5892
5892
|
}
|
|
5893
|
-
N >>>= F, q -= F,
|
|
5893
|
+
N >>>= F, q -= F, Y = 0, L = 3 + (N & 7), N >>>= 3, q -= 3;
|
|
5894
5894
|
} else {
|
|
5895
|
-
for (
|
|
5895
|
+
for (rt = F + 7; q < rt; ) {
|
|
5896
5896
|
if (o === 0)
|
|
5897
5897
|
break t;
|
|
5898
5898
|
o--, N += A[k++] << q, q += 8;
|
|
5899
5899
|
}
|
|
5900
|
-
N >>>= F, q -= F,
|
|
5900
|
+
N >>>= F, q -= F, Y = 0, L = 11 + (N & 127), N >>>= 7, q -= 7;
|
|
5901
5901
|
}
|
|
5902
5902
|
if (u.have + L > u.nlen + u.ndist) {
|
|
5903
5903
|
s.msg = "invalid bit length repeat", u.mode = BAD;
|
|
5904
5904
|
break;
|
|
5905
5905
|
}
|
|
5906
5906
|
for (; L--; )
|
|
5907
|
-
u.lens[u.have++] =
|
|
5907
|
+
u.lens[u.have++] = Y;
|
|
5908
5908
|
}
|
|
5909
5909
|
}
|
|
5910
5910
|
if (u.mode === BAD)
|
|
@@ -5913,11 +5913,11 @@ const fixedtables = (s) => {
|
|
|
5913
5913
|
s.msg = "invalid code -- missing end-of-block", u.mode = BAD;
|
|
5914
5914
|
break;
|
|
5915
5915
|
}
|
|
5916
|
-
if (u.lenbits = 9, Q = { bits: u.lenbits },
|
|
5916
|
+
if (u.lenbits = 9, Q = { bits: u.lenbits }, nt = inftrees(LENS, u.lens, 0, u.nlen, u.lencode, 0, u.work, Q), u.lenbits = Q.bits, nt) {
|
|
5917
5917
|
s.msg = "invalid literal/lengths set", u.mode = BAD;
|
|
5918
5918
|
break;
|
|
5919
5919
|
}
|
|
5920
|
-
if (u.distbits = 6, u.distcode = u.distdyn, Q = { bits: u.distbits },
|
|
5920
|
+
if (u.distbits = 6, u.distcode = u.distdyn, Q = { bits: u.distbits }, nt = inftrees(DISTS, u.lens, u.nlen, u.ndist, u.distcode, 0, u.work, Q), u.distbits = Q.bits, nt) {
|
|
5921
5921
|
s.msg = "invalid distances set", u.mode = BAD;
|
|
5922
5922
|
break;
|
|
5923
5923
|
}
|
|
@@ -5938,7 +5938,7 @@ const fixedtables = (s) => {
|
|
|
5938
5938
|
o--, N += A[k++] << q, q += 8;
|
|
5939
5939
|
}
|
|
5940
5940
|
if (z && !(z & 240)) {
|
|
5941
|
-
for (J = F, X = z,
|
|
5941
|
+
for (J = F, X = z, et = V; H = u.lencode[et + ((N & (1 << J + X) - 1) >> J)], F = H >>> 24, z = H >>> 16 & 255, V = H & 65535, !(J + F <= q); ) {
|
|
5942
5942
|
if (o === 0)
|
|
5943
5943
|
break t;
|
|
5944
5944
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5961,7 +5961,7 @@ const fixedtables = (s) => {
|
|
|
5961
5961
|
/* falls through */
|
|
5962
5962
|
case LENEXT:
|
|
5963
5963
|
if (u.extra) {
|
|
5964
|
-
for (
|
|
5964
|
+
for (rt = u.extra; q < rt; ) {
|
|
5965
5965
|
if (o === 0)
|
|
5966
5966
|
break t;
|
|
5967
5967
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5977,7 +5977,7 @@ const fixedtables = (s) => {
|
|
|
5977
5977
|
o--, N += A[k++] << q, q += 8;
|
|
5978
5978
|
}
|
|
5979
5979
|
if (!(z & 240)) {
|
|
5980
|
-
for (J = F, X = z,
|
|
5980
|
+
for (J = F, X = z, et = V; H = u.distcode[et + ((N & (1 << J + X) - 1) >> J)], F = H >>> 24, z = H >>> 16 & 255, V = H & 65535, !(J + F <= q); ) {
|
|
5981
5981
|
if (o === 0)
|
|
5982
5982
|
break t;
|
|
5983
5983
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5992,7 +5992,7 @@ const fixedtables = (s) => {
|
|
|
5992
5992
|
/* falls through */
|
|
5993
5993
|
case DISTEXT:
|
|
5994
5994
|
if (u.extra) {
|
|
5995
|
-
for (
|
|
5995
|
+
for (rt = u.extra; q < rt; ) {
|
|
5996
5996
|
if (o === 0)
|
|
5997
5997
|
break t;
|
|
5998
5998
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -6013,12 +6013,12 @@ const fixedtables = (s) => {
|
|
|
6013
6013
|
s.msg = "invalid distance too far back", u.mode = BAD;
|
|
6014
6014
|
break;
|
|
6015
6015
|
}
|
|
6016
|
-
L > u.wnext ? (L -= u.wnext, Z = u.wsize - L) : Z = u.wnext - L, L > u.length && (L = u.length),
|
|
6016
|
+
L > u.wnext ? (L -= u.wnext, Z = u.wsize - L) : Z = u.wnext - L, L > u.length && (L = u.length), W = u.window;
|
|
6017
6017
|
} else
|
|
6018
|
-
|
|
6018
|
+
W = h, Z = t - u.offset, L = u.length;
|
|
6019
6019
|
L > v && (L = v), v -= L, u.length -= L;
|
|
6020
6020
|
do
|
|
6021
|
-
h[t++] =
|
|
6021
|
+
h[t++] = W[Z++];
|
|
6022
6022
|
while (--L);
|
|
6023
6023
|
u.length === 0 && (u.mode = LEN);
|
|
6024
6024
|
break;
|
|
@@ -6059,10 +6059,10 @@ const fixedtables = (s) => {
|
|
|
6059
6059
|
u.mode = DONE;
|
|
6060
6060
|
/* falls through */
|
|
6061
6061
|
case DONE:
|
|
6062
|
-
|
|
6062
|
+
nt = Z_STREAM_END$1;
|
|
6063
6063
|
break t;
|
|
6064
6064
|
case BAD:
|
|
6065
|
-
|
|
6065
|
+
nt = Z_DATA_ERROR$1;
|
|
6066
6066
|
break t;
|
|
6067
6067
|
case MEM:
|
|
6068
6068
|
return Z_MEM_ERROR$1;
|
|
@@ -6072,7 +6072,7 @@ const fixedtables = (s) => {
|
|
|
6072
6072
|
return Z_STREAM_ERROR$1;
|
|
6073
6073
|
}
|
|
6074
6074
|
return s.next_out = t, s.avail_out = v, s.next_in = k, s.avail_in = o, u.hold = N, u.bits = q, (u.wsize || D !== s.avail_out && u.mode < BAD && (u.mode < CHECK || $ !== Z_FINISH$1)) && updatewindow(s, s.output, s.next_out, D - s.avail_out), U -= s.avail_in, D -= s.avail_out, s.total_in += U, s.total_out += D, u.total += D, u.wrap & 4 && D && (s.adler = u.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
|
|
6075
|
-
u.flags ? crc32_1(u.check, h, D, s.next_out - D) : adler32_1(u.check, h, D, s.next_out - D)), s.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (U === 0 && D === 0 || $ === Z_FINISH$1) &&
|
|
6075
|
+
u.flags ? crc32_1(u.check, h, D, s.next_out - D) : adler32_1(u.check, h, D, s.next_out - D)), s.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (U === 0 && D === 0 || $ === Z_FINISH$1) && nt === Z_OK$1 && (nt = Z_BUF_ERROR), nt;
|
|
6076
6076
|
}, inflateEnd = (s) => {
|
|
6077
6077
|
if (inflateStateCheck(s))
|
|
6078
6078
|
return Z_STREAM_ERROR$1;
|
|
@@ -6315,13 +6315,13 @@ class CallsWebSocket {
|
|
|
6315
6315
|
// 活性时间戳 根据服务端的响应来更新当前连接活性 活性为0 说明连接已经存在异常进行重连
|
|
6316
6316
|
ct(this, pt, {});
|
|
6317
6317
|
ct(this, ut, {});
|
|
6318
|
-
|
|
6318
|
+
K(this, "onReconnectSuccess", async ($) => {
|
|
6319
6319
|
});
|
|
6320
6320
|
// 重连成功的回调
|
|
6321
|
-
|
|
6321
|
+
K(this, "onReconnectStop", async ($) => {
|
|
6322
6322
|
});
|
|
6323
6323
|
// 自定义心跳规则
|
|
6324
|
-
ct(this, Tt, () =>
|
|
6324
|
+
ct(this, Tt, () => G(this, bt) ? com.quick.voice.proto.CommonReq.encode({ event: "heartbeat", sn: +`${I$1(1e5, 999999)}` }).finish() : "");
|
|
6325
6325
|
// 更新日志
|
|
6326
6326
|
ct(this, Ot, ($, u = {}) => {
|
|
6327
6327
|
try {
|
|
@@ -6344,7 +6344,7 @@ class CallsWebSocket {
|
|
|
6344
6344
|
}
|
|
6345
6345
|
let L = "#quickvo.logs";
|
|
6346
6346
|
ignoreEvent.includes(h) && (L = "#quickvo.ignoreEvents");
|
|
6347
|
-
const Z = { "#action": D, timeStr: N, event: h, data: q, time: A, ...v },
|
|
6347
|
+
const Z = { "#action": D, timeStr: N, event: h, data: q, time: A, ...v }, W = localStorage.getItem(L) || JSON.stringify([]), H = JSON.parse(W), F = [Z, ...H].slice(0, 500);
|
|
6348
6348
|
localStorage.setItem(L, JSON.stringify(F));
|
|
6349
6349
|
} catch (A) {
|
|
6350
6350
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: updataLogs is error", A);
|
|
@@ -6353,30 +6353,30 @@ class CallsWebSocket {
|
|
|
6353
6353
|
// 活性检查器 每次发送消息前 、 接收消息后 都会调用进行检查
|
|
6354
6354
|
ct(this, gt, ($) => new Promise(async (u) => {
|
|
6355
6355
|
const { event: A } = $, h = Date.now();
|
|
6356
|
-
A === "healthCheck" && (dt(this, ht, h),
|
|
6357
|
-
const k = 30 * 1e3 +
|
|
6358
|
-
h -
|
|
6356
|
+
A === "healthCheck" && (dt(this, ht, h), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 刷新活性", { activetimeStamp: G(this, ht), activetimeStampStr: O(G(this, ht)) }));
|
|
6357
|
+
const k = 30 * 1e3 + G(this, lt).timeout;
|
|
6358
|
+
h - G(this, ht) >= k && G(this, ft) && (G(this, lt).debug && console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 活性超时, 尝试重新建立连接", G(this, ft)), await this.connect()), u(G(this, ft));
|
|
6359
6359
|
}));
|
|
6360
6360
|
// 创建事件
|
|
6361
6361
|
ct(this, $t, ($, { resolve: u, reject: A }) => {
|
|
6362
6362
|
const { sn: h } = $, k = () => {
|
|
6363
|
-
const o =
|
|
6364
|
-
clearTimeout(o.destructionTimer), delete
|
|
6363
|
+
const o = G(this, pt)[h];
|
|
6364
|
+
clearTimeout(o.destructionTimer), delete G(this, pt)[h];
|
|
6365
6365
|
}, t = setTimeout(() => {
|
|
6366
|
-
const o =
|
|
6366
|
+
const o = G(this, pt)[h];
|
|
6367
6367
|
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo:event is timeout", o.message), k(), A("event is timeout");
|
|
6368
|
-
},
|
|
6369
|
-
|
|
6368
|
+
}, G(this, lt).timeout);
|
|
6369
|
+
G(this, pt)[h] = { message: $, resolve: u, reject: A, destruction: k, destructionTimer: t };
|
|
6370
6370
|
});
|
|
6371
6371
|
// 获取事件
|
|
6372
|
-
ct(this, It, ($) =>
|
|
6372
|
+
ct(this, It, ($) => G(this, pt)[$]);
|
|
6373
6373
|
// 接收消息
|
|
6374
6374
|
ct(this, Rt, async ($) => {
|
|
6375
6375
|
const u = new Uint8Array($), A = com.quick.voice.proto.CommonRsp.decode(u), { sn: h, event: k } = A, t = onMessageFormat(A);
|
|
6376
|
-
if (
|
|
6376
|
+
if (G(this, lt).debug && (G(this, Ot).call(this, "res", t), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", t)), await G(this, gt).call(this, t), k === "joinRoom" && dt(this, bt, !0), ignoreEvent.includes(k)) return;
|
|
6377
6377
|
if (notifyName_keys.includes(k))
|
|
6378
6378
|
return this.emitNotify(k, E(t, ["code", "data", "desc"]));
|
|
6379
|
-
const v =
|
|
6379
|
+
const v = G(this, It).call(this, h);
|
|
6380
6380
|
if (v) {
|
|
6381
6381
|
const { resolve: N = (U) => {
|
|
6382
6382
|
}, destruction: q = () => {
|
|
@@ -6387,66 +6387,66 @@ class CallsWebSocket {
|
|
|
6387
6387
|
// 重连成功
|
|
6388
6388
|
ct(this, Et, async ($) => {
|
|
6389
6389
|
const u = Date.now();
|
|
6390
|
-
dt(this, ht, u),
|
|
6390
|
+
dt(this, ht, u), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重置活性", { activetimeStamp: G(this, ht), activetimeStampStr: O(G(this, ht)) }), await this.onReconnectSuccess($);
|
|
6391
6391
|
});
|
|
6392
6392
|
/**
|
|
6393
6393
|
* 连接
|
|
6394
6394
|
* @param session
|
|
6395
6395
|
* @returns
|
|
6396
6396
|
*/
|
|
6397
|
-
|
|
6398
|
-
$ && dt(this, St, $),
|
|
6399
|
-
const u = `${
|
|
6397
|
+
K(this, "connect", async ($ = "") => {
|
|
6398
|
+
$ && dt(this, St, $), G(this, ft) && await G(this, ft).close();
|
|
6399
|
+
const u = `${G(this, lt).url}?s=${G(this, St)}&t=${Date.now()}`;
|
|
6400
6400
|
return dt(this, ft, new _({
|
|
6401
|
-
...
|
|
6401
|
+
...G(this, lt),
|
|
6402
6402
|
url: u,
|
|
6403
6403
|
binaryType: "arraybuffer",
|
|
6404
|
-
onMessage:
|
|
6404
|
+
onMessage: G(this, Rt),
|
|
6405
6405
|
checkReconnect,
|
|
6406
|
-
getHeartbeatMsg:
|
|
6407
|
-
onReconnectSuccess:
|
|
6406
|
+
getHeartbeatMsg: G(this, Tt),
|
|
6407
|
+
onReconnectSuccess: G(this, Et),
|
|
6408
6408
|
onReconnectStop: (A) => this.onReconnectStop(A)
|
|
6409
|
-
})), await
|
|
6409
|
+
})), await G(this, ft).connect(), dt(this, ht, Date.now()), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", G(this, ut)), G(this, ft);
|
|
6410
6410
|
});
|
|
6411
6411
|
/**
|
|
6412
6412
|
* 关闭
|
|
6413
6413
|
*/
|
|
6414
|
-
|
|
6414
|
+
K(this, "close", async () => {
|
|
6415
6415
|
var u;
|
|
6416
|
-
|
|
6417
|
-
const $ = Object.keys(
|
|
6416
|
+
G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
|
|
6417
|
+
const $ = Object.keys(G(this, pt));
|
|
6418
6418
|
for (const A of $) {
|
|
6419
|
-
const { destructionTimer: h } =
|
|
6419
|
+
const { destructionTimer: h } = G(this, pt)[A];
|
|
6420
6420
|
clearTimeout(h);
|
|
6421
6421
|
}
|
|
6422
|
-
dt(this, pt, {}), dt(this, ut, {}), await ((u =
|
|
6422
|
+
dt(this, pt, {}), dt(this, ut, {}), await ((u = G(this, ft)) == null ? void 0 : u.close());
|
|
6423
6423
|
});
|
|
6424
6424
|
/**
|
|
6425
6425
|
* 发送消息
|
|
6426
6426
|
* @param message Message
|
|
6427
6427
|
*/
|
|
6428
|
-
|
|
6428
|
+
K(this, "sendMessage", ($, u = !0) => new Promise(async (A, h) => {
|
|
6429
6429
|
var q;
|
|
6430
6430
|
const { event: k, ...t } = $, o = Date.now(), v = sendMessageFormat({
|
|
6431
6431
|
event: k,
|
|
6432
6432
|
sn: +`${o}${I$1(1e3, 9999)}`,
|
|
6433
6433
|
time: o,
|
|
6434
|
-
valid:
|
|
6434
|
+
valid: G(this, lt).timeout,
|
|
6435
6435
|
version: 1,
|
|
6436
6436
|
compress: !1,
|
|
6437
6437
|
...t
|
|
6438
6438
|
});
|
|
6439
|
-
|
|
6439
|
+
G(this, lt).debug && (G(this, Ot).call(this, "req", v), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", v)), await G(this, gt).call(this, v), k === "joinRoom" && dt(this, bt, !1), u && G(this, $t).call(this, v, { resolve: A, reject: h });
|
|
6440
6440
|
const N = com.quick.voice.proto.CommonReq.encode(v).finish();
|
|
6441
|
-
(q =
|
|
6441
|
+
(q = G(this, ft)) == null || q.sendMessage(N);
|
|
6442
6442
|
}));
|
|
6443
6443
|
/**
|
|
6444
6444
|
* 触发广播事件
|
|
6445
6445
|
* @param event 事件名称
|
|
6446
6446
|
* @param data 事件响应值
|
|
6447
6447
|
*/
|
|
6448
|
-
|
|
6449
|
-
const A =
|
|
6448
|
+
K(this, "emitNotify", async ($, u) => {
|
|
6449
|
+
const A = G(this, ut)[$] || [];
|
|
6450
6450
|
for (const h of A) {
|
|
6451
6451
|
const { callback: k = async () => {
|
|
6452
6452
|
} } = h;
|
|
@@ -6459,32 +6459,32 @@ class CallsWebSocket {
|
|
|
6459
6459
|
* @param _private
|
|
6460
6460
|
* @returns sn
|
|
6461
6461
|
*/
|
|
6462
|
-
|
|
6462
|
+
K(this, "addNotify", ($, u = !1) => {
|
|
6463
6463
|
const { event: A } = $;
|
|
6464
|
-
|
|
6464
|
+
G(this, ut)[A] || (G(this, ut)[A] = []);
|
|
6465
6465
|
const h = { sn: it(32), ...$ };
|
|
6466
|
-
return u ?
|
|
6466
|
+
return u ? G(this, ut)[A].unshift(h) : G(this, ut)[A].push(h), h.sn;
|
|
6467
6467
|
});
|
|
6468
6468
|
/**
|
|
6469
6469
|
* 移除广播
|
|
6470
6470
|
*/
|
|
6471
|
-
|
|
6471
|
+
K(this, "removeNotify", ($ = []) => {
|
|
6472
6472
|
if ($.length === 0)
|
|
6473
6473
|
dt(this, ut, {});
|
|
6474
6474
|
else {
|
|
6475
|
-
const u = Object.keys(
|
|
6475
|
+
const u = Object.keys(G(this, ut));
|
|
6476
6476
|
for (const A of u)
|
|
6477
|
-
|
|
6477
|
+
G(this, ut)[A] = G(this, ut)[A].filter((h) => !$.includes(h.sn || ""));
|
|
6478
6478
|
}
|
|
6479
|
-
|
|
6479
|
+
G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", G(this, ut));
|
|
6480
6480
|
});
|
|
6481
|
-
dt(this, lt, { ...
|
|
6481
|
+
dt(this, lt, { ...G(this, lt), ...$ });
|
|
6482
6482
|
}
|
|
6483
6483
|
}
|
|
6484
6484
|
ft = new WeakMap(), lt = new WeakMap(), St = new WeakMap(), bt = new WeakMap(), ht = new WeakMap(), pt = new WeakMap(), ut = new WeakMap(), Tt = new WeakMap(), Ot = new WeakMap(), gt = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Rt = new WeakMap(), Et = new WeakMap();
|
|
6485
6485
|
class AudioMediaStreamContext {
|
|
6486
6486
|
constructor($) {
|
|
6487
|
-
|
|
6487
|
+
K(this, "options", {
|
|
6488
6488
|
autoGainControl: !1,
|
|
6489
6489
|
// 自动增益
|
|
6490
6490
|
noiseSuppression: !1,
|
|
@@ -6492,28 +6492,28 @@ class AudioMediaStreamContext {
|
|
|
6492
6492
|
echoCancellation: !1
|
|
6493
6493
|
// 回声消除
|
|
6494
6494
|
});
|
|
6495
|
-
|
|
6496
|
-
|
|
6495
|
+
K(this, "stream");
|
|
6496
|
+
K(this, "audio", new Audio());
|
|
6497
6497
|
// @ts-ignore 音频上下文
|
|
6498
|
-
|
|
6498
|
+
K(this, "audioContext", new (window.AudioContext || window.webkitAudioContext)());
|
|
6499
6499
|
// 媒体流音频源节点
|
|
6500
|
-
|
|
6500
|
+
K(this, "mediaStreamAudioSourceNode");
|
|
6501
6501
|
// 增益节点 (自动增益)
|
|
6502
|
-
|
|
6502
|
+
K(this, "autoGainNode");
|
|
6503
6503
|
// 滤波器节点 (噪声抑制)
|
|
6504
|
-
|
|
6504
|
+
K(this, "biquadFilterNode");
|
|
6505
6505
|
// 延迟节点 (回声消除)
|
|
6506
|
-
|
|
6506
|
+
K(this, "delayNode");
|
|
6507
6507
|
// 增益节点 (音量控制)
|
|
6508
|
-
|
|
6508
|
+
K(this, "gainNode");
|
|
6509
6509
|
// 音频分析节点
|
|
6510
|
-
|
|
6510
|
+
K(this, "analyserNode");
|
|
6511
6511
|
// 缓冲区 存储分析节点的时域数据
|
|
6512
|
-
|
|
6512
|
+
K(this, "analyserArrayData");
|
|
6513
6513
|
/**
|
|
6514
6514
|
* 停止
|
|
6515
6515
|
*/
|
|
6516
|
-
|
|
6516
|
+
K(this, "stop", () => {
|
|
6517
6517
|
const $ = this.stream.getTracks();
|
|
6518
6518
|
for (const u of $)
|
|
6519
6519
|
u.enabled = !1, u.stop(), this.stream.removeTrack(u);
|
|
@@ -6521,23 +6521,23 @@ class AudioMediaStreamContext {
|
|
|
6521
6521
|
/**
|
|
6522
6522
|
* 获取数据流
|
|
6523
6523
|
*/
|
|
6524
|
-
|
|
6524
|
+
K(this, "getStream", async () => this.mediaStreamAudioSourceNode.mediaStream);
|
|
6525
6525
|
/**
|
|
6526
6526
|
* 静音
|
|
6527
6527
|
*/
|
|
6528
|
-
|
|
6528
|
+
K(this, "setMute", ($ = !0) => {
|
|
6529
6529
|
$ ? this.analyserNode.disconnect(this.audioContext.destination) : this.analyserNode.connect(this.audioContext.destination);
|
|
6530
6530
|
});
|
|
6531
6531
|
/**
|
|
6532
6532
|
* 设置音量
|
|
6533
6533
|
*/
|
|
6534
|
-
|
|
6534
|
+
K(this, "setVolumeGain", ($) => {
|
|
6535
6535
|
this.gainNode.gain.setValueAtTime($, this.audioContext.currentTime);
|
|
6536
6536
|
});
|
|
6537
6537
|
/**
|
|
6538
6538
|
* 获取音量
|
|
6539
6539
|
*/
|
|
6540
|
-
|
|
6540
|
+
K(this, "getVolume", () => {
|
|
6541
6541
|
const { analyserNode: $, analyserArrayData: u } = this;
|
|
6542
6542
|
$.getByteFrequencyData(u);
|
|
6543
6543
|
let A = 0;
|
|
@@ -6548,7 +6548,7 @@ class AudioMediaStreamContext {
|
|
|
6548
6548
|
/**
|
|
6549
6549
|
* 设置音频过滤
|
|
6550
6550
|
*/
|
|
6551
|
-
|
|
6551
|
+
K(this, "setFilter", async ($ = {}) => {
|
|
6552
6552
|
this.options = { ...this.options, ...$ };
|
|
6553
6553
|
const { autoGainControl: u, noiseSuppression: A, echoCancellation: h } = this.options, { mediaStreamAudioSourceNode: k, autoGainNode: t, biquadFilterNode: o, delayNode: v, gainNode: N } = this, q = k;
|
|
6554
6554
|
return u && q.connect(t), A && q.connect(o), h && q.connect(v), q.connect(N), $;
|
|
@@ -6560,11 +6560,11 @@ class AudioMediaStreamContext {
|
|
|
6560
6560
|
}
|
|
6561
6561
|
class VideoMediaStreamContext {
|
|
6562
6562
|
constructor($) {
|
|
6563
|
-
|
|
6563
|
+
K(this, "stream");
|
|
6564
6564
|
/**
|
|
6565
6565
|
* 停止
|
|
6566
6566
|
*/
|
|
6567
|
-
|
|
6567
|
+
K(this, "stop", () => {
|
|
6568
6568
|
const $ = this.stream.getTracks();
|
|
6569
6569
|
for (const u of $)
|
|
6570
6570
|
u.enabled = !1, u.stop(), this.stream.removeTrack(u);
|
|
@@ -6572,24 +6572,24 @@ class VideoMediaStreamContext {
|
|
|
6572
6572
|
/**
|
|
6573
6573
|
* 获取数据流
|
|
6574
6574
|
*/
|
|
6575
|
-
|
|
6575
|
+
K(this, "getStream", async () => this.stream);
|
|
6576
6576
|
this.stream = $;
|
|
6577
6577
|
}
|
|
6578
6578
|
}
|
|
6579
6579
|
class MediaStreams {
|
|
6580
6580
|
// 视频媒体流上下文
|
|
6581
6581
|
constructor() {
|
|
6582
|
-
|
|
6582
|
+
K(this, "audioMediaStreamContextMap", /* @__PURE__ */ new Map());
|
|
6583
6583
|
// 音频媒体流上下文
|
|
6584
|
-
|
|
6584
|
+
K(this, "videoMediaStreamContextMap", /* @__PURE__ */ new Map());
|
|
6585
6585
|
/**
|
|
6586
6586
|
* 获取key
|
|
6587
6587
|
*/
|
|
6588
|
-
|
|
6588
|
+
K(this, "getUserMediaKey", ($, u) => `${$}-${u}`);
|
|
6589
6589
|
/**
|
|
6590
6590
|
* 判断用户媒体类型
|
|
6591
6591
|
*/
|
|
6592
|
-
|
|
6592
|
+
K(this, "getUserMediaKind", ($) => {
|
|
6593
6593
|
let u = "";
|
|
6594
6594
|
switch ($) {
|
|
6595
6595
|
// 音频媒体处理
|
|
@@ -6608,7 +6608,7 @@ class MediaStreams {
|
|
|
6608
6608
|
/**
|
|
6609
6609
|
* 设置媒体参数
|
|
6610
6610
|
*/
|
|
6611
|
-
|
|
6611
|
+
K(this, "setConstraints", async ($, u, A) => {
|
|
6612
6612
|
const k = (await this.getUserStream($, u)).getTracks();
|
|
6613
6613
|
for (const t of k) {
|
|
6614
6614
|
const v = { ...t.getConstraints(), ...A };
|
|
@@ -6618,14 +6618,14 @@ class MediaStreams {
|
|
|
6618
6618
|
/**
|
|
6619
6619
|
* 删除用户处理上下文
|
|
6620
6620
|
*/
|
|
6621
|
-
|
|
6621
|
+
K(this, "removeUserMediaStreamContext", ($, u) => {
|
|
6622
6622
|
const A = this.getUserMediaKey($, u);
|
|
6623
6623
|
this.audioMediaStreamContextMap.delete(A), this.videoMediaStreamContextMap.delete(A);
|
|
6624
6624
|
});
|
|
6625
6625
|
/**
|
|
6626
6626
|
* 初始化用户媒体上下文
|
|
6627
6627
|
*/
|
|
6628
|
-
|
|
6628
|
+
K(this, "initUserMediaStreamContext", async ($, u, A) => {
|
|
6629
6629
|
const h = this.getUserMediaKey($, u);
|
|
6630
6630
|
if (A.getTracks().length === 0) {
|
|
6631
6631
|
console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: tracks.length is 0.", { userId: $, mediaType: u, stream: A });
|
|
@@ -6651,7 +6651,7 @@ class MediaStreams {
|
|
|
6651
6651
|
/**
|
|
6652
6652
|
* 获取某个用户的某个数据流
|
|
6653
6653
|
*/
|
|
6654
|
-
|
|
6654
|
+
K(this, "getUserStream", async ($, u) => {
|
|
6655
6655
|
const A = this.getUserMediaKey($, u), h = this.getUserMediaKind(u);
|
|
6656
6656
|
let k;
|
|
6657
6657
|
switch (h) {
|
|
@@ -6675,7 +6675,7 @@ class MediaStreams {
|
|
|
6675
6675
|
/**
|
|
6676
6676
|
* 获取某个用户的全部数据流
|
|
6677
6677
|
*/
|
|
6678
|
-
|
|
6678
|
+
K(this, "getUserStreams", async ($) => {
|
|
6679
6679
|
const u = {};
|
|
6680
6680
|
for (const A of mediaType_keys) {
|
|
6681
6681
|
const h = await this.getUserStream($, A);
|
|
@@ -6686,7 +6686,7 @@ class MediaStreams {
|
|
|
6686
6686
|
/**
|
|
6687
6687
|
* 删除某个用户的某个数据流
|
|
6688
6688
|
*/
|
|
6689
|
-
|
|
6689
|
+
K(this, "removeUserStreams", async ($, u = []) => {
|
|
6690
6690
|
u.length === 0 && (u = mediaType_keys);
|
|
6691
6691
|
for (const A of u) {
|
|
6692
6692
|
const h = await this.getUserStream($, A);
|
|
@@ -6696,7 +6696,7 @@ class MediaStreams {
|
|
|
6696
6696
|
/**
|
|
6697
6697
|
* 清除所有媒体流使用
|
|
6698
6698
|
*/
|
|
6699
|
-
|
|
6699
|
+
K(this, "clearUserStreams", async () => {
|
|
6700
6700
|
{
|
|
6701
6701
|
const $ = this.audioMediaStreamContextMap.values();
|
|
6702
6702
|
for (const u of $)
|
|
@@ -6711,7 +6711,7 @@ class MediaStreams {
|
|
|
6711
6711
|
/**
|
|
6712
6712
|
* 停止媒体流
|
|
6713
6713
|
*/
|
|
6714
|
-
|
|
6714
|
+
K(this, "stopStream", async ($) => {
|
|
6715
6715
|
const u = $.getTracks();
|
|
6716
6716
|
for (const A of u)
|
|
6717
6717
|
A.enabled = !1, A.stop(), $.removeTrack(A);
|
|
@@ -6756,7 +6756,7 @@ const getTrackNamesFormTracks = (s, $ = [], u = "trackName") => {
|
|
|
6756
6756
|
class RoomBase extends MediaStreams {
|
|
6757
6757
|
constructor() {
|
|
6758
6758
|
super();
|
|
6759
|
-
|
|
6759
|
+
K(this, "options", {
|
|
6760
6760
|
appid: "",
|
|
6761
6761
|
sdkToken: "",
|
|
6762
6762
|
roomId: "",
|
|
@@ -6764,17 +6764,17 @@ class RoomBase extends MediaStreams {
|
|
|
6764
6764
|
callType: 0,
|
|
6765
6765
|
autoSubscribe: !0
|
|
6766
6766
|
});
|
|
6767
|
-
|
|
6768
|
-
|
|
6767
|
+
K(this, "tools", tools);
|
|
6768
|
+
K(this, "state", "ready");
|
|
6769
6769
|
// 房间状态
|
|
6770
|
-
|
|
6770
|
+
K(this, "createAt", Date.now());
|
|
6771
6771
|
// 创建时间
|
|
6772
|
-
|
|
6772
|
+
K(this, "cwsIns");
|
|
6773
6773
|
// SDK通讯实例
|
|
6774
|
-
|
|
6774
|
+
K(this, "loading", !1);
|
|
6775
6775
|
// 是否加载中 加载中不允许广播网络
|
|
6776
6776
|
// 设备错误信息
|
|
6777
|
-
|
|
6777
|
+
K(this, "mediaDevicesErrInfo", {
|
|
6778
6778
|
microphoneCamera_audio: "",
|
|
6779
6779
|
microphoneCamera_video: "",
|
|
6780
6780
|
screenSharing_video: "",
|
|
@@ -6783,35 +6783,35 @@ class RoomBase extends MediaStreams {
|
|
|
6783
6783
|
/**
|
|
6784
6784
|
* 获取房间信息
|
|
6785
6785
|
*/
|
|
6786
|
-
|
|
6786
|
+
K(this, "getRoomInfo", () => {
|
|
6787
6787
|
const { options: u, state: A, createAt: h } = this;
|
|
6788
6788
|
return { ...u, state: A, createAt: h };
|
|
6789
6789
|
});
|
|
6790
6790
|
/**
|
|
6791
6791
|
* 设置房间状态
|
|
6792
6792
|
*/
|
|
6793
|
-
|
|
6793
|
+
K(this, "setRoomState", (u) => {
|
|
6794
6794
|
this.state = u;
|
|
6795
6795
|
const A = enum_roomState[u], h = { state: u, stateStr: A };
|
|
6796
|
-
this.cwsIns.emitNotify("onRoomState", { code: 200,
|
|
6796
|
+
this.cwsIns.emitNotify("onRoomState", { code: 200, data: h });
|
|
6797
6797
|
});
|
|
6798
6798
|
/**
|
|
6799
6799
|
* 设置属性
|
|
6800
6800
|
*/
|
|
6801
|
-
|
|
6801
|
+
K(this, "setOptions", (u) => {
|
|
6802
6802
|
const A = { ...this.options, ...u };
|
|
6803
6803
|
this.options = A;
|
|
6804
6804
|
});
|
|
6805
6805
|
/**
|
|
6806
6806
|
* 设置房间loading状态
|
|
6807
6807
|
*/
|
|
6808
|
-
|
|
6808
|
+
K(this, "setLoading", (u) => {
|
|
6809
6809
|
this.loading = u;
|
|
6810
6810
|
});
|
|
6811
6811
|
/**
|
|
6812
6812
|
* 获取媒体设备错误信息
|
|
6813
6813
|
*/
|
|
6814
|
-
|
|
6814
|
+
K(this, "getMediaDevicesErrInfo", async () => {
|
|
6815
6815
|
try {
|
|
6816
6816
|
await navigator.mediaDevices.getUserMedia({ audio: !0 }).then((u) => this.stopStream(u));
|
|
6817
6817
|
} catch (u) {
|
|
@@ -6824,31 +6824,31 @@ class RoomBase extends MediaStreams {
|
|
|
6824
6824
|
}
|
|
6825
6825
|
return this.mediaDevicesErrInfo;
|
|
6826
6826
|
});
|
|
6827
|
-
this.cwsIns = new CallsWebSocket({ ...this.options });
|
|
6827
|
+
this.cwsIns = new CallsWebSocket({ ...this.options, debug: !0 });
|
|
6828
6828
|
}
|
|
6829
6829
|
}
|
|
6830
6830
|
class RoomUsers extends RoomBase {
|
|
6831
6831
|
// 用户
|
|
6832
6832
|
constructor() {
|
|
6833
6833
|
super();
|
|
6834
|
-
|
|
6834
|
+
K(this, "userMap", /* @__PURE__ */ new Map());
|
|
6835
6835
|
/**
|
|
6836
6836
|
* 清除房间所有用户
|
|
6837
6837
|
*/
|
|
6838
|
-
|
|
6838
|
+
K(this, "clearUsers", () => {
|
|
6839
6839
|
this.userMap = /* @__PURE__ */ new Map();
|
|
6840
6840
|
});
|
|
6841
6841
|
/**
|
|
6842
6842
|
* 删除用户
|
|
6843
6843
|
*/
|
|
6844
|
-
|
|
6844
|
+
K(this, "removeUsers", async (u) => {
|
|
6845
6845
|
for (const A of u)
|
|
6846
6846
|
this.userMap.delete(A);
|
|
6847
6847
|
});
|
|
6848
6848
|
/**
|
|
6849
6849
|
* 创建一个用户
|
|
6850
6850
|
*/
|
|
6851
|
-
|
|
6851
|
+
K(this, "createUser", async (u) => {
|
|
6852
6852
|
const A = Date.now(), h = {
|
|
6853
6853
|
id: u,
|
|
6854
6854
|
callAction: 0,
|
|
@@ -6859,6 +6859,7 @@ class RoomUsers extends RoomBase {
|
|
|
6859
6859
|
screenSharing_audio: !1
|
|
6860
6860
|
},
|
|
6861
6861
|
callState: 0,
|
|
6862
|
+
loading: !1,
|
|
6862
6863
|
isSelf: u === this.options.userId,
|
|
6863
6864
|
joinTime: A,
|
|
6864
6865
|
updateAt: A,
|
|
@@ -6876,11 +6877,11 @@ class RoomUsers extends RoomBase {
|
|
|
6876
6877
|
/**
|
|
6877
6878
|
* 获取某个用户
|
|
6878
6879
|
*/
|
|
6879
|
-
|
|
6880
|
+
K(this, "getUser", async (u) => (this.userMap.has(u) || await this.createUser(u), this.userMap.get(u)));
|
|
6880
6881
|
/**
|
|
6881
6882
|
* 获取某些用户
|
|
6882
6883
|
*/
|
|
6883
|
-
|
|
6884
|
+
K(this, "getUsers", async (u = []) => {
|
|
6884
6885
|
u.length === 0 && (u = [...this.userMap.keys()]);
|
|
6885
6886
|
const A = [];
|
|
6886
6887
|
for (const h of u) {
|
|
@@ -6892,15 +6893,24 @@ class RoomUsers extends RoomBase {
|
|
|
6892
6893
|
/**
|
|
6893
6894
|
* 获取房间全部用户id
|
|
6894
6895
|
*/
|
|
6895
|
-
|
|
6896
|
+
K(this, "getUsersId", async () => [...this.userMap.keys()]);
|
|
6896
6897
|
/**
|
|
6897
6898
|
* 获取房间的访问者
|
|
6898
6899
|
*/
|
|
6899
|
-
|
|
6900
|
+
K(this, "getCaller", async () => await this.getUser(this.options.userId));
|
|
6901
|
+
/**
|
|
6902
|
+
* 设置用户加载状态
|
|
6903
|
+
*/
|
|
6904
|
+
K(this, "setUsersLoading", async (u, A = !0) => {
|
|
6905
|
+
for (const h of u) {
|
|
6906
|
+
const k = await this.getUser(h);
|
|
6907
|
+
k.loading = A;
|
|
6908
|
+
}
|
|
6909
|
+
});
|
|
6900
6910
|
/**
|
|
6901
6911
|
* 更新用户轨道
|
|
6902
6912
|
*/
|
|
6903
|
-
|
|
6913
|
+
K(this, "updateUsertracks", async (u, A = [], h = !0) => {
|
|
6904
6914
|
const k = await this.getUser(u);
|
|
6905
6915
|
h && (A = [...k.tracks, ...A]), A = st(A, ["type"]), A = A.filter(({ mid: v = "" }) => v !== "");
|
|
6906
6916
|
for (const v of A)
|
|
@@ -6933,28 +6943,28 @@ class RoomUsers extends RoomBase {
|
|
|
6933
6943
|
/**
|
|
6934
6944
|
* 更新用户会话状态
|
|
6935
6945
|
*/
|
|
6936
|
-
|
|
6946
|
+
K(this, "updateUserCallAction", async (u, A = 0) => {
|
|
6937
6947
|
const h = await this.getUser(u);
|
|
6938
6948
|
h.callAction = A, h.callActionMap = this.tools.getCallActionMap(A);
|
|
6939
6949
|
});
|
|
6940
6950
|
/**
|
|
6941
6951
|
* 更新用户网络信息
|
|
6942
6952
|
*/
|
|
6943
|
-
|
|
6953
|
+
K(this, "updateUserNetwork", async (u, A = { egress: 5, ingress: 5 }) => {
|
|
6944
6954
|
const h = await this.getUser(u);
|
|
6945
6955
|
h.network = A;
|
|
6946
6956
|
});
|
|
6947
6957
|
/**
|
|
6948
6958
|
* 更新用户基本信息
|
|
6949
6959
|
*/
|
|
6950
|
-
|
|
6960
|
+
K(this, "updateUserBase", async (u) => {
|
|
6951
6961
|
const A = await this.getUser(u);
|
|
6952
6962
|
A.isSelf = u === this.options.userId, A.updateAt = Date.now();
|
|
6953
6963
|
});
|
|
6954
6964
|
/**
|
|
6955
6965
|
* 更新多个用户信息
|
|
6956
6966
|
*/
|
|
6957
|
-
|
|
6967
|
+
K(this, "updateUsers", async (u) => {
|
|
6958
6968
|
for (const A of u) {
|
|
6959
6969
|
const { id: h, tracks: k, callAction: t } = A;
|
|
6960
6970
|
await this.updateUserBase(h), await this.updateUsertracks(h, k), await this.updateUserCallAction(h, t), await this.updateUserNetwork(h);
|
|
@@ -6963,9 +6973,9 @@ class RoomUsers extends RoomBase {
|
|
|
6963
6973
|
/**
|
|
6964
6974
|
* 广播用户变化
|
|
6965
6975
|
*/
|
|
6966
|
-
|
|
6976
|
+
K(this, "emitNotifyUpdateUsers", async () => {
|
|
6967
6977
|
if (this.loading) return;
|
|
6968
|
-
const u = await this.getUsers(), A = ot(u, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionMap", "network", "updateStreams"]);
|
|
6978
|
+
const u = await this.getUsers(), A = ot(u, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionMap", "network", "updateStreams", "loading"]);
|
|
6969
6979
|
this.cwsIns.emitNotify("onRoomUsers", { code: 200, data: A });
|
|
6970
6980
|
});
|
|
6971
6981
|
}
|
|
@@ -6976,14 +6986,14 @@ class RoomAudio extends RoomUsers {
|
|
|
6976
6986
|
/**
|
|
6977
6987
|
* 获取用户音频处理上下文
|
|
6978
6988
|
*/
|
|
6979
|
-
|
|
6989
|
+
K(this, "getUserAudioMediaStreamContext", (u, A) => {
|
|
6980
6990
|
const h = this.getUserMediaKey(u, A);
|
|
6981
6991
|
return this.audioMediaStreamContextMap.get(h);
|
|
6982
6992
|
});
|
|
6983
6993
|
/**
|
|
6984
6994
|
* 获取最大音量用户
|
|
6985
6995
|
*/
|
|
6986
|
-
|
|
6996
|
+
K(this, "getMaxVolumeUser", () => {
|
|
6987
6997
|
const u = Array.from(this.userMap.values(), ({ id: h }) => h);
|
|
6988
6998
|
if (u.length === 0) return;
|
|
6989
6999
|
let A = [];
|
|
@@ -6998,7 +7008,7 @@ class RoomAudio extends RoomUsers {
|
|
|
6998
7008
|
/**
|
|
6999
7009
|
* 设置音频过滤
|
|
7000
7010
|
*/
|
|
7001
|
-
|
|
7011
|
+
K(this, "setAudioFilter", async (u = {}) => {
|
|
7002
7012
|
const A = await this.getUsersId();
|
|
7003
7013
|
for (const h of A) {
|
|
7004
7014
|
{
|
|
@@ -7016,7 +7026,7 @@ class RoomAudio extends RoomUsers {
|
|
|
7016
7026
|
* @param userId
|
|
7017
7027
|
* @param mediaType
|
|
7018
7028
|
*/
|
|
7019
|
-
|
|
7029
|
+
K(this, "setVolume", (u, A, h) => {
|
|
7020
7030
|
const k = this.getUserAudioMediaStreamContext(u, A);
|
|
7021
7031
|
k == null || k.setVolumeGain(h);
|
|
7022
7032
|
});
|
|
@@ -7026,7 +7036,7 @@ class RoomAudio extends RoomUsers {
|
|
|
7026
7036
|
* @param mediaType
|
|
7027
7037
|
* @returns volume
|
|
7028
7038
|
*/
|
|
7029
|
-
|
|
7039
|
+
K(this, "getVolume", (u, A) => {
|
|
7030
7040
|
const h = this.getUserAudioMediaStreamContext(u, A);
|
|
7031
7041
|
return (h == null ? void 0 : h.getVolume()) || 0;
|
|
7032
7042
|
});
|
|
@@ -7036,12 +7046,12 @@ var xt, Nt;
|
|
|
7036
7046
|
class RoomPeer extends RoomAudio {
|
|
7037
7047
|
constructor() {
|
|
7038
7048
|
super();
|
|
7039
|
-
|
|
7040
|
-
|
|
7049
|
+
K(this, "peerIns", new RTCPeerConnection({ bundlePolicy: "max-bundle" }));
|
|
7050
|
+
K(this, "getPeerStatsTimer", 0);
|
|
7041
7051
|
// 获取报告的定时器
|
|
7042
|
-
|
|
7052
|
+
K(this, "reports", []);
|
|
7043
7053
|
// 通信网络质量
|
|
7044
|
-
|
|
7054
|
+
K(this, "peerNetwork", {
|
|
7045
7055
|
lostRate: "0",
|
|
7046
7056
|
// 丢包率
|
|
7047
7057
|
roundTripTime: "0",
|
|
@@ -7052,7 +7062,7 @@ class RoomPeer extends RoomAudio {
|
|
|
7052
7062
|
/**
|
|
7053
7063
|
* 创建 offter
|
|
7054
7064
|
*/
|
|
7055
|
-
|
|
7065
|
+
K(this, "createOffer", async () => {
|
|
7056
7066
|
var A;
|
|
7057
7067
|
const u = await this.peerIns.createOffer();
|
|
7058
7068
|
return u.sdp = (A = u.sdp) == null ? void 0 : A.replace("useinbandfec=1", "usedtx=1;useinbandfec=1"), u;
|
|
@@ -7060,55 +7070,53 @@ class RoomPeer extends RoomAudio {
|
|
|
7060
7070
|
/**
|
|
7061
7071
|
* 设置本地描述协议
|
|
7062
7072
|
*/
|
|
7063
|
-
|
|
7073
|
+
K(this, "setLocalDescription", async (u) => {
|
|
7064
7074
|
const A = new RTCSessionDescription(u);
|
|
7065
7075
|
return await this.peerIns.setLocalDescription(A), A;
|
|
7066
7076
|
});
|
|
7067
7077
|
/**
|
|
7068
7078
|
* 设置远程描述协议
|
|
7069
7079
|
*/
|
|
7070
|
-
|
|
7080
|
+
K(this, "setRemoteDescription", async (u) => {
|
|
7071
7081
|
const A = new RTCSessionDescription(u);
|
|
7072
7082
|
return await this.peerIns.setRemoteDescription(A), A;
|
|
7073
7083
|
});
|
|
7074
7084
|
/**
|
|
7075
7085
|
* 关闭某个用户的某些轨道
|
|
7076
7086
|
*/
|
|
7077
|
-
|
|
7078
|
-
const k =
|
|
7079
|
-
for (const N of
|
|
7080
|
-
const {
|
|
7081
|
-
|
|
7087
|
+
K(this, "closeUserTracks", async (u, A = [], h = !1) => {
|
|
7088
|
+
const k = this.tools.getTrackNamesFormTracks(A), t = (N) => k.includes(N), o = await this.getUser(u);
|
|
7089
|
+
for (const N of o.tracks) {
|
|
7090
|
+
const { userId: q, trackName: U, mediaType: D, msid: L } = N;
|
|
7091
|
+
if (t(U)) {
|
|
7092
|
+
if (q && D) {
|
|
7093
|
+
const Z = await this.getUserStream(q, D);
|
|
7094
|
+
this.stopStream(Z);
|
|
7095
|
+
}
|
|
7096
|
+
L && delete N.msid;
|
|
7097
|
+
}
|
|
7082
7098
|
}
|
|
7083
|
-
const o = (N) => t.includes(N);
|
|
7084
7099
|
if (h) {
|
|
7085
|
-
const N =
|
|
7100
|
+
const N = o.tracks.filter(({ trackName: q }) => !t(q));
|
|
7086
7101
|
await this.updateUsertracks(u, N, !1);
|
|
7087
7102
|
}
|
|
7088
7103
|
const v = this.peerIns.getTransceivers();
|
|
7089
7104
|
for (const N of v) {
|
|
7090
7105
|
const { sender: q, receiver: U } = N;
|
|
7091
|
-
q.track &&
|
|
7092
|
-
}
|
|
7093
|
-
for (const N of A) {
|
|
7094
|
-
const q = await this.getUserStream(u, N);
|
|
7095
|
-
if (!q) continue;
|
|
7096
|
-
const U = q.getTracks();
|
|
7097
|
-
for (const D of U)
|
|
7098
|
-
o(D.id) && (D.stop(), q.removeTrack(D));
|
|
7106
|
+
q.track && t(q.track.id) && (q.track.enabled = !1, q.track.stop(), this.peerIns.removeTrack(q)), U.track && t(U.track.id) && (U.track.enabled = !1, U.track.stop());
|
|
7099
7107
|
}
|
|
7100
7108
|
});
|
|
7101
7109
|
/**
|
|
7102
7110
|
* 获取peer网络情况
|
|
7103
7111
|
*/
|
|
7104
|
-
|
|
7112
|
+
K(this, "getPeerNetwork", () => this.peerNetwork);
|
|
7105
7113
|
/**
|
|
7106
7114
|
* 设置通讯策略
|
|
7107
7115
|
* @param callStrategy "fixedPictureQuality" | "qualityPriority" | "fluencyPriority" | "balancedDowngrade"
|
|
7108
7116
|
* @param mediaTypes mediaType[] "microphoneCamera_audio" | "microphoneCamera_video" | "screenSharing_video" | "screenSharing_audio"
|
|
7109
7117
|
* @example quickvo.setCallStrategy('fixedPictureQuality')
|
|
7110
7118
|
*/
|
|
7111
|
-
|
|
7119
|
+
K(this, "setCallStrategy", async (u, A = []) => {
|
|
7112
7120
|
A.length === 0 && (A = mediaType_keys);
|
|
7113
7121
|
let h = "balanced";
|
|
7114
7122
|
switch (u) {
|
|
@@ -7137,7 +7145,7 @@ class RoomPeer extends RoomAudio {
|
|
|
7137
7145
|
* 设置 RTCRtpSender 参数
|
|
7138
7146
|
* @param parameters RTCRtpSendParameters
|
|
7139
7147
|
*/
|
|
7140
|
-
|
|
7148
|
+
K(this, "setRTCRtpSenderParameters", (u) => {
|
|
7141
7149
|
const A = this.peerIns.getSenders();
|
|
7142
7150
|
for (const h of A) {
|
|
7143
7151
|
const k = h.getParameters();
|
|
@@ -7164,16 +7172,16 @@ class RoomPeer extends RoomAudio {
|
|
|
7164
7172
|
const U = (q / N).toFixed(2), [D = "0"] = o, [L = "0"] = v, Z = { lostRate: U, roundTripTime: D, jitter: L };
|
|
7165
7173
|
JSON.stringify(Z) !== JSON.stringify(this.peerNetwork) && this.cwsIns.emitNotify("onRoomNetwork", { code: 200, data: Z }), this.peerNetwork = Z;
|
|
7166
7174
|
const H = (F, z, V) => {
|
|
7167
|
-
const J = Number(F), X = Number(z),
|
|
7168
|
-
let
|
|
7169
|
-
return J < 0.03 && X < 100 &&
|
|
7175
|
+
const J = Number(F), X = Number(z), et = Number(V);
|
|
7176
|
+
let Y = "0";
|
|
7177
|
+
return J < 0.03 && X < 100 && et < 0.05 ? Y = "5" : J < 0.06 && X < 160 && et < 0.1 ? Y = "4" : J < 0.1 && X < 250 && et < 0.15 ? Y = "3" : J < 0.15 && X < 400 && et < 0.2 ? Y = "2" : Y = "1", Number(Y);
|
|
7170
7178
|
};
|
|
7171
7179
|
{
|
|
7172
7180
|
const F = H(U, D, L), z = await this.getCaller(), { network: V } = z, J = { egress: F, ingress: F }, X = JSON.stringify(V) !== JSON.stringify(J);
|
|
7173
7181
|
if (await this.updateUserNetwork(this.options.userId, J), X) {
|
|
7174
7182
|
this.emitNotifyUpdateUsers();
|
|
7175
|
-
const { userId:
|
|
7176
|
-
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...J, userId:
|
|
7183
|
+
const { userId: et, roomId: Y } = this.options;
|
|
7184
|
+
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...J, userId: et, roomId: Y } }, !1);
|
|
7177
7185
|
}
|
|
7178
7186
|
}
|
|
7179
7187
|
} catch (A) {
|
|
@@ -7203,11 +7211,11 @@ class RoomPeer extends RoomAudio {
|
|
|
7203
7211
|
const [U] = q.getTracks(), D = await u(U);
|
|
7204
7212
|
o = [...o, ...D];
|
|
7205
7213
|
}
|
|
7206
|
-
|
|
7214
|
+
G(this, xt).call(this, o);
|
|
7207
7215
|
};
|
|
7208
7216
|
this.getPeerStatsTimer = setInterval(A, 1 * 1e3);
|
|
7209
7217
|
});
|
|
7210
|
-
|
|
7218
|
+
G(this, Nt).call(this);
|
|
7211
7219
|
}
|
|
7212
7220
|
}
|
|
7213
7221
|
xt = new WeakMap(), Nt = new WeakMap();
|
|
@@ -7219,15 +7227,15 @@ class RoomCalls extends RoomPeer {
|
|
|
7219
7227
|
* 销毁
|
|
7220
7228
|
* @example quickvo.destroy()
|
|
7221
7229
|
*/
|
|
7222
|
-
|
|
7223
|
-
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"),
|
|
7230
|
+
K(this, "destroy", async () => {
|
|
7231
|
+
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), clearInterval(this.getPeerStatsTimer), this.clearUserStreams(), this.clearUsers(), await this.cwsIns.close();
|
|
7224
7232
|
});
|
|
7225
7233
|
/**
|
|
7226
7234
|
* 添加广播事件
|
|
7227
7235
|
* @param notify Notify
|
|
7228
7236
|
* @returns sn
|
|
7229
7237
|
*/
|
|
7230
|
-
|
|
7238
|
+
K(this, "addNotify", (u) => this.cwsIns.addNotify(u));
|
|
7231
7239
|
/**
|
|
7232
7240
|
* 设置本地流
|
|
7233
7241
|
* @param mediaType MediaType
|
|
@@ -7235,7 +7243,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7235
7243
|
* @example quickvo.setLocalStream('microphoneCamera_audio', false)
|
|
7236
7244
|
* @returns Promise<Streams>
|
|
7237
7245
|
*/
|
|
7238
|
-
|
|
7246
|
+
K(this, "setLocalStream", (u, A) => new Promise(async (h, k) => {
|
|
7239
7247
|
try {
|
|
7240
7248
|
const { userId: t } = this.options, o = {
|
|
7241
7249
|
autoGainControl: !1,
|
|
@@ -7290,20 +7298,28 @@ class RoomCalls extends RoomPeer {
|
|
|
7290
7298
|
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1', autoSubscribe: true })
|
|
7291
7299
|
* @returns Promise<boolean>
|
|
7292
7300
|
*/
|
|
7293
|
-
|
|
7301
|
+
K(this, "joinRoom", async (u) => new Promise(async (A, h) => {
|
|
7294
7302
|
try {
|
|
7295
|
-
this.setLoading(!0), this.setOptions(u), await
|
|
7296
|
-
const
|
|
7297
|
-
await this.cwsIns.sendMessage({ event: "joinRoom", data: { roomId: k, user: { id: t }, callType: o } }).then(async (q) => {
|
|
7298
|
-
const { code: U = 0, desc: D = "服务器繁忙", data: L } = q;
|
|
7299
|
-
if (U !== 200) return h(D);
|
|
7300
|
-
const { roomId: Z = "" } = L;
|
|
7301
|
-
if (Z !== k) return h("加入的房间不匹配");
|
|
7302
|
-
}), await Y(this, Dt).call(this), await this.syncRoomInfo(), await Y(this, kt).call(this, 0), this.setLoading(!1), v && await this.subscribe(), (async () => {
|
|
7303
|
+
this.setLoading(!0), this.setOptions(u), await G(this, Ct).call(this);
|
|
7304
|
+
const k = async () => {
|
|
7303
7305
|
this.setRoomState("connected");
|
|
7304
7306
|
const q = await this.getUsers();
|
|
7305
7307
|
A(q);
|
|
7306
|
-
}
|
|
7308
|
+
};
|
|
7309
|
+
this.setRoomState("connect");
|
|
7310
|
+
const { roomId: t, userId: o, callType: v, autoSubscribe: N } = this.options;
|
|
7311
|
+
await this.cwsIns.sendMessage({ event: "joinRoom", data: { roomId: t, user: { id: o }, callType: v } }).then(async (q) => {
|
|
7312
|
+
this.setLoading(!1);
|
|
7313
|
+
const { code: U = 0, desc: D = "服务器繁忙", data: L } = q;
|
|
7314
|
+
if (U !== 200) return h(D);
|
|
7315
|
+
const { roomId: Z = "" } = L;
|
|
7316
|
+
if (Z !== t) return h("加入的房间不匹配");
|
|
7317
|
+
if (await G(this, Dt).call(this), await this.syncRoomInfo(), G(this, kt).call(this, 0), k(), N)
|
|
7318
|
+
try {
|
|
7319
|
+
this.subscribe();
|
|
7320
|
+
} catch {
|
|
7321
|
+
}
|
|
7322
|
+
});
|
|
7307
7323
|
} catch (k) {
|
|
7308
7324
|
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe:error", k), h(`加入房间失败: ${k.message || k || "服务器繁忙"}`);
|
|
7309
7325
|
}
|
|
@@ -7313,7 +7329,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7313
7329
|
* @example quickvo.quitRoom()
|
|
7314
7330
|
* @returns Promise<boolean>
|
|
7315
7331
|
*/
|
|
7316
|
-
|
|
7332
|
+
K(this, "quitRoom", async () => new Promise(async (u, A) => {
|
|
7317
7333
|
try {
|
|
7318
7334
|
const { roomId: h, userId: k } = this.options, t = { roomId: h, user: { id: k } };
|
|
7319
7335
|
await this.stopPublish(), this.cwsIns.sendMessage({ event: "quitRoom", data: t }), await new Promise((o) => setTimeout(() => o(!0), 500)), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {} }), u(!0);
|
|
@@ -7325,7 +7341,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7325
7341
|
* 同步房间信息
|
|
7326
7342
|
* @example quickvo.syncRoomInfo()
|
|
7327
7343
|
*/
|
|
7328
|
-
|
|
7344
|
+
K(this, "syncRoomInfo", async () => new Promise(async (u, A) => {
|
|
7329
7345
|
const { userId: h } = this.options, { id: k = h, callAction: t = 0 } = await this.getUser(h);
|
|
7330
7346
|
await this.cwsIns.sendMessage({
|
|
7331
7347
|
event: "syncRoomInfo",
|
|
@@ -7335,10 +7351,10 @@ class RoomCalls extends RoomPeer {
|
|
|
7335
7351
|
const v = o.data.users, N = await this.getUsersId();
|
|
7336
7352
|
for (const q of N)
|
|
7337
7353
|
v.findIndex(({ id: D = "" }) => D === q) === -1 && this.removeUsers([q]);
|
|
7338
|
-
await this.updateUsers(v)
|
|
7354
|
+
await this.updateUsers(v);
|
|
7339
7355
|
{
|
|
7340
7356
|
const q = await this.getUsers();
|
|
7341
|
-
u(q);
|
|
7357
|
+
await this.emitNotifyUpdateUsers(), u(q);
|
|
7342
7358
|
}
|
|
7343
7359
|
}).catch((o) => A(o));
|
|
7344
7360
|
}));
|
|
@@ -7349,18 +7365,19 @@ class RoomCalls extends RoomPeer {
|
|
|
7349
7365
|
* @example quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3)
|
|
7350
7366
|
* @returns Promise<RoomUser>
|
|
7351
7367
|
*/
|
|
7352
|
-
|
|
7368
|
+
K(this, "publish", (u, A = 3) => new Promise(async (h, k) => {
|
|
7353
7369
|
try {
|
|
7354
|
-
this.
|
|
7355
|
-
|
|
7370
|
+
const t = await this.getCaller();
|
|
7371
|
+
await this.setUsersLoading([t.id], !0), await this.emitNotifyUpdateUsers(), this.setLoading(!0);
|
|
7372
|
+
const o = [], v = [], N = async (H) => {
|
|
7356
7373
|
let F = await this.getUserStream(t.id, H);
|
|
7357
7374
|
F.getTracks().length === 0 && (await this.setLocalStream(H, !0), F = await this.getUserStream(t.id, H));
|
|
7358
7375
|
{
|
|
7359
7376
|
const z = F.getTracks();
|
|
7360
7377
|
if (z.length === 0) throw new Error("tracks length is 0.");
|
|
7361
7378
|
for (const V of z) {
|
|
7362
|
-
const { id: J, enabled: X } = V,
|
|
7363
|
-
o.push({ type:
|
|
7379
|
+
const { id: J, enabled: X } = V, et = mediaType_keys.findIndex((Y) => Y === H);
|
|
7380
|
+
o.push({ type: et, enabled: X, trackName: J, location: "local", mid: "" }), v.push(V);
|
|
7364
7381
|
}
|
|
7365
7382
|
}
|
|
7366
7383
|
};
|
|
@@ -7380,23 +7397,22 @@ class RoomCalls extends RoomPeer {
|
|
|
7380
7397
|
}
|
|
7381
7398
|
}
|
|
7382
7399
|
const D = [...t.tracks, ...o], L = await this.tools.getCallAction(D), Z = async () => {
|
|
7383
|
-
this.setLoading(!1), await this.emitNotifyUpdateUsers();
|
|
7384
7400
|
const H = await this.getCaller();
|
|
7385
|
-
h(H);
|
|
7386
|
-
},
|
|
7401
|
+
this.setLoading(!1), await this.setUsersLoading([H.id], !1), await this.emitNotifyUpdateUsers(), h(H);
|
|
7402
|
+
}, W = async () => {
|
|
7387
7403
|
await this.cwsIns.sendMessage({ event: "publish", data: { sdp: q.sdp, tracks: o, callAction: L } }).then(async (H) => {
|
|
7388
7404
|
const { code: F = 0, desc: z, data: V } = H;
|
|
7389
7405
|
if (F !== 200) {
|
|
7390
7406
|
if (A > 0)
|
|
7391
|
-
return await new Promise((X) => setTimeout(() => X(!0), 300)), A = A - 1,
|
|
7407
|
+
return await new Promise((X) => setTimeout(() => X(!0), 300)), A = A - 1, W();
|
|
7392
7408
|
throw this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: publish is error. count 0", { mediaTypes: u }), new Error(z);
|
|
7393
7409
|
}
|
|
7394
7410
|
const { remoteSdp: J } = V;
|
|
7395
7411
|
if (await this.setRemoteDescription({ type: "answer", sdp: J }), !t) throw new Error("当前用户信息不在当前房间");
|
|
7396
|
-
await this.updateUsertracks(t.id, D), await
|
|
7412
|
+
await this.updateUsertracks(t.id, D), await G(this, kt).call(this, L), Z();
|
|
7397
7413
|
});
|
|
7398
7414
|
};
|
|
7399
|
-
await
|
|
7415
|
+
await W();
|
|
7400
7416
|
} catch (t) {
|
|
7401
7417
|
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe:error", t), k(`发布本地流失败: ${t.message}`);
|
|
7402
7418
|
}
|
|
@@ -7407,25 +7423,25 @@ class RoomCalls extends RoomPeer {
|
|
|
7407
7423
|
* @example quickvo.stopPublish(['microphoneCamera_audio'])
|
|
7408
7424
|
* @returns Promise<RoomUser>
|
|
7409
7425
|
*/
|
|
7410
|
-
|
|
7426
|
+
K(this, "stopPublish", async (u = []) => new Promise(async (A, h) => {
|
|
7411
7427
|
try {
|
|
7412
7428
|
const k = await this.getCaller();
|
|
7413
|
-
u.length === 0 && (u = mediaType_keys);
|
|
7429
|
+
await this.setUsersLoading([k.id], !0), await this.emitNotifyUpdateUsers(), u.length === 0 && (u = mediaType_keys);
|
|
7414
7430
|
const t = k.tracks.filter(({ mediaType: v }) => v && u.includes(v)), o = async () => {
|
|
7415
7431
|
const v = await this.getCaller();
|
|
7416
|
-
A(v);
|
|
7432
|
+
await this.setUsersLoading([v.id], !1), await this.emitNotifyUpdateUsers(), A(v);
|
|
7417
7433
|
};
|
|
7418
7434
|
if (t.length === 0) return o();
|
|
7419
|
-
await this.closeUserTracks(k.id,
|
|
7435
|
+
await this.closeUserTracks(k.id, t, !0);
|
|
7420
7436
|
{
|
|
7421
7437
|
const v = await this.setLocalDescription(await this.createOffer());
|
|
7422
7438
|
await this.cwsIns.sendMessage({ event: "closeTrack", data: { sdp: v.sdp, tracks: t } });
|
|
7423
7439
|
}
|
|
7424
7440
|
{
|
|
7425
7441
|
const v = await this.tools.getCallAction(k.tracks);
|
|
7426
|
-
await
|
|
7442
|
+
await G(this, kt).call(this, v);
|
|
7427
7443
|
}
|
|
7428
|
-
|
|
7444
|
+
o();
|
|
7429
7445
|
} catch (k) {
|
|
7430
7446
|
h(k);
|
|
7431
7447
|
}
|
|
@@ -7437,87 +7453,88 @@ class RoomCalls extends RoomPeer {
|
|
|
7437
7453
|
* @example quickvo.subscribe(['trackName1','trackName2'])
|
|
7438
7454
|
* @returns Promise<RoomUser[]>
|
|
7439
7455
|
*/
|
|
7440
|
-
|
|
7456
|
+
K(this, "subscribe", async (u = [], A = 3) => new Promise(async (h, k) => {
|
|
7441
7457
|
try {
|
|
7442
|
-
this.setLoading(!0);
|
|
7443
7458
|
const t = await this.getUsers();
|
|
7444
7459
|
let o = [];
|
|
7445
|
-
for (const
|
|
7446
|
-
const { isSelf:
|
|
7447
|
-
if (!
|
|
7448
|
-
const
|
|
7449
|
-
|
|
7460
|
+
for (const Z of t) {
|
|
7461
|
+
const { isSelf: W, tracks: H = [] } = Z;
|
|
7462
|
+
if (!W) {
|
|
7463
|
+
const F = H.filter(({ trackName: z, mid: V = "" }) => V !== "" && (u.includes(z) || u.length === 0));
|
|
7464
|
+
F.length !== 0 && o.push({ ...Z, tracks: F });
|
|
7450
7465
|
}
|
|
7451
7466
|
}
|
|
7452
|
-
const v =
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7467
|
+
const v = Array.from(o, ({ id: Z }) => Z);
|
|
7468
|
+
await this.setUsersLoading(v, !0);
|
|
7469
|
+
const N = async () => {
|
|
7470
|
+
const Z = await this.getUsers(v);
|
|
7471
|
+
await this.setUsersLoading(v, !1), await this.emitNotifyUpdateUsers(), h(Z);
|
|
7456
7472
|
};
|
|
7457
|
-
if (o.length === 0) return
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7473
|
+
if (o.length === 0) return N();
|
|
7474
|
+
await this.emitNotifyUpdateUsers();
|
|
7475
|
+
let q = 0;
|
|
7476
|
+
const U = [];
|
|
7477
|
+
for (const Z of o) {
|
|
7478
|
+
const { id: W, tracks: H } = Z, F = ot(H, ["type", "trackName"]), z = { id: W, tracks: F };
|
|
7479
|
+
U.push(z);
|
|
7463
7480
|
}
|
|
7464
|
-
const
|
|
7465
|
-
for (const
|
|
7466
|
-
const { id:
|
|
7467
|
-
for (const
|
|
7468
|
-
const { id:
|
|
7469
|
-
if (!
|
|
7470
|
-
const
|
|
7471
|
-
if (
|
|
7472
|
-
const
|
|
7473
|
-
|
|
7481
|
+
const D = async (Z, W) => {
|
|
7482
|
+
for (const H of Z) {
|
|
7483
|
+
const { id: F, tracks: z = [] } = H;
|
|
7484
|
+
for (const X of W) {
|
|
7485
|
+
const { id: et } = X, { type: Y } = z.find(({ msid: Q = "" }) => Q === et) || {}, nt = mediaType_keys[Y];
|
|
7486
|
+
if (!nt) continue;
|
|
7487
|
+
const tt = new MediaStream();
|
|
7488
|
+
if (tt.addTrack(X), await this.initUserMediaStreamContext(F, nt, tt), ["microphoneCamera_audio", "screenSharing_audio"].includes(nt)) {
|
|
7489
|
+
const Q = this.getUserAudioMediaStreamContext(F, nt);
|
|
7490
|
+
Q == null || Q.setMute(!1);
|
|
7474
7491
|
}
|
|
7475
7492
|
}
|
|
7476
|
-
const
|
|
7477
|
-
for (const
|
|
7478
|
-
const { trackName:
|
|
7479
|
-
if (
|
|
7480
|
-
const
|
|
7481
|
-
|
|
7493
|
+
const V = await this.getUser(F), J = [];
|
|
7494
|
+
for (const X of V.tracks) {
|
|
7495
|
+
const { trackName: et } = X, Y = z.find((tt) => `${tt.trackName}` === et) || {}, { msid: nt } = Y;
|
|
7496
|
+
if (nt) {
|
|
7497
|
+
const tt = { ...X, msid: nt };
|
|
7498
|
+
J.push(tt);
|
|
7482
7499
|
}
|
|
7483
7500
|
}
|
|
7484
|
-
await this.updateUsertracks(
|
|
7501
|
+
await this.updateUsertracks(F, J);
|
|
7485
7502
|
}
|
|
7486
|
-
|
|
7487
|
-
},
|
|
7488
|
-
clearTimeout(
|
|
7489
|
-
const { code:
|
|
7490
|
-
if (
|
|
7491
|
-
return A > 0 ? (await new Promise((
|
|
7492
|
-
const { remoteSdp:
|
|
7493
|
-
for (const
|
|
7494
|
-
const { id:
|
|
7495
|
-
for (const
|
|
7496
|
-
const { type:
|
|
7497
|
-
if (!
|
|
7498
|
-
const
|
|
7499
|
-
if (
|
|
7500
|
-
const mt = o.find((
|
|
7503
|
+
N();
|
|
7504
|
+
}, L = async () => {
|
|
7505
|
+
clearTimeout(q), await this.cwsIns.sendMessage({ event: "subscribe", data: { users: U } }).then(async (Z) => {
|
|
7506
|
+
const { code: W = 0, desc: H, data: F } = Z;
|
|
7507
|
+
if (W !== 200)
|
|
7508
|
+
return A > 0 ? (await new Promise((et) => setTimeout(() => et(!0), 300)), A = A - 1, L()) : (this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: subscribe is error. count 0", { trackNames: u }), k(H));
|
|
7509
|
+
const { remoteSdp: z, users: V = [] } = F, J = libExports.parse(z), X = ot(J.media, ["mid", "msid"]);
|
|
7510
|
+
for (const et of V) {
|
|
7511
|
+
const { id: Y, tracks: nt = [] } = et;
|
|
7512
|
+
for (const tt of nt) {
|
|
7513
|
+
const { type: Q, mid: rt, trackName: _t } = tt, { msid: vt = "" } = X.find((mt) => `${mt.mid}` === rt) || {};
|
|
7514
|
+
if (!vt) continue;
|
|
7515
|
+
const yt = vt.split(" ");
|
|
7516
|
+
if (tt.msid = yt[yt.length - 1], Q === null) {
|
|
7517
|
+
const mt = o.find((Lt) => Lt.id === Y);
|
|
7501
7518
|
if (mt) {
|
|
7502
|
-
const { tracks:
|
|
7503
|
-
|
|
7519
|
+
const { tracks: Lt = [] } = mt, { type: Zt = -1 } = Lt.find((Ft) => Ft.trackName === _t) || {};
|
|
7520
|
+
tt.type = Zt;
|
|
7504
7521
|
}
|
|
7505
7522
|
}
|
|
7506
7523
|
}
|
|
7507
7524
|
}
|
|
7508
7525
|
{
|
|
7509
|
-
const
|
|
7510
|
-
|
|
7511
|
-
await
|
|
7512
|
-
}, 1e4), this.peerIns.ontrack = async (
|
|
7513
|
-
const { track:
|
|
7514
|
-
|
|
7526
|
+
const et = [];
|
|
7527
|
+
q = setTimeout(async () => {
|
|
7528
|
+
await D(V, et);
|
|
7529
|
+
}, 1e4), this.peerIns.ontrack = async (Y) => {
|
|
7530
|
+
const { track: nt } = Y;
|
|
7531
|
+
et.push(nt), X.length === et.length && (clearTimeout(q), await D(V, et));
|
|
7515
7532
|
};
|
|
7516
7533
|
}
|
|
7517
|
-
await this.setRemoteDescription({ type: "offer", sdp:
|
|
7534
|
+
await this.setRemoteDescription({ type: "offer", sdp: z }), await G(this, qt).call(this);
|
|
7518
7535
|
});
|
|
7519
7536
|
};
|
|
7520
|
-
await
|
|
7537
|
+
await L();
|
|
7521
7538
|
} catch (t) {
|
|
7522
7539
|
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe:error", t), k(`发布本地流失败: ${t.message}`);
|
|
7523
7540
|
}
|
|
@@ -7527,20 +7544,20 @@ class RoomCalls extends RoomPeer {
|
|
|
7527
7544
|
* @param trackNames string[] = []
|
|
7528
7545
|
* @example quickvo.subscribe(['trackName1'])
|
|
7529
7546
|
*/
|
|
7530
|
-
|
|
7547
|
+
K(this, "stopSubscribe", async (u = []) => new Promise(async (A, h) => {
|
|
7531
7548
|
try {
|
|
7532
|
-
const k = await this.getUsers(), t = [];
|
|
7533
|
-
for (const
|
|
7534
|
-
const { tracks:
|
|
7535
|
-
for (const
|
|
7536
|
-
const { trackName:
|
|
7537
|
-
|
|
7549
|
+
const k = await this.getUsers(), t = [], o = [];
|
|
7550
|
+
for (const N of k) {
|
|
7551
|
+
const { id: q, tracks: U = [] } = N;
|
|
7552
|
+
for (const D of U) {
|
|
7553
|
+
const { trackName: L, mediaType: Z } = D;
|
|
7554
|
+
Z && (u.length === 0 || u.includes(L)) && (t.push(D), o.push(q), await this.setUsersLoading([q], !0), await this.closeUserTracks(N.id, [D]));
|
|
7538
7555
|
}
|
|
7539
7556
|
}
|
|
7540
7557
|
if (t.length === 0) return A(!0);
|
|
7541
7558
|
await this.emitNotifyUpdateUsers();
|
|
7542
|
-
const
|
|
7543
|
-
this.cwsIns.sendMessage({ event: "closeTrack", data: { sdp:
|
|
7559
|
+
const v = await this.setLocalDescription(await this.createOffer());
|
|
7560
|
+
this.cwsIns.sendMessage({ event: "closeTrack", data: { sdp: v.sdp, tracks: t } }), await this.setUsersLoading(o, !1), await this.emitNotifyUpdateUsers(), A(!0);
|
|
7544
7561
|
} catch (k) {
|
|
7545
7562
|
h(`停止订阅流: ${k.message}`);
|
|
7546
7563
|
}
|
|
@@ -7552,7 +7569,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7552
7569
|
* @param userId 用户id
|
|
7553
7570
|
* @example quickvo.inactiveTracks(['microphoneCamera_audio'], false)
|
|
7554
7571
|
*/
|
|
7555
|
-
|
|
7572
|
+
K(this, "inactiveTracks", async (u, A, h = this.options.userId) => {
|
|
7556
7573
|
const k = await this.getUser(h), { tracks: t = [] } = k, o = [...t];
|
|
7557
7574
|
for (let N of o) {
|
|
7558
7575
|
const { mediaType: q } = N;
|
|
@@ -7564,12 +7581,12 @@ class RoomCalls extends RoomPeer {
|
|
|
7564
7581
|
}
|
|
7565
7582
|
}
|
|
7566
7583
|
const v = await this.tools.getCallAction(o);
|
|
7567
|
-
await
|
|
7584
|
+
await G(this, kt).call(this, v), await this.emitNotifyUpdateUsers();
|
|
7568
7585
|
});
|
|
7569
7586
|
/**
|
|
7570
7587
|
* 远端调试
|
|
7571
7588
|
*/
|
|
7572
|
-
|
|
7589
|
+
K(this, "debugger", () => new Promise(async (u, A) => {
|
|
7573
7590
|
await this.cwsIns.sendMessage({ event: "debugger" }, !1).then(async (h) => {
|
|
7574
7591
|
if (h.code !== 200) return A(h.desc);
|
|
7575
7592
|
u(!0);
|
|
@@ -7615,7 +7632,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7615
7632
|
{
|
|
7616
7633
|
const u = async (A) => {
|
|
7617
7634
|
const { id: h, tracks: k } = A.data.user;
|
|
7618
|
-
await this.closeUserTracks(h, k, !0)
|
|
7635
|
+
await this.closeUserTracks(h, k, !0);
|
|
7619
7636
|
};
|
|
7620
7637
|
this.cwsIns.addNotify({ event: "onCloseTrack", callback: u }, !0);
|
|
7621
7638
|
}
|
|
@@ -7644,8 +7661,8 @@ class RoomCalls extends RoomPeer {
|
|
|
7644
7661
|
for (const z of F)
|
|
7645
7662
|
z.enabled = Z;
|
|
7646
7663
|
}
|
|
7647
|
-
const
|
|
7648
|
-
q.push(
|
|
7664
|
+
const W = { ...U, enabled: Z };
|
|
7665
|
+
q.push(W);
|
|
7649
7666
|
}
|
|
7650
7667
|
await this.updateUsertracks(h, q), await this.updateUserCallAction(h, k), this.emitNotifyUpdateUsers();
|
|
7651
7668
|
};
|
|
@@ -7728,7 +7745,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7728
7745
|
ct(this, Mt, async () => {
|
|
7729
7746
|
this.destroy();
|
|
7730
7747
|
});
|
|
7731
|
-
|
|
7748
|
+
G(this, At).call(this), this.setRoomState("ready"), this.cwsIns.onReconnectSuccess = G(this, Ut), this.cwsIns.onReconnectStop = G(this, Mt);
|
|
7732
7749
|
}
|
|
7733
7750
|
}
|
|
7734
7751
|
At = new WeakMap(), kt = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap();
|
|
@@ -7742,7 +7759,7 @@ class Room extends RoomCalls {
|
|
|
7742
7759
|
* @param keyName
|
|
7743
7760
|
* @returns string[]
|
|
7744
7761
|
*/
|
|
7745
|
-
|
|
7762
|
+
K(this, "getTrackNamesFormTracks", (u, A = [], h = "trackName") => {
|
|
7746
7763
|
const k = [];
|
|
7747
7764
|
for (const t of u) {
|
|
7748
7765
|
const { type: o } = t;
|
|
@@ -7765,25 +7782,25 @@ class QuickVO extends Room {
|
|
|
7765
7782
|
* @param key string
|
|
7766
7783
|
* @param func FrameRequestCallback
|
|
7767
7784
|
*/
|
|
7768
|
-
|
|
7785
|
+
K(this, "addRequestAnimationFrame", async (u, A) => {
|
|
7769
7786
|
{
|
|
7770
|
-
const h =
|
|
7787
|
+
const h = G(this, wt).get(u);
|
|
7771
7788
|
h && cancelAnimationFrame(h);
|
|
7772
7789
|
}
|
|
7773
7790
|
{
|
|
7774
7791
|
const h = requestAnimationFrame(A);
|
|
7775
|
-
|
|
7792
|
+
G(this, wt).set(u, h);
|
|
7776
7793
|
}
|
|
7777
7794
|
});
|
|
7778
7795
|
/**
|
|
7779
7796
|
* 清理 FrameRequestCallback
|
|
7780
7797
|
* @param keys string[] = []
|
|
7781
7798
|
*/
|
|
7782
|
-
|
|
7783
|
-
u.length === 0 && (u = [...
|
|
7799
|
+
K(this, "clearRequestAnimationFrame", async (u = []) => {
|
|
7800
|
+
u.length === 0 && (u = [...G(this, wt).keys()]);
|
|
7784
7801
|
const A = [];
|
|
7785
7802
|
for (const h of u) {
|
|
7786
|
-
const k =
|
|
7803
|
+
const k = G(this, wt).get(h);
|
|
7787
7804
|
k && (cancelAnimationFrame(k), A.push(k));
|
|
7788
7805
|
}
|
|
7789
7806
|
return A;
|