quickvo-sdk-js 0.5.4 → 0.5.6
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 +330 -281
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomBase.d.ts +3 -2
- package/dist/room/RoomCalls.d.ts +7 -1
- package/dist/room/RoomMedias.d.ts +1 -3
- package/dist/room/RoomPeer.d.ts +0 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var te = (a) => {
|
|
3
3
|
throw TypeError(a);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var Z = (a, I, u) =>
|
|
7
|
-
var
|
|
5
|
+
var ne = (a, I, u) => I in a ? ie(a, I, { enumerable: !0, configurable: !0, writable: !0, value: u }) : a[I] = u;
|
|
6
|
+
var Z = (a, I, u) => ne(a, typeof I != "symbol" ? I + "" : I, u), ee = (a, I, u) => I.has(a) || te("Cannot " + u);
|
|
7
|
+
var Q = (a, I, u) => (ee(a, I, "read from private field"), u ? u.call(a) : I.get(a)), at = (a, I, u) => I.has(a) ? te("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), wt = (a, I, u, E) => (ee(a, I, "write to private field"), E ? E.call(a, u) : I.set(a, u), u);
|
|
8
8
|
const L = (a, I = []) => {
|
|
9
9
|
const u = { ...a }, E = Object.keys(u);
|
|
10
10
|
for (const _ of E)
|
|
@@ -83,7 +83,7 @@ const L = (a, I = []) => {
|
|
|
83
83
|
}, G = (a) => W(a), U = (a, I = "YYYY-MM-DD hh:mm:ss", u = {}) => {
|
|
84
84
|
const E = { empty_str: "-", ...u }, { empty_str: _, offset: k } = E, e = W(a, k);
|
|
85
85
|
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()}`,
|
|
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)}`, J = `${Math.ceil(((e - G(`${O}/01/01 00:00:00`)) / 864e5 - Number(D)) / 7) + 1}`, z = [
|
|
87
87
|
{ k: "Y+", v: O },
|
|
88
88
|
// 年
|
|
89
89
|
{ k: "M+", v: $ },
|
|
@@ -98,7 +98,7 @@ const L = (a, I = []) => {
|
|
|
98
98
|
// 分
|
|
99
99
|
{ k: "s+", v: j },
|
|
100
100
|
// 秒
|
|
101
|
-
{ k: "d+", v:
|
|
101
|
+
{ k: "d+", v: V },
|
|
102
102
|
// 第几天
|
|
103
103
|
{ k: "w+", v: J }
|
|
104
104
|
// 第几周
|
|
@@ -591,9 +591,9 @@ function requireParser() {
|
|
|
591
591
|
var q = D[0], P = D.slice(2);
|
|
592
592
|
q === "m" && ($.push({ rtp: [], fmtp: [] }), N = $[$.length - 1]);
|
|
593
593
|
for (var j = 0; j < (_[q] || []).length; j += 1) {
|
|
594
|
-
var
|
|
595
|
-
if (
|
|
596
|
-
return E(
|
|
594
|
+
var V = _[q][j];
|
|
595
|
+
if (V.reg.test(P))
|
|
596
|
+
return E(V, N, P);
|
|
597
597
|
}
|
|
598
598
|
}), O.media = $, O;
|
|
599
599
|
};
|
|
@@ -954,16 +954,16 @@ function requireBase64() {
|
|
|
954
954
|
E[u[_] = _ < 26 ? _ + 65 : _ < 52 ? _ + 71 : _ < 62 ? _ - 4 : _ - 59 | 43] = _++;
|
|
955
955
|
I.encode = function(n, O, $) {
|
|
956
956
|
for (var N = null, D = [], q = 0, P = 0, j; O < $; ) {
|
|
957
|
-
var
|
|
957
|
+
var V = n[O++];
|
|
958
958
|
switch (P) {
|
|
959
959
|
case 0:
|
|
960
|
-
D[q++] = u[
|
|
960
|
+
D[q++] = u[V >> 2], j = (V & 3) << 4, P = 1;
|
|
961
961
|
break;
|
|
962
962
|
case 1:
|
|
963
|
-
D[q++] = u[j |
|
|
963
|
+
D[q++] = u[j | V >> 4], j = (V & 15) << 2, P = 2;
|
|
964
964
|
break;
|
|
965
965
|
case 2:
|
|
966
|
-
D[q++] = u[j |
|
|
966
|
+
D[q++] = u[j | V >> 6], D[q++] = u[V & 63], P = 0;
|
|
967
967
|
break;
|
|
968
968
|
}
|
|
969
969
|
q > 8191 && ((N || (N = [])).push(String.fromCharCode.apply(String, D)), q = 0);
|
|
@@ -1040,11 +1040,11 @@ function requireFloat() {
|
|
|
1040
1040
|
function a(k) {
|
|
1041
1041
|
return typeof Float32Array < "u" ? function() {
|
|
1042
1042
|
var e = new Float32Array([-0]), n = new Uint8Array(e.buffer), O = n[3] === 128;
|
|
1043
|
-
function $(P, j,
|
|
1044
|
-
e[0] = P, j[
|
|
1043
|
+
function $(P, j, V) {
|
|
1044
|
+
e[0] = P, j[V] = n[0], j[V + 1] = n[1], j[V + 2] = n[2], j[V + 3] = n[3];
|
|
1045
1045
|
}
|
|
1046
|
-
function N(P, j,
|
|
1047
|
-
e[0] = P, j[
|
|
1046
|
+
function N(P, j, V) {
|
|
1047
|
+
e[0] = P, j[V] = n[3], j[V + 1] = n[2], j[V + 2] = n[1], j[V + 3] = n[0];
|
|
1048
1048
|
}
|
|
1049
1049
|
k.writeFloatLE = O ? $ : N, k.writeFloatBE = O ? N : $;
|
|
1050
1050
|
function D(P, j) {
|
|
@@ -1084,11 +1084,11 @@ function requireFloat() {
|
|
|
1084
1084
|
k.readFloatLE = n.bind(null, E), k.readFloatBE = n.bind(null, _);
|
|
1085
1085
|
}(), typeof Float64Array < "u" ? function() {
|
|
1086
1086
|
var e = new Float64Array([-0]), n = new Uint8Array(e.buffer), O = n[7] === 128;
|
|
1087
|
-
function $(P, j,
|
|
1088
|
-
e[0] = P, j[
|
|
1087
|
+
function $(P, j, V) {
|
|
1088
|
+
e[0] = P, j[V] = n[0], j[V + 1] = n[1], j[V + 2] = n[2], j[V + 3] = n[3], j[V + 4] = n[4], j[V + 5] = n[5], j[V + 6] = n[6], j[V + 7] = n[7];
|
|
1089
1089
|
}
|
|
1090
|
-
function N(P, j,
|
|
1091
|
-
e[0] = P, j[
|
|
1090
|
+
function N(P, j, V) {
|
|
1091
|
+
e[0] = P, j[V] = n[7], j[V + 1] = n[6], j[V + 2] = n[5], j[V + 3] = n[4], j[V + 4] = n[3], j[V + 5] = n[2], j[V + 6] = n[1], j[V + 7] = n[0];
|
|
1092
1092
|
}
|
|
1093
1093
|
k.writeDoubleLE = O ? $ : N, k.writeDoubleBE = O ? N : $;
|
|
1094
1094
|
function D(P, j) {
|
|
@@ -1114,19 +1114,19 @@ function requireFloat() {
|
|
|
1114
1114
|
else if (D > 17976931348623157e292)
|
|
1115
1115
|
O(0, q, P + $), O((j << 31 | 2146435072) >>> 0, q, P + N);
|
|
1116
1116
|
else {
|
|
1117
|
-
var
|
|
1117
|
+
var V;
|
|
1118
1118
|
if (D < 22250738585072014e-324)
|
|
1119
|
-
|
|
1119
|
+
V = D / 5e-324, O(V >>> 0, q, P + $), O((j << 31 | V / 4294967296) >>> 0, q, P + N);
|
|
1120
1120
|
else {
|
|
1121
1121
|
var J = Math.floor(Math.log(D) / Math.LN2);
|
|
1122
|
-
J === 1024 && (J = 1023),
|
|
1122
|
+
J === 1024 && (J = 1023), V = D * Math.pow(2, -J), O(V * 4503599627370496 >>> 0, q, P + $), O((j << 31 | J + 1023 << 20 | V * 1048576 & 1048575) >>> 0, q, P + N);
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
1126
|
k.writeDoubleLE = e.bind(null, I, 0, 4), k.writeDoubleBE = e.bind(null, u, 4, 0);
|
|
1127
1127
|
function n(O, $, N, D, q) {
|
|
1128
|
-
var P = O(D, q + $), j = O(D, q + N),
|
|
1129
|
-
return J === 2047 ? z ? NaN :
|
|
1128
|
+
var P = O(D, q + $), j = O(D, q + N), V = (j >> 31) * 2 + 1, J = j >>> 20 & 2047, z = 4294967296 * (j & 1048575) + P;
|
|
1129
|
+
return J === 2047 ? z ? NaN : V * (1 / 0) : J === 0 ? V * 5e-324 * z : V * Math.pow(2, J - 1075) * (z + 4503599627370496);
|
|
1130
1130
|
}
|
|
1131
1131
|
k.readDoubleLE = n.bind(null, E, 0, 4), k.readDoubleBE = n.bind(null, _, 4, 0);
|
|
1132
1132
|
}(), k;
|
|
@@ -1474,7 +1474,7 @@ function requireWriter() {
|
|
|
1474
1474
|
}, O.prototype.double = function(z) {
|
|
1475
1475
|
return this._push(a.float.writeDoubleLE, 8, z);
|
|
1476
1476
|
};
|
|
1477
|
-
var
|
|
1477
|
+
var V = a.Array.prototype.set ? function(z, Y, et) {
|
|
1478
1478
|
Y.set(z, et);
|
|
1479
1479
|
} : function(z, Y, et) {
|
|
1480
1480
|
for (var tt = 0; tt < z.length; ++tt)
|
|
@@ -1488,7 +1488,7 @@ function requireWriter() {
|
|
|
1488
1488
|
var et = O.alloc(Y = E.length(z));
|
|
1489
1489
|
E.decode(z, et, 0), z = et;
|
|
1490
1490
|
}
|
|
1491
|
-
return this.uint32(Y)._push(
|
|
1491
|
+
return this.uint32(Y)._push(V, Y, z);
|
|
1492
1492
|
}, O.prototype.string = function(z) {
|
|
1493
1493
|
var Y = _.length(z);
|
|
1494
1494
|
return Y ? this.uint32(Y)._push(_.write, Y, z) : this._push(N, 1, 0);
|
|
@@ -1560,8 +1560,8 @@ function requireReader() {
|
|
|
1560
1560
|
throw Error("illegal buffer");
|
|
1561
1561
|
}, n = function() {
|
|
1562
1562
|
return a.Buffer ? function(P) {
|
|
1563
|
-
return (k.create = function(
|
|
1564
|
-
return a.Buffer.isBuffer(
|
|
1563
|
+
return (k.create = function(V) {
|
|
1564
|
+
return a.Buffer.isBuffer(V) ? new I(V) : e(V);
|
|
1565
1565
|
})(P);
|
|
1566
1566
|
} : e;
|
|
1567
1567
|
};
|
|
@@ -1648,8 +1648,8 @@ function requireReader() {
|
|
|
1648
1648
|
if (this.pos += q, Array.isArray(this.buf))
|
|
1649
1649
|
return this.buf.slice(P, j);
|
|
1650
1650
|
if (P === j) {
|
|
1651
|
-
var
|
|
1652
|
-
return
|
|
1651
|
+
var V = a.Buffer;
|
|
1652
|
+
return V ? V.alloc(0) : new this.buf.constructor(0);
|
|
1653
1653
|
}
|
|
1654
1654
|
return this._slice.call(this.buf, P, j);
|
|
1655
1655
|
}, k.prototype.string = function() {
|
|
@@ -5339,17 +5339,17 @@ const d_code = (a) => a < 256 ? _dist_code[a] : _dist_code[256 + (a >>> 7)], put
|
|
|
5339
5339
|
a.bi_valid === 16 ? (put_short(a, a.bi_buf), a.bi_buf = 0, a.bi_valid = 0) : a.bi_valid >= 8 && (a.pending_buf[a.pending++] = a.bi_buf & 255, a.bi_buf >>= 8, a.bi_valid -= 8);
|
|
5340
5340
|
}, gen_bitlen = (a, I) => {
|
|
5341
5341
|
const u = I.dyn_tree, E = I.max_code, _ = I.stat_desc.static_tree, k = I.stat_desc.has_stree, e = I.stat_desc.extra_bits, n = I.stat_desc.extra_base, O = I.stat_desc.max_length;
|
|
5342
|
-
let $, N, D, q, P, j,
|
|
5342
|
+
let $, N, D, q, P, j, V = 0;
|
|
5343
5343
|
for (q = 0; q <= MAX_BITS$1; q++)
|
|
5344
5344
|
a.bl_count[q] = 0;
|
|
5345
5345
|
for (u[a.heap[a.heap_max] * 2 + 1] = 0, $ = a.heap_max + 1; $ < HEAP_SIZE$1; $++)
|
|
5346
|
-
N = a.heap[$], q = u[u[N * 2 + 1] * 2 + 1] + 1, q > O && (q = O,
|
|
5347
|
-
if (
|
|
5346
|
+
N = a.heap[$], q = u[u[N * 2 + 1] * 2 + 1] + 1, q > O && (q = O, V++), u[N * 2 + 1] = q, !(N > E) && (a.bl_count[q]++, P = 0, N >= n && (P = e[N - n]), j = u[N * 2], a.opt_len += j * (q + P), k && (a.static_len += j * (_[N * 2 + 1] + P)));
|
|
5347
|
+
if (V !== 0) {
|
|
5348
5348
|
do {
|
|
5349
5349
|
for (q = O - 1; a.bl_count[q] === 0; )
|
|
5350
5350
|
q--;
|
|
5351
|
-
a.bl_count[q]--, a.bl_count[q + 1] += 2, a.bl_count[O]--,
|
|
5352
|
-
} while (
|
|
5351
|
+
a.bl_count[q]--, a.bl_count[q + 1] += 2, a.bl_count[O]--, V -= 2;
|
|
5352
|
+
} while (V > 0);
|
|
5353
5353
|
for (q = O; q !== 0; q--)
|
|
5354
5354
|
for (N = a.bl_count[q]; N !== 0; )
|
|
5355
5355
|
D = a.heap[--$], !(D > E) && (u[D * 2 + 1] !== q && (a.opt_len += (q - u[D * 2 + 1]) * u[D * 2], u[D * 2 + 1] = q), N--);
|
|
@@ -6134,12 +6134,12 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
|
|
|
6134
6134
|
};
|
|
6135
6135
|
const BAD$1 = 16209, TYPE$1 = 16191;
|
|
6136
6136
|
var inffast = function a(I, u) {
|
|
6137
|
-
let E, _, k, e, n, O, $, N, D, q, P, j,
|
|
6137
|
+
let E, _, k, e, n, O, $, N, D, q, P, j, V, J, z, Y, et, tt, nt, lt, it, st, ct, ot;
|
|
6138
6138
|
const rt = I.state;
|
|
6139
|
-
E = I.next_in, ct = I.input, _ = E + (I.avail_in - 5), k = I.next_out, ot = I.output, e = k - (u - I.avail_out), n = k + (I.avail_out - 257), O = rt.dmax, $ = rt.wsize, N = rt.whave, D = rt.wnext, q = rt.window, P = rt.hold, j = rt.bits,
|
|
6139
|
+
E = I.next_in, ct = I.input, _ = E + (I.avail_in - 5), k = I.next_out, ot = I.output, e = k - (u - I.avail_out), n = k + (I.avail_out - 257), O = rt.dmax, $ = rt.wsize, N = rt.whave, D = rt.wnext, q = rt.window, P = rt.hold, j = rt.bits, V = rt.lencode, J = rt.distcode, z = (1 << rt.lenbits) - 1, Y = (1 << rt.distbits) - 1;
|
|
6140
6140
|
t:
|
|
6141
6141
|
do {
|
|
6142
|
-
j < 15 && (P += ct[E++] << j, j += 8, P += ct[E++] << j, j += 8), et =
|
|
6142
|
+
j < 15 && (P += ct[E++] << j, j += 8, P += ct[E++] << j, j += 8), et = V[P & z];
|
|
6143
6143
|
e:
|
|
6144
6144
|
for (; ; ) {
|
|
6145
6145
|
if (tt = et >>> 24, P >>>= tt, j -= tt, tt = et >>> 16 & 255, tt === 0)
|
|
@@ -6207,7 +6207,7 @@ var inffast = function a(I, u) {
|
|
|
6207
6207
|
break;
|
|
6208
6208
|
}
|
|
6209
6209
|
} else if ((tt & 64) === 0) {
|
|
6210
|
-
et =
|
|
6210
|
+
et = V[(et & 65535) + (P & (1 << tt) - 1)];
|
|
6211
6211
|
continue e;
|
|
6212
6212
|
} else if (tt & 32) {
|
|
6213
6213
|
rt.mode = TYPE$1;
|
|
@@ -6357,9 +6357,9 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6357
6357
|
64
|
|
6358
6358
|
]), inflate_table = (a, I, u, E, _, k, e, n) => {
|
|
6359
6359
|
const O = n.bits;
|
|
6360
|
-
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0,
|
|
6360
|
+
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, J = 0, z = 0, Y = 0, et, tt, nt, lt, it, st = null, ct;
|
|
6361
6361
|
const ot = new Uint16Array(MAXBITS + 1), rt = new Uint16Array(MAXBITS + 1);
|
|
6362
|
-
let Ot = null,
|
|
6362
|
+
let Ot = null, Xt, Nt, At;
|
|
6363
6363
|
for ($ = 0; $ <= MAXBITS; $++)
|
|
6364
6364
|
ot[$] = 0;
|
|
6365
6365
|
for (N = 0; N < E; N++)
|
|
@@ -6379,12 +6379,12 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6379
6379
|
rt[$ + 1] = rt[$] + ot[$];
|
|
6380
6380
|
for (N = 0; N < E; N++)
|
|
6381
6381
|
I[u + N] !== 0 && (e[rt[I[u + N]]++] = N);
|
|
6382
|
-
if (a === CODES$1 ? (st = Ot = e, ct = 20) : a === LENS$1 ? (st = lbase, Ot = lext, ct = 257) : (st = dbase, Ot = dext, ct = 0), Y = 0, N = 0, $ = D, it = k, j = P,
|
|
6382
|
+
if (a === CODES$1 ? (st = Ot = e, ct = 20) : a === LENS$1 ? (st = lbase, Ot = lext, ct = 257) : (st = dbase, Ot = dext, ct = 0), Y = 0, N = 0, $ = D, it = k, j = P, V = 0, nt = -1, z = 1 << P, lt = z - 1, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6383
6383
|
return 1;
|
|
6384
6384
|
for (; ; ) {
|
|
6385
|
-
|
|
6385
|
+
Xt = $ - V, e[N] + 1 < ct ? (Nt = 0, At = e[N]) : e[N] >= ct ? (Nt = Ot[e[N] - ct], At = st[e[N] - ct]) : (Nt = 96, At = 0), et = 1 << $ - V, tt = 1 << j, D = tt;
|
|
6386
6386
|
do
|
|
6387
|
-
tt -= et, _[it + (Y >>
|
|
6387
|
+
tt -= et, _[it + (Y >> V) + tt] = Xt << 24 | Nt << 16 | At | 0;
|
|
6388
6388
|
while (tt !== 0);
|
|
6389
6389
|
for (et = 1 << $ - 1; Y & et; )
|
|
6390
6390
|
et >>= 1;
|
|
@@ -6394,14 +6394,14 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6394
6394
|
$ = I[u + e[N]];
|
|
6395
6395
|
}
|
|
6396
6396
|
if ($ > P && (Y & lt) !== nt) {
|
|
6397
|
-
for (
|
|
6397
|
+
for (V === 0 && (V = P), it += D, j = $ - V, J = 1 << j; j + V < q && (J -= ot[j + V], !(J <= 0)); )
|
|
6398
6398
|
j++, J <<= 1;
|
|
6399
6399
|
if (z += 1 << j, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6400
6400
|
return 1;
|
|
6401
6401
|
nt = Y & lt, _[nt] = P << 24 | j << 16 | it - k | 0;
|
|
6402
6402
|
}
|
|
6403
6403
|
}
|
|
6404
|
-
return Y !== 0 && (_[it + Y] = $ -
|
|
6404
|
+
return Y !== 0 && (_[it + Y] = $ - V << 24 | 64 << 16 | 0), n.bits = P, 0;
|
|
6405
6405
|
};
|
|
6406
6406
|
var inftrees = inflate_table;
|
|
6407
6407
|
const CODES = 0, LENS = 1, DISTS = 2, {
|
|
@@ -6472,7 +6472,7 @@ const fixedtables = (a) => {
|
|
|
6472
6472
|
const k = a.state;
|
|
6473
6473
|
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;
|
|
6474
6474
|
}, inflate$2 = (a, I) => {
|
|
6475
|
-
let u, E, _, k, e, n, O, $, N, D, q, P, j,
|
|
6475
|
+
let u, E, _, k, e, n, O, $, N, D, q, P, j, V, J = 0, z, Y, et, tt, nt, lt, it, st;
|
|
6476
6476
|
const ct = new Uint8Array(4);
|
|
6477
6477
|
let ot, rt;
|
|
6478
6478
|
const Ot = (
|
|
@@ -6861,12 +6861,12 @@ const fixedtables = (a) => {
|
|
|
6861
6861
|
a.msg = "invalid distance too far back", u.mode = BAD;
|
|
6862
6862
|
break;
|
|
6863
6863
|
}
|
|
6864
|
-
P > u.wnext ? (P -= u.wnext, j = u.wsize - P) : j = u.wnext - P, P > u.length && (P = u.length),
|
|
6864
|
+
P > u.wnext ? (P -= u.wnext, j = u.wsize - P) : j = u.wnext - P, P > u.length && (P = u.length), V = u.window;
|
|
6865
6865
|
} else
|
|
6866
|
-
|
|
6866
|
+
V = _, j = e - u.offset, P = u.length;
|
|
6867
6867
|
P > O && (P = O), O -= P, u.length -= P;
|
|
6868
6868
|
do
|
|
6869
|
-
_[e++] =
|
|
6869
|
+
_[e++] = V[j++];
|
|
6870
6870
|
while (--P);
|
|
6871
6871
|
u.length === 0 && (u.mode = LEN);
|
|
6872
6872
|
break;
|
|
@@ -7154,11 +7154,11 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
|
|
|
7154
7154
|
}
|
|
7155
7155
|
return a;
|
|
7156
7156
|
};
|
|
7157
|
-
var
|
|
7157
|
+
var vt, ut, Rt, yt, _t, qt, Dt, Ct, Ut, Et, Mt, Pt, Bt;
|
|
7158
7158
|
class CallsWebSocket {
|
|
7159
7159
|
// 状态
|
|
7160
7160
|
constructor(I) {
|
|
7161
|
-
at(this,
|
|
7161
|
+
at(this, vt);
|
|
7162
7162
|
at(this, ut, {
|
|
7163
7163
|
url: "wss://demo.putplay.cc/websocket",
|
|
7164
7164
|
// 地址
|
|
@@ -7168,10 +7168,10 @@ class CallsWebSocket {
|
|
|
7168
7168
|
// 最大重连次数
|
|
7169
7169
|
timeout: 30 * 1e3
|
|
7170
7170
|
});
|
|
7171
|
-
at(this,
|
|
7171
|
+
at(this, Rt, "");
|
|
7172
7172
|
// 缓存登录凭证
|
|
7173
|
-
at(this, dt, {});
|
|
7174
7173
|
at(this, yt, {});
|
|
7174
|
+
at(this, _t, {});
|
|
7175
7175
|
Z(this, "state", "closed");
|
|
7176
7176
|
// 外部 发送消息之前
|
|
7177
7177
|
Z(this, "sendMessageBefore", async () => {
|
|
@@ -7183,26 +7183,26 @@ class CallsWebSocket {
|
|
|
7183
7183
|
Z(this, "onReconnectStop", (I) => {
|
|
7184
7184
|
});
|
|
7185
7185
|
// 是否需要重连
|
|
7186
|
-
at(this,
|
|
7186
|
+
at(this, qt, (I) => {
|
|
7187
7187
|
let u = !0;
|
|
7188
7188
|
const { code: E = 1e3, reason: _ = "" } = I;
|
|
7189
7189
|
return E === 1e3 && (_ === "quit success!" || _ === "replace old connection!") && (u = !1), u;
|
|
7190
7190
|
});
|
|
7191
7191
|
// 重连成功
|
|
7192
|
-
at(this,
|
|
7193
|
-
|
|
7192
|
+
at(this, Dt, async (I) => {
|
|
7193
|
+
Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重连成功", I), this.state = "connected", this.onReconnectSuccess(I);
|
|
7194
7194
|
});
|
|
7195
7195
|
// 重连停止
|
|
7196
|
-
at(this,
|
|
7197
|
-
|
|
7196
|
+
at(this, Ct, async (I) => {
|
|
7197
|
+
Q(this, ut).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);
|
|
7198
7198
|
});
|
|
7199
7199
|
// 自定义心跳规则
|
|
7200
|
-
at(this,
|
|
7200
|
+
at(this, Ut, () => {
|
|
7201
7201
|
const I = { event: "heartbeat", sn: +`${F(1e5, 999999)}` };
|
|
7202
7202
|
return com.quick.voice.proto.CommonReq.encode(I).finish();
|
|
7203
7203
|
});
|
|
7204
7204
|
// 更新日志
|
|
7205
|
-
at(this,
|
|
7205
|
+
at(this, Et, (I, u = {}) => {
|
|
7206
7206
|
try {
|
|
7207
7207
|
const { time: E, event: _, data: k = {}, data_original: e = {}, data_remote: n, ...O } = u, $ = U(E, "YYYY-MM-DD hh:mm:ss", { offset: 480 });
|
|
7208
7208
|
let N = {};
|
|
@@ -7223,31 +7223,31 @@ class CallsWebSocket {
|
|
|
7223
7223
|
}
|
|
7224
7224
|
let P = "#quickvo.logs";
|
|
7225
7225
|
ignoreEvent.includes(_) && (P = "#quickvo.ignoreEvents");
|
|
7226
|
-
const j = { "#action": q, timeStr: $, event: _, data: N, time: E, ...O },
|
|
7226
|
+
const j = { "#action": q, timeStr: $, event: _, data: N, time: E, ...O }, V = localStorage.getItem(P) || JSON.stringify([]), J = JSON.parse(V), z = [j, ...J].slice(0, 500);
|
|
7227
7227
|
localStorage.setItem(P, JSON.stringify(z));
|
|
7228
7228
|
} catch (E) {
|
|
7229
7229
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: updataLogs is error", E);
|
|
7230
7230
|
}
|
|
7231
7231
|
});
|
|
7232
7232
|
// 创建事件
|
|
7233
|
-
at(this,
|
|
7233
|
+
at(this, Mt, (I, { resolve: u, reject: E }) => {
|
|
7234
7234
|
const { sn: _ } = I, k = () => {
|
|
7235
|
-
const n =
|
|
7236
|
-
clearTimeout(n.destructionTimer), delete
|
|
7235
|
+
const n = Q(this, yt)[_];
|
|
7236
|
+
clearTimeout(n.destructionTimer), delete Q(this, yt)[_];
|
|
7237
7237
|
}, e = setTimeout(() => {
|
|
7238
|
-
const n =
|
|
7238
|
+
const n = Q(this, yt)[_];
|
|
7239
7239
|
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");
|
|
7240
|
-
},
|
|
7241
|
-
|
|
7240
|
+
}, Q(this, ut).timeout);
|
|
7241
|
+
Q(this, yt)[_] = { message: I, resolve: u, reject: E, destruction: k, destructionTimer: e };
|
|
7242
7242
|
});
|
|
7243
7243
|
// 获取事件
|
|
7244
|
-
at(this,
|
|
7244
|
+
at(this, Pt, (I) => Q(this, yt)[I]);
|
|
7245
7245
|
// 接收消息
|
|
7246
|
-
at(this,
|
|
7246
|
+
at(this, Bt, async (I) => {
|
|
7247
7247
|
const u = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(u), { sn: _, event: k } = E, e = onMessageFormat(E);
|
|
7248
|
-
if (
|
|
7248
|
+
if (Q(this, ut).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) || Q(this, Et).call(this, "res", e)), notifyName_keys.includes(k))
|
|
7249
7249
|
return this.emitNotify(k, L(e, ["code", "data", "desc"]));
|
|
7250
|
-
const O =
|
|
7250
|
+
const O = Q(this, Pt).call(this, _);
|
|
7251
7251
|
if (O) {
|
|
7252
7252
|
const { resolve: $ = (D) => {
|
|
7253
7253
|
}, destruction: N = () => {
|
|
@@ -7257,12 +7257,12 @@ class CallsWebSocket {
|
|
|
7257
7257
|
});
|
|
7258
7258
|
// 清除事件
|
|
7259
7259
|
Z(this, "clearEvents", (I = []) => {
|
|
7260
|
-
const u = Object.keys(
|
|
7260
|
+
const u = Object.keys(Q(this, yt));
|
|
7261
7261
|
I.length === 0 && (I = u);
|
|
7262
7262
|
for (const E of u) {
|
|
7263
7263
|
if (!I.includes(E)) continue;
|
|
7264
|
-
const _ =
|
|
7265
|
-
clearTimeout(_.destructionTimer), delete
|
|
7264
|
+
const _ = Q(this, yt)[E];
|
|
7265
|
+
clearTimeout(_.destructionTimer), delete Q(this, yt)[E];
|
|
7266
7266
|
}
|
|
7267
7267
|
});
|
|
7268
7268
|
/**
|
|
@@ -7271,31 +7271,31 @@ class CallsWebSocket {
|
|
|
7271
7271
|
* @returns
|
|
7272
7272
|
*/
|
|
7273
7273
|
Z(this, "connect", async (I = "") => new Promise(async (u) => {
|
|
7274
|
-
I && wt(this,
|
|
7275
|
-
const E = `${
|
|
7276
|
-
wt(this,
|
|
7277
|
-
...
|
|
7274
|
+
I && wt(this, Rt, I), Q(this, vt) && (await Q(this, vt).close(), this.state = "closed");
|
|
7275
|
+
const E = `${Q(this, ut).url}?s=${Q(this, Rt)}&t=${Date.now()}`;
|
|
7276
|
+
wt(this, vt, new M({
|
|
7277
|
+
...Q(this, ut),
|
|
7278
7278
|
url: E,
|
|
7279
7279
|
binaryType: "arraybuffer",
|
|
7280
|
-
onMessage:
|
|
7281
|
-
checkReconnect:
|
|
7282
|
-
getHeartbeatMsg:
|
|
7283
|
-
onReconnectSuccess:
|
|
7284
|
-
onReconnectStop:
|
|
7285
|
-
})), this.state = "connecting", await
|
|
7280
|
+
onMessage: Q(this, Bt),
|
|
7281
|
+
checkReconnect: Q(this, qt),
|
|
7282
|
+
getHeartbeatMsg: Q(this, Ut),
|
|
7283
|
+
onReconnectSuccess: Q(this, Dt),
|
|
7284
|
+
onReconnectStop: Q(this, Ct)
|
|
7285
|
+
})), this.state = "connecting", await Q(this, vt).connect(), this.state = "connected", Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", Q(this, _t)), u(Q(this, vt));
|
|
7286
7286
|
}));
|
|
7287
7287
|
/**
|
|
7288
7288
|
* 关闭
|
|
7289
7289
|
*/
|
|
7290
7290
|
Z(this, "close", async () => {
|
|
7291
7291
|
var u;
|
|
7292
|
-
|
|
7293
|
-
const I = Object.keys(
|
|
7292
|
+
Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
|
|
7293
|
+
const I = Object.keys(Q(this, yt));
|
|
7294
7294
|
for (const E of I) {
|
|
7295
|
-
const { destructionTimer: _ } =
|
|
7295
|
+
const { destructionTimer: _ } = Q(this, yt)[E];
|
|
7296
7296
|
clearTimeout(_);
|
|
7297
7297
|
}
|
|
7298
|
-
wt(this,
|
|
7298
|
+
wt(this, yt, {}), await ((u = Q(this, vt)) == null ? void 0 : u.close()), wt(this, vt, void 0), this.state = "closed";
|
|
7299
7299
|
});
|
|
7300
7300
|
/**
|
|
7301
7301
|
* 发送消息
|
|
@@ -7308,14 +7308,14 @@ class CallsWebSocket {
|
|
|
7308
7308
|
event: k,
|
|
7309
7309
|
sn: +`${n}${F(1e3, 9999)}`,
|
|
7310
7310
|
time: n,
|
|
7311
|
-
valid:
|
|
7311
|
+
valid: Q(this, ut).timeout,
|
|
7312
7312
|
version: 1,
|
|
7313
7313
|
compress: !1,
|
|
7314
7314
|
...e
|
|
7315
7315
|
});
|
|
7316
|
-
|
|
7316
|
+
Q(this, ut).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) || Q(this, Et).call(this, "req", O)), u && Q(this, Mt).call(this, O, { resolve: E, reject: _ });
|
|
7317
7317
|
const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
|
|
7318
|
-
(N =
|
|
7318
|
+
(N = Q(this, vt)) == null || N.sendMessage($);
|
|
7319
7319
|
}));
|
|
7320
7320
|
/**
|
|
7321
7321
|
* 触发广播事件
|
|
@@ -7323,7 +7323,7 @@ class CallsWebSocket {
|
|
|
7323
7323
|
* @param result 事件响应值
|
|
7324
7324
|
*/
|
|
7325
7325
|
Z(this, "emitNotify", async (I, u) => {
|
|
7326
|
-
const E =
|
|
7326
|
+
const E = Q(this, _t)[I] || [];
|
|
7327
7327
|
for (const _ of E) {
|
|
7328
7328
|
const { callback: k = async () => {
|
|
7329
7329
|
} } = _;
|
|
@@ -7338,8 +7338,8 @@ class CallsWebSocket {
|
|
|
7338
7338
|
*/
|
|
7339
7339
|
Z(this, "addNotify", (I, u = !1) => {
|
|
7340
7340
|
const { event: E, sn: _ = ht(32) } = I;
|
|
7341
|
-
|
|
7342
|
-
const k =
|
|
7341
|
+
Q(this, _t)[E] || (Q(this, _t)[E] = []);
|
|
7342
|
+
const k = Q(this, _t)[E], e = k.findIndex((n) => n.sn === _);
|
|
7343
7343
|
return e !== -1 && k.splice(e, 1), u ? k.unshift(I) : k.push(I), _;
|
|
7344
7344
|
});
|
|
7345
7345
|
/**
|
|
@@ -7347,18 +7347,18 @@ class CallsWebSocket {
|
|
|
7347
7347
|
*/
|
|
7348
7348
|
Z(this, "removeNotify", (I = []) => {
|
|
7349
7349
|
if (I.length === 0)
|
|
7350
|
-
wt(this,
|
|
7350
|
+
wt(this, _t, {});
|
|
7351
7351
|
else {
|
|
7352
|
-
const u = Object.keys(
|
|
7352
|
+
const u = Object.keys(Q(this, _t));
|
|
7353
7353
|
for (const E of u)
|
|
7354
|
-
|
|
7354
|
+
Q(this, _t)[E] = Q(this, _t)[E].filter((_) => !I.includes(_.sn || ""));
|
|
7355
7355
|
}
|
|
7356
|
-
|
|
7356
|
+
Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", Q(this, _t));
|
|
7357
7357
|
});
|
|
7358
|
-
wt(this, ut, { ...
|
|
7358
|
+
wt(this, ut, { ...Q(this, ut), ...I });
|
|
7359
7359
|
}
|
|
7360
7360
|
}
|
|
7361
|
-
|
|
7361
|
+
vt = new WeakMap(), ut = new WeakMap(), Rt = new WeakMap(), yt = new WeakMap(), _t = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap(), Ut = new WeakMap(), Et = new WeakMap(), Mt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap();
|
|
7362
7362
|
var y = Object.defineProperty, x = (a) => {
|
|
7363
7363
|
throw TypeError(a);
|
|
7364
7364
|
}, 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;
|
|
@@ -7414,6 +7414,7 @@ class K {
|
|
|
7414
7414
|
}
|
|
7415
7415
|
}
|
|
7416
7416
|
d = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
|
|
7417
|
+
var Lt;
|
|
7417
7418
|
class RoomBase {
|
|
7418
7419
|
constructor() {
|
|
7419
7420
|
Z(this, "options", {
|
|
@@ -7425,7 +7426,6 @@ class RoomBase {
|
|
|
7425
7426
|
debug: !1,
|
|
7426
7427
|
newPublishAutoSubscribe: !0
|
|
7427
7428
|
});
|
|
7428
|
-
Z(this, "localStreamActiveMap", /* @__PURE__ */ new Map());
|
|
7429
7429
|
Z(this, "prohibitNotify", !1);
|
|
7430
7430
|
// 是否禁止通知
|
|
7431
7431
|
Z(this, "isEarly", !1);
|
|
@@ -7440,8 +7440,11 @@ class RoomBase {
|
|
|
7440
7440
|
// SDK通讯实例 // SDK通讯实例
|
|
7441
7441
|
Z(this, "peerIns", new RTCPeerConnection({ bundlePolicy: "max-bundle" }));
|
|
7442
7442
|
Z(this, "transceiverMap", /* @__PURE__ */ new Map());
|
|
7443
|
+
// 本地发射器
|
|
7443
7444
|
Z(this, "userMap", /* @__PURE__ */ new Map());
|
|
7444
7445
|
// 用户
|
|
7446
|
+
Z(this, "setLocalStreamActiveMap", /* @__PURE__ */ new Map());
|
|
7447
|
+
// 本地数据是否已开启调用
|
|
7445
7448
|
// 设备错误信息
|
|
7446
7449
|
Z(this, "mediaDevicesErrInfo", {
|
|
7447
7450
|
microphoneCamera_audio: "",
|
|
@@ -7449,8 +7452,8 @@ class RoomBase {
|
|
|
7449
7452
|
screenSharing_video: "",
|
|
7450
7453
|
screenSharing_audio: ""
|
|
7451
7454
|
});
|
|
7452
|
-
|
|
7453
|
-
this.taskQueue.
|
|
7455
|
+
at(this, Lt, () => {
|
|
7456
|
+
this.taskQueue.setCondition("createWs", !0), this.taskQueue.setCondition("createSession", !1), this.taskQueue.setCondition("ice", !1);
|
|
7454
7457
|
});
|
|
7455
7458
|
/**
|
|
7456
7459
|
* 获取房间信息
|
|
@@ -7548,71 +7551,33 @@ class RoomBase {
|
|
|
7548
7551
|
* 处理为应用层数据
|
|
7549
7552
|
*/
|
|
7550
7553
|
Z(this, "usersFilter", (I) => ft(I, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "permissions", "isPublished", "updateStreams"]).sort((_, k) => _.id.localeCompare(k.id, "en")));
|
|
7551
|
-
|
|
7554
|
+
Q(this, Lt).call(this);
|
|
7552
7555
|
}
|
|
7553
7556
|
}
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
I.type = "sine", I.frequency.setValueAtTime(0, a.currentTime);
|
|
7557
|
-
const u = a.createGain();
|
|
7558
|
-
u.gain.value = 0, I.connect(u), u.connect(a.destination), I.start();
|
|
7559
|
-
const E = a.createMediaStreamDestination();
|
|
7560
|
-
return u.disconnect(), I.connect(E), E.stream;
|
|
7561
|
-
}, createFakeVideoStream = (a = 10, I = 10, u = 30) => {
|
|
7562
|
-
const E = document.createElement("canvas"), _ = E.getContext("2d");
|
|
7563
|
-
E.width = a, E.height = I;
|
|
7564
|
-
let k = 0;
|
|
7565
|
-
return setInterval(() => {
|
|
7566
|
-
_.clearRect(0, 0, E.width, E.height);
|
|
7567
|
-
const O = _.createLinearGradient(0, 0, E.width, E.height);
|
|
7568
|
-
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;
|
|
7569
|
-
}, 100), E.captureStream(u);
|
|
7570
|
-
};
|
|
7571
|
-
var bt, vt, _t, St, Pt, Bt, Lt, $t, jt;
|
|
7557
|
+
Lt = new WeakMap();
|
|
7558
|
+
var $t, kt, dt, bt, jt, Zt, Tt, Ft;
|
|
7572
7559
|
class RoomMedias extends RoomBase {
|
|
7573
|
-
//
|
|
7560
|
+
// 媒体流上下文
|
|
7574
7561
|
constructor() {
|
|
7575
7562
|
super();
|
|
7576
|
-
|
|
7563
|
+
at(this, $t, []);
|
|
7577
7564
|
// 可用媒体设备列表
|
|
7578
|
-
at(this,
|
|
7565
|
+
at(this, kt, /* @__PURE__ */ new Map());
|
|
7579
7566
|
// 媒体流设备管理
|
|
7580
|
-
at(this,
|
|
7567
|
+
at(this, dt, /* @__PURE__ */ new Map());
|
|
7581
7568
|
// 媒体轨道参数管理
|
|
7582
|
-
at(this,
|
|
7583
|
-
// 媒体流上下文
|
|
7584
|
-
at(this, St, /* @__PURE__ */ new Map());
|
|
7585
|
-
// 初始化假数据流
|
|
7586
|
-
at(this, Pt, () => {
|
|
7587
|
-
for (const u of mediaType_keys)
|
|
7588
|
-
switch (u) {
|
|
7589
|
-
case "microphoneCamera_audio":
|
|
7590
|
-
V(this, St).set("microphoneCamera_audio", createMutedAudioStream());
|
|
7591
|
-
break;
|
|
7592
|
-
case "microphoneCamera_video":
|
|
7593
|
-
V(this, St).set("microphoneCamera_video", createFakeVideoStream());
|
|
7594
|
-
break;
|
|
7595
|
-
case "screenSharing_audio":
|
|
7596
|
-
V(this, St).set("screenSharing_audio", createMutedAudioStream());
|
|
7597
|
-
break;
|
|
7598
|
-
case "screenSharing_video":
|
|
7599
|
-
V(this, St).set("screenSharing_video", createFakeVideoStream());
|
|
7600
|
-
break;
|
|
7601
|
-
}
|
|
7602
|
-
});
|
|
7603
|
-
// 获取假数据流
|
|
7604
|
-
Z(this, "getPhoneyStreams", (u) => V(this, St).get(u));
|
|
7569
|
+
at(this, bt, /* @__PURE__ */ new Map());
|
|
7605
7570
|
/**
|
|
7606
7571
|
* 初始化媒体参数
|
|
7607
7572
|
*/
|
|
7608
|
-
at(this,
|
|
7609
|
-
|
|
7573
|
+
at(this, jt, () => {
|
|
7574
|
+
Q(this, dt).set("microphoneCamera_audio", {}), Q(this, dt).set("microphoneCamera_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), Q(this, dt).set("screenSharing_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), Q(this, dt).set("screenSharing_audio", {});
|
|
7610
7575
|
});
|
|
7611
7576
|
/**
|
|
7612
7577
|
* 初始化媒体设备类型
|
|
7613
7578
|
*/
|
|
7614
|
-
at(this,
|
|
7615
|
-
|
|
7579
|
+
at(this, Zt, () => {
|
|
7580
|
+
Q(this, kt).set("audioinput", "default"), Q(this, kt).set("videoinput", "default"), Q(this, kt).set("audiooutput", "default");
|
|
7616
7581
|
});
|
|
7617
7582
|
/**
|
|
7618
7583
|
* 房间所有用户所有媒体流变化
|
|
@@ -7637,14 +7602,14 @@ class RoomMedias extends RoomBase {
|
|
|
7637
7602
|
case "audio":
|
|
7638
7603
|
{
|
|
7639
7604
|
const $ = new AudioMediaContext(k);
|
|
7640
|
-
|
|
7605
|
+
Q(this, bt).set(e, $);
|
|
7641
7606
|
}
|
|
7642
7607
|
break;
|
|
7643
7608
|
// 视频媒体处理
|
|
7644
7609
|
case "video":
|
|
7645
7610
|
{
|
|
7646
7611
|
const $ = new VideoMediaContext(k);
|
|
7647
|
-
|
|
7612
|
+
Q(this, bt).set(e, $);
|
|
7648
7613
|
}
|
|
7649
7614
|
break;
|
|
7650
7615
|
}
|
|
@@ -7652,7 +7617,7 @@ class RoomMedias extends RoomBase {
|
|
|
7652
7617
|
const $ = this.getUserMediaStreamContext(u, E);
|
|
7653
7618
|
if ($ && $.kind === "audio")
|
|
7654
7619
|
try {
|
|
7655
|
-
const N =
|
|
7620
|
+
const N = Q(this, kt).get("audiooutput");
|
|
7656
7621
|
(O = $.audioContext) == null || O.setSinkId(N);
|
|
7657
7622
|
} catch (N) {
|
|
7658
7623
|
console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setSinkId is error", N);
|
|
@@ -7664,21 +7629,21 @@ class RoomMedias extends RoomBase {
|
|
|
7664
7629
|
*/
|
|
7665
7630
|
Z(this, "getUserMediaStreamContext", (u, E) => {
|
|
7666
7631
|
const _ = this.getUserMediaKey(u, E);
|
|
7667
|
-
return
|
|
7632
|
+
return Q(this, bt).get(_);
|
|
7668
7633
|
});
|
|
7669
7634
|
/**
|
|
7670
7635
|
* 获取用户音频媒体流上下文
|
|
7671
7636
|
*/
|
|
7672
7637
|
Z(this, "getUserAudioMediaStreamContext", (u, E) => {
|
|
7673
7638
|
const _ = this.getUserMediaKey(u, E);
|
|
7674
|
-
return
|
|
7639
|
+
return Q(this, bt).get(_);
|
|
7675
7640
|
});
|
|
7676
7641
|
/**
|
|
7677
7642
|
* 删除用户媒体流上下文
|
|
7678
7643
|
*/
|
|
7679
7644
|
Z(this, "removeUserMediaStreamContext", (u, E) => {
|
|
7680
|
-
const _ = this.getUserMediaKey(u, E), k =
|
|
7681
|
-
k == null || k.stop(),
|
|
7645
|
+
const _ = this.getUserMediaKey(u, E), k = Q(this, bt).get(_);
|
|
7646
|
+
k == null || k.stop(), Q(this, bt).delete(_);
|
|
7682
7647
|
});
|
|
7683
7648
|
/**
|
|
7684
7649
|
* 获取某个用户的某个数据流
|
|
@@ -7711,16 +7676,16 @@ class RoomMedias extends RoomBase {
|
|
|
7711
7676
|
* 清除所有媒体流使用
|
|
7712
7677
|
*/
|
|
7713
7678
|
Z(this, "clearUserStreams", () => {
|
|
7714
|
-
const u =
|
|
7679
|
+
const u = Q(this, bt).values();
|
|
7715
7680
|
for (const E of u)
|
|
7716
7681
|
E.stop();
|
|
7717
|
-
wt(this,
|
|
7682
|
+
wt(this, bt, /* @__PURE__ */ new Map());
|
|
7718
7683
|
});
|
|
7719
7684
|
/**
|
|
7720
7685
|
* 设置轨道媒体参数
|
|
7721
7686
|
*/
|
|
7722
7687
|
Z(this, "setMediaTrackConstraints", async (u, E) => {
|
|
7723
|
-
|
|
7688
|
+
Q(this, dt).set(u, E);
|
|
7724
7689
|
const k = this.getUserStream(this.options.userId, u).getTracks();
|
|
7725
7690
|
if (k.length !== 0)
|
|
7726
7691
|
for (const e of k) {
|
|
@@ -7732,75 +7697,115 @@ class RoomMedias extends RoomBase {
|
|
|
7732
7697
|
* 初始化本地流
|
|
7733
7698
|
*/
|
|
7734
7699
|
Z(this, "initLocalStream", async (u) => {
|
|
7735
|
-
|
|
7736
|
-
|
|
7700
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: initLocalStream", u);
|
|
7701
|
+
const { userId: E } = this.options;
|
|
7702
|
+
switch (u) {
|
|
7737
7703
|
// 麦克风
|
|
7738
7704
|
case "microphoneCamera_audio":
|
|
7739
7705
|
{
|
|
7740
|
-
|
|
7706
|
+
this.removeUserMediaStreamContext(E, "microphoneCamera_audio");
|
|
7707
|
+
const _ = Q(this, kt).get("audioinput"), k = Q(this, dt).get("microphoneCamera_audio"), e = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...k }, video: !1 });
|
|
7741
7708
|
await this.initUserMediaStreamContext(E, "microphoneCamera_audio", e);
|
|
7742
7709
|
}
|
|
7743
7710
|
break;
|
|
7744
7711
|
// 摄像头
|
|
7745
7712
|
case "microphoneCamera_video":
|
|
7746
7713
|
{
|
|
7747
|
-
|
|
7714
|
+
this.removeUserMediaStreamContext(E, "microphoneCamera_video");
|
|
7715
|
+
const _ = Q(this, kt).get("videoinput"), k = Q(this, dt).get("microphoneCamera_video"), e = await navigator.mediaDevices.getUserMedia({ audio: !1, video: { deviceId: _, ...k } });
|
|
7748
7716
|
await this.initUserMediaStreamContext(E, "microphoneCamera_video", e);
|
|
7749
7717
|
}
|
|
7750
7718
|
break;
|
|
7719
|
+
// 麦克风 + 摄像头
|
|
7720
|
+
case "microphoneCamera":
|
|
7721
|
+
{
|
|
7722
|
+
this.removeUserMediaStreamContext(E, "microphoneCamera_audio"), this.removeUserMediaStreamContext(E, "microphoneCamera_video");
|
|
7723
|
+
const _ = Q(this, kt).get("audioinput"), k = Q(this, kt).get("videoinput"), e = Q(this, dt).get("microphoneCamera_audio"), n = Q(this, dt).get("microphoneCamera_video"), O = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...e }, video: { deviceId: k, ...n } });
|
|
7724
|
+
await this.initUserMediaStreamContext(E, "microphoneCamera_audio", O);
|
|
7725
|
+
}
|
|
7726
|
+
break;
|
|
7751
7727
|
// 屏幕共享 音频
|
|
7752
7728
|
case "screenSharing_audio":
|
|
7753
7729
|
{
|
|
7754
|
-
|
|
7730
|
+
this.removeUserMediaStreamContext(E, "screenSharing_audio");
|
|
7731
|
+
const _ = Q(this, dt).get("screenSharing_audio"), e = (await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._ })).getTracks();
|
|
7755
7732
|
for (const n of e) {
|
|
7756
|
-
const { kind: O } = n
|
|
7757
|
-
|
|
7733
|
+
const { kind: O } = n;
|
|
7734
|
+
if (O === "audio") {
|
|
7735
|
+
const $ = new MediaStream();
|
|
7736
|
+
$.addTrack(n), await this.initUserMediaStreamContext(E, "screenSharing_audio", $);
|
|
7737
|
+
}
|
|
7758
7738
|
}
|
|
7759
7739
|
}
|
|
7760
7740
|
break;
|
|
7761
7741
|
// 屏幕共享 视频
|
|
7762
7742
|
case "screenSharing_video":
|
|
7763
7743
|
{
|
|
7764
|
-
|
|
7765
|
-
|
|
7744
|
+
this.removeUserMediaStreamContext(E, u);
|
|
7745
|
+
const _ = Q(this, dt).get(u), e = (await navigator.mediaDevices.getDisplayMedia({ audio: !1, video: !0, ..._ })).getTracks();
|
|
7746
|
+
for (const n of e) {
|
|
7747
|
+
const { kind: O } = n;
|
|
7748
|
+
if (O === "video") {
|
|
7749
|
+
const $ = new MediaStream();
|
|
7750
|
+
$.addTrack(n), await this.initUserMediaStreamContext(E, "screenSharing_video", $);
|
|
7751
|
+
}
|
|
7752
|
+
}
|
|
7753
|
+
}
|
|
7754
|
+
break;
|
|
7755
|
+
// 屏幕共享 音频+视频
|
|
7756
|
+
case "screenSharing":
|
|
7757
|
+
{
|
|
7758
|
+
this.removeUserMediaStreamContext(E, "screenSharing_audio"), this.removeUserMediaStreamContext(E, "screenSharing_video");
|
|
7759
|
+
const _ = Q(this, dt).get("screenSharing_audio"), k = Q(this, dt).get("screenSharing_video"), n = (await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._, ...k })).getTracks();
|
|
7760
|
+
for (const O of n) {
|
|
7761
|
+
const { kind: $ } = O;
|
|
7762
|
+
if ($ === "audio") {
|
|
7763
|
+
const N = new MediaStream();
|
|
7764
|
+
N.addTrack(O), await this.initUserMediaStreamContext(E, "screenSharing_audio", N);
|
|
7765
|
+
}
|
|
7766
|
+
if ($ === "video") {
|
|
7767
|
+
const N = new MediaStream();
|
|
7768
|
+
N.addTrack(O), await this.initUserMediaStreamContext(E, "screenSharing_video", N);
|
|
7769
|
+
}
|
|
7770
|
+
}
|
|
7766
7771
|
}
|
|
7767
7772
|
break;
|
|
7768
7773
|
}
|
|
7769
7774
|
{
|
|
7770
|
-
const
|
|
7771
|
-
this.cwsIns.emitNotify("onLocalStream", { code: 200, data:
|
|
7775
|
+
const _ = this.getUserStreams(E);
|
|
7776
|
+
this.cwsIns.emitNotify("onLocalStream", { code: 200, data: _, desc: "local stream is change." }), this.emitNotifyUpdateUsersStreams([{ userId: E, updateStreams: { [u]: !0 } }]);
|
|
7772
7777
|
}
|
|
7773
7778
|
});
|
|
7774
7779
|
/**
|
|
7775
7780
|
* 获取媒体设备列表
|
|
7776
7781
|
*/
|
|
7777
|
-
at(this,
|
|
7778
|
-
this
|
|
7782
|
+
at(this, Tt, 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) => {
|
|
7783
|
+
wt(this, $t, u);
|
|
7779
7784
|
}).catch(function(u) {
|
|
7780
7785
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", u);
|
|
7781
|
-
}), this
|
|
7786
|
+
}), Q(this, $t)));
|
|
7782
7787
|
/**
|
|
7783
7788
|
* 媒体设备发生变化
|
|
7784
7789
|
*/
|
|
7785
|
-
at(this,
|
|
7790
|
+
at(this, Ft, () => {
|
|
7786
7791
|
navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
|
|
7787
|
-
await
|
|
7788
|
-
}),
|
|
7792
|
+
await Q(this, Tt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
|
|
7793
|
+
}), Q(this, Tt).call(this);
|
|
7789
7794
|
});
|
|
7790
7795
|
/**
|
|
7791
7796
|
* 获取正在使用的媒体设备ID
|
|
7792
7797
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7793
7798
|
* @returns deviceId 设备ID
|
|
7794
7799
|
*/
|
|
7795
|
-
Z(this, "getMediaDeviceKind", (u) =>
|
|
7800
|
+
Z(this, "getMediaDeviceKind", (u) => Q(this, kt).get(u));
|
|
7796
7801
|
/**
|
|
7797
7802
|
* 设置正在使用的媒体设备
|
|
7798
7803
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7799
7804
|
* @param deviceId 设备ID
|
|
7800
7805
|
*/
|
|
7801
7806
|
Z(this, "setDeviceKind", async (u, E) => {
|
|
7802
|
-
if (
|
|
7803
|
-
const _ =
|
|
7807
|
+
if (Q(this, kt).set(u, E), u === "audiooutput") {
|
|
7808
|
+
const _ = Q(this, bt).values();
|
|
7804
7809
|
for (const k of _)
|
|
7805
7810
|
k.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype && k.audioContext.setSinkId(E);
|
|
7806
7811
|
}
|
|
@@ -7816,7 +7821,7 @@ class RoomMedias extends RoomBase {
|
|
|
7816
7821
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7817
7822
|
* @returns MediaDeviceInfo[]
|
|
7818
7823
|
*/
|
|
7819
|
-
Z(this, "getEnumerateDevices", async (u) => (await
|
|
7824
|
+
Z(this, "getEnumerateDevices", async (u) => (await Q(this, Tt).call(this), Q(this, $t).filter((_) => _.kind === u)));
|
|
7820
7825
|
/**
|
|
7821
7826
|
* 获取可用音频输入设备
|
|
7822
7827
|
* @returns MediaDeviceInfo[]
|
|
@@ -7832,10 +7837,10 @@ class RoomMedias extends RoomBase {
|
|
|
7832
7837
|
* @returns MediaDeviceInfo[]
|
|
7833
7838
|
*/
|
|
7834
7839
|
Z(this, "getEnumerateVideoinputDevices", () => this.getEnumerateDevices("videoinput"));
|
|
7835
|
-
|
|
7840
|
+
Q(this, Ft).call(this), Q(this, Zt).call(this), Q(this, jt).call(this);
|
|
7836
7841
|
}
|
|
7837
7842
|
}
|
|
7838
|
-
|
|
7843
|
+
$t = new WeakMap(), kt = new WeakMap(), dt = new WeakMap(), bt = new WeakMap(), jt = new WeakMap(), Zt = new WeakMap(), Tt = new WeakMap(), Ft = new WeakMap();
|
|
7839
7844
|
class RoomUsers extends RoomMedias {
|
|
7840
7845
|
constructor() {
|
|
7841
7846
|
super();
|
|
@@ -8122,10 +8127,29 @@ class RoomUsers extends RoomMedias {
|
|
|
8122
8127
|
});
|
|
8123
8128
|
}
|
|
8124
8129
|
}
|
|
8125
|
-
|
|
8130
|
+
const createMutedAudioStream = () => {
|
|
8131
|
+
const a = new AudioContext(), I = a.createOscillator();
|
|
8132
|
+
I.type = "sine", I.frequency.setValueAtTime(0, a.currentTime);
|
|
8133
|
+
const u = a.createGain();
|
|
8134
|
+
u.gain.value = 0, I.connect(u), u.connect(a.destination), I.start();
|
|
8135
|
+
const E = a.createMediaStreamDestination();
|
|
8136
|
+
return u.disconnect(), I.connect(E), E.stream;
|
|
8137
|
+
}, createFakeVideoStream = (a = 10, I = 10, u = 30) => {
|
|
8138
|
+
const E = document.createElement("canvas"), _ = E.getContext("2d");
|
|
8139
|
+
E.width = a, E.height = I;
|
|
8140
|
+
let k = 0;
|
|
8141
|
+
return setInterval(() => {
|
|
8142
|
+
_.clearRect(0, 0, E.width, E.height);
|
|
8143
|
+
const O = _.createLinearGradient(0, 0, E.width, E.height);
|
|
8144
|
+
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;
|
|
8145
|
+
}, 100), E.captureStream(u);
|
|
8146
|
+
};
|
|
8147
|
+
var St, Ht, xt, zt, Jt, Wt;
|
|
8126
8148
|
class RoomPeer extends RoomUsers {
|
|
8127
8149
|
constructor() {
|
|
8128
8150
|
super();
|
|
8151
|
+
at(this, St, /* @__PURE__ */ new Map());
|
|
8152
|
+
// 假媒体流 (创建轨道用)
|
|
8129
8153
|
Z(this, "getPeerStatsTimer", 0);
|
|
8130
8154
|
// 获取报告的定时器
|
|
8131
8155
|
Z(this, "reports", []);
|
|
@@ -8142,22 +8166,29 @@ class RoomPeer extends RoomUsers {
|
|
|
8142
8166
|
jitter: "0"
|
|
8143
8167
|
// 网络抖动
|
|
8144
8168
|
});
|
|
8145
|
-
Z(this, "connectedResolveMap", /* @__PURE__ */ new Map());
|
|
8146
8169
|
Z(this, "initPeer", () => {
|
|
8147
|
-
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(),
|
|
8170
|
+
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), Q(this, zt).call(this), Q(this, Wt).call(this);
|
|
8148
8171
|
});
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8172
|
+
// 初始化假数据流
|
|
8173
|
+
at(this, Ht, () => {
|
|
8174
|
+
for (const u of mediaType_keys)
|
|
8175
|
+
switch (u) {
|
|
8176
|
+
case "microphoneCamera_audio":
|
|
8177
|
+
Q(this, St).set("microphoneCamera_audio", createMutedAudioStream());
|
|
8178
|
+
break;
|
|
8179
|
+
case "microphoneCamera_video":
|
|
8180
|
+
Q(this, St).set("microphoneCamera_video", createFakeVideoStream());
|
|
8181
|
+
break;
|
|
8182
|
+
case "screenSharing_audio":
|
|
8183
|
+
Q(this, St).set("screenSharing_audio", createMutedAudioStream());
|
|
8184
|
+
break;
|
|
8185
|
+
case "screenSharing_video":
|
|
8186
|
+
Q(this, St).set("screenSharing_video", createFakeVideoStream());
|
|
8187
|
+
break;
|
|
8188
|
+
}
|
|
8160
8189
|
});
|
|
8190
|
+
// 获取假数据流
|
|
8191
|
+
at(this, xt, (u) => Q(this, St).get(u));
|
|
8161
8192
|
/**
|
|
8162
8193
|
* 替换发射器媒体流
|
|
8163
8194
|
*/
|
|
@@ -8169,7 +8200,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8169
8200
|
let n;
|
|
8170
8201
|
if (e) {
|
|
8171
8202
|
const { sender: O } = e;
|
|
8172
|
-
E ? n = this.getUserStream(_, k) : n = this.
|
|
8203
|
+
E ? n = this.getUserStream(_, k) : n = Q(this, xt).call(this, k);
|
|
8173
8204
|
const [$] = n.getTracks();
|
|
8174
8205
|
O.replaceTrack($);
|
|
8175
8206
|
}
|
|
@@ -8198,14 +8229,14 @@ class RoomPeer extends RoomUsers {
|
|
|
8198
8229
|
const E = [];
|
|
8199
8230
|
for (const _ of u) {
|
|
8200
8231
|
if (this.transceiverMap.has(_)) continue;
|
|
8201
|
-
const k = this.
|
|
8232
|
+
const k = Q(this, xt).call(this, _), [e] = k.getTracks(), n = this.peerIns.addTransceiver(e, { direction: "sendonly" });
|
|
8202
8233
|
this.transceiverMap.set(_, n), E.push(_);
|
|
8203
8234
|
}
|
|
8204
8235
|
if (u.length === 0 || E.length) {
|
|
8205
8236
|
const _ = await this.peerIns.createOffer();
|
|
8206
8237
|
if (this.options.debug) {
|
|
8207
8238
|
const k = libExports.parse(_.sdp), e = ft(k.media, ["mid", "msid", "type"]);
|
|
8208
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->
|
|
8239
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->quickvo: setLocalDescription", { msidArr: e, sdpJson: k, description: _ });
|
|
8209
8240
|
}
|
|
8210
8241
|
await this.peerIns.setLocalDescription(_);
|
|
8211
8242
|
}
|
|
@@ -8225,7 +8256,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8225
8256
|
const u = await this.getAllUserTrackMids(), E = this.peerIns.getTransceivers();
|
|
8226
8257
|
for (const _ of E) {
|
|
8227
8258
|
const { mid: k } = _;
|
|
8228
|
-
Number(k) === 0 || u.includes(k) || (_.stop(), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->
|
|
8259
|
+
Number(k) === 0 || u.includes(k) || (_.stop(), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: clearTransceivers: ${k} is stop.`, _));
|
|
8229
8260
|
}
|
|
8230
8261
|
});
|
|
8231
8262
|
/**
|
|
@@ -8251,8 +8282,8 @@ class RoomPeer extends RoomUsers {
|
|
|
8251
8282
|
const { userId: q, mediaType: P } = D;
|
|
8252
8283
|
if (!q || !P) continue;
|
|
8253
8284
|
$.has(q) || $.set(q, { userId: q, tracks: [], updateStreams: {} });
|
|
8254
|
-
const
|
|
8255
|
-
|
|
8285
|
+
const V = $.get(q);
|
|
8286
|
+
V.tracks.push(D), V.updateStreams[P] = !0;
|
|
8256
8287
|
}
|
|
8257
8288
|
const N = [...$.values()];
|
|
8258
8289
|
for (const D of N) {
|
|
@@ -8261,7 +8292,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8261
8292
|
}
|
|
8262
8293
|
await this.emitNotifyUpdateUsersStreams(N), this.peerIns.removeEventListener("track", O), _(!0);
|
|
8263
8294
|
}, O = async ($) => {
|
|
8264
|
-
const { streams: N, transceiver: D } = $, [q] = N, { mid: P, receiver: j } = D, { track:
|
|
8295
|
+
const { streams: N, transceiver: D } = $, [q] = N, { mid: P, receiver: j } = D, { track: V } = j, { id: J, kind: z } = V, Y = k.find((nt) => nt.mid === `${P}`);
|
|
8265
8296
|
if (!Y) return;
|
|
8266
8297
|
const { userId: et, mediaType: tt } = Y;
|
|
8267
8298
|
if (!(!et || !tt)) {
|
|
@@ -8273,7 +8304,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8273
8304
|
const nt = { ...Y, mid: P, msid: J };
|
|
8274
8305
|
e.push(nt);
|
|
8275
8306
|
}
|
|
8276
|
-
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#00b60f;", `------->
|
|
8307
|
+
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();
|
|
8277
8308
|
}
|
|
8278
8309
|
};
|
|
8279
8310
|
this.peerIns.addEventListener("track", O), E = setTimeout(() => n(), 5 * 1e3);
|
|
@@ -8283,7 +8314,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8283
8314
|
/**
|
|
8284
8315
|
* 监听webrtc ice通讯连接
|
|
8285
8316
|
*/
|
|
8286
|
-
at(this,
|
|
8317
|
+
at(this, zt, () => {
|
|
8287
8318
|
let u = 0;
|
|
8288
8319
|
const E = () => {
|
|
8289
8320
|
this.setRoomState("closed");
|
|
@@ -8335,14 +8366,14 @@ class RoomPeer extends RoomUsers {
|
|
|
8335
8366
|
const O = this.peerIns.getTransceivers();
|
|
8336
8367
|
for (const $ of O) {
|
|
8337
8368
|
const { sender: N, receiver: D } = $;
|
|
8338
|
-
N.track && e(N.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->
|
|
8369
|
+
N.track && e(N.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: sender: ${N.track.id} is stop.`, $), N.track.enabled = !1, N.track.stop(), this.peerIns.removeTrack(N), $.stop()), D.track && e(D.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: receiver: ${D.track.id} is stop.`, $), D.track.enabled = !1, D.track.stop(), $.stop());
|
|
8339
8370
|
}
|
|
8340
8371
|
});
|
|
8341
8372
|
Z(this, "createOffer", async () => {
|
|
8342
8373
|
const u = await this.peerIns.createOffer();
|
|
8343
8374
|
if (this.options.debug) {
|
|
8344
8375
|
const E = libExports.parse(u.sdp), _ = ft(E.media, ["mid", "msid", "type"]);
|
|
8345
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->
|
|
8376
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->quickvo: createOffer", { msidArr: _, sdpJson: E, description: u });
|
|
8346
8377
|
}
|
|
8347
8378
|
await this.peerIns.setLocalDescription(u);
|
|
8348
8379
|
});
|
|
@@ -8350,7 +8381,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8350
8381
|
const u = await this.peerIns.createAnswer();
|
|
8351
8382
|
if (this.options.debug) {
|
|
8352
8383
|
const E = libExports.parse(u.sdp), _ = ft(E.media, ["mid", "msid", "type"]);
|
|
8353
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->
|
|
8384
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->quickvo: createAnswer", { msidArr: _, sdpJson: E, description: u });
|
|
8354
8385
|
}
|
|
8355
8386
|
await this.peerIns.setLocalDescription(u);
|
|
8356
8387
|
});
|
|
@@ -8367,7 +8398,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8367
8398
|
Z(this, "setRemoteDescription", async (u) => {
|
|
8368
8399
|
if (this.options.debug) {
|
|
8369
8400
|
const E = libExports.parse(u.sdp), _ = ft(E.media, ["mid", "msid", "type"]);
|
|
8370
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->
|
|
8401
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ffffff;", "------->quickvo: setRemoteDescription", { msidArr: _, sdpJson: E, description: u });
|
|
8371
8402
|
}
|
|
8372
8403
|
return await this.peerIns.setRemoteDescription(u), u;
|
|
8373
8404
|
});
|
|
@@ -8432,7 +8463,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8432
8463
|
/**
|
|
8433
8464
|
* 计算网络质量
|
|
8434
8465
|
*/
|
|
8435
|
-
at(this,
|
|
8466
|
+
at(this, Jt, async () => {
|
|
8436
8467
|
try {
|
|
8437
8468
|
const u = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...u.values()].filter((nt) => E.includes(nt.type));
|
|
8438
8469
|
let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
|
|
@@ -8446,7 +8477,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8446
8477
|
lt && (e = lt), it && (n = it), st && (N += st), ct && (D += ct), rt && q.push((rt * 100).toFixed(2)), ot && P.push(ot.toFixed(2));
|
|
8447
8478
|
}
|
|
8448
8479
|
P.sort().reverse(), q.sort().reverse();
|
|
8449
|
-
const j = N - O,
|
|
8480
|
+
const j = N - O, V = D - $, J = j === 0 ? "0.00" : (V / j).toFixed(2), [z = "0"] = q, [Y = "0"] = P, et = { inboundBytes: e, outboundBytes: n, lostRate: J, roundTripTime: z, jitter: Y };
|
|
8450
8481
|
this.peerNetwork = et;
|
|
8451
8482
|
const tt = (nt, lt, it) => {
|
|
8452
8483
|
const st = Number(nt), ct = Number(lt), ot = Number(it);
|
|
@@ -8462,15 +8493,15 @@ class RoomPeer extends RoomUsers {
|
|
|
8462
8493
|
}
|
|
8463
8494
|
}
|
|
8464
8495
|
} catch (u) {
|
|
8465
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->
|
|
8496
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setNetQuality is err.", u);
|
|
8466
8497
|
}
|
|
8467
8498
|
});
|
|
8468
8499
|
/**
|
|
8469
8500
|
* 获取连接的所有轨道分析数据
|
|
8470
8501
|
*/
|
|
8471
|
-
at(this,
|
|
8502
|
+
at(this, Wt, () => {
|
|
8472
8503
|
const u = async () => {
|
|
8473
|
-
this.peerIns.connectionState !== "connected" || !this.options.roomId ||
|
|
8504
|
+
this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this, Jt).call(this);
|
|
8474
8505
|
};
|
|
8475
8506
|
this.getPeerStatsTimer = setInterval(u, 1 * 1e3);
|
|
8476
8507
|
});
|
|
@@ -8478,10 +8509,11 @@ class RoomPeer extends RoomUsers {
|
|
|
8478
8509
|
* 停止网络报告分析
|
|
8479
8510
|
*/
|
|
8480
8511
|
Z(this, "stopGetPeerStats", () => clearInterval(this.getPeerStatsTimer));
|
|
8512
|
+
Q(this, Ht).call(this);
|
|
8481
8513
|
}
|
|
8482
8514
|
}
|
|
8483
|
-
|
|
8484
|
-
var
|
|
8515
|
+
St = new WeakMap(), Ht = new WeakMap(), xt = new WeakMap(), zt = new WeakMap(), Jt = new WeakMap(), Wt = new WeakMap();
|
|
8516
|
+
var Kt, It;
|
|
8485
8517
|
class RoomCalls extends RoomPeer {
|
|
8486
8518
|
constructor() {
|
|
8487
8519
|
super();
|
|
@@ -8497,17 +8529,20 @@ class RoomCalls extends RoomPeer {
|
|
|
8497
8529
|
Z(this, "setLocalStream", (u, E) => new Promise(async (_, k) => {
|
|
8498
8530
|
try {
|
|
8499
8531
|
const { userId: e } = this.options;
|
|
8500
|
-
|
|
8501
|
-
{
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
N.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
|
|
8505
|
-
}
|
|
8506
|
-
{
|
|
8507
|
-
const $ = this.getUserStream(e, "screenSharing_video").getTracks();
|
|
8508
|
-
for (const N of $)
|
|
8509
|
-
N.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
|
|
8532
|
+
for (const O of u)
|
|
8533
|
+
if (this.setLocalStreamActiveMap.set(O, E), E === !1) {
|
|
8534
|
+
this.removeUserMediaStreamContext(e, O);
|
|
8535
|
+
continue;
|
|
8510
8536
|
}
|
|
8537
|
+
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")) {
|
|
8538
|
+
const $ = this.getUserStream(e, "screenSharing_audio").getTracks();
|
|
8539
|
+
for (const N of $)
|
|
8540
|
+
N.onended = () => this.stopPublish(["screenSharing_audio"]);
|
|
8541
|
+
}
|
|
8542
|
+
if (u.includes("screenSharing_video")) {
|
|
8543
|
+
const $ = this.getUserStream(e, "screenSharing_video").getTracks();
|
|
8544
|
+
for (const N of $)
|
|
8545
|
+
N.onended = () => this.stopPublish(["screenSharing_video"]);
|
|
8511
8546
|
}
|
|
8512
8547
|
const n = this.getUserStreams(e);
|
|
8513
8548
|
_(n);
|
|
@@ -8515,6 +8550,25 @@ class RoomCalls extends RoomPeer {
|
|
|
8515
8550
|
k(e);
|
|
8516
8551
|
}
|
|
8517
8552
|
}));
|
|
8553
|
+
/**
|
|
8554
|
+
* 设置正在使用的媒体设备
|
|
8555
|
+
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
8556
|
+
* @param deviceId 设备ID
|
|
8557
|
+
*/
|
|
8558
|
+
Z(this, "setMediaDeviceKind", async (u, E) => {
|
|
8559
|
+
await this.setDeviceKind(u, E);
|
|
8560
|
+
const _ = await this.getCaller(), { tracks: k = [], callActionMap: e } = _, n = async (O) => {
|
|
8561
|
+
if (this.setLocalStreamActiveMap.get(O)) {
|
|
8562
|
+
try {
|
|
8563
|
+
await this.initLocalStream(O);
|
|
8564
|
+
} catch (N) {
|
|
8565
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: initLocalStream is error.", N), await this.inactiveTracks([O], !1);
|
|
8566
|
+
}
|
|
8567
|
+
k.find((N) => N.mediaType === O && e[O]) && await this.replaceSenderStream([O], !0);
|
|
8568
|
+
}
|
|
8569
|
+
};
|
|
8570
|
+
u === "audioinput" && await n("microphoneCamera_audio"), u === "videoinput" && await n("microphoneCamera_video");
|
|
8571
|
+
});
|
|
8518
8572
|
/**
|
|
8519
8573
|
* 添加广播事件
|
|
8520
8574
|
* @param notify Notify
|
|
@@ -8525,7 +8579,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8525
8579
|
* 广播给房间其他人
|
|
8526
8580
|
* 只有当自己建立了发射轨道 并且 加入房间后才进行广播
|
|
8527
8581
|
*/
|
|
8528
|
-
at(this,
|
|
8582
|
+
at(this, Kt, async (u) => {
|
|
8529
8583
|
const { roomId: E } = this.options;
|
|
8530
8584
|
if (!E) return;
|
|
8531
8585
|
const { id: _, tracks: k = [] } = await this.getCaller();
|
|
@@ -8556,8 +8610,8 @@ class RoomCalls extends RoomPeer {
|
|
|
8556
8610
|
}).then(async (D) => {
|
|
8557
8611
|
const { code: q = 0, desc: P = "服务器繁忙", data: j } = D;
|
|
8558
8612
|
if (q !== 200) return _(P);
|
|
8559
|
-
const { roomId:
|
|
8560
|
-
if (
|
|
8613
|
+
const { roomId: V = "", roomUsers: J = [] } = j;
|
|
8614
|
+
if (V !== O) return _("加入的房间不匹配");
|
|
8561
8615
|
this.createSession(), await this.updateUsers(J), e();
|
|
8562
8616
|
});
|
|
8563
8617
|
} catch (O) {
|
|
@@ -8574,7 +8628,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8574
8628
|
Z(this, "quitRoom", () => new Promise(async (u) => {
|
|
8575
8629
|
const { roomId: E, userId: _ } = this.options, k = { roomId: E, user: { id: _ } };
|
|
8576
8630
|
try {
|
|
8577
|
-
this.stopSubscribe(), this.stopGetPeerStats(), this.
|
|
8631
|
+
this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.setRoomState("ready");
|
|
8578
8632
|
} catch {
|
|
8579
8633
|
}
|
|
8580
8634
|
await new Promise((e) => setTimeout(() => e(!0), 300)), this.cwsIns.sendMessage({ event: "quitRoom", data: k }), u(!0);
|
|
@@ -8587,7 +8641,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8587
8641
|
Z(this, "quitRoomEx", () => new Promise(async (u) => {
|
|
8588
8642
|
const { roomId: E, userId: _ } = this.options, k = { roomId: E, user: { id: _ } };
|
|
8589
8643
|
try {
|
|
8590
|
-
this.stopSubscribe(), this.stopGetPeerStats(), this.
|
|
8644
|
+
this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), await this.replaceSenderStream([], !1);
|
|
8591
8645
|
} catch {
|
|
8592
8646
|
}
|
|
8593
8647
|
await new Promise((e) => setTimeout(() => e(!0), 300)), this.cwsIns.sendMessage({ event: "quitRoomEx", data: k }), u(!0);
|
|
@@ -8620,30 +8674,25 @@ class RoomCalls extends RoomPeer {
|
|
|
8620
8674
|
Z(this, "publish", (u) => new Promise(async (E, _) => {
|
|
8621
8675
|
const k = async () => {
|
|
8622
8676
|
try {
|
|
8623
|
-
|
|
8624
|
-
const e = await this.getCaller();
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
const
|
|
8677
|
+
await this.replaceSenderStream(u, !1), await this.createTrack(u);
|
|
8678
|
+
const e = await this.getCaller(), n = this.getSenderTracks(u), O = [...e.tracks, ...n];
|
|
8679
|
+
await this.updateUsertracks(e.id, O, !0);
|
|
8680
|
+
const $ = await this.getCallAction(O);
|
|
8681
|
+
await Q(this, It).call(this, $), await this.replaceSenderStream(u, !0), Q(this, Kt).call(this, u);
|
|
8682
|
+
try {
|
|
8683
|
+
await this.setLocalStream(u, !0);
|
|
8684
|
+
} catch {
|
|
8685
|
+
}
|
|
8686
|
+
const N = [];
|
|
8633
8687
|
for (const D of u)
|
|
8634
|
-
this.getUserStream(e.id, D).getTracks().length
|
|
8635
|
-
|
|
8636
|
-
const O = this.getSenderTracks(u), $ = [...e.tracks, ...O], N = await this.getCallAction($);
|
|
8637
|
-
await this.updateUsertracks(e.id, $, !0), V(this, zt).call(this, u), await V(this, Tt).call(this, N), await this.replaceSenderStream(n, !0);
|
|
8688
|
+
this.getUserStream(e.id, D).getTracks().length === 0 && N.push(D);
|
|
8689
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: inactive_mediaTypes", N), N.length !== 0 && await this.inactiveTracks(N, !1);
|
|
8638
8690
|
{
|
|
8639
8691
|
await this.emitNotifyUpdateUsers();
|
|
8640
8692
|
const D = await this.getCaller();
|
|
8641
8693
|
E(D);
|
|
8642
8694
|
}
|
|
8643
8695
|
} catch (e) {
|
|
8644
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: error", e);
|
|
8645
|
-
for (const n of u)
|
|
8646
|
-
await this.setLocalStream(n, !1);
|
|
8647
8696
|
_(`publish is error: ${e.message || e}`);
|
|
8648
8697
|
}
|
|
8649
8698
|
};
|
|
@@ -8670,7 +8719,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8670
8719
|
await this.replaceSenderStream(u, !0), await this.removeSenders(u), await this.closeUserTracks(e.id, n, !0);
|
|
8671
8720
|
{
|
|
8672
8721
|
const $ = await this.getCallAction(e.tracks);
|
|
8673
|
-
await
|
|
8722
|
+
await Q(this, It).call(this, $);
|
|
8674
8723
|
}
|
|
8675
8724
|
await this.createOffer(), await this.cwsIns.sendMessage({
|
|
8676
8725
|
event: "closeTrack",
|
|
@@ -8701,8 +8750,8 @@ class RoomCalls extends RoomPeer {
|
|
|
8701
8750
|
for (const q of n) {
|
|
8702
8751
|
const { isSelf: P, tracks: j = [] } = q;
|
|
8703
8752
|
if (!P) {
|
|
8704
|
-
const
|
|
8705
|
-
|
|
8753
|
+
const V = j.filter(({ trackName: J, mid: z = "" }) => z !== "" && (u.includes(J) || u.length === 0));
|
|
8754
|
+
V.length !== 0 && O.push({ ...q, tracks: V });
|
|
8706
8755
|
}
|
|
8707
8756
|
}
|
|
8708
8757
|
const $ = async () => {
|
|
@@ -8712,7 +8761,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8712
8761
|
if (O.length === 0) return $();
|
|
8713
8762
|
const N = [];
|
|
8714
8763
|
for (const q of O) {
|
|
8715
|
-
const { id: P, tracks: j } = q,
|
|
8764
|
+
const { id: P, tracks: j } = q, V = ft(j, ["type", "trackName"]), J = { id: P, tracks: V };
|
|
8716
8765
|
N.push(J);
|
|
8717
8766
|
}
|
|
8718
8767
|
const D = async () => {
|
|
@@ -8720,11 +8769,11 @@ class RoomCalls extends RoomPeer {
|
|
|
8720
8769
|
event: "subscribe",
|
|
8721
8770
|
data: { users: N }
|
|
8722
8771
|
}).then(async (q) => {
|
|
8723
|
-
const { code: P = 0, data: j, desc:
|
|
8772
|
+
const { code: P = 0, data: j, desc: V } = q;
|
|
8724
8773
|
if (P !== 200) {
|
|
8725
8774
|
if (E > 0)
|
|
8726
8775
|
return await new Promise((Y) => setTimeout(() => Y(!0), 300)), E = E - 1, D();
|
|
8727
|
-
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(
|
|
8776
|
+
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);
|
|
8728
8777
|
}
|
|
8729
8778
|
const { remoteSdp: J, users: z = [] } = j;
|
|
8730
8779
|
this.onSubscribeUserTracks(z).then(async () => {
|
|
@@ -8734,7 +8783,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8734
8783
|
};
|
|
8735
8784
|
await D();
|
|
8736
8785
|
} catch (n) {
|
|
8737
|
-
|
|
8786
|
+
this.taskQueue.setCondition("subscribe", !0), k(`subscribe is error: ${n.message || n}`);
|
|
8738
8787
|
}
|
|
8739
8788
|
};
|
|
8740
8789
|
this.taskQueue.addTask(e, ["createWs", "createSession", "ice", "createTrack", "closeTrack"], { describe: "subscribe" });
|
|
@@ -8752,8 +8801,8 @@ class RoomCalls extends RoomPeer {
|
|
|
8752
8801
|
for (const $ of e) {
|
|
8753
8802
|
const { tracks: N = [] } = $;
|
|
8754
8803
|
for (const D of N) {
|
|
8755
|
-
const { type: q, mid: P, trackName: j, mediaType:
|
|
8756
|
-
if (!(!
|
|
8804
|
+
const { type: q, mid: P, trackName: j, mediaType: V, msid: J } = D;
|
|
8805
|
+
if (!(!V || !J) && (u.length === 0 || u.includes(j))) {
|
|
8757
8806
|
const z = { type: q, mid: P, trackName: J };
|
|
8758
8807
|
n.push(z), await this.closeUserTracks($.id, [D]);
|
|
8759
8808
|
}
|
|
@@ -8797,7 +8846,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8797
8846
|
}
|
|
8798
8847
|
}
|
|
8799
8848
|
const O = await this.getCallAction(n);
|
|
8800
|
-
await
|
|
8849
|
+
await Q(this, It).call(this, O), await this.emitNotifyUpdateUsers(), _(!0);
|
|
8801
8850
|
}));
|
|
8802
8851
|
/**
|
|
8803
8852
|
* 远端调试
|
|
@@ -8813,7 +8862,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8813
8862
|
/**
|
|
8814
8863
|
* 更新自己通话状态
|
|
8815
8864
|
*/
|
|
8816
|
-
at(this,
|
|
8865
|
+
at(this, It, async (u) => new Promise(async (E, _) => {
|
|
8817
8866
|
const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: u } };
|
|
8818
8867
|
await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
|
|
8819
8868
|
const { code: $ = 0 } = O;
|
|
@@ -8864,7 +8913,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8864
8913
|
return this.setRoomState("connecting"), new Promise((u) => {
|
|
8865
8914
|
const E = async () => {
|
|
8866
8915
|
try {
|
|
8867
|
-
|
|
8916
|
+
this.taskQueue.setCondition("createSession", !1), await this.addSenders(), await this.cwsIns.sendMessage({
|
|
8868
8917
|
event: "connectCF",
|
|
8869
8918
|
data: { sdp: this.getSdp() }
|
|
8870
8919
|
}).then(async (_) => {
|
|
@@ -8915,13 +8964,13 @@ class RoomCalls extends RoomPeer {
|
|
|
8915
8964
|
this.setRoomState("ready");
|
|
8916
8965
|
}
|
|
8917
8966
|
}
|
|
8918
|
-
|
|
8967
|
+
Kt = new WeakMap(), It = new WeakMap();
|
|
8919
8968
|
class Room extends RoomCalls {
|
|
8920
8969
|
constructor() {
|
|
8921
8970
|
super();
|
|
8922
8971
|
}
|
|
8923
8972
|
}
|
|
8924
|
-
var gt,
|
|
8973
|
+
var gt, Gt, Qt, Vt, Yt;
|
|
8925
8974
|
class QuickVO extends Room {
|
|
8926
8975
|
constructor(u) {
|
|
8927
8976
|
super();
|
|
@@ -8929,7 +8978,7 @@ class QuickVO extends Room {
|
|
|
8929
8978
|
/**
|
|
8930
8979
|
* 添加内部监听事件
|
|
8931
8980
|
*/
|
|
8932
|
-
at(this,
|
|
8981
|
+
at(this, Gt, () => {
|
|
8933
8982
|
{
|
|
8934
8983
|
const u = async (E) => {
|
|
8935
8984
|
const { qualities: _ = [] } = E.data, [k] = _;
|
|
@@ -9004,14 +9053,14 @@ class QuickVO extends Room {
|
|
|
9004
9053
|
/**
|
|
9005
9054
|
* cwsIns 发送消息前
|
|
9006
9055
|
*/
|
|
9007
|
-
at(this,
|
|
9056
|
+
at(this, Qt, () => {
|
|
9008
9057
|
this.cwsIns.sendMessageBefore = async () => {
|
|
9009
9058
|
};
|
|
9010
9059
|
});
|
|
9011
9060
|
/**
|
|
9012
9061
|
* 重连成功
|
|
9013
9062
|
*/
|
|
9014
|
-
at(this,
|
|
9063
|
+
at(this, Vt, () => {
|
|
9015
9064
|
this.cwsIns.onReconnectSuccess = async () => {
|
|
9016
9065
|
this.syncRoomInfo();
|
|
9017
9066
|
};
|
|
@@ -9019,7 +9068,7 @@ class QuickVO extends Room {
|
|
|
9019
9068
|
/**
|
|
9020
9069
|
* 重连停止
|
|
9021
9070
|
*/
|
|
9022
|
-
at(this,
|
|
9071
|
+
at(this, Yt, async () => {
|
|
9023
9072
|
});
|
|
9024
9073
|
/**
|
|
9025
9074
|
* 添加 FrameRequestCallback
|
|
@@ -9028,13 +9077,13 @@ class QuickVO extends Room {
|
|
|
9028
9077
|
*/
|
|
9029
9078
|
Z(this, "addRequestAnimationFrame", async (u, E) => {
|
|
9030
9079
|
{
|
|
9031
|
-
const k =
|
|
9080
|
+
const k = Q(this, gt).get(u);
|
|
9032
9081
|
k && cancelAnimationFrame(k);
|
|
9033
9082
|
}
|
|
9034
9083
|
const _ = (k = Date.now()) => {
|
|
9035
9084
|
E(k);
|
|
9036
9085
|
const e = requestAnimationFrame(_);
|
|
9037
|
-
|
|
9086
|
+
Q(this, gt).set(u, e);
|
|
9038
9087
|
};
|
|
9039
9088
|
_();
|
|
9040
9089
|
});
|
|
@@ -9043,10 +9092,10 @@ class QuickVO extends Room {
|
|
|
9043
9092
|
* @param keys string[] = []
|
|
9044
9093
|
*/
|
|
9045
9094
|
Z(this, "clearRequestAnimationFrame", async (u = []) => {
|
|
9046
|
-
u.length === 0 && (u = [...
|
|
9095
|
+
u.length === 0 && (u = [...Q(this, gt).keys()]);
|
|
9047
9096
|
const E = [];
|
|
9048
9097
|
for (const _ of u) {
|
|
9049
|
-
const k =
|
|
9098
|
+
const k = Q(this, gt).get(_);
|
|
9050
9099
|
k && (cancelAnimationFrame(k), E.push(k));
|
|
9051
9100
|
}
|
|
9052
9101
|
return E;
|
|
@@ -9056,12 +9105,12 @@ class QuickVO extends Room {
|
|
|
9056
9105
|
* @example quickvo.destroy()
|
|
9057
9106
|
*/
|
|
9058
9107
|
Z(this, "destroy", async () => {
|
|
9059
|
-
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.stopGetPeerStats(), this.
|
|
9108
|
+
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();
|
|
9060
9109
|
});
|
|
9061
|
-
this.setOptions(u), this.initCwsCall(),
|
|
9110
|
+
this.setOptions(u), this.initCwsCall(), Q(this, Qt).call(this), Q(this, Vt).call(this), Q(this, Yt).call(this), Q(this, Gt).call(this);
|
|
9062
9111
|
}
|
|
9063
9112
|
}
|
|
9064
|
-
gt = new WeakMap(),
|
|
9113
|
+
gt = new WeakMap(), Gt = new WeakMap(), Qt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap();
|
|
9065
9114
|
export {
|
|
9066
9115
|
QuickVO,
|
|
9067
9116
|
ignoreEvent
|