quickvo-sdk-js 0.6.2 → 0.6.4
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 +355 -311
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomBase.d.ts +1 -1
- package/dist/room/RoomMedias.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var se = Object.defineProperty;
|
|
2
|
+
var re = (a) => {
|
|
3
3
|
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var Z = (a, I, u) =>
|
|
7
|
-
var
|
|
8
|
-
const
|
|
5
|
+
var ae = (a, I, u) => I in a ? se(a, I, { enumerable: !0, configurable: !0, writable: !0, value: u }) : a[I] = u;
|
|
6
|
+
var Z = (a, I, u) => ae(a, typeof I != "symbol" ? I + "" : I, u), ce = (a, I, u) => I.has(a) || re("Cannot " + u);
|
|
7
|
+
var J = (a, I, u) => (ce(a, I, "read from private field"), u ? u.call(a) : I.get(a)), at = (a, I, u) => I.has(a) ? re("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), Ot = (a, I, u, E) => (ce(a, I, "write to private field"), E ? E.call(a, u) : I.set(a, u), u);
|
|
8
|
+
const ot = (a, I = {}) => {
|
|
9
|
+
const u = { unit: "B", splitStr: " ", ...I };
|
|
10
|
+
let { unit: E, splitStr: _ } = u;
|
|
11
|
+
const k = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], e = k.findIndex(($) => $ === E), n = k.slice(e + 1, k.length);
|
|
12
|
+
let O = a;
|
|
13
|
+
for (const $ of n)
|
|
14
|
+
if (E = $, O = O / 1024, O < 1024) break;
|
|
15
|
+
return `${O.toFixed(2)}${_}${E}`;
|
|
16
|
+
}, L = (a, I = []) => {
|
|
9
17
|
const u = { ...a }, E = Object.keys(u);
|
|
10
18
|
for (const _ of E)
|
|
11
19
|
I.findIndex((k) => String(k) === _) === -1 && delete u[_];
|
|
@@ -83,7 +91,7 @@ const L = (a, I = []) => {
|
|
|
83
91
|
}, G = (a) => W(a), U = (a, I = "YYYY-MM-DD hh:mm:ss", u = {}) => {
|
|
84
92
|
const E = { empty_str: "-", ...u }, { empty_str: _, offset: k } = E, e = W(a, k);
|
|
85
93
|
if (Number(a) !== 0 && e === 0) return _;
|
|
86
|
-
const n = new Date(e), O = `${n.getFullYear()}`, $ = `${n.getMonth() + 1}`, N = `${n.getDate()}`, D = `${n.getDay() === 0 ? 7 : n.getDay()}`, q = `${n.getHours()}`, P = `${n.getMinutes()}`, j = `${n.getSeconds()}`, V = `${Math.ceil((e - G(`${O}/01/01 00:00:00`) + 1) / 864e5)}`,
|
|
94
|
+
const n = new Date(e), O = `${n.getFullYear()}`, $ = `${n.getMonth() + 1}`, N = `${n.getDate()}`, D = `${n.getDay() === 0 ? 7 : n.getDay()}`, q = `${n.getHours()}`, P = `${n.getMinutes()}`, j = `${n.getSeconds()}`, V = `${Math.ceil((e - G(`${O}/01/01 00:00:00`) + 1) / 864e5)}`, Q = `${Math.ceil(((e - G(`${O}/01/01 00:00:00`)) / 864e5 - Number(D)) / 7) + 1}`, z = [
|
|
87
95
|
{ k: "Y+", v: O },
|
|
88
96
|
// 年
|
|
89
97
|
{ k: "M+", v: $ },
|
|
@@ -100,7 +108,7 @@ const L = (a, I = []) => {
|
|
|
100
108
|
// 秒
|
|
101
109
|
{ k: "d+", v: V },
|
|
102
110
|
// 第几天
|
|
103
|
-
{ k: "w+", v:
|
|
111
|
+
{ k: "w+", v: Q }
|
|
104
112
|
// 第几周
|
|
105
113
|
// 有其他格式化字符需求可以继续添加,必须转化成字符串
|
|
106
114
|
];
|
|
@@ -108,8 +116,8 @@ const L = (a, I = []) => {
|
|
|
108
116
|
for (let { k: et, v: tt } of z)
|
|
109
117
|
if (Y = new RegExp(`(${et})`).exec(I), Y) {
|
|
110
118
|
const nt = Y[1];
|
|
111
|
-
let
|
|
112
|
-
nt.includes("W") && (
|
|
119
|
+
let ut = tt.padStart(nt.length, "0");
|
|
120
|
+
nt.includes("W") && (ut = X[ut.slice(0, 2)]), I = I.replace(nt, ut);
|
|
113
121
|
}
|
|
114
122
|
return I;
|
|
115
123
|
}, enum_mediaType = {
|
|
@@ -1141,15 +1149,15 @@ function requireFloat() {
|
|
|
1141
1149
|
if (D < 22250738585072014e-324)
|
|
1142
1150
|
V = D / 5e-324, O(V >>> 0, q, P + $), O((j << 31 | V / 4294967296) >>> 0, q, P + N);
|
|
1143
1151
|
else {
|
|
1144
|
-
var
|
|
1145
|
-
|
|
1152
|
+
var Q = Math.floor(Math.log(D) / Math.LN2);
|
|
1153
|
+
Q === 1024 && (Q = 1023), V = D * Math.pow(2, -Q), O(V * 4503599627370496 >>> 0, q, P + $), O((j << 31 | Q + 1023 << 20 | V * 1048576 & 1048575) >>> 0, q, P + N);
|
|
1146
1154
|
}
|
|
1147
1155
|
}
|
|
1148
1156
|
}
|
|
1149
1157
|
k.writeDoubleLE = e.bind(null, I, 0, 4), k.writeDoubleBE = e.bind(null, u, 4, 0);
|
|
1150
1158
|
function n(O, $, N, D, q) {
|
|
1151
|
-
var P = O(D, q + $), j = O(D, q + N), V = (j >> 31) * 2 + 1,
|
|
1152
|
-
return
|
|
1159
|
+
var P = O(D, q + $), j = O(D, q + N), V = (j >> 31) * 2 + 1, Q = j >>> 20 & 2047, z = 4294967296 * (j & 1048575) + P;
|
|
1160
|
+
return Q === 2047 ? z ? NaN : V * (1 / 0) : Q === 0 ? V * 5e-324 * z : V * Math.pow(2, Q - 1075) * (z + 4503599627370496);
|
|
1153
1161
|
}
|
|
1154
1162
|
k.readDoubleLE = n.bind(null, E, 0, 4), k.readDoubleBE = n.bind(null, _, 4, 0);
|
|
1155
1163
|
}(), k;
|
|
@@ -1422,13 +1430,13 @@ function requireWriter() {
|
|
|
1422
1430
|
if (hasRequiredWriter) return writer;
|
|
1423
1431
|
hasRequiredWriter = 1, writer = O;
|
|
1424
1432
|
var a = requireMinimal$1(), I, u = a.LongBits, E = a.base64, _ = a.utf8;
|
|
1425
|
-
function k(
|
|
1426
|
-
this.fn =
|
|
1433
|
+
function k(Q, z, Y) {
|
|
1434
|
+
this.fn = Q, this.len = z, this.next = void 0, this.val = Y;
|
|
1427
1435
|
}
|
|
1428
1436
|
function e() {
|
|
1429
1437
|
}
|
|
1430
|
-
function n(
|
|
1431
|
-
this.head =
|
|
1438
|
+
function n(Q) {
|
|
1439
|
+
this.head = Q.head, this.tail = Q.tail, this.len = Q.len, this.next = Q.states;
|
|
1432
1440
|
}
|
|
1433
1441
|
function O() {
|
|
1434
1442
|
this.len = 0, this.head = new k(e, 0, 0), this.tail = this.head, this.states = null;
|
|
@@ -1447,16 +1455,16 @@ function requireWriter() {
|
|
|
1447
1455
|
}, a.Array !== Array && (O.alloc = a.pool(O.alloc, a.Array.prototype.subarray)), O.prototype._push = function(z, Y, et) {
|
|
1448
1456
|
return this.tail = this.tail.next = new k(z, Y, et), this.len += Y, this;
|
|
1449
1457
|
};
|
|
1450
|
-
function N(
|
|
1451
|
-
z[Y] =
|
|
1458
|
+
function N(Q, z, Y) {
|
|
1459
|
+
z[Y] = Q & 255;
|
|
1452
1460
|
}
|
|
1453
|
-
function D(
|
|
1454
|
-
for (;
|
|
1455
|
-
z[Y++] =
|
|
1456
|
-
z[Y] =
|
|
1461
|
+
function D(Q, z, Y) {
|
|
1462
|
+
for (; Q > 127; )
|
|
1463
|
+
z[Y++] = Q & 127 | 128, Q >>>= 7;
|
|
1464
|
+
z[Y] = Q;
|
|
1457
1465
|
}
|
|
1458
|
-
function q(
|
|
1459
|
-
this.len =
|
|
1466
|
+
function q(Q, z) {
|
|
1467
|
+
this.len = Q, this.next = void 0, this.val = z;
|
|
1460
1468
|
}
|
|
1461
1469
|
q.prototype = Object.create(k.prototype), q.prototype.fn = D, O.prototype.uint32 = function(z) {
|
|
1462
1470
|
return this.len += (this.tail = this.tail.next = new q(
|
|
@@ -1468,12 +1476,12 @@ function requireWriter() {
|
|
|
1468
1476
|
}, O.prototype.sint32 = function(z) {
|
|
1469
1477
|
return this.uint32((z << 1 ^ z >> 31) >>> 0);
|
|
1470
1478
|
};
|
|
1471
|
-
function P(
|
|
1472
|
-
for (;
|
|
1473
|
-
z[Y++] =
|
|
1474
|
-
for (;
|
|
1475
|
-
z[Y++] =
|
|
1476
|
-
z[Y++] =
|
|
1479
|
+
function P(Q, z, Y) {
|
|
1480
|
+
for (; Q.hi; )
|
|
1481
|
+
z[Y++] = Q.lo & 127 | 128, Q.lo = (Q.lo >>> 7 | Q.hi << 25) >>> 0, Q.hi >>>= 7;
|
|
1482
|
+
for (; Q.lo > 127; )
|
|
1483
|
+
z[Y++] = Q.lo & 127 | 128, Q.lo = Q.lo >>> 7;
|
|
1484
|
+
z[Y++] = Q.lo;
|
|
1477
1485
|
}
|
|
1478
1486
|
O.prototype.uint64 = function(z) {
|
|
1479
1487
|
var Y = u.from(z);
|
|
@@ -1484,8 +1492,8 @@ function requireWriter() {
|
|
|
1484
1492
|
}, O.prototype.bool = function(z) {
|
|
1485
1493
|
return this._push(N, 1, z ? 1 : 0);
|
|
1486
1494
|
};
|
|
1487
|
-
function j(
|
|
1488
|
-
z[Y] =
|
|
1495
|
+
function j(Q, z, Y) {
|
|
1496
|
+
z[Y] = Q & 255, z[Y + 1] = Q >>> 8 & 255, z[Y + 2] = Q >>> 16 & 255, z[Y + 3] = Q >>> 24;
|
|
1489
1497
|
}
|
|
1490
1498
|
O.prototype.fixed32 = function(z) {
|
|
1491
1499
|
return this._push(j, 4, z >>> 0);
|
|
@@ -1526,8 +1534,8 @@ function requireWriter() {
|
|
|
1526
1534
|
for (var z = this.head.next, Y = this.constructor.alloc(this.len), et = 0; z; )
|
|
1527
1535
|
z.fn(z.val, Y, et), et += z.len, z = z.next;
|
|
1528
1536
|
return Y;
|
|
1529
|
-
}, O._configure = function(
|
|
1530
|
-
I =
|
|
1537
|
+
}, O._configure = function(Q) {
|
|
1538
|
+
I = Q, O.create = $(), I._configure();
|
|
1531
1539
|
}, writer;
|
|
1532
1540
|
}
|
|
1533
1541
|
var writer_buffer, hasRequiredWriter_buffer;
|
|
@@ -6157,74 +6165,74 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
|
|
|
6157
6165
|
};
|
|
6158
6166
|
const BAD$1 = 16209, TYPE$1 = 16191;
|
|
6159
6167
|
var inffast = function a(I, u) {
|
|
6160
|
-
let E, _, k, e, n, O, $, N, D, q, P, j, V,
|
|
6161
|
-
const
|
|
6162
|
-
E = I.next_in,
|
|
6168
|
+
let E, _, k, e, n, O, $, N, D, q, P, j, V, Q, z, Y, et, tt, nt, ut, it, lt, st, rt;
|
|
6169
|
+
const ct = I.state;
|
|
6170
|
+
E = I.next_in, st = I.input, _ = E + (I.avail_in - 5), k = I.next_out, rt = I.output, e = k - (u - I.avail_out), n = k + (I.avail_out - 257), O = ct.dmax, $ = ct.wsize, N = ct.whave, D = ct.wnext, q = ct.window, P = ct.hold, j = ct.bits, V = ct.lencode, Q = ct.distcode, z = (1 << ct.lenbits) - 1, Y = (1 << ct.distbits) - 1;
|
|
6163
6171
|
t:
|
|
6164
6172
|
do {
|
|
6165
|
-
j < 15 && (P +=
|
|
6173
|
+
j < 15 && (P += st[E++] << j, j += 8, P += st[E++] << j, j += 8), et = V[P & z];
|
|
6166
6174
|
e:
|
|
6167
6175
|
for (; ; ) {
|
|
6168
6176
|
if (tt = et >>> 24, P >>>= tt, j -= tt, tt = et >>> 16 & 255, tt === 0)
|
|
6169
|
-
|
|
6177
|
+
rt[k++] = et & 65535;
|
|
6170
6178
|
else if (tt & 16) {
|
|
6171
|
-
nt = et & 65535, tt &= 15, tt && (j < tt && (P +=
|
|
6179
|
+
nt = et & 65535, tt &= 15, tt && (j < tt && (P += st[E++] << j, j += 8), nt += P & (1 << tt) - 1, P >>>= tt, j -= tt), j < 15 && (P += st[E++] << j, j += 8, P += st[E++] << j, j += 8), et = Q[P & Y];
|
|
6172
6180
|
i:
|
|
6173
6181
|
for (; ; ) {
|
|
6174
6182
|
if (tt = et >>> 24, P >>>= tt, j -= tt, tt = et >>> 16 & 255, tt & 16) {
|
|
6175
|
-
if (
|
|
6176
|
-
I.msg = "invalid distance too far back",
|
|
6183
|
+
if (ut = et & 65535, tt &= 15, j < tt && (P += st[E++] << j, j += 8, j < tt && (P += st[E++] << j, j += 8)), ut += P & (1 << tt) - 1, ut > O) {
|
|
6184
|
+
I.msg = "invalid distance too far back", ct.mode = BAD$1;
|
|
6177
6185
|
break t;
|
|
6178
6186
|
}
|
|
6179
|
-
if (P >>>= tt, j -= tt, tt = k - e,
|
|
6180
|
-
if (tt =
|
|
6181
|
-
I.msg = "invalid distance too far back",
|
|
6187
|
+
if (P >>>= tt, j -= tt, tt = k - e, ut > tt) {
|
|
6188
|
+
if (tt = ut - tt, tt > N && ct.sane) {
|
|
6189
|
+
I.msg = "invalid distance too far back", ct.mode = BAD$1;
|
|
6182
6190
|
break t;
|
|
6183
6191
|
}
|
|
6184
|
-
if (it = 0,
|
|
6192
|
+
if (it = 0, lt = q, D === 0) {
|
|
6185
6193
|
if (it += $ - tt, tt < nt) {
|
|
6186
6194
|
nt -= tt;
|
|
6187
6195
|
do
|
|
6188
|
-
|
|
6196
|
+
rt[k++] = q[it++];
|
|
6189
6197
|
while (--tt);
|
|
6190
|
-
it = k -
|
|
6198
|
+
it = k - ut, lt = rt;
|
|
6191
6199
|
}
|
|
6192
6200
|
} else if (D < tt) {
|
|
6193
6201
|
if (it += $ + D - tt, tt -= D, tt < nt) {
|
|
6194
6202
|
nt -= tt;
|
|
6195
6203
|
do
|
|
6196
|
-
|
|
6204
|
+
rt[k++] = q[it++];
|
|
6197
6205
|
while (--tt);
|
|
6198
6206
|
if (it = 0, D < nt) {
|
|
6199
6207
|
tt = D, nt -= tt;
|
|
6200
6208
|
do
|
|
6201
|
-
|
|
6209
|
+
rt[k++] = q[it++];
|
|
6202
6210
|
while (--tt);
|
|
6203
|
-
it = k -
|
|
6211
|
+
it = k - ut, lt = rt;
|
|
6204
6212
|
}
|
|
6205
6213
|
}
|
|
6206
6214
|
} else if (it += D - tt, tt < nt) {
|
|
6207
6215
|
nt -= tt;
|
|
6208
6216
|
do
|
|
6209
|
-
|
|
6217
|
+
rt[k++] = q[it++];
|
|
6210
6218
|
while (--tt);
|
|
6211
|
-
it = k -
|
|
6219
|
+
it = k - ut, lt = rt;
|
|
6212
6220
|
}
|
|
6213
6221
|
for (; nt > 2; )
|
|
6214
|
-
|
|
6215
|
-
nt && (
|
|
6222
|
+
rt[k++] = lt[it++], rt[k++] = lt[it++], rt[k++] = lt[it++], nt -= 3;
|
|
6223
|
+
nt && (rt[k++] = lt[it++], nt > 1 && (rt[k++] = lt[it++]));
|
|
6216
6224
|
} else {
|
|
6217
|
-
it = k -
|
|
6225
|
+
it = k - ut;
|
|
6218
6226
|
do
|
|
6219
|
-
|
|
6227
|
+
rt[k++] = rt[it++], rt[k++] = rt[it++], rt[k++] = rt[it++], nt -= 3;
|
|
6220
6228
|
while (nt > 2);
|
|
6221
|
-
nt && (
|
|
6229
|
+
nt && (rt[k++] = rt[it++], nt > 1 && (rt[k++] = rt[it++]));
|
|
6222
6230
|
}
|
|
6223
6231
|
} else if ((tt & 64) === 0) {
|
|
6224
|
-
et =
|
|
6232
|
+
et = Q[(et & 65535) + (P & (1 << tt) - 1)];
|
|
6225
6233
|
continue i;
|
|
6226
6234
|
} else {
|
|
6227
|
-
I.msg = "invalid distance code",
|
|
6235
|
+
I.msg = "invalid distance code", ct.mode = BAD$1;
|
|
6228
6236
|
break t;
|
|
6229
6237
|
}
|
|
6230
6238
|
break;
|
|
@@ -6233,16 +6241,16 @@ var inffast = function a(I, u) {
|
|
|
6233
6241
|
et = V[(et & 65535) + (P & (1 << tt) - 1)];
|
|
6234
6242
|
continue e;
|
|
6235
6243
|
} else if (tt & 32) {
|
|
6236
|
-
|
|
6244
|
+
ct.mode = TYPE$1;
|
|
6237
6245
|
break t;
|
|
6238
6246
|
} else {
|
|
6239
|
-
I.msg = "invalid literal/length code",
|
|
6247
|
+
I.msg = "invalid literal/length code", ct.mode = BAD$1;
|
|
6240
6248
|
break t;
|
|
6241
6249
|
}
|
|
6242
6250
|
break;
|
|
6243
6251
|
}
|
|
6244
6252
|
} while (E < _ && k < n);
|
|
6245
|
-
nt = j >> 3, E -= nt, j -= nt << 3, P &= (1 << j) - 1, I.next_in = E, I.next_out = k, I.avail_in = E < _ ? 5 + (_ - E) : 5 - (E - _), I.avail_out = k < n ? 257 + (n - k) : 257 - (k - n),
|
|
6253
|
+
nt = j >> 3, E -= nt, j -= nt << 3, P &= (1 << j) - 1, I.next_in = E, I.next_out = k, I.avail_in = E < _ ? 5 + (_ - E) : 5 - (E - _), I.avail_out = k < n ? 257 + (n - k) : 257 - (k - n), ct.hold = P, ct.bits = j;
|
|
6246
6254
|
};
|
|
6247
6255
|
const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS$1 = 1, DISTS$1 = 2, lbase = new Uint16Array([
|
|
6248
6256
|
/* Length codes 257..285 base */
|
|
@@ -6380,48 +6388,48 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6380
6388
|
64
|
|
6381
6389
|
]), inflate_table = (a, I, u, E, _, k, e, n) => {
|
|
6382
6390
|
const O = n.bits;
|
|
6383
|
-
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0,
|
|
6384
|
-
const
|
|
6385
|
-
let
|
|
6391
|
+
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, Q = 0, z = 0, Y = 0, et, tt, nt, ut, it, lt = null, st;
|
|
6392
|
+
const rt = new Uint16Array(MAXBITS + 1), ct = new Uint16Array(MAXBITS + 1);
|
|
6393
|
+
let $t = null, oe, Ut, Mt;
|
|
6386
6394
|
for ($ = 0; $ <= MAXBITS; $++)
|
|
6387
|
-
|
|
6395
|
+
rt[$] = 0;
|
|
6388
6396
|
for (N = 0; N < E; N++)
|
|
6389
|
-
|
|
6390
|
-
for (P = O, q = MAXBITS; q >= 1 &&
|
|
6397
|
+
rt[I[u + N]]++;
|
|
6398
|
+
for (P = O, q = MAXBITS; q >= 1 && rt[q] === 0; q--)
|
|
6391
6399
|
;
|
|
6392
6400
|
if (P > q && (P = q), q === 0)
|
|
6393
6401
|
return _[k++] = 1 << 24 | 64 << 16 | 0, _[k++] = 1 << 24 | 64 << 16 | 0, n.bits = 1, 0;
|
|
6394
|
-
for (D = 1; D < q &&
|
|
6402
|
+
for (D = 1; D < q && rt[D] === 0; D++)
|
|
6395
6403
|
;
|
|
6396
|
-
for (P < D && (P = D),
|
|
6397
|
-
if (
|
|
6404
|
+
for (P < D && (P = D), Q = 1, $ = 1; $ <= MAXBITS; $++)
|
|
6405
|
+
if (Q <<= 1, Q -= rt[$], Q < 0)
|
|
6398
6406
|
return -1;
|
|
6399
|
-
if (
|
|
6407
|
+
if (Q > 0 && (a === CODES$1 || q !== 1))
|
|
6400
6408
|
return -1;
|
|
6401
|
-
for (
|
|
6402
|
-
|
|
6409
|
+
for (ct[1] = 0, $ = 1; $ < MAXBITS; $++)
|
|
6410
|
+
ct[$ + 1] = ct[$] + rt[$];
|
|
6403
6411
|
for (N = 0; N < E; N++)
|
|
6404
|
-
I[u + N] !== 0 && (e[
|
|
6405
|
-
if (a === CODES$1 ? (
|
|
6412
|
+
I[u + N] !== 0 && (e[ct[I[u + N]]++] = N);
|
|
6413
|
+
if (a === CODES$1 ? (lt = $t = e, st = 20) : a === LENS$1 ? (lt = lbase, $t = lext, st = 257) : (lt = dbase, $t = dext, st = 0), Y = 0, N = 0, $ = D, it = k, j = P, V = 0, nt = -1, z = 1 << P, ut = z - 1, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6406
6414
|
return 1;
|
|
6407
6415
|
for (; ; ) {
|
|
6408
|
-
|
|
6416
|
+
oe = $ - V, e[N] + 1 < st ? (Ut = 0, Mt = e[N]) : e[N] >= st ? (Ut = $t[e[N] - st], Mt = lt[e[N] - st]) : (Ut = 96, Mt = 0), et = 1 << $ - V, tt = 1 << j, D = tt;
|
|
6409
6417
|
do
|
|
6410
|
-
tt -= et, _[it + (Y >> V) + tt] =
|
|
6418
|
+
tt -= et, _[it + (Y >> V) + tt] = oe << 24 | Ut << 16 | Mt | 0;
|
|
6411
6419
|
while (tt !== 0);
|
|
6412
6420
|
for (et = 1 << $ - 1; Y & et; )
|
|
6413
6421
|
et >>= 1;
|
|
6414
|
-
if (et !== 0 ? (Y &= et - 1, Y += et) : Y = 0, N++, --
|
|
6422
|
+
if (et !== 0 ? (Y &= et - 1, Y += et) : Y = 0, N++, --rt[$] === 0) {
|
|
6415
6423
|
if ($ === q)
|
|
6416
6424
|
break;
|
|
6417
6425
|
$ = I[u + e[N]];
|
|
6418
6426
|
}
|
|
6419
|
-
if ($ > P && (Y &
|
|
6420
|
-
for (V === 0 && (V = P), it += D, j = $ - V,
|
|
6421
|
-
j++,
|
|
6427
|
+
if ($ > P && (Y & ut) !== nt) {
|
|
6428
|
+
for (V === 0 && (V = P), it += D, j = $ - V, Q = 1 << j; j + V < q && (Q -= rt[j + V], !(Q <= 0)); )
|
|
6429
|
+
j++, Q <<= 1;
|
|
6422
6430
|
if (z += 1 << j, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6423
6431
|
return 1;
|
|
6424
|
-
nt = Y &
|
|
6432
|
+
nt = Y & ut, _[nt] = P << 24 | j << 16 | it - k | 0;
|
|
6425
6433
|
}
|
|
6426
6434
|
}
|
|
6427
6435
|
return Y !== 0 && (_[it + Y] = $ - V << 24 | 64 << 16 | 0), n.bits = P, 0;
|
|
@@ -6495,16 +6503,16 @@ const fixedtables = (a) => {
|
|
|
6495
6503
|
const k = a.state;
|
|
6496
6504
|
return k.window === null && (k.wsize = 1 << k.wbits, k.wnext = 0, k.whave = 0, k.window = new Uint8Array(k.wsize)), E >= k.wsize ? (k.window.set(I.subarray(u - k.wsize, u), 0), k.wnext = 0, k.whave = k.wsize) : (_ = k.wsize - k.wnext, _ > E && (_ = E), k.window.set(I.subarray(u - E, u - E + _), k.wnext), E -= _, E ? (k.window.set(I.subarray(u - E, u), 0), k.wnext = E, k.whave = k.wsize) : (k.wnext += _, k.wnext === k.wsize && (k.wnext = 0), k.whave < k.wsize && (k.whave += _))), 0;
|
|
6497
6505
|
}, inflate$2 = (a, I) => {
|
|
6498
|
-
let u, E, _, k, e, n, O, $, N, D, q, P, j, V,
|
|
6499
|
-
const
|
|
6500
|
-
let
|
|
6501
|
-
const
|
|
6506
|
+
let u, E, _, k, e, n, O, $, N, D, q, P, j, V, Q = 0, z, Y, et, tt, nt, ut, it, lt;
|
|
6507
|
+
const st = new Uint8Array(4);
|
|
6508
|
+
let rt, ct;
|
|
6509
|
+
const $t = (
|
|
6502
6510
|
/* permutation of code lengths */
|
|
6503
6511
|
new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
|
|
6504
6512
|
);
|
|
6505
6513
|
if (inflateStateCheck(a) || !a.output || !a.input && a.avail_in !== 0)
|
|
6506
6514
|
return Z_STREAM_ERROR$1;
|
|
6507
|
-
u = a.state, u.mode === TYPE && (u.mode = TYPEDO), e = a.next_out, _ = a.output, O = a.avail_out, k = a.next_in, E = a.input, n = a.avail_in, $ = u.hold, N = u.bits, D = n, q = O,
|
|
6515
|
+
u = a.state, u.mode === TYPE && (u.mode = TYPEDO), e = a.next_out, _ = a.output, O = a.avail_out, k = a.next_in, E = a.input, n = a.avail_in, $ = u.hold, N = u.bits, D = n, q = O, lt = Z_OK$1;
|
|
6508
6516
|
t:
|
|
6509
6517
|
for (; ; )
|
|
6510
6518
|
switch (u.mode) {
|
|
@@ -6519,7 +6527,7 @@ const fixedtables = (a) => {
|
|
|
6519
6527
|
n--, $ += E[k++] << N, N += 8;
|
|
6520
6528
|
}
|
|
6521
6529
|
if (u.wrap & 2 && $ === 35615) {
|
|
6522
|
-
u.wbits === 0 && (u.wbits = 15), u.check = 0,
|
|
6530
|
+
u.wbits === 0 && (u.wbits = 15), u.check = 0, st[0] = $ & 255, st[1] = $ >>> 8 & 255, u.check = crc32_1(u.check, st, 2, 0), $ = 0, N = 0, u.mode = FLAGS;
|
|
6523
6531
|
break;
|
|
6524
6532
|
}
|
|
6525
6533
|
if (u.head && (u.head.done = !1), !(u.wrap & 1) || /* check if zlib header allowed */
|
|
@@ -6551,7 +6559,7 @@ const fixedtables = (a) => {
|
|
|
6551
6559
|
a.msg = "unknown header flags set", u.mode = BAD;
|
|
6552
6560
|
break;
|
|
6553
6561
|
}
|
|
6554
|
-
u.head && (u.head.text = $ >> 8 & 1), u.flags & 512 && u.wrap & 4 && (
|
|
6562
|
+
u.head && (u.head.text = $ >> 8 & 1), u.flags & 512 && u.wrap & 4 && (st[0] = $ & 255, st[1] = $ >>> 8 & 255, u.check = crc32_1(u.check, st, 2, 0)), $ = 0, N = 0, u.mode = TIME;
|
|
6555
6563
|
/* falls through */
|
|
6556
6564
|
case TIME:
|
|
6557
6565
|
for (; N < 32; ) {
|
|
@@ -6559,7 +6567,7 @@ const fixedtables = (a) => {
|
|
|
6559
6567
|
break t;
|
|
6560
6568
|
n--, $ += E[k++] << N, N += 8;
|
|
6561
6569
|
}
|
|
6562
|
-
u.head && (u.head.time = $), u.flags & 512 && u.wrap & 4 && (
|
|
6570
|
+
u.head && (u.head.time = $), u.flags & 512 && u.wrap & 4 && (st[0] = $ & 255, st[1] = $ >>> 8 & 255, st[2] = $ >>> 16 & 255, st[3] = $ >>> 24 & 255, u.check = crc32_1(u.check, st, 4, 0)), $ = 0, N = 0, u.mode = OS;
|
|
6563
6571
|
/* falls through */
|
|
6564
6572
|
case OS:
|
|
6565
6573
|
for (; N < 16; ) {
|
|
@@ -6567,7 +6575,7 @@ const fixedtables = (a) => {
|
|
|
6567
6575
|
break t;
|
|
6568
6576
|
n--, $ += E[k++] << N, N += 8;
|
|
6569
6577
|
}
|
|
6570
|
-
u.head && (u.head.xflags = $ & 255, u.head.os = $ >> 8), u.flags & 512 && u.wrap & 4 && (
|
|
6578
|
+
u.head && (u.head.xflags = $ & 255, u.head.os = $ >> 8), u.flags & 512 && u.wrap & 4 && (st[0] = $ & 255, st[1] = $ >>> 8 & 255, u.check = crc32_1(u.check, st, 2, 0)), $ = 0, N = 0, u.mode = EXLEN;
|
|
6571
6579
|
/* falls through */
|
|
6572
6580
|
case EXLEN:
|
|
6573
6581
|
if (u.flags & 1024) {
|
|
@@ -6576,7 +6584,7 @@ const fixedtables = (a) => {
|
|
|
6576
6584
|
break t;
|
|
6577
6585
|
n--, $ += E[k++] << N, N += 8;
|
|
6578
6586
|
}
|
|
6579
|
-
u.length = $, u.head && (u.head.extra_len = $), u.flags & 512 && u.wrap & 4 && (
|
|
6587
|
+
u.length = $, u.head && (u.head.extra_len = $), u.flags & 512 && u.wrap & 4 && (st[0] = $ & 255, st[1] = $ >>> 8 & 255, u.check = crc32_1(u.check, st, 2, 0)), $ = 0, N = 0;
|
|
6580
6588
|
} else u.head && (u.head.extra = null);
|
|
6581
6589
|
u.mode = EXTRA;
|
|
6582
6590
|
/* falls through */
|
|
@@ -6724,11 +6732,11 @@ const fixedtables = (a) => {
|
|
|
6724
6732
|
break t;
|
|
6725
6733
|
n--, $ += E[k++] << N, N += 8;
|
|
6726
6734
|
}
|
|
6727
|
-
u.lens[
|
|
6735
|
+
u.lens[$t[u.have++]] = $ & 7, $ >>>= 3, N -= 3;
|
|
6728
6736
|
}
|
|
6729
6737
|
for (; u.have < 19; )
|
|
6730
|
-
u.lens[
|
|
6731
|
-
if (u.lencode = u.lendyn, u.lenbits = 7,
|
|
6738
|
+
u.lens[$t[u.have++]] = 0;
|
|
6739
|
+
if (u.lencode = u.lendyn, u.lenbits = 7, rt = { bits: u.lenbits }, lt = inftrees(CODES, u.lens, 0, 19, u.lencode, 0, u.work, rt), u.lenbits = rt.bits, lt) {
|
|
6732
6740
|
a.msg = "invalid code lengths set", u.mode = BAD;
|
|
6733
6741
|
break;
|
|
6734
6742
|
}
|
|
@@ -6736,7 +6744,7 @@ const fixedtables = (a) => {
|
|
|
6736
6744
|
/* falls through */
|
|
6737
6745
|
case CODELENS:
|
|
6738
6746
|
for (; u.have < u.nlen + u.ndist; ) {
|
|
6739
|
-
for (;
|
|
6747
|
+
for (; Q = u.lencode[$ & (1 << u.lenbits) - 1], z = Q >>> 24, Y = Q >>> 16 & 255, et = Q & 65535, !(z <= N); ) {
|
|
6740
6748
|
if (n === 0)
|
|
6741
6749
|
break t;
|
|
6742
6750
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6745,7 +6753,7 @@ const fixedtables = (a) => {
|
|
|
6745
6753
|
$ >>>= z, N -= z, u.lens[u.have++] = et;
|
|
6746
6754
|
else {
|
|
6747
6755
|
if (et === 16) {
|
|
6748
|
-
for (
|
|
6756
|
+
for (ct = z + 2; N < ct; ) {
|
|
6749
6757
|
if (n === 0)
|
|
6750
6758
|
break t;
|
|
6751
6759
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6756,14 +6764,14 @@ const fixedtables = (a) => {
|
|
|
6756
6764
|
}
|
|
6757
6765
|
it = u.lens[u.have - 1], P = 3 + ($ & 3), $ >>>= 2, N -= 2;
|
|
6758
6766
|
} else if (et === 17) {
|
|
6759
|
-
for (
|
|
6767
|
+
for (ct = z + 3; N < ct; ) {
|
|
6760
6768
|
if (n === 0)
|
|
6761
6769
|
break t;
|
|
6762
6770
|
n--, $ += E[k++] << N, N += 8;
|
|
6763
6771
|
}
|
|
6764
6772
|
$ >>>= z, N -= z, it = 0, P = 3 + ($ & 7), $ >>>= 3, N -= 3;
|
|
6765
6773
|
} else {
|
|
6766
|
-
for (
|
|
6774
|
+
for (ct = z + 7; N < ct; ) {
|
|
6767
6775
|
if (n === 0)
|
|
6768
6776
|
break t;
|
|
6769
6777
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6784,11 +6792,11 @@ const fixedtables = (a) => {
|
|
|
6784
6792
|
a.msg = "invalid code -- missing end-of-block", u.mode = BAD;
|
|
6785
6793
|
break;
|
|
6786
6794
|
}
|
|
6787
|
-
if (u.lenbits = 9,
|
|
6795
|
+
if (u.lenbits = 9, rt = { bits: u.lenbits }, lt = inftrees(LENS, u.lens, 0, u.nlen, u.lencode, 0, u.work, rt), u.lenbits = rt.bits, lt) {
|
|
6788
6796
|
a.msg = "invalid literal/lengths set", u.mode = BAD;
|
|
6789
6797
|
break;
|
|
6790
6798
|
}
|
|
6791
|
-
if (u.distbits = 6, u.distcode = u.distdyn,
|
|
6799
|
+
if (u.distbits = 6, u.distcode = u.distdyn, rt = { bits: u.distbits }, lt = inftrees(DISTS, u.lens, u.nlen, u.ndist, u.distcode, 0, u.work, rt), u.distbits = rt.bits, lt) {
|
|
6792
6800
|
a.msg = "invalid distances set", u.mode = BAD;
|
|
6793
6801
|
break;
|
|
6794
6802
|
}
|
|
@@ -6803,13 +6811,13 @@ const fixedtables = (a) => {
|
|
|
6803
6811
|
a.next_out = e, a.avail_out = O, a.next_in = k, a.avail_in = n, u.hold = $, u.bits = N, inffast(a, q), e = a.next_out, _ = a.output, O = a.avail_out, k = a.next_in, E = a.input, n = a.avail_in, $ = u.hold, N = u.bits, u.mode === TYPE && (u.back = -1);
|
|
6804
6812
|
break;
|
|
6805
6813
|
}
|
|
6806
|
-
for (u.back = 0;
|
|
6814
|
+
for (u.back = 0; Q = u.lencode[$ & (1 << u.lenbits) - 1], z = Q >>> 24, Y = Q >>> 16 & 255, et = Q & 65535, !(z <= N); ) {
|
|
6807
6815
|
if (n === 0)
|
|
6808
6816
|
break t;
|
|
6809
6817
|
n--, $ += E[k++] << N, N += 8;
|
|
6810
6818
|
}
|
|
6811
6819
|
if (Y && (Y & 240) === 0) {
|
|
6812
|
-
for (tt = z, nt = Y,
|
|
6820
|
+
for (tt = z, nt = Y, ut = et; Q = u.lencode[ut + (($ & (1 << tt + nt) - 1) >> tt)], z = Q >>> 24, Y = Q >>> 16 & 255, et = Q & 65535, !(tt + z <= N); ) {
|
|
6813
6821
|
if (n === 0)
|
|
6814
6822
|
break t;
|
|
6815
6823
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6832,7 +6840,7 @@ const fixedtables = (a) => {
|
|
|
6832
6840
|
/* falls through */
|
|
6833
6841
|
case LENEXT:
|
|
6834
6842
|
if (u.extra) {
|
|
6835
|
-
for (
|
|
6843
|
+
for (ct = u.extra; N < ct; ) {
|
|
6836
6844
|
if (n === 0)
|
|
6837
6845
|
break t;
|
|
6838
6846
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6842,13 +6850,13 @@ const fixedtables = (a) => {
|
|
|
6842
6850
|
u.was = u.length, u.mode = DIST;
|
|
6843
6851
|
/* falls through */
|
|
6844
6852
|
case DIST:
|
|
6845
|
-
for (;
|
|
6853
|
+
for (; Q = u.distcode[$ & (1 << u.distbits) - 1], z = Q >>> 24, Y = Q >>> 16 & 255, et = Q & 65535, !(z <= N); ) {
|
|
6846
6854
|
if (n === 0)
|
|
6847
6855
|
break t;
|
|
6848
6856
|
n--, $ += E[k++] << N, N += 8;
|
|
6849
6857
|
}
|
|
6850
6858
|
if ((Y & 240) === 0) {
|
|
6851
|
-
for (tt = z, nt = Y,
|
|
6859
|
+
for (tt = z, nt = Y, ut = et; Q = u.distcode[ut + (($ & (1 << tt + nt) - 1) >> tt)], z = Q >>> 24, Y = Q >>> 16 & 255, et = Q & 65535, !(tt + z <= N); ) {
|
|
6852
6860
|
if (n === 0)
|
|
6853
6861
|
break t;
|
|
6854
6862
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6863,7 +6871,7 @@ const fixedtables = (a) => {
|
|
|
6863
6871
|
/* falls through */
|
|
6864
6872
|
case DISTEXT:
|
|
6865
6873
|
if (u.extra) {
|
|
6866
|
-
for (
|
|
6874
|
+
for (ct = u.extra; N < ct; ) {
|
|
6867
6875
|
if (n === 0)
|
|
6868
6876
|
break t;
|
|
6869
6877
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6930,10 +6938,10 @@ const fixedtables = (a) => {
|
|
|
6930
6938
|
u.mode = DONE;
|
|
6931
6939
|
/* falls through */
|
|
6932
6940
|
case DONE:
|
|
6933
|
-
|
|
6941
|
+
lt = Z_STREAM_END$1;
|
|
6934
6942
|
break t;
|
|
6935
6943
|
case BAD:
|
|
6936
|
-
|
|
6944
|
+
lt = Z_DATA_ERROR$1;
|
|
6937
6945
|
break t;
|
|
6938
6946
|
case MEM:
|
|
6939
6947
|
return Z_MEM_ERROR$1;
|
|
@@ -6943,7 +6951,7 @@ const fixedtables = (a) => {
|
|
|
6943
6951
|
return Z_STREAM_ERROR$1;
|
|
6944
6952
|
}
|
|
6945
6953
|
return a.next_out = e, a.avail_out = O, a.next_in = k, a.avail_in = n, u.hold = $, u.bits = N, (u.wsize || q !== a.avail_out && u.mode < BAD && (u.mode < CHECK || I !== Z_FINISH$1)) && updatewindow(a, a.output, a.next_out, q - a.avail_out), D -= a.avail_in, q -= a.avail_out, a.total_in += D, a.total_out += q, u.total += q, u.wrap & 4 && q && (a.adler = u.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
|
|
6946
|
-
u.flags ? crc32_1(u.check, _, q, a.next_out - q) : adler32_1(u.check, _, q, a.next_out - q)), a.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (D === 0 && q === 0 || I === Z_FINISH$1) &&
|
|
6954
|
+
u.flags ? crc32_1(u.check, _, q, a.next_out - q) : adler32_1(u.check, _, q, a.next_out - q)), a.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (D === 0 && q === 0 || I === Z_FINISH$1) && lt === Z_OK$1 && (lt = Z_BUF_ERROR), lt;
|
|
6947
6955
|
}, inflateEnd = (a) => {
|
|
6948
6956
|
if (inflateStateCheck(a))
|
|
6949
6957
|
return Z_STREAM_ERROR$1;
|
|
@@ -7177,12 +7185,12 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
|
|
|
7177
7185
|
}
|
|
7178
7186
|
return a;
|
|
7179
7187
|
};
|
|
7180
|
-
var
|
|
7188
|
+
var wt, dt, xt, yt, kt, Pt, Bt, Lt, jt, Nt, Zt, Ft, Ht;
|
|
7181
7189
|
class CallsWebSocket {
|
|
7182
7190
|
// 状态
|
|
7183
7191
|
constructor(I) {
|
|
7184
|
-
at(this,
|
|
7185
|
-
at(this,
|
|
7192
|
+
at(this, wt);
|
|
7193
|
+
at(this, dt, {
|
|
7186
7194
|
url: "wss://demo.putplay.cc/websocket",
|
|
7187
7195
|
// 地址
|
|
7188
7196
|
debug: !1,
|
|
@@ -7191,10 +7199,10 @@ class CallsWebSocket {
|
|
|
7191
7199
|
// 最大重连次数
|
|
7192
7200
|
timeout: 30 * 1e3
|
|
7193
7201
|
});
|
|
7194
|
-
at(this,
|
|
7202
|
+
at(this, xt, "");
|
|
7195
7203
|
// 缓存登录凭证
|
|
7196
|
-
at(this, _t, {});
|
|
7197
7204
|
at(this, yt, {});
|
|
7205
|
+
at(this, kt, {});
|
|
7198
7206
|
Z(this, "state", "closed");
|
|
7199
7207
|
// 外部 发送消息之前
|
|
7200
7208
|
Z(this, "sendMessageBefore", async () => {
|
|
@@ -7206,33 +7214,33 @@ class CallsWebSocket {
|
|
|
7206
7214
|
Z(this, "onReconnectStop", (I) => {
|
|
7207
7215
|
});
|
|
7208
7216
|
// 是否需要重连
|
|
7209
|
-
at(this,
|
|
7217
|
+
at(this, Pt, (I) => {
|
|
7210
7218
|
let u = !0;
|
|
7211
7219
|
const { code: E = 1e3, reason: _ = "" } = I;
|
|
7212
7220
|
return E === 1e3 && (_ === "quit success!" || _ === "replace old connection!") && (u = !1), u;
|
|
7213
7221
|
});
|
|
7214
7222
|
// 重连成功
|
|
7215
|
-
at(this,
|
|
7216
|
-
|
|
7223
|
+
at(this, Bt, async (I) => {
|
|
7224
|
+
J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重连成功", I), this.state = "connected", this.onReconnectSuccess(I);
|
|
7217
7225
|
});
|
|
7218
7226
|
// 重连停止
|
|
7219
|
-
at(this,
|
|
7220
|
-
|
|
7227
|
+
at(this, Lt, async (I) => {
|
|
7228
|
+
J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重连停止", I), this.close(), this.state = "closed", this.onReconnectStop(I);
|
|
7221
7229
|
});
|
|
7222
7230
|
// 自定义心跳规则
|
|
7223
|
-
at(this,
|
|
7231
|
+
at(this, jt, () => {
|
|
7224
7232
|
const I = { event: "heartbeat", sn: +`${F(1e5, 999999)}` };
|
|
7225
7233
|
return com.quick.voice.proto.CommonReq.encode(I).finish();
|
|
7226
7234
|
});
|
|
7227
7235
|
// 更新日志
|
|
7228
|
-
at(this,
|
|
7236
|
+
at(this, Nt, (I, u = {}) => {
|
|
7229
7237
|
try {
|
|
7230
7238
|
const { time: E, event: _, data: k = {}, data_original: e = {}, data_remote: n, ...O } = u, $ = U(E, "YYYY-MM-DD hh:mm:ss", { offset: 480 });
|
|
7231
7239
|
let N = {};
|
|
7232
7240
|
const D = (et = {}) => {
|
|
7233
7241
|
const tt = JSON.parse(JSON.stringify(et)), nt = Object.keys(tt);
|
|
7234
|
-
for (const
|
|
7235
|
-
(
|
|
7242
|
+
for (const ut of nt)
|
|
7243
|
+
(ut.includes("sdp") || ut.includes("Sdp")) && (tt[ut] = "");
|
|
7236
7244
|
return tt;
|
|
7237
7245
|
};
|
|
7238
7246
|
let q = "res ↓";
|
|
@@ -7246,10 +7254,10 @@ class CallsWebSocket {
|
|
|
7246
7254
|
}
|
|
7247
7255
|
let P = "#quickvo.logs";
|
|
7248
7256
|
ignoreEvent.includes(_) && (P = "#quickvo.ignoreEvents");
|
|
7249
|
-
const j = { "#action": q, timeStr: $, event: _, data: N, time: E, ...O }, V = localStorage.getItem(P) || JSON.stringify([]),
|
|
7257
|
+
const j = { "#action": q, timeStr: $, event: _, data: N, time: E, ...O }, V = localStorage.getItem(P) || JSON.stringify([]), Q = JSON.parse(V);
|
|
7250
7258
|
let z = _ === "heartbeat";
|
|
7251
7259
|
const Y = [j];
|
|
7252
|
-
for (const et of
|
|
7260
|
+
for (const et of Q) {
|
|
7253
7261
|
const { event: tt } = et;
|
|
7254
7262
|
if (tt === "heartbeat") {
|
|
7255
7263
|
if (z) continue;
|
|
@@ -7264,24 +7272,24 @@ class CallsWebSocket {
|
|
|
7264
7272
|
}
|
|
7265
7273
|
});
|
|
7266
7274
|
// 创建事件
|
|
7267
|
-
at(this,
|
|
7275
|
+
at(this, Zt, (I, { resolve: u, reject: E }) => {
|
|
7268
7276
|
const { sn: _ } = I, k = () => {
|
|
7269
|
-
const n =
|
|
7270
|
-
clearTimeout(n.destructionTimer), delete
|
|
7277
|
+
const n = J(this, yt)[_];
|
|
7278
|
+
clearTimeout(n.destructionTimer), delete J(this, yt)[_];
|
|
7271
7279
|
}, e = setTimeout(() => {
|
|
7272
|
-
const n =
|
|
7280
|
+
const n = J(this, yt)[_];
|
|
7273
7281
|
console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo:event is timeout", n.message), k(), E("event is timeout");
|
|
7274
|
-
},
|
|
7275
|
-
|
|
7282
|
+
}, J(this, dt).timeout);
|
|
7283
|
+
J(this, yt)[_] = { message: I, resolve: u, reject: E, destruction: k, destructionTimer: e };
|
|
7276
7284
|
});
|
|
7277
7285
|
// 获取事件
|
|
7278
|
-
at(this,
|
|
7286
|
+
at(this, Ft, (I) => J(this, yt)[I]);
|
|
7279
7287
|
// 接收消息
|
|
7280
|
-
at(this,
|
|
7288
|
+
at(this, Ht, async (I) => {
|
|
7281
7289
|
const u = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(u), { sn: _, event: k } = E, e = onMessageFormat(E);
|
|
7282
|
-
if (
|
|
7290
|
+
if (J(this, dt).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", e), ignoreEvent.includes(k) || J(this, Nt).call(this, "res", e)), notifyName_keys.includes(k))
|
|
7283
7291
|
return this.emitNotify(k, L(e, ["code", "data", "desc"]));
|
|
7284
|
-
const O =
|
|
7292
|
+
const O = J(this, Ft).call(this, _);
|
|
7285
7293
|
if (O) {
|
|
7286
7294
|
const { resolve: $ = (D) => {
|
|
7287
7295
|
}, destruction: N = () => {
|
|
@@ -7291,12 +7299,12 @@ class CallsWebSocket {
|
|
|
7291
7299
|
});
|
|
7292
7300
|
// 清除事件
|
|
7293
7301
|
Z(this, "clearEvents", (I = []) => {
|
|
7294
|
-
const u = Object.keys(
|
|
7302
|
+
const u = Object.keys(J(this, yt));
|
|
7295
7303
|
I.length === 0 && (I = u);
|
|
7296
7304
|
for (const E of u) {
|
|
7297
7305
|
if (!I.includes(E)) continue;
|
|
7298
|
-
const _ =
|
|
7299
|
-
clearTimeout(_.destructionTimer), delete
|
|
7306
|
+
const _ = J(this, yt)[E];
|
|
7307
|
+
clearTimeout(_.destructionTimer), delete J(this, yt)[E];
|
|
7300
7308
|
}
|
|
7301
7309
|
});
|
|
7302
7310
|
/**
|
|
@@ -7305,31 +7313,31 @@ class CallsWebSocket {
|
|
|
7305
7313
|
* @returns
|
|
7306
7314
|
*/
|
|
7307
7315
|
Z(this, "connect", async (I = "") => new Promise(async (u) => {
|
|
7308
|
-
I &&
|
|
7309
|
-
const E = `${
|
|
7310
|
-
|
|
7311
|
-
...
|
|
7316
|
+
I && Ot(this, xt, I), J(this, wt) && (await J(this, wt).close(), this.state = "closed");
|
|
7317
|
+
const E = `${J(this, dt).url}?s=${J(this, xt)}&t=${Date.now()}`;
|
|
7318
|
+
Ot(this, wt, new M({
|
|
7319
|
+
...J(this, dt),
|
|
7312
7320
|
url: E,
|
|
7313
7321
|
binaryType: "arraybuffer",
|
|
7314
|
-
onMessage:
|
|
7315
|
-
checkReconnect:
|
|
7316
|
-
getHeartbeatMsg:
|
|
7317
|
-
onReconnectSuccess:
|
|
7318
|
-
onReconnectStop:
|
|
7319
|
-
})), this.state = "connecting", await
|
|
7322
|
+
onMessage: J(this, Ht),
|
|
7323
|
+
checkReconnect: J(this, Pt),
|
|
7324
|
+
getHeartbeatMsg: J(this, jt),
|
|
7325
|
+
onReconnectSuccess: J(this, Bt),
|
|
7326
|
+
onReconnectStop: J(this, Lt)
|
|
7327
|
+
})), this.state = "connecting", await J(this, wt).connect(), this.state = "connected", J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", J(this, kt)), u(J(this, wt));
|
|
7320
7328
|
}));
|
|
7321
7329
|
/**
|
|
7322
7330
|
* 关闭
|
|
7323
7331
|
*/
|
|
7324
7332
|
Z(this, "close", async () => {
|
|
7325
7333
|
var u;
|
|
7326
|
-
|
|
7327
|
-
const I = Object.keys(
|
|
7334
|
+
J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
|
|
7335
|
+
const I = Object.keys(J(this, yt));
|
|
7328
7336
|
for (const E of I) {
|
|
7329
|
-
const { destructionTimer: _ } =
|
|
7337
|
+
const { destructionTimer: _ } = J(this, yt)[E];
|
|
7330
7338
|
clearTimeout(_);
|
|
7331
7339
|
}
|
|
7332
|
-
|
|
7340
|
+
Ot(this, yt, {}), await ((u = J(this, wt)) == null ? void 0 : u.close()), Ot(this, wt, void 0), this.state = "closed";
|
|
7333
7341
|
});
|
|
7334
7342
|
/**
|
|
7335
7343
|
* 发送消息
|
|
@@ -7342,14 +7350,14 @@ class CallsWebSocket {
|
|
|
7342
7350
|
event: k,
|
|
7343
7351
|
sn: +`${n}${F(1e3, 9999)}`,
|
|
7344
7352
|
time: n,
|
|
7345
|
-
valid:
|
|
7353
|
+
valid: J(this, dt).timeout,
|
|
7346
7354
|
version: 1,
|
|
7347
7355
|
compress: !1,
|
|
7348
7356
|
...e
|
|
7349
7357
|
});
|
|
7350
|
-
|
|
7358
|
+
J(this, dt).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", O), ignoreEvent.includes(k) || J(this, Nt).call(this, "req", O)), u && J(this, Zt).call(this, O, { resolve: E, reject: _ });
|
|
7351
7359
|
const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
|
|
7352
|
-
(N =
|
|
7360
|
+
(N = J(this, wt)) == null || N.sendMessage($);
|
|
7353
7361
|
}));
|
|
7354
7362
|
/**
|
|
7355
7363
|
* 触发广播事件
|
|
@@ -7357,7 +7365,7 @@ class CallsWebSocket {
|
|
|
7357
7365
|
* @param result 事件响应值
|
|
7358
7366
|
*/
|
|
7359
7367
|
Z(this, "emitNotify", async (I, u) => {
|
|
7360
|
-
const E =
|
|
7368
|
+
const E = J(this, kt)[I] || [];
|
|
7361
7369
|
for (const _ of E) {
|
|
7362
7370
|
const { callback: k = async () => {
|
|
7363
7371
|
} } = _;
|
|
@@ -7372,8 +7380,8 @@ class CallsWebSocket {
|
|
|
7372
7380
|
*/
|
|
7373
7381
|
Z(this, "addNotify", (I, u = !1) => {
|
|
7374
7382
|
const { event: E, sn: _ = ht(32) } = I;
|
|
7375
|
-
|
|
7376
|
-
const k =
|
|
7383
|
+
J(this, kt)[E] || (J(this, kt)[E] = []);
|
|
7384
|
+
const k = J(this, kt)[E], e = k.findIndex((n) => n.sn === _);
|
|
7377
7385
|
return e !== -1 && k.splice(e, 1), u ? k.unshift(I) : k.push(I), _;
|
|
7378
7386
|
});
|
|
7379
7387
|
/**
|
|
@@ -7381,18 +7389,18 @@ class CallsWebSocket {
|
|
|
7381
7389
|
*/
|
|
7382
7390
|
Z(this, "removeNotify", (I = []) => {
|
|
7383
7391
|
if (I.length === 0)
|
|
7384
|
-
|
|
7392
|
+
Ot(this, kt, {});
|
|
7385
7393
|
else {
|
|
7386
|
-
const u = Object.keys(
|
|
7394
|
+
const u = Object.keys(J(this, kt));
|
|
7387
7395
|
for (const E of u)
|
|
7388
|
-
|
|
7396
|
+
J(this, kt)[E] = J(this, kt)[E].filter((_) => !I.includes(_.sn || ""));
|
|
7389
7397
|
}
|
|
7390
|
-
|
|
7398
|
+
J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", J(this, kt));
|
|
7391
7399
|
});
|
|
7392
|
-
|
|
7400
|
+
Ot(this, dt, { ...J(this, dt), ...I });
|
|
7393
7401
|
}
|
|
7394
7402
|
}
|
|
7395
|
-
|
|
7403
|
+
wt = new WeakMap(), dt = new WeakMap(), xt = new WeakMap(), yt = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(), Lt = new WeakMap(), jt = new WeakMap(), Nt = new WeakMap(), Zt = new WeakMap(), Ft = new WeakMap(), Ht = new WeakMap();
|
|
7396
7404
|
var y = Object.defineProperty, x = (a) => {
|
|
7397
7405
|
throw TypeError(a);
|
|
7398
7406
|
}, g = (a, I, u) => I in a ? y(a, I, { enumerable: !0, configurable: !0, writable: !0, value: u }) : a[I] = u, h = (a, I, u) => g(a, typeof I != "symbol" ? I + "" : I, u), b = (a, I, u) => I.has(a) || x("Cannot " + u), o = (a, I, u) => (b(a, I, "read from private field"), u ? u.call(a) : I.get(a)), f = (a, I, u) => I.has(a) ? x("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), p = (a, I, u, E) => (b(a, I, "write to private field"), I.set(a, u), u), d, c, l;
|
|
@@ -7448,7 +7456,7 @@ class K {
|
|
|
7448
7456
|
}
|
|
7449
7457
|
}
|
|
7450
7458
|
d = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
|
|
7451
|
-
var
|
|
7459
|
+
var zt;
|
|
7452
7460
|
class RoomBase {
|
|
7453
7461
|
constructor(I) {
|
|
7454
7462
|
Z(this, "options", {
|
|
@@ -7496,17 +7504,35 @@ class RoomBase {
|
|
|
7496
7504
|
* 提交日志
|
|
7497
7505
|
*/
|
|
7498
7506
|
Z(this, "reportLogs", (I, u = "未知错误") => {
|
|
7499
|
-
const { appid: E, userId: _, earlyId: k = "", logUrl: e } = this.options, n = "web"
|
|
7507
|
+
const { appid: E, userId: _, earlyId: k = "", logUrl: e } = this.options, n = "web", O = ($) => ({
|
|
7508
|
+
ws_c_timeout: 0,
|
|
7509
|
+
// WebSocket 连接超时
|
|
7510
|
+
webrtc_c_timeout: 1,
|
|
7511
|
+
// WebRTC 连接超时
|
|
7512
|
+
join_room_error: 2,
|
|
7513
|
+
// 加入房间失败
|
|
7514
|
+
publish_error: 3,
|
|
7515
|
+
// 发布流失败
|
|
7516
|
+
subscribe_error: 4,
|
|
7517
|
+
// 订阅流失败
|
|
7518
|
+
close_track_error: 5,
|
|
7519
|
+
// 关闭轨道失败
|
|
7520
|
+
heartbeat_e_timeout: 6,
|
|
7521
|
+
// 心跳检测发送超时
|
|
7522
|
+
heartbeat_i_timeout: 7,
|
|
7523
|
+
// 心跳检测接收超时
|
|
7524
|
+
quit_room_error: 8
|
|
7525
|
+
// 退出房间失败
|
|
7526
|
+
})[$].toString();
|
|
7500
7527
|
{
|
|
7501
|
-
const O = { origin: n, type:
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7506
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: reportLogs", N);
|
|
7528
|
+
const $ = O(I), N = { origin: n, type: $, app_id: E, user_id: _, ins_id: k, desc: u }, D = btoa(encodeURI(JSON.stringify(N))), q = `${e}/upload/log?log_key=${D}`;
|
|
7529
|
+
{
|
|
7530
|
+
const P = localStorage.getItem("#quickvo.logs") || JSON.stringify([]), V = new TextEncoder().encode(P), Q = pako.deflate(V, { gzip: !0 });
|
|
7531
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: reportLogs", { obj: N, url: q, size: ot(Q.byteLength) }), fetch(q, { headers: { "Content-Type": "multipart/form-data" }, method: "POST", body: Q });
|
|
7532
|
+
}
|
|
7507
7533
|
}
|
|
7508
7534
|
});
|
|
7509
|
-
at(this,
|
|
7535
|
+
at(this, zt, () => {
|
|
7510
7536
|
this.taskQueue.setCondition("createWs", !0), this.taskQueue.setCondition("createSession", !1), this.taskQueue.setCondition("ice", !1);
|
|
7511
7537
|
});
|
|
7512
7538
|
/**
|
|
@@ -7599,33 +7625,35 @@ class RoomBase {
|
|
|
7599
7625
|
* 处理为应用层数据
|
|
7600
7626
|
*/
|
|
7601
7627
|
Z(this, "usersFilter", (I) => ft(I, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "permissions", "isPublished", "updateStreams"]).sort((_, k) => _.id.localeCompare(k.id, "en")));
|
|
7602
|
-
this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }),
|
|
7628
|
+
this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), J(this, zt).call(this);
|
|
7603
7629
|
}
|
|
7604
7630
|
}
|
|
7605
|
-
|
|
7606
|
-
var
|
|
7631
|
+
zt = new WeakMap();
|
|
7632
|
+
var It, bt, _t, vt, St, Jt, Wt, Rt, Kt;
|
|
7607
7633
|
class RoomMedias extends RoomBase {
|
|
7608
|
-
//
|
|
7634
|
+
// 本地流管理
|
|
7609
7635
|
constructor(u) {
|
|
7610
7636
|
super(u);
|
|
7611
|
-
at(this,
|
|
7637
|
+
at(this, It, []);
|
|
7612
7638
|
// 可用媒体设备列表
|
|
7613
|
-
at(this,
|
|
7639
|
+
at(this, bt, /* @__PURE__ */ new Map());
|
|
7614
7640
|
// 媒体流设备管理
|
|
7615
|
-
at(this,
|
|
7641
|
+
at(this, _t, /* @__PURE__ */ new Map());
|
|
7616
7642
|
// 媒体轨道参数管理
|
|
7617
|
-
at(this,
|
|
7643
|
+
at(this, vt, /* @__PURE__ */ new Map());
|
|
7644
|
+
// 媒体流上下文
|
|
7645
|
+
at(this, St, []);
|
|
7618
7646
|
/**
|
|
7619
7647
|
* 初始化媒体参数
|
|
7620
7648
|
*/
|
|
7621
|
-
at(this,
|
|
7622
|
-
|
|
7649
|
+
at(this, Jt, () => {
|
|
7650
|
+
J(this, _t).set("microphoneCamera_audio", {}), J(this, _t).set("microphoneCamera_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), J(this, _t).set("screenSharing_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), J(this, _t).set("screenSharing_audio", {});
|
|
7623
7651
|
});
|
|
7624
7652
|
/**
|
|
7625
7653
|
* 初始化媒体设备类型
|
|
7626
7654
|
*/
|
|
7627
|
-
at(this,
|
|
7628
|
-
|
|
7655
|
+
at(this, Wt, () => {
|
|
7656
|
+
J(this, bt).set("audioinput", "default"), J(this, bt).set("videoinput", "default"), J(this, bt).set("audiooutput", "default");
|
|
7629
7657
|
});
|
|
7630
7658
|
/**
|
|
7631
7659
|
* 房间所有用户所有媒体流变化
|
|
@@ -7650,14 +7678,14 @@ class RoomMedias extends RoomBase {
|
|
|
7650
7678
|
case "audio":
|
|
7651
7679
|
{
|
|
7652
7680
|
const $ = new AudioMediaContext(k);
|
|
7653
|
-
|
|
7681
|
+
J(this, vt).set(e, $);
|
|
7654
7682
|
}
|
|
7655
7683
|
break;
|
|
7656
7684
|
// 视频媒体处理
|
|
7657
7685
|
case "video":
|
|
7658
7686
|
{
|
|
7659
7687
|
const $ = new VideoMediaContext(k);
|
|
7660
|
-
|
|
7688
|
+
J(this, vt).set(e, $);
|
|
7661
7689
|
}
|
|
7662
7690
|
break;
|
|
7663
7691
|
}
|
|
@@ -7665,7 +7693,7 @@ class RoomMedias extends RoomBase {
|
|
|
7665
7693
|
const $ = this.getUserMediaStreamContext(u, E);
|
|
7666
7694
|
if ($ && $.kind === "audio")
|
|
7667
7695
|
try {
|
|
7668
|
-
const N =
|
|
7696
|
+
const N = J(this, bt).get("audiooutput");
|
|
7669
7697
|
(O = $.audioContext) == null || O.setSinkId(N);
|
|
7670
7698
|
} catch (N) {
|
|
7671
7699
|
console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setSinkId is error", N);
|
|
@@ -7677,21 +7705,21 @@ class RoomMedias extends RoomBase {
|
|
|
7677
7705
|
*/
|
|
7678
7706
|
Z(this, "getUserMediaStreamContext", (u, E) => {
|
|
7679
7707
|
const _ = this.getUserMediaKey(u, E);
|
|
7680
|
-
return
|
|
7708
|
+
return J(this, vt).get(_);
|
|
7681
7709
|
});
|
|
7682
7710
|
/**
|
|
7683
7711
|
* 获取用户音频媒体流上下文
|
|
7684
7712
|
*/
|
|
7685
7713
|
Z(this, "getUserAudioMediaStreamContext", (u, E) => {
|
|
7686
7714
|
const _ = this.getUserMediaKey(u, E);
|
|
7687
|
-
return
|
|
7715
|
+
return J(this, vt).get(_);
|
|
7688
7716
|
});
|
|
7689
7717
|
/**
|
|
7690
7718
|
* 删除用户媒体流上下文
|
|
7691
7719
|
*/
|
|
7692
7720
|
Z(this, "removeUserMediaStreamContext", (u, E) => {
|
|
7693
|
-
const _ = this.getUserMediaKey(u, E), k =
|
|
7694
|
-
k == null || k.stop(),
|
|
7721
|
+
const _ = this.getUserMediaKey(u, E), k = J(this, vt).get(_);
|
|
7722
|
+
k == null || k.stop(), J(this, vt).delete(_);
|
|
7695
7723
|
});
|
|
7696
7724
|
/**
|
|
7697
7725
|
* 获取某个用户的某个数据流
|
|
@@ -7724,16 +7752,16 @@ class RoomMedias extends RoomBase {
|
|
|
7724
7752
|
* 清除所有媒体流使用
|
|
7725
7753
|
*/
|
|
7726
7754
|
Z(this, "clearUserStreams", () => {
|
|
7727
|
-
const u =
|
|
7755
|
+
const u = J(this, vt).values();
|
|
7728
7756
|
for (const E of u)
|
|
7729
7757
|
E.stop();
|
|
7730
|
-
|
|
7758
|
+
Ot(this, vt, /* @__PURE__ */ new Map());
|
|
7731
7759
|
});
|
|
7732
7760
|
/**
|
|
7733
7761
|
* 设置轨道媒体参数
|
|
7734
7762
|
*/
|
|
7735
7763
|
Z(this, "setMediaTrackConstraints", async (u, E) => {
|
|
7736
|
-
|
|
7764
|
+
J(this, _t).set(u, E);
|
|
7737
7765
|
const k = this.getUserStream(this.options.userId, u).getTracks();
|
|
7738
7766
|
if (k.length !== 0)
|
|
7739
7767
|
for (const e of k) {
|
|
@@ -7741,6 +7769,17 @@ class RoomMedias extends RoomBase {
|
|
|
7741
7769
|
await e.applyConstraints(O);
|
|
7742
7770
|
}
|
|
7743
7771
|
});
|
|
7772
|
+
/**
|
|
7773
|
+
* 清理所有本地流
|
|
7774
|
+
*/
|
|
7775
|
+
Z(this, "clearLocalStream", () => {
|
|
7776
|
+
for (const u of J(this, St)) {
|
|
7777
|
+
const E = u.getTracks();
|
|
7778
|
+
for (const _ of E)
|
|
7779
|
+
_.stop();
|
|
7780
|
+
}
|
|
7781
|
+
Ot(this, St, []);
|
|
7782
|
+
});
|
|
7744
7783
|
/**
|
|
7745
7784
|
* 初始化本地流
|
|
7746
7785
|
*/
|
|
@@ -7751,31 +7790,33 @@ class RoomMedias extends RoomBase {
|
|
|
7751
7790
|
case "microphoneCamera_audio":
|
|
7752
7791
|
{
|
|
7753
7792
|
this.removeUserMediaStreamContext(E, "microphoneCamera_audio");
|
|
7754
|
-
const _ =
|
|
7755
|
-
await this.initUserMediaStreamContext(E, "microphoneCamera_audio", e);
|
|
7793
|
+
const _ = J(this, bt).get("audioinput"), k = J(this, _t).get("microphoneCamera_audio"), e = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...k }, video: !1 });
|
|
7794
|
+
J(this, St).push(e), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", e);
|
|
7756
7795
|
}
|
|
7757
7796
|
break;
|
|
7758
7797
|
// 摄像头
|
|
7759
7798
|
case "microphoneCamera_video":
|
|
7760
7799
|
{
|
|
7761
7800
|
this.removeUserMediaStreamContext(E, "microphoneCamera_video");
|
|
7762
|
-
const _ =
|
|
7763
|
-
await this.initUserMediaStreamContext(E, "microphoneCamera_video", e);
|
|
7801
|
+
const _ = J(this, bt).get("videoinput"), k = J(this, _t).get("microphoneCamera_video"), e = await navigator.mediaDevices.getUserMedia({ audio: !1, video: { deviceId: _, ...k } });
|
|
7802
|
+
J(this, St).push(e), await this.initUserMediaStreamContext(E, "microphoneCamera_video", e);
|
|
7764
7803
|
}
|
|
7765
7804
|
break;
|
|
7766
7805
|
// 麦克风 + 摄像头
|
|
7767
7806
|
case "microphoneCamera":
|
|
7768
7807
|
{
|
|
7769
7808
|
this.removeUserMediaStreamContext(E, "microphoneCamera_audio"), this.removeUserMediaStreamContext(E, "microphoneCamera_video");
|
|
7770
|
-
const _ =
|
|
7771
|
-
await this.initUserMediaStreamContext(E, "microphoneCamera_audio", O);
|
|
7809
|
+
const _ = J(this, bt).get("audioinput"), k = J(this, bt).get("videoinput"), e = J(this, _t).get("microphoneCamera_audio"), n = J(this, _t).get("microphoneCamera_video"), O = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...e }, video: { deviceId: k, ...n } });
|
|
7810
|
+
J(this, St).push(O), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", O);
|
|
7772
7811
|
}
|
|
7773
7812
|
break;
|
|
7774
7813
|
// 屏幕共享 音频
|
|
7775
7814
|
case "screenSharing_audio":
|
|
7776
7815
|
{
|
|
7777
7816
|
this.removeUserMediaStreamContext(E, "screenSharing_audio");
|
|
7778
|
-
const _ =
|
|
7817
|
+
const _ = J(this, _t).get("screenSharing_audio"), k = await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._ });
|
|
7818
|
+
J(this, St).push(k);
|
|
7819
|
+
const e = k.getTracks();
|
|
7779
7820
|
for (const n of e) {
|
|
7780
7821
|
const { kind: O } = n;
|
|
7781
7822
|
if (O === "audio") {
|
|
@@ -7789,7 +7830,9 @@ class RoomMedias extends RoomBase {
|
|
|
7789
7830
|
case "screenSharing_video":
|
|
7790
7831
|
{
|
|
7791
7832
|
this.removeUserMediaStreamContext(E, u);
|
|
7792
|
-
const _ =
|
|
7833
|
+
const _ = J(this, _t).get(u), k = await navigator.mediaDevices.getDisplayMedia({ audio: !1, video: !0, ..._ });
|
|
7834
|
+
J(this, St).push(k);
|
|
7835
|
+
const e = k.getTracks();
|
|
7793
7836
|
for (const n of e) {
|
|
7794
7837
|
const { kind: O } = n;
|
|
7795
7838
|
if (O === "video") {
|
|
@@ -7803,7 +7846,9 @@ class RoomMedias extends RoomBase {
|
|
|
7803
7846
|
case "screenSharing":
|
|
7804
7847
|
{
|
|
7805
7848
|
this.removeUserMediaStreamContext(E, "screenSharing_audio"), this.removeUserMediaStreamContext(E, "screenSharing_video");
|
|
7806
|
-
const _ =
|
|
7849
|
+
const _ = J(this, _t).get("screenSharing_audio"), k = J(this, _t).get("screenSharing_video"), e = await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._, ...k });
|
|
7850
|
+
J(this, St).push(e);
|
|
7851
|
+
const n = e.getTracks();
|
|
7807
7852
|
for (const O of n) {
|
|
7808
7853
|
const { kind: $ } = O;
|
|
7809
7854
|
if ($ === "audio") {
|
|
@@ -7826,33 +7871,33 @@ class RoomMedias extends RoomBase {
|
|
|
7826
7871
|
/**
|
|
7827
7872
|
* 获取媒体设备列表
|
|
7828
7873
|
*/
|
|
7829
|
-
at(this,
|
|
7830
|
-
|
|
7874
|
+
at(this, Rt, async () => !navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 不支持 enumerateDevices"), []) : (await navigator.mediaDevices.enumerateDevices().then((u) => {
|
|
7875
|
+
Ot(this, It, u);
|
|
7831
7876
|
}).catch(function(u) {
|
|
7832
7877
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", u);
|
|
7833
|
-
}),
|
|
7878
|
+
}), J(this, It)));
|
|
7834
7879
|
/**
|
|
7835
7880
|
* 媒体设备发生变化
|
|
7836
7881
|
*/
|
|
7837
|
-
at(this,
|
|
7882
|
+
at(this, Kt, () => {
|
|
7838
7883
|
navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
|
|
7839
|
-
await
|
|
7840
|
-
}),
|
|
7884
|
+
await J(this, Rt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
|
|
7885
|
+
}), J(this, Rt).call(this);
|
|
7841
7886
|
});
|
|
7842
7887
|
/**
|
|
7843
7888
|
* 获取正在使用的媒体设备ID
|
|
7844
7889
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7845
7890
|
* @returns deviceId 设备ID
|
|
7846
7891
|
*/
|
|
7847
|
-
Z(this, "getMediaDeviceKind", (u) =>
|
|
7892
|
+
Z(this, "getMediaDeviceKind", (u) => J(this, bt).get(u));
|
|
7848
7893
|
/**
|
|
7849
7894
|
* 设置正在使用的媒体设备
|
|
7850
7895
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7851
7896
|
* @param deviceId 设备ID
|
|
7852
7897
|
*/
|
|
7853
7898
|
Z(this, "setDeviceKind", async (u, E) => {
|
|
7854
|
-
if (
|
|
7855
|
-
const _ =
|
|
7899
|
+
if (J(this, bt).set(u, E), u === "audiooutput") {
|
|
7900
|
+
const _ = J(this, vt).values();
|
|
7856
7901
|
for (const k of _)
|
|
7857
7902
|
if (k.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype)
|
|
7858
7903
|
try {
|
|
@@ -7873,7 +7918,7 @@ class RoomMedias extends RoomBase {
|
|
|
7873
7918
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7874
7919
|
* @returns MediaDeviceInfo[]
|
|
7875
7920
|
*/
|
|
7876
|
-
Z(this, "getEnumerateDevices", async (u) => (await
|
|
7921
|
+
Z(this, "getEnumerateDevices", async (u) => (await J(this, Rt).call(this), J(this, It).filter((_) => _.kind === u)));
|
|
7877
7922
|
/**
|
|
7878
7923
|
* 获取可用音频输入设备
|
|
7879
7924
|
* @returns MediaDeviceInfo[]
|
|
@@ -7889,10 +7934,10 @@ class RoomMedias extends RoomBase {
|
|
|
7889
7934
|
* @returns MediaDeviceInfo[]
|
|
7890
7935
|
*/
|
|
7891
7936
|
Z(this, "getEnumerateVideoinputDevices", () => this.getEnumerateDevices("videoinput"));
|
|
7892
|
-
|
|
7937
|
+
J(this, Kt).call(this), J(this, Wt).call(this), J(this, Jt).call(this);
|
|
7893
7938
|
}
|
|
7894
7939
|
}
|
|
7895
|
-
|
|
7940
|
+
It = new WeakMap(), bt = new WeakMap(), _t = new WeakMap(), vt = new WeakMap(), St = new WeakMap(), Jt = new WeakMap(), Wt = new WeakMap(), Rt = new WeakMap(), Kt = new WeakMap();
|
|
7896
7941
|
class RoomUsers extends RoomMedias {
|
|
7897
7942
|
constructor(u) {
|
|
7898
7943
|
super(u);
|
|
@@ -8196,11 +8241,11 @@ const createMutedAudioStream = () => {
|
|
|
8196
8241
|
O.addColorStop(0, `hsla(${k}, 100%, 50%, 0)`), O.addColorStop(1, `hsla(${k + 120}, 100%, 50%, 0)`), _.fillStyle = O, _.fillRect(0, 0, E.width, E.height), k = (k + 1) % 360;
|
|
8197
8242
|
}, 100), E.captureStream(u);
|
|
8198
8243
|
};
|
|
8199
|
-
var
|
|
8244
|
+
var gt, Gt, At, Qt, Vt, Yt;
|
|
8200
8245
|
class RoomPeer extends RoomUsers {
|
|
8201
8246
|
constructor(u) {
|
|
8202
8247
|
super(u);
|
|
8203
|
-
at(this,
|
|
8248
|
+
at(this, gt, /* @__PURE__ */ new Map());
|
|
8204
8249
|
// 假媒体流 (创建轨道用)
|
|
8205
8250
|
Z(this, "getPeerStatsTimer", 0);
|
|
8206
8251
|
// 获取报告的定时器
|
|
@@ -8219,28 +8264,28 @@ class RoomPeer extends RoomUsers {
|
|
|
8219
8264
|
// 网络抖动
|
|
8220
8265
|
});
|
|
8221
8266
|
Z(this, "initPeer", () => {
|
|
8222
|
-
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(),
|
|
8267
|
+
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), J(this, Qt).call(this), J(this, Yt).call(this);
|
|
8223
8268
|
});
|
|
8224
8269
|
// 初始化假数据流
|
|
8225
|
-
at(this,
|
|
8270
|
+
at(this, Gt, () => {
|
|
8226
8271
|
for (const u of mediaType_keys)
|
|
8227
8272
|
switch (u) {
|
|
8228
8273
|
case "microphoneCamera_audio":
|
|
8229
|
-
|
|
8274
|
+
J(this, gt).set("microphoneCamera_audio", createMutedAudioStream());
|
|
8230
8275
|
break;
|
|
8231
8276
|
case "microphoneCamera_video":
|
|
8232
|
-
|
|
8277
|
+
J(this, gt).set("microphoneCamera_video", createFakeVideoStream());
|
|
8233
8278
|
break;
|
|
8234
8279
|
case "screenSharing_audio":
|
|
8235
|
-
|
|
8280
|
+
J(this, gt).set("screenSharing_audio", createMutedAudioStream());
|
|
8236
8281
|
break;
|
|
8237
8282
|
case "screenSharing_video":
|
|
8238
|
-
|
|
8283
|
+
J(this, gt).set("screenSharing_video", createFakeVideoStream());
|
|
8239
8284
|
break;
|
|
8240
8285
|
}
|
|
8241
8286
|
});
|
|
8242
8287
|
// 获取假数据流
|
|
8243
|
-
at(this,
|
|
8288
|
+
at(this, At, (u) => J(this, gt).get(u));
|
|
8244
8289
|
/**
|
|
8245
8290
|
* 替换发射器媒体流
|
|
8246
8291
|
*/
|
|
@@ -8252,7 +8297,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8252
8297
|
let n;
|
|
8253
8298
|
if (e) {
|
|
8254
8299
|
const { sender: O } = e;
|
|
8255
|
-
E ? n = this.getUserStream(_, k) : n =
|
|
8300
|
+
E ? n = this.getUserStream(_, k) : n = J(this, At).call(this, k);
|
|
8256
8301
|
const [$] = n.getTracks();
|
|
8257
8302
|
await O.replaceTrack($);
|
|
8258
8303
|
}
|
|
@@ -8277,11 +8322,11 @@ class RoomPeer extends RoomUsers {
|
|
|
8277
8322
|
* 添加发射器
|
|
8278
8323
|
*/
|
|
8279
8324
|
Z(this, "addSenders", async (u = []) => {
|
|
8280
|
-
u.length === 0 && this.peerIns.addTransceiver("audio", { direction: "sendonly" });
|
|
8325
|
+
u.length === 0 && (this.peerIns.addTransceiver("audio", { direction: "sendonly" }), this.peerIns.addTransceiver("video", { direction: "sendonly" }));
|
|
8281
8326
|
const E = [];
|
|
8282
8327
|
for (const _ of u) {
|
|
8283
8328
|
if (this.transceiverMap.has(_)) continue;
|
|
8284
|
-
const k =
|
|
8329
|
+
const k = J(this, At).call(this, _), [e] = k.getTracks(), n = this.peerIns.addTransceiver(e, { direction: "sendonly" });
|
|
8285
8330
|
this.transceiverMap.set(_, n), E.push(_);
|
|
8286
8331
|
}
|
|
8287
8332
|
if (u.length === 0 || E.length) {
|
|
@@ -8298,6 +8343,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8298
8343
|
* 移除发射器
|
|
8299
8344
|
*/
|
|
8300
8345
|
Z(this, "removeSenders", async (u = []) => {
|
|
8346
|
+
u.length === 0 && (u = mediaType_keys);
|
|
8301
8347
|
for (const E of u)
|
|
8302
8348
|
this.transceiverMap.has(E) && this.transceiverMap.delete(E);
|
|
8303
8349
|
});
|
|
@@ -8344,7 +8390,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8344
8390
|
}
|
|
8345
8391
|
await this.emitNotifyUpdateUsersStreams(N), this.peerIns.removeEventListener("track", O), _(!0);
|
|
8346
8392
|
}, O = async ($) => {
|
|
8347
|
-
const { streams: N, transceiver: D } = $, [q] = N, { mid: P, receiver: j } = D, { track: V } = j, { id:
|
|
8393
|
+
const { streams: N, transceiver: D } = $, [q] = N, { mid: P, receiver: j } = D, { track: V } = j, { id: Q, kind: z } = V, Y = k.find((nt) => nt.mid === `${P}`);
|
|
8348
8394
|
if (!Y) return;
|
|
8349
8395
|
const { userId: et, mediaType: tt } = Y;
|
|
8350
8396
|
if (!(!et || !tt)) {
|
|
@@ -8353,7 +8399,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8353
8399
|
(nt == null ? void 0 : nt.kind) === "audio" && nt.setMute(!1);
|
|
8354
8400
|
}
|
|
8355
8401
|
{
|
|
8356
|
-
const nt = { ...Y, mid: P, msid:
|
|
8402
|
+
const nt = { ...Y, mid: P, msid: Q };
|
|
8357
8403
|
e.push(nt);
|
|
8358
8404
|
}
|
|
8359
8405
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#00b60f;", `------->quickvo: await subscribe ${e.length}/${k.length}`, { mediaType: tt, mid: P, userTrack: Y, e: $ }), k.length === e.length && n();
|
|
@@ -8366,7 +8412,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8366
8412
|
/**
|
|
8367
8413
|
* 监听webrtc ice通讯连接
|
|
8368
8414
|
*/
|
|
8369
|
-
at(this,
|
|
8415
|
+
at(this, Qt, () => {
|
|
8370
8416
|
let u = 0;
|
|
8371
8417
|
const E = () => {
|
|
8372
8418
|
this.setRoomState("closed");
|
|
@@ -8516,33 +8562,33 @@ class RoomPeer extends RoomUsers {
|
|
|
8516
8562
|
/**
|
|
8517
8563
|
* 计算网络质量
|
|
8518
8564
|
*/
|
|
8519
|
-
at(this,
|
|
8565
|
+
at(this, Vt, async () => {
|
|
8520
8566
|
try {
|
|
8521
8567
|
const u = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...u.values()].filter((nt) => E.includes(nt.type));
|
|
8522
8568
|
let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
|
|
8523
8569
|
for (const nt of this.reports) {
|
|
8524
|
-
const { packetsSent:
|
|
8525
|
-
|
|
8570
|
+
const { packetsSent: ut, packetsLost: it } = nt;
|
|
8571
|
+
ut && (O += ut), it && ($ += it);
|
|
8526
8572
|
}
|
|
8527
8573
|
this.reports = k;
|
|
8528
8574
|
for (const nt of this.reports) {
|
|
8529
|
-
const { bytesReceived:
|
|
8530
|
-
|
|
8575
|
+
const { bytesReceived: ut, bytesSent: it, packetsSent: lt, packetsLost: st, jitter: rt, roundTripTime: ct } = nt;
|
|
8576
|
+
ut && (e = ut), it && (n = it), lt && (N += lt), st && (D += st), ct && q.push((ct * 100).toFixed(2)), rt && P.push(rt.toFixed(2));
|
|
8531
8577
|
}
|
|
8532
8578
|
P.sort().reverse(), q.sort().reverse();
|
|
8533
|
-
const j = N - O, V = D - $,
|
|
8579
|
+
const j = N - O, V = D - $, Q = j === 0 ? "0.00" : (V / j).toFixed(2), [z = "0"] = q, [Y = "0"] = P, et = { inboundBytes: e, outboundBytes: n, lostRate: Q, roundTripTime: z, jitter: Y };
|
|
8534
8580
|
this.peerNetwork = et;
|
|
8535
|
-
const tt = (nt,
|
|
8536
|
-
const
|
|
8537
|
-
let
|
|
8538
|
-
return
|
|
8581
|
+
const tt = (nt, ut, it) => {
|
|
8582
|
+
const lt = Number(nt), st = Number(ut), rt = Number(it);
|
|
8583
|
+
let ct = "0";
|
|
8584
|
+
return lt < 0.03 && st < 100 && rt < 0.05 ? ct = "5" : lt < 0.06 && st < 160 && rt < 0.1 ? ct = "4" : lt < 0.1 && st < 250 && rt < 0.15 ? ct = "3" : lt < 0.15 && st < 400 && rt < 0.2 ? ct = "2" : ct = "1", Number(ct);
|
|
8539
8585
|
};
|
|
8540
8586
|
{
|
|
8541
|
-
const nt = tt(
|
|
8542
|
-
if (await this.updateUserNetwork(this.options.userId,
|
|
8587
|
+
const nt = tt(Q, z, Y), ut = await this.getCaller(), { network: it } = ut, lt = { egress: nt, ingress: nt }, st = JSON.stringify(it) !== JSON.stringify(lt);
|
|
8588
|
+
if (await this.updateUserNetwork(this.options.userId, lt), st) {
|
|
8543
8589
|
this.emitNotifyUpdateUsers();
|
|
8544
|
-
const { userId:
|
|
8545
|
-
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...
|
|
8590
|
+
const { userId: rt, roomId: ct } = this.options;
|
|
8591
|
+
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...lt, userId: rt, roomId: ct } }, !1);
|
|
8546
8592
|
}
|
|
8547
8593
|
}
|
|
8548
8594
|
} catch (u) {
|
|
@@ -8552,9 +8598,9 @@ class RoomPeer extends RoomUsers {
|
|
|
8552
8598
|
/**
|
|
8553
8599
|
* 获取连接的所有轨道分析数据
|
|
8554
8600
|
*/
|
|
8555
|
-
at(this,
|
|
8601
|
+
at(this, Yt, () => {
|
|
8556
8602
|
const u = async () => {
|
|
8557
|
-
this.peerIns.connectionState !== "connected" || !this.options.roomId ||
|
|
8603
|
+
this.peerIns.connectionState !== "connected" || !this.options.roomId || J(this, Vt).call(this);
|
|
8558
8604
|
};
|
|
8559
8605
|
this.getPeerStatsTimer = setInterval(u, 1 * 1e3);
|
|
8560
8606
|
});
|
|
@@ -8562,11 +8608,11 @@ class RoomPeer extends RoomUsers {
|
|
|
8562
8608
|
* 停止网络报告分析
|
|
8563
8609
|
*/
|
|
8564
8610
|
Z(this, "stopGetPeerStats", () => clearInterval(this.getPeerStatsTimer));
|
|
8565
|
-
|
|
8611
|
+
J(this, Gt).call(this);
|
|
8566
8612
|
}
|
|
8567
8613
|
}
|
|
8568
|
-
|
|
8569
|
-
var
|
|
8614
|
+
gt = new WeakMap(), Gt = new WeakMap(), At = new WeakMap(), Qt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap();
|
|
8615
|
+
var Xt, Et, qt, Dt, Ct;
|
|
8570
8616
|
class RoomCalls extends RoomPeer {
|
|
8571
8617
|
constructor(u) {
|
|
8572
8618
|
super(u);
|
|
@@ -8576,7 +8622,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8576
8622
|
* 广播给房间其他人
|
|
8577
8623
|
* 只有当自己建立了发射轨道 并且 加入房间后才进行广播
|
|
8578
8624
|
*/
|
|
8579
|
-
at(this,
|
|
8625
|
+
at(this, Xt, async (u) => {
|
|
8580
8626
|
const { roomId: E } = this.options;
|
|
8581
8627
|
if (!E) return;
|
|
8582
8628
|
const { id: _, tracks: k = [] } = await this.getCaller();
|
|
@@ -8587,7 +8633,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8587
8633
|
/**
|
|
8588
8634
|
* 更新自己通话状态
|
|
8589
8635
|
*/
|
|
8590
|
-
at(this,
|
|
8636
|
+
at(this, Et, async (u) => new Promise(async (E, _) => {
|
|
8591
8637
|
const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: u } };
|
|
8592
8638
|
await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
|
|
8593
8639
|
const { code: $ = 0 } = O;
|
|
@@ -8598,7 +8644,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8598
8644
|
/**
|
|
8599
8645
|
* 创建连接
|
|
8600
8646
|
*/
|
|
8601
|
-
at(this,
|
|
8647
|
+
at(this, qt, () => new Promise(async (u, E) => {
|
|
8602
8648
|
try {
|
|
8603
8649
|
if (["connecting", "connected"].includes(this.cwsIns.state)) return u(!0);
|
|
8604
8650
|
this.taskQueue.setCondition("createWs", !1), this.cwsIns.clearEvents(), this.initPeer();
|
|
@@ -8613,19 +8659,19 @@ class RoomCalls extends RoomPeer {
|
|
|
8613
8659
|
};
|
|
8614
8660
|
if (this.isEarly) {
|
|
8615
8661
|
const N = ht();
|
|
8616
|
-
O.i = N;
|
|
8662
|
+
O.i = N, this.setOptions({ earlyId: N });
|
|
8617
8663
|
}
|
|
8618
8664
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createWs", O);
|
|
8619
8665
|
const $ = btoa(encodeURI(JSON.stringify(O)));
|
|
8620
8666
|
await this.cwsIns.connect($), this.taskQueue.setCondition("createWs", !0), u(!0);
|
|
8621
8667
|
} catch (_) {
|
|
8622
|
-
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createWs is error.", _), E(_);
|
|
8668
|
+
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createWs is error.", _), this.reportLogs("ws_c_timeout", _.message || _), E(_);
|
|
8623
8669
|
}
|
|
8624
8670
|
}));
|
|
8625
8671
|
/**
|
|
8626
8672
|
* 创建cf会话
|
|
8627
8673
|
*/
|
|
8628
|
-
at(this,
|
|
8674
|
+
at(this, Dt, () => {
|
|
8629
8675
|
if (!["connecting", "connected"].includes(this.roomState))
|
|
8630
8676
|
return this.setRoomState("connecting"), new Promise((u) => {
|
|
8631
8677
|
const E = async () => {
|
|
@@ -8649,7 +8695,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8649
8695
|
u(!0);
|
|
8650
8696
|
});
|
|
8651
8697
|
} catch (_) {
|
|
8652
|
-
|
|
8698
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo create session is error.", _), this.taskQueue.setCondition("createSession", !0), this.reportLogs("ws_c_timeout", _.message || _);
|
|
8653
8699
|
}
|
|
8654
8700
|
};
|
|
8655
8701
|
this.taskQueue.addTask(E, ["createWs"], { key: "createSession", describe: "createSession" });
|
|
@@ -8661,12 +8707,12 @@ class RoomCalls extends RoomPeer {
|
|
|
8661
8707
|
* @example quickvo.earlyConnect(['microphoneCamera_audio', 'microphoneCamera_video'])
|
|
8662
8708
|
*/
|
|
8663
8709
|
Z(this, "earlyConnect", (u = []) => {
|
|
8664
|
-
this.isEarly = !0,
|
|
8710
|
+
this.isEarly = !0, J(this, qt).call(this), J(this, Dt).call(this), u.length === 0 && (u = ["microphoneCamera_audio", "microphoneCamera_video"]), J(this, Ct).call(this, u);
|
|
8665
8711
|
});
|
|
8666
8712
|
/**
|
|
8667
8713
|
* 创建媒体轨道
|
|
8668
8714
|
*/
|
|
8669
|
-
at(this,
|
|
8715
|
+
at(this, Ct, async (u) => new Promise((E) => {
|
|
8670
8716
|
const _ = async () => {
|
|
8671
8717
|
try {
|
|
8672
8718
|
this.taskQueue.setCondition("createTrack", !1);
|
|
@@ -8678,13 +8724,12 @@ class RoomCalls extends RoomPeer {
|
|
|
8678
8724
|
data: { sdp: this.getSdp(), tracks: e, callAction: 0 }
|
|
8679
8725
|
}).then(async (n) => {
|
|
8680
8726
|
const { code: O = 0, desc: $, data: N } = n;
|
|
8681
|
-
if (O !== 200)
|
|
8682
|
-
throw this.options.debug && console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createTrack is error.", { mediaTypes: u }), new Error($);
|
|
8727
|
+
if (O !== 200) throw new Error($);
|
|
8683
8728
|
const { remoteSdp: D } = N;
|
|
8684
8729
|
await this.setRemoteDescription({ type: "answer", sdp: D }), this.taskQueue.setCondition("createTrack", !0), E(!0);
|
|
8685
8730
|
});
|
|
8686
|
-
} catch {
|
|
8687
|
-
await this.removeSenders(u), this.taskQueue.setCondition("createTrack", !0), E(!0);
|
|
8731
|
+
} catch (k) {
|
|
8732
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createTrack is error.", k), await this.removeSenders(u), this.taskQueue.setCondition("createTrack", !0), this.reportLogs("publish_error", k.message || k), E(!0);
|
|
8688
8733
|
}
|
|
8689
8734
|
};
|
|
8690
8735
|
this.taskQueue.addTask(_, ["createWs", "createSession", "ice", "subscribe", "createTrack", "closeTrack"], { describe: "createTrack" });
|
|
@@ -8700,22 +8745,23 @@ class RoomCalls extends RoomPeer {
|
|
|
8700
8745
|
Z(this, "setLocalStream", (u, E) => new Promise(async (_, k) => {
|
|
8701
8746
|
try {
|
|
8702
8747
|
typeof u == "string" && (u = [u]);
|
|
8703
|
-
const { userId: e } = this.options;
|
|
8748
|
+
const { userId: e = "" } = this.options;
|
|
8704
8749
|
for (const O of u)
|
|
8705
8750
|
if (this.setLocalStreamActiveMap.set(O, E), E === !1) {
|
|
8706
8751
|
this.removeUserMediaStreamContext(e, O);
|
|
8707
8752
|
continue;
|
|
8708
8753
|
}
|
|
8709
|
-
if (E
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8754
|
+
if (E) {
|
|
8755
|
+
if (u.includes("microphoneCamera_audio") && u.includes("microphoneCamera_video") && await this.initLocalStream("microphoneCamera"), u.includes("microphoneCamera_audio") && await this.initLocalStream("microphoneCamera_audio"), u.includes("microphoneCamera_video") && await this.initLocalStream("microphoneCamera_video"), u.includes("screenSharing_audio") && u.includes("screenSharing_video") && await this.initLocalStream("screenSharing"), u.includes("screenSharing_audio") && !u.includes("screenSharing_video") && await this.initLocalStream("screenSharing_audio"), u.includes("screenSharing_video") && !u.includes("screenSharing_audio") && await this.initLocalStream("screenSharing_video"), u.includes("screenSharing_audio")) {
|
|
8756
|
+
const $ = this.getUserStream(e, "screenSharing_audio").getTracks();
|
|
8757
|
+
for (const N of $)
|
|
8758
|
+
N.onended = () => this.stopPublish(["screenSharing_audio"]);
|
|
8759
|
+
}
|
|
8760
|
+
if (u.includes("screenSharing_video")) {
|
|
8761
|
+
const $ = this.getUserStream(e, "screenSharing_video").getTracks();
|
|
8762
|
+
for (const N of $)
|
|
8763
|
+
N.onended = () => this.stopPublish(["screenSharing_video"]);
|
|
8764
|
+
}
|
|
8719
8765
|
}
|
|
8720
8766
|
const n = this.getUserStreams(e);
|
|
8721
8767
|
_(n);
|
|
@@ -8763,7 +8809,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8763
8809
|
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
|
|
8764
8810
|
* @returns Promise<boolean>
|
|
8765
8811
|
*/
|
|
8766
|
-
Z(this, "joinRoom", async (u) => (this.setOptions(u), await
|
|
8812
|
+
Z(this, "joinRoom", async (u) => (this.setOptions(u), await J(this, qt).call(this), new Promise((E, _) => {
|
|
8767
8813
|
this.clearUsers();
|
|
8768
8814
|
let k = "";
|
|
8769
8815
|
const e = async () => {
|
|
@@ -8780,9 +8826,9 @@ class RoomCalls extends RoomPeer {
|
|
|
8780
8826
|
}).then(async (D) => {
|
|
8781
8827
|
const { code: q = 0, desc: P = "服务器繁忙", data: j } = D;
|
|
8782
8828
|
if (q !== 200) return _(P);
|
|
8783
|
-
const { roomId: V = "", roomUsers:
|
|
8829
|
+
const { roomId: V = "", roomUsers: Q = [] } = j;
|
|
8784
8830
|
if (V !== O) return _("加入的房间不匹配");
|
|
8785
|
-
this.isInRoom = !0,
|
|
8831
|
+
this.isInRoom = !0, J(this, Dt).call(this), await this.updateUsers(Q), e();
|
|
8786
8832
|
});
|
|
8787
8833
|
} catch (O) {
|
|
8788
8834
|
this.taskQueue.setCondition("joinRoom", !0), this.reportLogs("join_room_error", O.message || O), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
|
|
@@ -8798,7 +8844,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8798
8844
|
Z(this, "quitRoom", () => new Promise(async (u) => {
|
|
8799
8845
|
const { roomId: E, userId: _ } = this.options, k = { roomId: E, user: { id: _ } };
|
|
8800
8846
|
try {
|
|
8801
|
-
this.isInRoom = !1, this.
|
|
8847
|
+
this.isInRoom = !1, this.clearLocalStream(), this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.setRoomState("ready");
|
|
8802
8848
|
} catch (e) {
|
|
8803
8849
|
this.reportLogs("quit_room_error", e.message || e);
|
|
8804
8850
|
}
|
|
@@ -8812,7 +8858,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8812
8858
|
Z(this, "quitRoomEx", () => new Promise(async (u) => {
|
|
8813
8859
|
const { roomId: E, userId: _ } = this.options, k = { roomId: E, user: { id: _ } };
|
|
8814
8860
|
try {
|
|
8815
|
-
this.isInRoom = !1, this.
|
|
8861
|
+
this.isInRoom = !1, this.clearLocalStream(), this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams();
|
|
8816
8862
|
} catch (e) {
|
|
8817
8863
|
this.reportLogs("quit_room_error", e.message || e);
|
|
8818
8864
|
}
|
|
@@ -8847,7 +8893,6 @@ class RoomCalls extends RoomPeer {
|
|
|
8847
8893
|
const k = async () => {
|
|
8848
8894
|
try {
|
|
8849
8895
|
const e = await this.getCaller();
|
|
8850
|
-
await this.replaceSenderStream(u, !1);
|
|
8851
8896
|
try {
|
|
8852
8897
|
await this.setLocalStream(u, !0);
|
|
8853
8898
|
} catch {
|
|
@@ -8856,11 +8901,11 @@ class RoomCalls extends RoomPeer {
|
|
|
8856
8901
|
for (const q of u)
|
|
8857
8902
|
this.getUserStream(e.id, q).getTracks().length === 0 && n.push(q);
|
|
8858
8903
|
const O = u.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
|
|
8859
|
-
await
|
|
8904
|
+
await J(this, Ct).call(this, O);
|
|
8860
8905
|
const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
|
|
8861
8906
|
await this.updateUsertracks(e.id, N, !0);
|
|
8862
8907
|
const D = await this.getCallAction(N);
|
|
8863
|
-
await
|
|
8908
|
+
await J(this, Et).call(this, D), J(this, Xt).call(this, u), await this.replaceSenderStream(O, !0), n.length !== 0 && await this.inactiveTracks(n, !1);
|
|
8864
8909
|
{
|
|
8865
8910
|
await this.emitNotifyUpdateUsers();
|
|
8866
8911
|
const q = await this.getCaller();
|
|
@@ -8893,7 +8938,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8893
8938
|
await this.replaceSenderStream(u, !1), await this.closeUserTracks(e.id, n, !0), await this.removeSenders(u);
|
|
8894
8939
|
{
|
|
8895
8940
|
const $ = await this.getCallAction(e.tracks);
|
|
8896
|
-
await
|
|
8941
|
+
await J(this, Et).call(this, $);
|
|
8897
8942
|
}
|
|
8898
8943
|
await this.createOffer(), await this.cwsIns.sendMessage({
|
|
8899
8944
|
event: "closeTrack",
|
|
@@ -8924,7 +8969,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8924
8969
|
for (const q of n) {
|
|
8925
8970
|
const { isSelf: P, tracks: j = [] } = q;
|
|
8926
8971
|
if (!P) {
|
|
8927
|
-
const V = j.filter(({ trackName:
|
|
8972
|
+
const V = j.filter(({ trackName: Q, mid: z = "" }) => z !== "" && (u.includes(Q) || u.length === 0));
|
|
8928
8973
|
V.length !== 0 && O.push({ ...q, tracks: V });
|
|
8929
8974
|
}
|
|
8930
8975
|
}
|
|
@@ -8935,8 +8980,8 @@ class RoomCalls extends RoomPeer {
|
|
|
8935
8980
|
if (O.length === 0) return $();
|
|
8936
8981
|
const N = [];
|
|
8937
8982
|
for (const q of O) {
|
|
8938
|
-
const { id: P, tracks: j } = q, V = ft(j, ["type", "trackName"]),
|
|
8939
|
-
N.push(
|
|
8983
|
+
const { id: P, tracks: j } = q, V = ft(j, ["type", "trackName"]), Q = { id: P, tracks: V };
|
|
8984
|
+
N.push(Q);
|
|
8940
8985
|
}
|
|
8941
8986
|
const D = async () => {
|
|
8942
8987
|
this.options.debug && console.info("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: surplus subscribe count is ${E}`), await this.cwsIns.sendMessage({
|
|
@@ -8949,10 +8994,10 @@ class RoomCalls extends RoomPeer {
|
|
|
8949
8994
|
return await new Promise((Y) => setTimeout(() => Y(!0), 300)), E = E - 1, D();
|
|
8950
8995
|
throw 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 }), new Error(V);
|
|
8951
8996
|
}
|
|
8952
|
-
const { remoteSdp:
|
|
8997
|
+
const { remoteSdp: Q, users: z = [] } = j;
|
|
8953
8998
|
this.onSubscribeUserTracks(z).then(async () => {
|
|
8954
8999
|
await this.renegotiate(), $();
|
|
8955
|
-
}), await this.setRemoteDescription({ type: "offer", sdp:
|
|
9000
|
+
}), await this.setRemoteDescription({ type: "offer", sdp: Q });
|
|
8956
9001
|
});
|
|
8957
9002
|
};
|
|
8958
9003
|
await D();
|
|
@@ -8986,9 +9031,9 @@ class RoomCalls extends RoomPeer {
|
|
|
8986
9031
|
for (const $ of e) {
|
|
8987
9032
|
const { tracks: N = [] } = $;
|
|
8988
9033
|
for (const D of N) {
|
|
8989
|
-
const { type: q, mid: P, trackName: j, mediaType: V, msid:
|
|
8990
|
-
if (!(!V || !
|
|
8991
|
-
const z = { type: q, mid: P, trackName:
|
|
9034
|
+
const { type: q, mid: P, trackName: j, mediaType: V, msid: Q } = D;
|
|
9035
|
+
if (!(!V || !Q) && (u.length === 0 || u.includes(j))) {
|
|
9036
|
+
const z = { type: q, mid: P, trackName: Q };
|
|
8992
9037
|
n.push(z), await this.closeUserTracks($.id, [D]);
|
|
8993
9038
|
}
|
|
8994
9039
|
}
|
|
@@ -9020,7 +9065,6 @@ class RoomCalls extends RoomPeer {
|
|
|
9020
9065
|
const k = await this.getCaller();
|
|
9021
9066
|
if (!k) return;
|
|
9022
9067
|
const { tracks: e = [] } = k, n = [...e];
|
|
9023
|
-
await this.replaceSenderStream(u, !0);
|
|
9024
9068
|
for (let $ of n) {
|
|
9025
9069
|
const { mediaType: N } = $;
|
|
9026
9070
|
if (N && u.includes(N)) {
|
|
@@ -9031,7 +9075,7 @@ class RoomCalls extends RoomPeer {
|
|
|
9031
9075
|
}
|
|
9032
9076
|
}
|
|
9033
9077
|
const O = await this.getCallAction(n);
|
|
9034
|
-
await
|
|
9078
|
+
await J(this, Et).call(this, O), await this.emitNotifyUpdateUsers(), _(!0);
|
|
9035
9079
|
}));
|
|
9036
9080
|
/**
|
|
9037
9081
|
* 远端调试
|
|
@@ -9046,21 +9090,21 @@ class RoomCalls extends RoomPeer {
|
|
|
9046
9090
|
}));
|
|
9047
9091
|
}
|
|
9048
9092
|
}
|
|
9049
|
-
|
|
9093
|
+
Xt = new WeakMap(), Et = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap();
|
|
9050
9094
|
class Room extends RoomCalls {
|
|
9051
9095
|
constructor(I) {
|
|
9052
9096
|
super(I);
|
|
9053
9097
|
}
|
|
9054
9098
|
}
|
|
9055
|
-
var
|
|
9099
|
+
var Tt, te, ee, ie, ne;
|
|
9056
9100
|
class QuickVO extends Room {
|
|
9057
9101
|
constructor(u) {
|
|
9058
9102
|
super(u);
|
|
9059
|
-
at(this,
|
|
9103
|
+
at(this, Tt, /* @__PURE__ */ new Map());
|
|
9060
9104
|
/**
|
|
9061
9105
|
* 添加内部监听事件
|
|
9062
9106
|
*/
|
|
9063
|
-
at(this,
|
|
9107
|
+
at(this, te, () => {
|
|
9064
9108
|
{
|
|
9065
9109
|
const u = async (E) => {
|
|
9066
9110
|
const { qualities: _ = [] } = E.data, [k] = _;
|
|
@@ -9141,12 +9185,12 @@ class QuickVO extends Room {
|
|
|
9141
9185
|
/**
|
|
9142
9186
|
* cwsIns 发送消息前
|
|
9143
9187
|
*/
|
|
9144
|
-
at(this,
|
|
9188
|
+
at(this, ee, () => {
|
|
9145
9189
|
});
|
|
9146
9190
|
/**
|
|
9147
9191
|
* 重连成功
|
|
9148
9192
|
*/
|
|
9149
|
-
at(this,
|
|
9193
|
+
at(this, ie, () => {
|
|
9150
9194
|
this.cwsIns.onReconnectSuccess = async () => {
|
|
9151
9195
|
await this.syncRoomInfo();
|
|
9152
9196
|
};
|
|
@@ -9154,7 +9198,7 @@ class QuickVO extends Room {
|
|
|
9154
9198
|
/**
|
|
9155
9199
|
* 重连停止
|
|
9156
9200
|
*/
|
|
9157
|
-
at(this,
|
|
9201
|
+
at(this, ne, async () => {
|
|
9158
9202
|
});
|
|
9159
9203
|
/**
|
|
9160
9204
|
* 添加 FrameRequestCallback
|
|
@@ -9163,13 +9207,13 @@ class QuickVO extends Room {
|
|
|
9163
9207
|
*/
|
|
9164
9208
|
Z(this, "addRequestAnimationFrame", async (u, E) => {
|
|
9165
9209
|
{
|
|
9166
|
-
const k =
|
|
9210
|
+
const k = J(this, Tt).get(u);
|
|
9167
9211
|
k && cancelAnimationFrame(k);
|
|
9168
9212
|
}
|
|
9169
9213
|
const _ = (k = Date.now()) => {
|
|
9170
9214
|
E(k);
|
|
9171
9215
|
const e = requestAnimationFrame(_);
|
|
9172
|
-
|
|
9216
|
+
J(this, Tt).set(u, e);
|
|
9173
9217
|
};
|
|
9174
9218
|
_();
|
|
9175
9219
|
});
|
|
@@ -9178,10 +9222,10 @@ class QuickVO extends Room {
|
|
|
9178
9222
|
* @param keys string[] = []
|
|
9179
9223
|
*/
|
|
9180
9224
|
Z(this, "clearRequestAnimationFrame", async (u = []) => {
|
|
9181
|
-
u.length === 0 && (u = [...
|
|
9225
|
+
u.length === 0 && (u = [...J(this, Tt).keys()]);
|
|
9182
9226
|
const E = [];
|
|
9183
9227
|
for (const _ of u) {
|
|
9184
|
-
const k =
|
|
9228
|
+
const k = J(this, Tt).get(_);
|
|
9185
9229
|
k && (cancelAnimationFrame(k), E.push(k));
|
|
9186
9230
|
}
|
|
9187
9231
|
return E;
|
|
@@ -9193,10 +9237,10 @@ class QuickVO extends Room {
|
|
|
9193
9237
|
Z(this, "destroy", async () => {
|
|
9194
9238
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {}, desc: "sdk is destroy." }), await this.cwsIns.close();
|
|
9195
9239
|
});
|
|
9196
|
-
|
|
9240
|
+
J(this, ee).call(this), J(this, ie).call(this), J(this, ne).call(this), J(this, te).call(this);
|
|
9197
9241
|
}
|
|
9198
9242
|
}
|
|
9199
|
-
|
|
9243
|
+
Tt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), ne = new WeakMap();
|
|
9200
9244
|
export {
|
|
9201
9245
|
QuickVO,
|
|
9202
9246
|
ignoreEvent
|