quickvo-sdk-js 0.6.3 → 0.6.5
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
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 J = (a, I, u) => (
|
|
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[_];
|
|
@@ -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 = {
|
|
@@ -729,8 +737,6 @@ class AudioMediaContext {
|
|
|
729
737
|
Z(this, "audioContext", new (window.AudioContext || window.webkitAudioContext)());
|
|
730
738
|
// 媒体流音频源节点
|
|
731
739
|
Z(this, "mediaStreamAudioSourceNode");
|
|
732
|
-
// 媒体流音频源节点
|
|
733
|
-
Z(this, "destination");
|
|
734
740
|
// 增益节点 (自动增益)
|
|
735
741
|
Z(this, "autoGainNode");
|
|
736
742
|
// 滤波器节点 (噪声抑制)
|
|
@@ -747,11 +753,6 @@ class AudioMediaContext {
|
|
|
747
753
|
* 停止
|
|
748
754
|
*/
|
|
749
755
|
Z(this, "stop", () => {
|
|
750
|
-
{
|
|
751
|
-
const I = this.destination.stream.getTracks();
|
|
752
|
-
for (const u of I)
|
|
753
|
-
u.enabled = !1, u.stop(), this.stream.removeTrack(u);
|
|
754
|
-
}
|
|
755
756
|
{
|
|
756
757
|
const I = this.stream.getTracks();
|
|
757
758
|
for (const u of I)
|
|
@@ -769,13 +770,12 @@ class AudioMediaContext {
|
|
|
769
770
|
/**
|
|
770
771
|
* 获取数据流
|
|
771
772
|
*/
|
|
772
|
-
Z(this, "getStream", () => this.
|
|
773
|
-
// getStream = () => this.mediaStreamAudioSourceNode.mediaStream
|
|
773
|
+
Z(this, "getStream", () => this.mediaStreamAudioSourceNode.mediaStream);
|
|
774
774
|
/**
|
|
775
775
|
* 静音
|
|
776
776
|
*/
|
|
777
777
|
Z(this, "setMute", (I = !0) => {
|
|
778
|
-
I ? this.
|
|
778
|
+
I ? this.gainNode.disconnect(this.audioContext.destination) : this.gainNode.connect(this.audioContext.destination);
|
|
779
779
|
});
|
|
780
780
|
/**
|
|
781
781
|
* 设置音量
|
|
@@ -813,12 +813,13 @@ class AudioMediaContext {
|
|
|
813
813
|
*/
|
|
814
814
|
Z(this, "setFilter", (I = {}) => {
|
|
815
815
|
this.options = { ...this.options, ...I };
|
|
816
|
-
const { autoGainControl: u, noiseSuppression: E, echoCancellation: _ } = this.options, { mediaStreamAudioSourceNode: k, autoGainNode: e, biquadFilterNode: n, delayNode: O, gainNode: $ } = this
|
|
816
|
+
const { autoGainControl: u, noiseSuppression: E, echoCancellation: _ } = this.options, { mediaStreamAudioSourceNode: k, autoGainNode: e, biquadFilterNode: n, delayNode: O, gainNode: $ } = this;
|
|
817
|
+
let N = k;
|
|
817
818
|
return u && N.connect(e), E && N.connect(n), _ && N.connect(O), N.connect($), I;
|
|
818
819
|
});
|
|
819
|
-
this.stream.addTrack(I), this.audio.srcObject = this.stream, this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), this.mediaStreamAudioSourceNode = this.audioContext.createMediaStreamSource(this.stream), this.
|
|
820
|
-
const { gainNode: u, analyserNode: E
|
|
821
|
-
u.connect(E),
|
|
820
|
+
this.stream.addTrack(I), this.audio.srcObject = this.stream, this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), this.mediaStreamAudioSourceNode = this.audioContext.createMediaStreamSource(this.stream), this.autoGainNode = this.audioContext.createGain(), this.autoGainNode.gain.setValueAtTime(0.8, this.audioContext.currentTime), this.biquadFilterNode = this.audioContext.createBiquadFilter(), this.biquadFilterNode.type = "lowpass", this.biquadFilterNode.frequency.value = 1e3, this.delayNode = this.audioContext.createDelay(), this.delayNode.delayTime.value = 0.5, this.gainNode = this.audioContext.createGain(), this.gainNode.gain.setValueAtTime(this.gain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount);
|
|
821
|
+
const { gainNode: u, analyserNode: E } = this;
|
|
822
|
+
u.connect(E), this.audioContext.state === "suspended" && (this.audioContext.resume(), document.addEventListener("click", () => this.audioContext.resume(), { once: !0 })), this.setFilter();
|
|
822
823
|
}
|
|
823
824
|
}
|
|
824
825
|
class VideoMediaContext {
|
|
@@ -6157,74 +6158,74 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
|
|
|
6157
6158
|
};
|
|
6158
6159
|
const BAD$1 = 16209, TYPE$1 = 16191;
|
|
6159
6160
|
var inffast = function a(I, u) {
|
|
6160
|
-
let E, _, k, e, n, O, $, N, D, q, P, j, V, Q, z, Y, et, tt, nt,
|
|
6161
|
-
const
|
|
6162
|
-
E = I.next_in,
|
|
6161
|
+
let E, _, k, e, n, O, $, N, D, q, P, j, V, Q, z, Y, et, tt, nt, ut, it, lt, st, rt;
|
|
6162
|
+
const ct = I.state;
|
|
6163
|
+
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
6164
|
t:
|
|
6164
6165
|
do {
|
|
6165
|
-
j < 15 && (P +=
|
|
6166
|
+
j < 15 && (P += st[E++] << j, j += 8, P += st[E++] << j, j += 8), et = V[P & z];
|
|
6166
6167
|
e:
|
|
6167
6168
|
for (; ; ) {
|
|
6168
6169
|
if (tt = et >>> 24, P >>>= tt, j -= tt, tt = et >>> 16 & 255, tt === 0)
|
|
6169
|
-
|
|
6170
|
+
rt[k++] = et & 65535;
|
|
6170
6171
|
else if (tt & 16) {
|
|
6171
|
-
nt = et & 65535, tt &= 15, tt && (j < tt && (P +=
|
|
6172
|
+
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
6173
|
i:
|
|
6173
6174
|
for (; ; ) {
|
|
6174
6175
|
if (tt = et >>> 24, P >>>= tt, j -= tt, tt = et >>> 16 & 255, tt & 16) {
|
|
6175
|
-
if (
|
|
6176
|
-
I.msg = "invalid distance too far back",
|
|
6176
|
+
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) {
|
|
6177
|
+
I.msg = "invalid distance too far back", ct.mode = BAD$1;
|
|
6177
6178
|
break t;
|
|
6178
6179
|
}
|
|
6179
|
-
if (P >>>= tt, j -= tt, tt = k - e,
|
|
6180
|
-
if (tt =
|
|
6181
|
-
I.msg = "invalid distance too far back",
|
|
6180
|
+
if (P >>>= tt, j -= tt, tt = k - e, ut > tt) {
|
|
6181
|
+
if (tt = ut - tt, tt > N && ct.sane) {
|
|
6182
|
+
I.msg = "invalid distance too far back", ct.mode = BAD$1;
|
|
6182
6183
|
break t;
|
|
6183
6184
|
}
|
|
6184
|
-
if (it = 0,
|
|
6185
|
+
if (it = 0, lt = q, D === 0) {
|
|
6185
6186
|
if (it += $ - tt, tt < nt) {
|
|
6186
6187
|
nt -= tt;
|
|
6187
6188
|
do
|
|
6188
|
-
|
|
6189
|
+
rt[k++] = q[it++];
|
|
6189
6190
|
while (--tt);
|
|
6190
|
-
it = k -
|
|
6191
|
+
it = k - ut, lt = rt;
|
|
6191
6192
|
}
|
|
6192
6193
|
} else if (D < tt) {
|
|
6193
6194
|
if (it += $ + D - tt, tt -= D, tt < nt) {
|
|
6194
6195
|
nt -= tt;
|
|
6195
6196
|
do
|
|
6196
|
-
|
|
6197
|
+
rt[k++] = q[it++];
|
|
6197
6198
|
while (--tt);
|
|
6198
6199
|
if (it = 0, D < nt) {
|
|
6199
6200
|
tt = D, nt -= tt;
|
|
6200
6201
|
do
|
|
6201
|
-
|
|
6202
|
+
rt[k++] = q[it++];
|
|
6202
6203
|
while (--tt);
|
|
6203
|
-
it = k -
|
|
6204
|
+
it = k - ut, lt = rt;
|
|
6204
6205
|
}
|
|
6205
6206
|
}
|
|
6206
6207
|
} else if (it += D - tt, tt < nt) {
|
|
6207
6208
|
nt -= tt;
|
|
6208
6209
|
do
|
|
6209
|
-
|
|
6210
|
+
rt[k++] = q[it++];
|
|
6210
6211
|
while (--tt);
|
|
6211
|
-
it = k -
|
|
6212
|
+
it = k - ut, lt = rt;
|
|
6212
6213
|
}
|
|
6213
6214
|
for (; nt > 2; )
|
|
6214
|
-
|
|
6215
|
-
nt && (
|
|
6215
|
+
rt[k++] = lt[it++], rt[k++] = lt[it++], rt[k++] = lt[it++], nt -= 3;
|
|
6216
|
+
nt && (rt[k++] = lt[it++], nt > 1 && (rt[k++] = lt[it++]));
|
|
6216
6217
|
} else {
|
|
6217
|
-
it = k -
|
|
6218
|
+
it = k - ut;
|
|
6218
6219
|
do
|
|
6219
|
-
|
|
6220
|
+
rt[k++] = rt[it++], rt[k++] = rt[it++], rt[k++] = rt[it++], nt -= 3;
|
|
6220
6221
|
while (nt > 2);
|
|
6221
|
-
nt && (
|
|
6222
|
+
nt && (rt[k++] = rt[it++], nt > 1 && (rt[k++] = rt[it++]));
|
|
6222
6223
|
}
|
|
6223
6224
|
} else if ((tt & 64) === 0) {
|
|
6224
6225
|
et = Q[(et & 65535) + (P & (1 << tt) - 1)];
|
|
6225
6226
|
continue i;
|
|
6226
6227
|
} else {
|
|
6227
|
-
I.msg = "invalid distance code",
|
|
6228
|
+
I.msg = "invalid distance code", ct.mode = BAD$1;
|
|
6228
6229
|
break t;
|
|
6229
6230
|
}
|
|
6230
6231
|
break;
|
|
@@ -6233,16 +6234,16 @@ var inffast = function a(I, u) {
|
|
|
6233
6234
|
et = V[(et & 65535) + (P & (1 << tt) - 1)];
|
|
6234
6235
|
continue e;
|
|
6235
6236
|
} else if (tt & 32) {
|
|
6236
|
-
|
|
6237
|
+
ct.mode = TYPE$1;
|
|
6237
6238
|
break t;
|
|
6238
6239
|
} else {
|
|
6239
|
-
I.msg = "invalid literal/length code",
|
|
6240
|
+
I.msg = "invalid literal/length code", ct.mode = BAD$1;
|
|
6240
6241
|
break t;
|
|
6241
6242
|
}
|
|
6242
6243
|
break;
|
|
6243
6244
|
}
|
|
6244
6245
|
} 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),
|
|
6246
|
+
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
6247
|
};
|
|
6247
6248
|
const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS$1 = 1, DISTS$1 = 2, lbase = new Uint16Array([
|
|
6248
6249
|
/* Length codes 257..285 base */
|
|
@@ -6380,48 +6381,48 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6380
6381
|
64
|
|
6381
6382
|
]), inflate_table = (a, I, u, E, _, k, e, n) => {
|
|
6382
6383
|
const O = n.bits;
|
|
6383
|
-
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, Q = 0, z = 0, Y = 0, et, tt, nt,
|
|
6384
|
-
const
|
|
6385
|
-
let
|
|
6384
|
+
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;
|
|
6385
|
+
const rt = new Uint16Array(MAXBITS + 1), ct = new Uint16Array(MAXBITS + 1);
|
|
6386
|
+
let $t = null, oe, Ut, Mt;
|
|
6386
6387
|
for ($ = 0; $ <= MAXBITS; $++)
|
|
6387
|
-
|
|
6388
|
+
rt[$] = 0;
|
|
6388
6389
|
for (N = 0; N < E; N++)
|
|
6389
|
-
|
|
6390
|
-
for (P = O, q = MAXBITS; q >= 1 &&
|
|
6390
|
+
rt[I[u + N]]++;
|
|
6391
|
+
for (P = O, q = MAXBITS; q >= 1 && rt[q] === 0; q--)
|
|
6391
6392
|
;
|
|
6392
6393
|
if (P > q && (P = q), q === 0)
|
|
6393
6394
|
return _[k++] = 1 << 24 | 64 << 16 | 0, _[k++] = 1 << 24 | 64 << 16 | 0, n.bits = 1, 0;
|
|
6394
|
-
for (D = 1; D < q &&
|
|
6395
|
+
for (D = 1; D < q && rt[D] === 0; D++)
|
|
6395
6396
|
;
|
|
6396
6397
|
for (P < D && (P = D), Q = 1, $ = 1; $ <= MAXBITS; $++)
|
|
6397
|
-
if (Q <<= 1, Q -=
|
|
6398
|
+
if (Q <<= 1, Q -= rt[$], Q < 0)
|
|
6398
6399
|
return -1;
|
|
6399
6400
|
if (Q > 0 && (a === CODES$1 || q !== 1))
|
|
6400
6401
|
return -1;
|
|
6401
|
-
for (
|
|
6402
|
-
|
|
6402
|
+
for (ct[1] = 0, $ = 1; $ < MAXBITS; $++)
|
|
6403
|
+
ct[$ + 1] = ct[$] + rt[$];
|
|
6403
6404
|
for (N = 0; N < E; N++)
|
|
6404
|
-
I[u + N] !== 0 && (e[
|
|
6405
|
-
if (a === CODES$1 ? (
|
|
6405
|
+
I[u + N] !== 0 && (e[ct[I[u + N]]++] = N);
|
|
6406
|
+
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
6407
|
return 1;
|
|
6407
6408
|
for (; ; ) {
|
|
6408
|
-
|
|
6409
|
+
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
6410
|
do
|
|
6410
|
-
tt -= et, _[it + (Y >> V) + tt] =
|
|
6411
|
+
tt -= et, _[it + (Y >> V) + tt] = oe << 24 | Ut << 16 | Mt | 0;
|
|
6411
6412
|
while (tt !== 0);
|
|
6412
6413
|
for (et = 1 << $ - 1; Y & et; )
|
|
6413
6414
|
et >>= 1;
|
|
6414
|
-
if (et !== 0 ? (Y &= et - 1, Y += et) : Y = 0, N++, --
|
|
6415
|
+
if (et !== 0 ? (Y &= et - 1, Y += et) : Y = 0, N++, --rt[$] === 0) {
|
|
6415
6416
|
if ($ === q)
|
|
6416
6417
|
break;
|
|
6417
6418
|
$ = I[u + e[N]];
|
|
6418
6419
|
}
|
|
6419
|
-
if ($ > P && (Y &
|
|
6420
|
-
for (V === 0 && (V = P), it += D, j = $ - V, Q = 1 << j; j + V < q && (Q -=
|
|
6420
|
+
if ($ > P && (Y & ut) !== nt) {
|
|
6421
|
+
for (V === 0 && (V = P), it += D, j = $ - V, Q = 1 << j; j + V < q && (Q -= rt[j + V], !(Q <= 0)); )
|
|
6421
6422
|
j++, Q <<= 1;
|
|
6422
6423
|
if (z += 1 << j, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6423
6424
|
return 1;
|
|
6424
|
-
nt = Y &
|
|
6425
|
+
nt = Y & ut, _[nt] = P << 24 | j << 16 | it - k | 0;
|
|
6425
6426
|
}
|
|
6426
6427
|
}
|
|
6427
6428
|
return Y !== 0 && (_[it + Y] = $ - V << 24 | 64 << 16 | 0), n.bits = P, 0;
|
|
@@ -6495,16 +6496,16 @@ const fixedtables = (a) => {
|
|
|
6495
6496
|
const k = a.state;
|
|
6496
6497
|
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
6498
|
}, inflate$2 = (a, I) => {
|
|
6498
|
-
let u, E, _, k, e, n, O, $, N, D, q, P, j, V, Q = 0, z, Y, et, tt, nt,
|
|
6499
|
-
const
|
|
6500
|
-
let
|
|
6501
|
-
const
|
|
6499
|
+
let u, E, _, k, e, n, O, $, N, D, q, P, j, V, Q = 0, z, Y, et, tt, nt, ut, it, lt;
|
|
6500
|
+
const st = new Uint8Array(4);
|
|
6501
|
+
let rt, ct;
|
|
6502
|
+
const $t = (
|
|
6502
6503
|
/* permutation of code lengths */
|
|
6503
6504
|
new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
|
|
6504
6505
|
);
|
|
6505
6506
|
if (inflateStateCheck(a) || !a.output || !a.input && a.avail_in !== 0)
|
|
6506
6507
|
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,
|
|
6508
|
+
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
6509
|
t:
|
|
6509
6510
|
for (; ; )
|
|
6510
6511
|
switch (u.mode) {
|
|
@@ -6519,7 +6520,7 @@ const fixedtables = (a) => {
|
|
|
6519
6520
|
n--, $ += E[k++] << N, N += 8;
|
|
6520
6521
|
}
|
|
6521
6522
|
if (u.wrap & 2 && $ === 35615) {
|
|
6522
|
-
u.wbits === 0 && (u.wbits = 15), u.check = 0,
|
|
6523
|
+
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
6524
|
break;
|
|
6524
6525
|
}
|
|
6525
6526
|
if (u.head && (u.head.done = !1), !(u.wrap & 1) || /* check if zlib header allowed */
|
|
@@ -6551,7 +6552,7 @@ const fixedtables = (a) => {
|
|
|
6551
6552
|
a.msg = "unknown header flags set", u.mode = BAD;
|
|
6552
6553
|
break;
|
|
6553
6554
|
}
|
|
6554
|
-
u.head && (u.head.text = $ >> 8 & 1), u.flags & 512 && u.wrap & 4 && (
|
|
6555
|
+
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
6556
|
/* falls through */
|
|
6556
6557
|
case TIME:
|
|
6557
6558
|
for (; N < 32; ) {
|
|
@@ -6559,7 +6560,7 @@ const fixedtables = (a) => {
|
|
|
6559
6560
|
break t;
|
|
6560
6561
|
n--, $ += E[k++] << N, N += 8;
|
|
6561
6562
|
}
|
|
6562
|
-
u.head && (u.head.time = $), u.flags & 512 && u.wrap & 4 && (
|
|
6563
|
+
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
6564
|
/* falls through */
|
|
6564
6565
|
case OS:
|
|
6565
6566
|
for (; N < 16; ) {
|
|
@@ -6567,7 +6568,7 @@ const fixedtables = (a) => {
|
|
|
6567
6568
|
break t;
|
|
6568
6569
|
n--, $ += E[k++] << N, N += 8;
|
|
6569
6570
|
}
|
|
6570
|
-
u.head && (u.head.xflags = $ & 255, u.head.os = $ >> 8), u.flags & 512 && u.wrap & 4 && (
|
|
6571
|
+
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
6572
|
/* falls through */
|
|
6572
6573
|
case EXLEN:
|
|
6573
6574
|
if (u.flags & 1024) {
|
|
@@ -6576,7 +6577,7 @@ const fixedtables = (a) => {
|
|
|
6576
6577
|
break t;
|
|
6577
6578
|
n--, $ += E[k++] << N, N += 8;
|
|
6578
6579
|
}
|
|
6579
|
-
u.length = $, u.head && (u.head.extra_len = $), u.flags & 512 && u.wrap & 4 && (
|
|
6580
|
+
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
6581
|
} else u.head && (u.head.extra = null);
|
|
6581
6582
|
u.mode = EXTRA;
|
|
6582
6583
|
/* falls through */
|
|
@@ -6724,11 +6725,11 @@ const fixedtables = (a) => {
|
|
|
6724
6725
|
break t;
|
|
6725
6726
|
n--, $ += E[k++] << N, N += 8;
|
|
6726
6727
|
}
|
|
6727
|
-
u.lens[
|
|
6728
|
+
u.lens[$t[u.have++]] = $ & 7, $ >>>= 3, N -= 3;
|
|
6728
6729
|
}
|
|
6729
6730
|
for (; u.have < 19; )
|
|
6730
|
-
u.lens[
|
|
6731
|
-
if (u.lencode = u.lendyn, u.lenbits = 7,
|
|
6731
|
+
u.lens[$t[u.have++]] = 0;
|
|
6732
|
+
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
6733
|
a.msg = "invalid code lengths set", u.mode = BAD;
|
|
6733
6734
|
break;
|
|
6734
6735
|
}
|
|
@@ -6745,7 +6746,7 @@ const fixedtables = (a) => {
|
|
|
6745
6746
|
$ >>>= z, N -= z, u.lens[u.have++] = et;
|
|
6746
6747
|
else {
|
|
6747
6748
|
if (et === 16) {
|
|
6748
|
-
for (
|
|
6749
|
+
for (ct = z + 2; N < ct; ) {
|
|
6749
6750
|
if (n === 0)
|
|
6750
6751
|
break t;
|
|
6751
6752
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6756,14 +6757,14 @@ const fixedtables = (a) => {
|
|
|
6756
6757
|
}
|
|
6757
6758
|
it = u.lens[u.have - 1], P = 3 + ($ & 3), $ >>>= 2, N -= 2;
|
|
6758
6759
|
} else if (et === 17) {
|
|
6759
|
-
for (
|
|
6760
|
+
for (ct = z + 3; N < ct; ) {
|
|
6760
6761
|
if (n === 0)
|
|
6761
6762
|
break t;
|
|
6762
6763
|
n--, $ += E[k++] << N, N += 8;
|
|
6763
6764
|
}
|
|
6764
6765
|
$ >>>= z, N -= z, it = 0, P = 3 + ($ & 7), $ >>>= 3, N -= 3;
|
|
6765
6766
|
} else {
|
|
6766
|
-
for (
|
|
6767
|
+
for (ct = z + 7; N < ct; ) {
|
|
6767
6768
|
if (n === 0)
|
|
6768
6769
|
break t;
|
|
6769
6770
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6784,11 +6785,11 @@ const fixedtables = (a) => {
|
|
|
6784
6785
|
a.msg = "invalid code -- missing end-of-block", u.mode = BAD;
|
|
6785
6786
|
break;
|
|
6786
6787
|
}
|
|
6787
|
-
if (u.lenbits = 9,
|
|
6788
|
+
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
6789
|
a.msg = "invalid literal/lengths set", u.mode = BAD;
|
|
6789
6790
|
break;
|
|
6790
6791
|
}
|
|
6791
|
-
if (u.distbits = 6, u.distcode = u.distdyn,
|
|
6792
|
+
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
6793
|
a.msg = "invalid distances set", u.mode = BAD;
|
|
6793
6794
|
break;
|
|
6794
6795
|
}
|
|
@@ -6809,7 +6810,7 @@ const fixedtables = (a) => {
|
|
|
6809
6810
|
n--, $ += E[k++] << N, N += 8;
|
|
6810
6811
|
}
|
|
6811
6812
|
if (Y && (Y & 240) === 0) {
|
|
6812
|
-
for (tt = z, nt = Y,
|
|
6813
|
+
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
6814
|
if (n === 0)
|
|
6814
6815
|
break t;
|
|
6815
6816
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6832,7 +6833,7 @@ const fixedtables = (a) => {
|
|
|
6832
6833
|
/* falls through */
|
|
6833
6834
|
case LENEXT:
|
|
6834
6835
|
if (u.extra) {
|
|
6835
|
-
for (
|
|
6836
|
+
for (ct = u.extra; N < ct; ) {
|
|
6836
6837
|
if (n === 0)
|
|
6837
6838
|
break t;
|
|
6838
6839
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6848,7 +6849,7 @@ const fixedtables = (a) => {
|
|
|
6848
6849
|
n--, $ += E[k++] << N, N += 8;
|
|
6849
6850
|
}
|
|
6850
6851
|
if ((Y & 240) === 0) {
|
|
6851
|
-
for (tt = z, nt = Y,
|
|
6852
|
+
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
6853
|
if (n === 0)
|
|
6853
6854
|
break t;
|
|
6854
6855
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6863,7 +6864,7 @@ const fixedtables = (a) => {
|
|
|
6863
6864
|
/* falls through */
|
|
6864
6865
|
case DISTEXT:
|
|
6865
6866
|
if (u.extra) {
|
|
6866
|
-
for (
|
|
6867
|
+
for (ct = u.extra; N < ct; ) {
|
|
6867
6868
|
if (n === 0)
|
|
6868
6869
|
break t;
|
|
6869
6870
|
n--, $ += E[k++] << N, N += 8;
|
|
@@ -6930,10 +6931,10 @@ const fixedtables = (a) => {
|
|
|
6930
6931
|
u.mode = DONE;
|
|
6931
6932
|
/* falls through */
|
|
6932
6933
|
case DONE:
|
|
6933
|
-
|
|
6934
|
+
lt = Z_STREAM_END$1;
|
|
6934
6935
|
break t;
|
|
6935
6936
|
case BAD:
|
|
6936
|
-
|
|
6937
|
+
lt = Z_DATA_ERROR$1;
|
|
6937
6938
|
break t;
|
|
6938
6939
|
case MEM:
|
|
6939
6940
|
return Z_MEM_ERROR$1;
|
|
@@ -6943,7 +6944,7 @@ const fixedtables = (a) => {
|
|
|
6943
6944
|
return Z_STREAM_ERROR$1;
|
|
6944
6945
|
}
|
|
6945
6946
|
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) &&
|
|
6947
|
+
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
6948
|
}, inflateEnd = (a) => {
|
|
6948
6949
|
if (inflateStateCheck(a))
|
|
6949
6950
|
return Z_STREAM_ERROR$1;
|
|
@@ -7177,12 +7178,12 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
|
|
|
7177
7178
|
}
|
|
7178
7179
|
return a;
|
|
7179
7180
|
};
|
|
7180
|
-
var
|
|
7181
|
+
var wt, dt, xt, yt, kt, Pt, Lt, Bt, jt, Nt, Zt, Ft, Ht;
|
|
7181
7182
|
class CallsWebSocket {
|
|
7182
7183
|
// 状态
|
|
7183
7184
|
constructor(I) {
|
|
7184
|
-
|
|
7185
|
-
|
|
7185
|
+
at(this, wt);
|
|
7186
|
+
at(this, dt, {
|
|
7186
7187
|
url: "wss://demo.putplay.cc/websocket",
|
|
7187
7188
|
// 地址
|
|
7188
7189
|
debug: !1,
|
|
@@ -7191,10 +7192,10 @@ class CallsWebSocket {
|
|
|
7191
7192
|
// 最大重连次数
|
|
7192
7193
|
timeout: 30 * 1e3
|
|
7193
7194
|
});
|
|
7194
|
-
|
|
7195
|
+
at(this, xt, "");
|
|
7195
7196
|
// 缓存登录凭证
|
|
7196
|
-
|
|
7197
|
-
|
|
7197
|
+
at(this, yt, {});
|
|
7198
|
+
at(this, kt, {});
|
|
7198
7199
|
Z(this, "state", "closed");
|
|
7199
7200
|
// 外部 发送消息之前
|
|
7200
7201
|
Z(this, "sendMessageBefore", async () => {
|
|
@@ -7206,33 +7207,33 @@ class CallsWebSocket {
|
|
|
7206
7207
|
Z(this, "onReconnectStop", (I) => {
|
|
7207
7208
|
});
|
|
7208
7209
|
// 是否需要重连
|
|
7209
|
-
|
|
7210
|
+
at(this, Pt, (I) => {
|
|
7210
7211
|
let u = !0;
|
|
7211
7212
|
const { code: E = 1e3, reason: _ = "" } = I;
|
|
7212
7213
|
return E === 1e3 && (_ === "quit success!" || _ === "replace old connection!") && (u = !1), u;
|
|
7213
7214
|
});
|
|
7214
7215
|
// 重连成功
|
|
7215
|
-
|
|
7216
|
-
J(this,
|
|
7216
|
+
at(this, Lt, async (I) => {
|
|
7217
|
+
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
7218
|
});
|
|
7218
7219
|
// 重连停止
|
|
7219
|
-
|
|
7220
|
-
J(this,
|
|
7220
|
+
at(this, Bt, async (I) => {
|
|
7221
|
+
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
7222
|
});
|
|
7222
7223
|
// 自定义心跳规则
|
|
7223
|
-
|
|
7224
|
+
at(this, jt, () => {
|
|
7224
7225
|
const I = { event: "heartbeat", sn: +`${F(1e5, 999999)}` };
|
|
7225
7226
|
return com.quick.voice.proto.CommonReq.encode(I).finish();
|
|
7226
7227
|
});
|
|
7227
7228
|
// 更新日志
|
|
7228
|
-
|
|
7229
|
+
at(this, Nt, (I, u = {}) => {
|
|
7229
7230
|
try {
|
|
7230
7231
|
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
7232
|
let N = {};
|
|
7232
7233
|
const D = (et = {}) => {
|
|
7233
7234
|
const tt = JSON.parse(JSON.stringify(et)), nt = Object.keys(tt);
|
|
7234
|
-
for (const
|
|
7235
|
-
(
|
|
7235
|
+
for (const ut of nt)
|
|
7236
|
+
(ut.includes("sdp") || ut.includes("Sdp")) && (tt[ut] = "");
|
|
7236
7237
|
return tt;
|
|
7237
7238
|
};
|
|
7238
7239
|
let q = "res ↓";
|
|
@@ -7264,24 +7265,24 @@ class CallsWebSocket {
|
|
|
7264
7265
|
}
|
|
7265
7266
|
});
|
|
7266
7267
|
// 创建事件
|
|
7267
|
-
|
|
7268
|
+
at(this, Zt, (I, { resolve: u, reject: E }) => {
|
|
7268
7269
|
const { sn: _ } = I, k = () => {
|
|
7269
|
-
const n = J(this,
|
|
7270
|
-
clearTimeout(n.destructionTimer), delete J(this,
|
|
7270
|
+
const n = J(this, yt)[_];
|
|
7271
|
+
clearTimeout(n.destructionTimer), delete J(this, yt)[_];
|
|
7271
7272
|
}, e = setTimeout(() => {
|
|
7272
|
-
const n = J(this,
|
|
7273
|
+
const n = J(this, yt)[_];
|
|
7273
7274
|
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
|
-
}, J(this,
|
|
7275
|
-
J(this,
|
|
7275
|
+
}, J(this, dt).timeout);
|
|
7276
|
+
J(this, yt)[_] = { message: I, resolve: u, reject: E, destruction: k, destructionTimer: e };
|
|
7276
7277
|
});
|
|
7277
7278
|
// 获取事件
|
|
7278
|
-
|
|
7279
|
+
at(this, Ft, (I) => J(this, yt)[I]);
|
|
7279
7280
|
// 接收消息
|
|
7280
|
-
|
|
7281
|
+
at(this, Ht, async (I) => {
|
|
7281
7282
|
const u = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(u), { sn: _, event: k } = E, e = onMessageFormat(E);
|
|
7282
|
-
if (J(this,
|
|
7283
|
+
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
7284
|
return this.emitNotify(k, L(e, ["code", "data", "desc"]));
|
|
7284
|
-
const O = J(this,
|
|
7285
|
+
const O = J(this, Ft).call(this, _);
|
|
7285
7286
|
if (O) {
|
|
7286
7287
|
const { resolve: $ = (D) => {
|
|
7287
7288
|
}, destruction: N = () => {
|
|
@@ -7291,12 +7292,12 @@ class CallsWebSocket {
|
|
|
7291
7292
|
});
|
|
7292
7293
|
// 清除事件
|
|
7293
7294
|
Z(this, "clearEvents", (I = []) => {
|
|
7294
|
-
const u = Object.keys(J(this,
|
|
7295
|
+
const u = Object.keys(J(this, yt));
|
|
7295
7296
|
I.length === 0 && (I = u);
|
|
7296
7297
|
for (const E of u) {
|
|
7297
7298
|
if (!I.includes(E)) continue;
|
|
7298
|
-
const _ = J(this,
|
|
7299
|
-
clearTimeout(_.destructionTimer), delete J(this,
|
|
7299
|
+
const _ = J(this, yt)[E];
|
|
7300
|
+
clearTimeout(_.destructionTimer), delete J(this, yt)[E];
|
|
7300
7301
|
}
|
|
7301
7302
|
});
|
|
7302
7303
|
/**
|
|
@@ -7305,31 +7306,31 @@ class CallsWebSocket {
|
|
|
7305
7306
|
* @returns
|
|
7306
7307
|
*/
|
|
7307
7308
|
Z(this, "connect", async (I = "") => new Promise(async (u) => {
|
|
7308
|
-
I &&
|
|
7309
|
-
const E = `${J(this,
|
|
7310
|
-
|
|
7311
|
-
...J(this,
|
|
7309
|
+
I && Ot(this, xt, I), J(this, wt) && (await J(this, wt).close(), this.state = "closed");
|
|
7310
|
+
const E = `${J(this, dt).url}?s=${J(this, xt)}&t=${Date.now()}`;
|
|
7311
|
+
Ot(this, wt, new M({
|
|
7312
|
+
...J(this, dt),
|
|
7312
7313
|
url: E,
|
|
7313
7314
|
binaryType: "arraybuffer",
|
|
7314
|
-
onMessage: J(this,
|
|
7315
|
-
checkReconnect: J(this,
|
|
7316
|
-
getHeartbeatMsg: J(this,
|
|
7317
|
-
onReconnectSuccess: J(this,
|
|
7318
|
-
onReconnectStop: J(this,
|
|
7319
|
-
})), this.state = "connecting", await J(this,
|
|
7315
|
+
onMessage: J(this, Ht),
|
|
7316
|
+
checkReconnect: J(this, Pt),
|
|
7317
|
+
getHeartbeatMsg: J(this, jt),
|
|
7318
|
+
onReconnectSuccess: J(this, Lt),
|
|
7319
|
+
onReconnectStop: J(this, Bt)
|
|
7320
|
+
})), 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
7321
|
}));
|
|
7321
7322
|
/**
|
|
7322
7323
|
* 关闭
|
|
7323
7324
|
*/
|
|
7324
7325
|
Z(this, "close", async () => {
|
|
7325
7326
|
var u;
|
|
7326
|
-
J(this,
|
|
7327
|
-
const I = Object.keys(J(this,
|
|
7327
|
+
J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
|
|
7328
|
+
const I = Object.keys(J(this, yt));
|
|
7328
7329
|
for (const E of I) {
|
|
7329
|
-
const { destructionTimer: _ } = J(this,
|
|
7330
|
+
const { destructionTimer: _ } = J(this, yt)[E];
|
|
7330
7331
|
clearTimeout(_);
|
|
7331
7332
|
}
|
|
7332
|
-
|
|
7333
|
+
Ot(this, yt, {}), await ((u = J(this, wt)) == null ? void 0 : u.close()), Ot(this, wt, void 0), this.state = "closed";
|
|
7333
7334
|
});
|
|
7334
7335
|
/**
|
|
7335
7336
|
* 发送消息
|
|
@@ -7342,14 +7343,14 @@ class CallsWebSocket {
|
|
|
7342
7343
|
event: k,
|
|
7343
7344
|
sn: +`${n}${F(1e3, 9999)}`,
|
|
7344
7345
|
time: n,
|
|
7345
|
-
valid: J(this,
|
|
7346
|
+
valid: J(this, dt).timeout,
|
|
7346
7347
|
version: 1,
|
|
7347
7348
|
compress: !1,
|
|
7348
7349
|
...e
|
|
7349
7350
|
});
|
|
7350
|
-
J(this,
|
|
7351
|
+
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
7352
|
const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
|
|
7352
|
-
(N = J(this,
|
|
7353
|
+
(N = J(this, wt)) == null || N.sendMessage($);
|
|
7353
7354
|
}));
|
|
7354
7355
|
/**
|
|
7355
7356
|
* 触发广播事件
|
|
@@ -7357,7 +7358,7 @@ class CallsWebSocket {
|
|
|
7357
7358
|
* @param result 事件响应值
|
|
7358
7359
|
*/
|
|
7359
7360
|
Z(this, "emitNotify", async (I, u) => {
|
|
7360
|
-
const E = J(this,
|
|
7361
|
+
const E = J(this, kt)[I] || [];
|
|
7361
7362
|
for (const _ of E) {
|
|
7362
7363
|
const { callback: k = async () => {
|
|
7363
7364
|
} } = _;
|
|
@@ -7372,8 +7373,8 @@ class CallsWebSocket {
|
|
|
7372
7373
|
*/
|
|
7373
7374
|
Z(this, "addNotify", (I, u = !1) => {
|
|
7374
7375
|
const { event: E, sn: _ = ht(32) } = I;
|
|
7375
|
-
J(this,
|
|
7376
|
-
const k = J(this,
|
|
7376
|
+
J(this, kt)[E] || (J(this, kt)[E] = []);
|
|
7377
|
+
const k = J(this, kt)[E], e = k.findIndex((n) => n.sn === _);
|
|
7377
7378
|
return e !== -1 && k.splice(e, 1), u ? k.unshift(I) : k.push(I), _;
|
|
7378
7379
|
});
|
|
7379
7380
|
/**
|
|
@@ -7381,18 +7382,18 @@ class CallsWebSocket {
|
|
|
7381
7382
|
*/
|
|
7382
7383
|
Z(this, "removeNotify", (I = []) => {
|
|
7383
7384
|
if (I.length === 0)
|
|
7384
|
-
|
|
7385
|
+
Ot(this, kt, {});
|
|
7385
7386
|
else {
|
|
7386
|
-
const u = Object.keys(J(this,
|
|
7387
|
+
const u = Object.keys(J(this, kt));
|
|
7387
7388
|
for (const E of u)
|
|
7388
|
-
J(this,
|
|
7389
|
+
J(this, kt)[E] = J(this, kt)[E].filter((_) => !I.includes(_.sn || ""));
|
|
7389
7390
|
}
|
|
7390
|
-
J(this,
|
|
7391
|
+
J(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", J(this, kt));
|
|
7391
7392
|
});
|
|
7392
|
-
|
|
7393
|
+
Ot(this, dt, { ...J(this, dt), ...I });
|
|
7393
7394
|
}
|
|
7394
7395
|
}
|
|
7395
|
-
|
|
7396
|
+
wt = new WeakMap(), dt = new WeakMap(), xt = new WeakMap(), yt = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), Lt = new WeakMap(), Bt = new WeakMap(), jt = new WeakMap(), Nt = new WeakMap(), Zt = new WeakMap(), Ft = new WeakMap(), Ht = new WeakMap();
|
|
7396
7397
|
var y = Object.defineProperty, x = (a) => {
|
|
7397
7398
|
throw TypeError(a);
|
|
7398
7399
|
}, 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 +7449,7 @@ class K {
|
|
|
7448
7449
|
}
|
|
7449
7450
|
}
|
|
7450
7451
|
d = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
|
|
7451
|
-
var
|
|
7452
|
+
var zt;
|
|
7452
7453
|
class RoomBase {
|
|
7453
7454
|
constructor(I) {
|
|
7454
7455
|
Z(this, "options", {
|
|
@@ -7496,13 +7497,35 @@ class RoomBase {
|
|
|
7496
7497
|
* 提交日志
|
|
7497
7498
|
*/
|
|
7498
7499
|
Z(this, "reportLogs", (I, u = "未知错误") => {
|
|
7499
|
-
const { appid: E, userId: _, earlyId: k = "", logUrl: e } = this.options, n = "web"
|
|
7500
|
+
const { appid: E, userId: _, earlyId: k = "", logUrl: e } = this.options, n = "web", O = ($) => ({
|
|
7501
|
+
ws_c_timeout: 0,
|
|
7502
|
+
// WebSocket 连接超时
|
|
7503
|
+
webrtc_c_timeout: 1,
|
|
7504
|
+
// WebRTC 连接超时
|
|
7505
|
+
join_room_error: 2,
|
|
7506
|
+
// 加入房间失败
|
|
7507
|
+
publish_error: 3,
|
|
7508
|
+
// 发布流失败
|
|
7509
|
+
subscribe_error: 4,
|
|
7510
|
+
// 订阅流失败
|
|
7511
|
+
close_track_error: 5,
|
|
7512
|
+
// 关闭轨道失败
|
|
7513
|
+
heartbeat_e_timeout: 6,
|
|
7514
|
+
// 心跳检测发送超时
|
|
7515
|
+
heartbeat_i_timeout: 7,
|
|
7516
|
+
// 心跳检测接收超时
|
|
7517
|
+
quit_room_error: 8
|
|
7518
|
+
// 退出房间失败
|
|
7519
|
+
})[$].toString();
|
|
7500
7520
|
{
|
|
7501
|
-
const O = { origin: n, type:
|
|
7502
|
-
|
|
7521
|
+
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}`;
|
|
7522
|
+
{
|
|
7523
|
+
const P = localStorage.getItem("#quickvo.logs") || JSON.stringify([]), V = new TextEncoder().encode(P), Q = pako.deflate(V, { gzip: !0 });
|
|
7524
|
+
this.options.debug && 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 });
|
|
7525
|
+
}
|
|
7503
7526
|
}
|
|
7504
7527
|
});
|
|
7505
|
-
|
|
7528
|
+
at(this, zt, () => {
|
|
7506
7529
|
this.taskQueue.setCondition("createWs", !0), this.taskQueue.setCondition("createSession", !1), this.taskQueue.setCondition("ice", !1);
|
|
7507
7530
|
});
|
|
7508
7531
|
/**
|
|
@@ -7535,7 +7558,7 @@ class RoomBase {
|
|
|
7535
7558
|
const I = await navigator.mediaDevices.enumerateDevices();
|
|
7536
7559
|
I.find((E) => E.kind === "audioinput") || (this.mediaDevicesErrInfo.microphoneCamera_audio = "audioinput is not available."), I.find((E) => E.kind === "videoinput") || (this.mediaDevicesErrInfo.microphoneCamera_video = "videoinput is not available.");
|
|
7537
7560
|
} catch (I) {
|
|
7538
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->
|
|
7561
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getMediaDevicesErrInfo is error.", I);
|
|
7539
7562
|
}
|
|
7540
7563
|
return this.mediaDevicesErrInfo;
|
|
7541
7564
|
});
|
|
@@ -7595,35 +7618,35 @@ class RoomBase {
|
|
|
7595
7618
|
* 处理为应用层数据
|
|
7596
7619
|
*/
|
|
7597
7620
|
Z(this, "usersFilter", (I) => ft(I, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "permissions", "isPublished", "updateStreams"]).sort((_, k) => _.id.localeCompare(k.id, "en")));
|
|
7598
|
-
this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), J(this,
|
|
7621
|
+
this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), J(this, zt).call(this);
|
|
7599
7622
|
}
|
|
7600
7623
|
}
|
|
7601
|
-
|
|
7602
|
-
var
|
|
7624
|
+
zt = new WeakMap();
|
|
7625
|
+
var It, bt, _t, vt, St, Jt, Wt, Rt, Kt;
|
|
7603
7626
|
class RoomMedias extends RoomBase {
|
|
7604
7627
|
// 本地流管理
|
|
7605
7628
|
constructor(u) {
|
|
7606
7629
|
super(u);
|
|
7607
|
-
|
|
7630
|
+
at(this, It, []);
|
|
7608
7631
|
// 可用媒体设备列表
|
|
7609
|
-
|
|
7632
|
+
at(this, bt, /* @__PURE__ */ new Map());
|
|
7610
7633
|
// 媒体流设备管理
|
|
7611
|
-
|
|
7634
|
+
at(this, _t, /* @__PURE__ */ new Map());
|
|
7612
7635
|
// 媒体轨道参数管理
|
|
7613
|
-
|
|
7636
|
+
at(this, vt, /* @__PURE__ */ new Map());
|
|
7614
7637
|
// 媒体流上下文
|
|
7615
|
-
|
|
7638
|
+
at(this, St, []);
|
|
7616
7639
|
/**
|
|
7617
7640
|
* 初始化媒体参数
|
|
7618
7641
|
*/
|
|
7619
|
-
|
|
7620
|
-
J(this,
|
|
7642
|
+
at(this, Jt, () => {
|
|
7643
|
+
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", {});
|
|
7621
7644
|
});
|
|
7622
7645
|
/**
|
|
7623
7646
|
* 初始化媒体设备类型
|
|
7624
7647
|
*/
|
|
7625
|
-
|
|
7626
|
-
J(this,
|
|
7648
|
+
at(this, Wt, () => {
|
|
7649
|
+
J(this, bt).set("audioinput", "default"), J(this, bt).set("videoinput", "default"), J(this, bt).set("audiooutput", "default");
|
|
7627
7650
|
});
|
|
7628
7651
|
/**
|
|
7629
7652
|
* 房间所有用户所有媒体流变化
|
|
@@ -7648,14 +7671,14 @@ class RoomMedias extends RoomBase {
|
|
|
7648
7671
|
case "audio":
|
|
7649
7672
|
{
|
|
7650
7673
|
const $ = new AudioMediaContext(k);
|
|
7651
|
-
J(this,
|
|
7674
|
+
J(this, vt).set(e, $);
|
|
7652
7675
|
}
|
|
7653
7676
|
break;
|
|
7654
7677
|
// 视频媒体处理
|
|
7655
7678
|
case "video":
|
|
7656
7679
|
{
|
|
7657
7680
|
const $ = new VideoMediaContext(k);
|
|
7658
|
-
J(this,
|
|
7681
|
+
J(this, vt).set(e, $);
|
|
7659
7682
|
}
|
|
7660
7683
|
break;
|
|
7661
7684
|
}
|
|
@@ -7663,7 +7686,7 @@ class RoomMedias extends RoomBase {
|
|
|
7663
7686
|
const $ = this.getUserMediaStreamContext(u, E);
|
|
7664
7687
|
if ($ && $.kind === "audio")
|
|
7665
7688
|
try {
|
|
7666
|
-
const N = J(this,
|
|
7689
|
+
const N = J(this, bt).get("audiooutput");
|
|
7667
7690
|
(O = $.audioContext) == null || O.setSinkId(N);
|
|
7668
7691
|
} catch (N) {
|
|
7669
7692
|
console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setSinkId is error", N);
|
|
@@ -7675,21 +7698,21 @@ class RoomMedias extends RoomBase {
|
|
|
7675
7698
|
*/
|
|
7676
7699
|
Z(this, "getUserMediaStreamContext", (u, E) => {
|
|
7677
7700
|
const _ = this.getUserMediaKey(u, E);
|
|
7678
|
-
return J(this,
|
|
7701
|
+
return J(this, vt).get(_);
|
|
7679
7702
|
});
|
|
7680
7703
|
/**
|
|
7681
7704
|
* 获取用户音频媒体流上下文
|
|
7682
7705
|
*/
|
|
7683
7706
|
Z(this, "getUserAudioMediaStreamContext", (u, E) => {
|
|
7684
7707
|
const _ = this.getUserMediaKey(u, E);
|
|
7685
|
-
return J(this,
|
|
7708
|
+
return J(this, vt).get(_);
|
|
7686
7709
|
});
|
|
7687
7710
|
/**
|
|
7688
7711
|
* 删除用户媒体流上下文
|
|
7689
7712
|
*/
|
|
7690
7713
|
Z(this, "removeUserMediaStreamContext", (u, E) => {
|
|
7691
|
-
const _ = this.getUserMediaKey(u, E), k = J(this,
|
|
7692
|
-
k == null || k.stop(), J(this,
|
|
7714
|
+
const _ = this.getUserMediaKey(u, E), k = J(this, vt).get(_);
|
|
7715
|
+
k == null || k.stop(), J(this, vt).delete(_);
|
|
7693
7716
|
});
|
|
7694
7717
|
/**
|
|
7695
7718
|
* 获取某个用户的某个数据流
|
|
@@ -7722,16 +7745,16 @@ class RoomMedias extends RoomBase {
|
|
|
7722
7745
|
* 清除所有媒体流使用
|
|
7723
7746
|
*/
|
|
7724
7747
|
Z(this, "clearUserStreams", () => {
|
|
7725
|
-
const u = J(this,
|
|
7748
|
+
const u = J(this, vt).values();
|
|
7726
7749
|
for (const E of u)
|
|
7727
7750
|
E.stop();
|
|
7728
|
-
|
|
7751
|
+
Ot(this, vt, /* @__PURE__ */ new Map());
|
|
7729
7752
|
});
|
|
7730
7753
|
/**
|
|
7731
7754
|
* 设置轨道媒体参数
|
|
7732
7755
|
*/
|
|
7733
7756
|
Z(this, "setMediaTrackConstraints", async (u, E) => {
|
|
7734
|
-
J(this,
|
|
7757
|
+
J(this, _t).set(u, E);
|
|
7735
7758
|
const k = this.getUserStream(this.options.userId, u).getTracks();
|
|
7736
7759
|
if (k.length !== 0)
|
|
7737
7760
|
for (const e of k) {
|
|
@@ -7743,12 +7766,12 @@ class RoomMedias extends RoomBase {
|
|
|
7743
7766
|
* 清理所有本地流
|
|
7744
7767
|
*/
|
|
7745
7768
|
Z(this, "clearLocalStream", () => {
|
|
7746
|
-
for (const u of J(this,
|
|
7769
|
+
for (const u of J(this, St)) {
|
|
7747
7770
|
const E = u.getTracks();
|
|
7748
7771
|
for (const _ of E)
|
|
7749
7772
|
_.stop();
|
|
7750
7773
|
}
|
|
7751
|
-
|
|
7774
|
+
Ot(this, St, []);
|
|
7752
7775
|
});
|
|
7753
7776
|
/**
|
|
7754
7777
|
* 初始化本地流
|
|
@@ -7760,32 +7783,32 @@ class RoomMedias extends RoomBase {
|
|
|
7760
7783
|
case "microphoneCamera_audio":
|
|
7761
7784
|
{
|
|
7762
7785
|
this.removeUserMediaStreamContext(E, "microphoneCamera_audio");
|
|
7763
|
-
const _ = J(this,
|
|
7764
|
-
J(this,
|
|
7786
|
+
const _ = J(this, bt).get("audioinput"), k = J(this, _t).get("microphoneCamera_audio"), e = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...k }, video: !1 });
|
|
7787
|
+
J(this, St).push(e), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", e);
|
|
7765
7788
|
}
|
|
7766
7789
|
break;
|
|
7767
7790
|
// 摄像头
|
|
7768
7791
|
case "microphoneCamera_video":
|
|
7769
7792
|
{
|
|
7770
7793
|
this.removeUserMediaStreamContext(E, "microphoneCamera_video");
|
|
7771
|
-
const _ = J(this,
|
|
7772
|
-
J(this,
|
|
7794
|
+
const _ = J(this, bt).get("videoinput"), k = J(this, _t).get("microphoneCamera_video"), e = await navigator.mediaDevices.getUserMedia({ audio: !1, video: { deviceId: _, ...k } });
|
|
7795
|
+
J(this, St).push(e), await this.initUserMediaStreamContext(E, "microphoneCamera_video", e);
|
|
7773
7796
|
}
|
|
7774
7797
|
break;
|
|
7775
7798
|
// 麦克风 + 摄像头
|
|
7776
7799
|
case "microphoneCamera":
|
|
7777
7800
|
{
|
|
7778
7801
|
this.removeUserMediaStreamContext(E, "microphoneCamera_audio"), this.removeUserMediaStreamContext(E, "microphoneCamera_video");
|
|
7779
|
-
const _ = J(this,
|
|
7780
|
-
J(this,
|
|
7802
|
+
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 } });
|
|
7803
|
+
J(this, St).push(O), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", O);
|
|
7781
7804
|
}
|
|
7782
7805
|
break;
|
|
7783
7806
|
// 屏幕共享 音频
|
|
7784
7807
|
case "screenSharing_audio":
|
|
7785
7808
|
{
|
|
7786
7809
|
this.removeUserMediaStreamContext(E, "screenSharing_audio");
|
|
7787
|
-
const _ = J(this,
|
|
7788
|
-
J(this,
|
|
7810
|
+
const _ = J(this, _t).get("screenSharing_audio"), k = await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._ });
|
|
7811
|
+
J(this, St).push(k);
|
|
7789
7812
|
const e = k.getTracks();
|
|
7790
7813
|
for (const n of e) {
|
|
7791
7814
|
const { kind: O } = n;
|
|
@@ -7800,8 +7823,8 @@ class RoomMedias extends RoomBase {
|
|
|
7800
7823
|
case "screenSharing_video":
|
|
7801
7824
|
{
|
|
7802
7825
|
this.removeUserMediaStreamContext(E, u);
|
|
7803
|
-
const _ = J(this,
|
|
7804
|
-
J(this,
|
|
7826
|
+
const _ = J(this, _t).get(u), k = await navigator.mediaDevices.getDisplayMedia({ audio: !1, video: !0, ..._ });
|
|
7827
|
+
J(this, St).push(k);
|
|
7805
7828
|
const e = k.getTracks();
|
|
7806
7829
|
for (const n of e) {
|
|
7807
7830
|
const { kind: O } = n;
|
|
@@ -7816,8 +7839,8 @@ class RoomMedias extends RoomBase {
|
|
|
7816
7839
|
case "screenSharing":
|
|
7817
7840
|
{
|
|
7818
7841
|
this.removeUserMediaStreamContext(E, "screenSharing_audio"), this.removeUserMediaStreamContext(E, "screenSharing_video");
|
|
7819
|
-
const _ = J(this,
|
|
7820
|
-
J(this,
|
|
7842
|
+
const _ = J(this, _t).get("screenSharing_audio"), k = J(this, _t).get("screenSharing_video"), e = await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._, ...k });
|
|
7843
|
+
J(this, St).push(e);
|
|
7821
7844
|
const n = e.getTracks();
|
|
7822
7845
|
for (const O of n) {
|
|
7823
7846
|
const { kind: $ } = O;
|
|
@@ -7841,33 +7864,33 @@ class RoomMedias extends RoomBase {
|
|
|
7841
7864
|
/**
|
|
7842
7865
|
* 获取媒体设备列表
|
|
7843
7866
|
*/
|
|
7844
|
-
|
|
7845
|
-
|
|
7867
|
+
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) => {
|
|
7868
|
+
Ot(this, It, u);
|
|
7846
7869
|
}).catch(function(u) {
|
|
7847
7870
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", u);
|
|
7848
|
-
}), J(this,
|
|
7871
|
+
}), J(this, It)));
|
|
7849
7872
|
/**
|
|
7850
7873
|
* 媒体设备发生变化
|
|
7851
7874
|
*/
|
|
7852
|
-
|
|
7875
|
+
at(this, Kt, () => {
|
|
7853
7876
|
navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
|
|
7854
|
-
await J(this,
|
|
7855
|
-
}), J(this,
|
|
7877
|
+
await J(this, Rt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
|
|
7878
|
+
}), J(this, Rt).call(this);
|
|
7856
7879
|
});
|
|
7857
7880
|
/**
|
|
7858
7881
|
* 获取正在使用的媒体设备ID
|
|
7859
7882
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7860
7883
|
* @returns deviceId 设备ID
|
|
7861
7884
|
*/
|
|
7862
|
-
Z(this, "getMediaDeviceKind", (u) => J(this,
|
|
7885
|
+
Z(this, "getMediaDeviceKind", (u) => J(this, bt).get(u));
|
|
7863
7886
|
/**
|
|
7864
7887
|
* 设置正在使用的媒体设备
|
|
7865
7888
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7866
7889
|
* @param deviceId 设备ID
|
|
7867
7890
|
*/
|
|
7868
7891
|
Z(this, "setDeviceKind", async (u, E) => {
|
|
7869
|
-
if (J(this,
|
|
7870
|
-
const _ = J(this,
|
|
7892
|
+
if (J(this, bt).set(u, E), u === "audiooutput") {
|
|
7893
|
+
const _ = J(this, vt).values();
|
|
7871
7894
|
for (const k of _)
|
|
7872
7895
|
if (k.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype)
|
|
7873
7896
|
try {
|
|
@@ -7888,7 +7911,7 @@ class RoomMedias extends RoomBase {
|
|
|
7888
7911
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7889
7912
|
* @returns MediaDeviceInfo[]
|
|
7890
7913
|
*/
|
|
7891
|
-
Z(this, "getEnumerateDevices", async (u) => (await J(this,
|
|
7914
|
+
Z(this, "getEnumerateDevices", async (u) => (await J(this, Rt).call(this), J(this, It).filter((_) => _.kind === u)));
|
|
7892
7915
|
/**
|
|
7893
7916
|
* 获取可用音频输入设备
|
|
7894
7917
|
* @returns MediaDeviceInfo[]
|
|
@@ -7904,10 +7927,10 @@ class RoomMedias extends RoomBase {
|
|
|
7904
7927
|
* @returns MediaDeviceInfo[]
|
|
7905
7928
|
*/
|
|
7906
7929
|
Z(this, "getEnumerateVideoinputDevices", () => this.getEnumerateDevices("videoinput"));
|
|
7907
|
-
J(this,
|
|
7930
|
+
J(this, Kt).call(this), J(this, Wt).call(this), J(this, Jt).call(this);
|
|
7908
7931
|
}
|
|
7909
7932
|
}
|
|
7910
|
-
|
|
7933
|
+
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();
|
|
7911
7934
|
class RoomUsers extends RoomMedias {
|
|
7912
7935
|
constructor(u) {
|
|
7913
7936
|
super(u);
|
|
@@ -8211,11 +8234,11 @@ const createMutedAudioStream = () => {
|
|
|
8211
8234
|
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;
|
|
8212
8235
|
}, 100), E.captureStream(u);
|
|
8213
8236
|
};
|
|
8214
|
-
var
|
|
8237
|
+
var gt, Gt, At, Qt, Vt, Yt;
|
|
8215
8238
|
class RoomPeer extends RoomUsers {
|
|
8216
8239
|
constructor(u) {
|
|
8217
8240
|
super(u);
|
|
8218
|
-
|
|
8241
|
+
at(this, gt, /* @__PURE__ */ new Map());
|
|
8219
8242
|
// 假媒体流 (创建轨道用)
|
|
8220
8243
|
Z(this, "getPeerStatsTimer", 0);
|
|
8221
8244
|
// 获取报告的定时器
|
|
@@ -8234,28 +8257,35 @@ class RoomPeer extends RoomUsers {
|
|
|
8234
8257
|
// 网络抖动
|
|
8235
8258
|
});
|
|
8236
8259
|
Z(this, "initPeer", () => {
|
|
8237
|
-
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), J(this,
|
|
8260
|
+
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), J(this, Qt).call(this), J(this, Yt).call(this);
|
|
8238
8261
|
});
|
|
8239
8262
|
// 初始化假数据流
|
|
8240
|
-
|
|
8241
|
-
for (const u of mediaType_keys)
|
|
8263
|
+
at(this, Gt, () => {
|
|
8264
|
+
for (const u of mediaType_keys) {
|
|
8265
|
+
const E = J(this, gt).get(u);
|
|
8266
|
+
if (E) {
|
|
8267
|
+
const _ = E.getTracks();
|
|
8268
|
+
for (const k of _)
|
|
8269
|
+
k.stop();
|
|
8270
|
+
}
|
|
8242
8271
|
switch (u) {
|
|
8243
8272
|
case "microphoneCamera_audio":
|
|
8244
|
-
J(this,
|
|
8273
|
+
J(this, gt).set("microphoneCamera_audio", createMutedAudioStream());
|
|
8245
8274
|
break;
|
|
8246
8275
|
case "microphoneCamera_video":
|
|
8247
|
-
J(this,
|
|
8276
|
+
J(this, gt).set("microphoneCamera_video", createFakeVideoStream());
|
|
8248
8277
|
break;
|
|
8249
8278
|
case "screenSharing_audio":
|
|
8250
|
-
J(this,
|
|
8279
|
+
J(this, gt).set("screenSharing_audio", createMutedAudioStream());
|
|
8251
8280
|
break;
|
|
8252
8281
|
case "screenSharing_video":
|
|
8253
|
-
J(this,
|
|
8282
|
+
J(this, gt).set("screenSharing_video", createFakeVideoStream());
|
|
8254
8283
|
break;
|
|
8255
8284
|
}
|
|
8285
|
+
}
|
|
8256
8286
|
});
|
|
8257
8287
|
// 获取假数据流
|
|
8258
|
-
|
|
8288
|
+
at(this, At, (u) => J(this, gt).get(u));
|
|
8259
8289
|
/**
|
|
8260
8290
|
* 替换发射器媒体流
|
|
8261
8291
|
*/
|
|
@@ -8267,7 +8297,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8267
8297
|
let n;
|
|
8268
8298
|
if (e) {
|
|
8269
8299
|
const { sender: O } = e;
|
|
8270
|
-
E ? n = this.getUserStream(_, k) : n = J(this,
|
|
8300
|
+
E ? n = this.getUserStream(_, k) : n = J(this, At).call(this, k);
|
|
8271
8301
|
const [$] = n.getTracks();
|
|
8272
8302
|
await O.replaceTrack($);
|
|
8273
8303
|
}
|
|
@@ -8292,14 +8322,14 @@ class RoomPeer extends RoomUsers {
|
|
|
8292
8322
|
* 添加发射器
|
|
8293
8323
|
*/
|
|
8294
8324
|
Z(this, "addSenders", async (u = []) => {
|
|
8295
|
-
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" }));
|
|
8296
8326
|
const E = [];
|
|
8297
8327
|
for (const _ of u) {
|
|
8298
|
-
if (this.transceiverMap.
|
|
8299
|
-
const
|
|
8300
|
-
this.transceiverMap.set(_,
|
|
8328
|
+
if (this.transceiverMap.get(_)) continue;
|
|
8329
|
+
const e = J(this, At).call(this, _), [n] = e.getTracks(), O = this.peerIns.addTransceiver(n, { direction: "sendonly" });
|
|
8330
|
+
this.transceiverMap.set(_, O), E.push(_);
|
|
8301
8331
|
}
|
|
8302
|
-
if (u.length === 0 || E.length) {
|
|
8332
|
+
if (u.length === 0 || E.length !== 0) {
|
|
8303
8333
|
const _ = await this.peerIns.createOffer();
|
|
8304
8334
|
if (this.options.debug) {
|
|
8305
8335
|
const k = libExports.parse(_.sdp), e = ft(k.media, ["mid", "msid", "type"]);
|
|
@@ -8382,7 +8412,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8382
8412
|
/**
|
|
8383
8413
|
* 监听webrtc ice通讯连接
|
|
8384
8414
|
*/
|
|
8385
|
-
|
|
8415
|
+
at(this, Qt, () => {
|
|
8386
8416
|
let u = 0;
|
|
8387
8417
|
const E = () => {
|
|
8388
8418
|
this.setRoomState("closed");
|
|
@@ -8532,33 +8562,33 @@ class RoomPeer extends RoomUsers {
|
|
|
8532
8562
|
/**
|
|
8533
8563
|
* 计算网络质量
|
|
8534
8564
|
*/
|
|
8535
|
-
|
|
8565
|
+
at(this, Vt, async () => {
|
|
8536
8566
|
try {
|
|
8537
8567
|
const u = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...u.values()].filter((nt) => E.includes(nt.type));
|
|
8538
8568
|
let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
|
|
8539
8569
|
for (const nt of this.reports) {
|
|
8540
|
-
const { packetsSent:
|
|
8541
|
-
|
|
8570
|
+
const { packetsSent: ut, packetsLost: it } = nt;
|
|
8571
|
+
ut && (O += ut), it && ($ += it);
|
|
8542
8572
|
}
|
|
8543
8573
|
this.reports = k;
|
|
8544
8574
|
for (const nt of this.reports) {
|
|
8545
|
-
const { bytesReceived:
|
|
8546
|
-
|
|
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));
|
|
8547
8577
|
}
|
|
8548
8578
|
P.sort().reverse(), q.sort().reverse();
|
|
8549
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 };
|
|
8550
8580
|
this.peerNetwork = et;
|
|
8551
|
-
const tt = (nt,
|
|
8552
|
-
const
|
|
8553
|
-
let
|
|
8554
|
-
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);
|
|
8555
8585
|
};
|
|
8556
8586
|
{
|
|
8557
|
-
const nt = tt(Q, z, Y),
|
|
8558
|
-
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) {
|
|
8559
8589
|
this.emitNotifyUpdateUsers();
|
|
8560
|
-
const { userId:
|
|
8561
|
-
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);
|
|
8562
8592
|
}
|
|
8563
8593
|
}
|
|
8564
8594
|
} catch (u) {
|
|
@@ -8568,9 +8598,9 @@ class RoomPeer extends RoomUsers {
|
|
|
8568
8598
|
/**
|
|
8569
8599
|
* 获取连接的所有轨道分析数据
|
|
8570
8600
|
*/
|
|
8571
|
-
|
|
8601
|
+
at(this, Yt, () => {
|
|
8572
8602
|
const u = async () => {
|
|
8573
|
-
this.peerIns.connectionState !== "connected" || !this.options.roomId || J(this,
|
|
8603
|
+
this.peerIns.connectionState !== "connected" || !this.options.roomId || J(this, Vt).call(this);
|
|
8574
8604
|
};
|
|
8575
8605
|
this.getPeerStatsTimer = setInterval(u, 1 * 1e3);
|
|
8576
8606
|
});
|
|
@@ -8578,11 +8608,11 @@ class RoomPeer extends RoomUsers {
|
|
|
8578
8608
|
* 停止网络报告分析
|
|
8579
8609
|
*/
|
|
8580
8610
|
Z(this, "stopGetPeerStats", () => clearInterval(this.getPeerStatsTimer));
|
|
8581
|
-
J(this,
|
|
8611
|
+
J(this, Gt).call(this);
|
|
8582
8612
|
}
|
|
8583
8613
|
}
|
|
8584
|
-
|
|
8585
|
-
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;
|
|
8586
8616
|
class RoomCalls extends RoomPeer {
|
|
8587
8617
|
constructor(u) {
|
|
8588
8618
|
super(u);
|
|
@@ -8592,7 +8622,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8592
8622
|
* 广播给房间其他人
|
|
8593
8623
|
* 只有当自己建立了发射轨道 并且 加入房间后才进行广播
|
|
8594
8624
|
*/
|
|
8595
|
-
|
|
8625
|
+
at(this, Xt, async (u) => {
|
|
8596
8626
|
const { roomId: E } = this.options;
|
|
8597
8627
|
if (!E) return;
|
|
8598
8628
|
const { id: _, tracks: k = [] } = await this.getCaller();
|
|
@@ -8603,7 +8633,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8603
8633
|
/**
|
|
8604
8634
|
* 更新自己通话状态
|
|
8605
8635
|
*/
|
|
8606
|
-
|
|
8636
|
+
at(this, Et, async (u) => new Promise(async (E, _) => {
|
|
8607
8637
|
const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: u } };
|
|
8608
8638
|
await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
|
|
8609
8639
|
const { code: $ = 0 } = O;
|
|
@@ -8614,7 +8644,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8614
8644
|
/**
|
|
8615
8645
|
* 创建连接
|
|
8616
8646
|
*/
|
|
8617
|
-
|
|
8647
|
+
at(this, qt, () => new Promise(async (u, E) => {
|
|
8618
8648
|
try {
|
|
8619
8649
|
if (["connecting", "connected"].includes(this.cwsIns.state)) return u(!0);
|
|
8620
8650
|
this.taskQueue.setCondition("createWs", !1), this.cwsIns.clearEvents(), this.initPeer();
|
|
@@ -8629,19 +8659,19 @@ class RoomCalls extends RoomPeer {
|
|
|
8629
8659
|
};
|
|
8630
8660
|
if (this.isEarly) {
|
|
8631
8661
|
const N = ht();
|
|
8632
|
-
O.i = N;
|
|
8662
|
+
O.i = N, this.setOptions({ earlyId: N });
|
|
8633
8663
|
}
|
|
8634
8664
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createWs", O);
|
|
8635
8665
|
const $ = btoa(encodeURI(JSON.stringify(O)));
|
|
8636
8666
|
await this.cwsIns.connect($), this.taskQueue.setCondition("createWs", !0), u(!0);
|
|
8637
8667
|
} catch (_) {
|
|
8638
|
-
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(_);
|
|
8639
8669
|
}
|
|
8640
8670
|
}));
|
|
8641
8671
|
/**
|
|
8642
8672
|
* 创建cf会话
|
|
8643
8673
|
*/
|
|
8644
|
-
|
|
8674
|
+
at(this, Dt, () => {
|
|
8645
8675
|
if (!["connecting", "connected"].includes(this.roomState))
|
|
8646
8676
|
return this.setRoomState("connecting"), new Promise((u) => {
|
|
8647
8677
|
const E = async () => {
|
|
@@ -8665,7 +8695,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8665
8695
|
u(!0);
|
|
8666
8696
|
});
|
|
8667
8697
|
} catch (_) {
|
|
8668
|
-
|
|
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 || _);
|
|
8669
8699
|
}
|
|
8670
8700
|
};
|
|
8671
8701
|
this.taskQueue.addTask(E, ["createWs"], { key: "createSession", describe: "createSession" });
|
|
@@ -8677,12 +8707,12 @@ class RoomCalls extends RoomPeer {
|
|
|
8677
8707
|
* @example quickvo.earlyConnect(['microphoneCamera_audio', 'microphoneCamera_video'])
|
|
8678
8708
|
*/
|
|
8679
8709
|
Z(this, "earlyConnect", (u = []) => {
|
|
8680
|
-
this.isEarly = !0, J(this,
|
|
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);
|
|
8681
8711
|
});
|
|
8682
8712
|
/**
|
|
8683
8713
|
* 创建媒体轨道
|
|
8684
8714
|
*/
|
|
8685
|
-
|
|
8715
|
+
at(this, Ct, async (u) => new Promise((E) => {
|
|
8686
8716
|
const _ = async () => {
|
|
8687
8717
|
try {
|
|
8688
8718
|
this.taskQueue.setCondition("createTrack", !1);
|
|
@@ -8694,13 +8724,12 @@ class RoomCalls extends RoomPeer {
|
|
|
8694
8724
|
data: { sdp: this.getSdp(), tracks: e, callAction: 0 }
|
|
8695
8725
|
}).then(async (n) => {
|
|
8696
8726
|
const { code: O = 0, desc: $, data: N } = n;
|
|
8697
|
-
if (O !== 200)
|
|
8698
|
-
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($);
|
|
8699
8728
|
const { remoteSdp: D } = N;
|
|
8700
8729
|
await this.setRemoteDescription({ type: "answer", sdp: D }), this.taskQueue.setCondition("createTrack", !0), E(!0);
|
|
8701
8730
|
});
|
|
8702
8731
|
} catch (k) {
|
|
8703
|
-
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), E(!0);
|
|
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);
|
|
8704
8733
|
}
|
|
8705
8734
|
};
|
|
8706
8735
|
this.taskQueue.addTask(_, ["createWs", "createSession", "ice", "subscribe", "createTrack", "closeTrack"], { describe: "createTrack" });
|
|
@@ -8718,20 +8747,17 @@ class RoomCalls extends RoomPeer {
|
|
|
8718
8747
|
typeof u == "string" && (u = [u]);
|
|
8719
8748
|
const { userId: e = "" } = this.options;
|
|
8720
8749
|
for (const O of u)
|
|
8721
|
-
|
|
8722
|
-
this.removeUserMediaStreamContext(e, O);
|
|
8723
|
-
continue;
|
|
8724
|
-
}
|
|
8750
|
+
this.removeUserMediaStreamContext(e, O), this.setLocalStreamActiveMap.set(O, E);
|
|
8725
8751
|
if (E) {
|
|
8726
|
-
if (u.includes("microphoneCamera_audio") && u.includes("microphoneCamera_video")
|
|
8752
|
+
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")) {
|
|
8727
8753
|
const $ = this.getUserStream(e, "screenSharing_audio").getTracks();
|
|
8728
8754
|
for (const N of $)
|
|
8729
|
-
N.onended = () => this.stopPublish(["screenSharing_audio"]);
|
|
8755
|
+
N.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
|
|
8730
8756
|
}
|
|
8731
8757
|
if (u.includes("screenSharing_video")) {
|
|
8732
8758
|
const $ = this.getUserStream(e, "screenSharing_video").getTracks();
|
|
8733
8759
|
for (const N of $)
|
|
8734
|
-
N.onended = () => this.stopPublish(["screenSharing_video"]);
|
|
8760
|
+
N.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
|
|
8735
8761
|
}
|
|
8736
8762
|
}
|
|
8737
8763
|
const n = this.getUserStreams(e);
|
|
@@ -8767,7 +8793,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8767
8793
|
Z(this, "changeScreenSharing", async (u) => {
|
|
8768
8794
|
const E = await this.getCaller(), { tracks: _ = [], callActionMap: k } = E;
|
|
8769
8795
|
try {
|
|
8770
|
-
await this.setLocalStream(u, !0)
|
|
8796
|
+
await this.setLocalStream(u, !0);
|
|
8771
8797
|
for (const e of u)
|
|
8772
8798
|
_.find((O) => O.mediaType === e && k[e]) && await this.replaceSenderStream([e], !0);
|
|
8773
8799
|
} catch (e) {
|
|
@@ -8780,7 +8806,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8780
8806
|
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
|
|
8781
8807
|
* @returns Promise<boolean>
|
|
8782
8808
|
*/
|
|
8783
|
-
Z(this, "joinRoom", async (u) => (this.setOptions(u), await J(this,
|
|
8809
|
+
Z(this, "joinRoom", async (u) => (this.setOptions(u), await J(this, qt).call(this), new Promise((E, _) => {
|
|
8784
8810
|
this.clearUsers();
|
|
8785
8811
|
let k = "";
|
|
8786
8812
|
const e = async () => {
|
|
@@ -8799,7 +8825,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8799
8825
|
if (q !== 200) return _(P);
|
|
8800
8826
|
const { roomId: V = "", roomUsers: Q = [] } = j;
|
|
8801
8827
|
if (V !== O) return _("加入的房间不匹配");
|
|
8802
|
-
this.isInRoom = !0, J(this,
|
|
8828
|
+
this.isInRoom = !0, J(this, Dt).call(this), await this.updateUsers(Q), e();
|
|
8803
8829
|
});
|
|
8804
8830
|
} catch (O) {
|
|
8805
8831
|
this.taskQueue.setCondition("joinRoom", !0), this.reportLogs("join_room_error", O.message || O), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
|
|
@@ -8866,17 +8892,18 @@ class RoomCalls extends RoomPeer {
|
|
|
8866
8892
|
const e = await this.getCaller();
|
|
8867
8893
|
try {
|
|
8868
8894
|
await this.setLocalStream(u, !0);
|
|
8869
|
-
} catch {
|
|
8895
|
+
} catch (q) {
|
|
8896
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setLocalStream is error.", q);
|
|
8870
8897
|
}
|
|
8871
8898
|
const n = [];
|
|
8872
8899
|
for (const q of u)
|
|
8873
8900
|
this.getUserStream(e.id, q).getTracks().length === 0 && n.push(q);
|
|
8874
8901
|
const O = u.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
|
|
8875
|
-
await J(this,
|
|
8902
|
+
await J(this, Ct).call(this, O);
|
|
8876
8903
|
const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
|
|
8877
8904
|
await this.updateUsertracks(e.id, N, !0);
|
|
8878
8905
|
const D = await this.getCallAction(N);
|
|
8879
|
-
await J(this,
|
|
8906
|
+
await J(this, Et).call(this, D), n.length !== 0 && await this.inactiveTracks(n, !1), O.length !== 0 && await this.replaceSenderStream(O, !0), J(this, Xt).call(this, u);
|
|
8880
8907
|
{
|
|
8881
8908
|
await this.emitNotifyUpdateUsers();
|
|
8882
8909
|
const q = await this.getCaller();
|
|
@@ -8906,10 +8933,10 @@ class RoomCalls extends RoomPeer {
|
|
|
8906
8933
|
await this.emitNotifyUpdateUsers(), E($);
|
|
8907
8934
|
};
|
|
8908
8935
|
if (n.length === 0) return O();
|
|
8909
|
-
await this.
|
|
8936
|
+
await this.closeUserTracks(e.id, n, !0), await this.removeSenders(u);
|
|
8910
8937
|
{
|
|
8911
8938
|
const $ = await this.getCallAction(e.tracks);
|
|
8912
|
-
await J(this,
|
|
8939
|
+
await J(this, Et).call(this, $);
|
|
8913
8940
|
}
|
|
8914
8941
|
await this.createOffer(), await this.cwsIns.sendMessage({
|
|
8915
8942
|
event: "closeTrack",
|
|
@@ -9036,6 +9063,7 @@ class RoomCalls extends RoomPeer {
|
|
|
9036
9063
|
const k = await this.getCaller();
|
|
9037
9064
|
if (!k) return;
|
|
9038
9065
|
const { tracks: e = [] } = k, n = [...e];
|
|
9066
|
+
await this.replaceSenderStream(u, !0);
|
|
9039
9067
|
for (let $ of n) {
|
|
9040
9068
|
const { mediaType: N } = $;
|
|
9041
9069
|
if (N && u.includes(N)) {
|
|
@@ -9046,7 +9074,7 @@ class RoomCalls extends RoomPeer {
|
|
|
9046
9074
|
}
|
|
9047
9075
|
}
|
|
9048
9076
|
const O = await this.getCallAction(n);
|
|
9049
|
-
await J(this,
|
|
9077
|
+
await J(this, Et).call(this, O), E === !1 && await this.replaceSenderStream(u, !1), await this.emitNotifyUpdateUsers(), _(!0);
|
|
9050
9078
|
}));
|
|
9051
9079
|
/**
|
|
9052
9080
|
* 远端调试
|
|
@@ -9061,21 +9089,21 @@ class RoomCalls extends RoomPeer {
|
|
|
9061
9089
|
}));
|
|
9062
9090
|
}
|
|
9063
9091
|
}
|
|
9064
|
-
|
|
9092
|
+
Xt = new WeakMap(), Et = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap();
|
|
9065
9093
|
class Room extends RoomCalls {
|
|
9066
9094
|
constructor(I) {
|
|
9067
9095
|
super(I);
|
|
9068
9096
|
}
|
|
9069
9097
|
}
|
|
9070
|
-
var
|
|
9098
|
+
var Tt, te, ee, ie, ne;
|
|
9071
9099
|
class QuickVO extends Room {
|
|
9072
9100
|
constructor(u) {
|
|
9073
9101
|
super(u);
|
|
9074
|
-
|
|
9102
|
+
at(this, Tt, /* @__PURE__ */ new Map());
|
|
9075
9103
|
/**
|
|
9076
9104
|
* 添加内部监听事件
|
|
9077
9105
|
*/
|
|
9078
|
-
|
|
9106
|
+
at(this, te, () => {
|
|
9079
9107
|
{
|
|
9080
9108
|
const u = async (E) => {
|
|
9081
9109
|
const { qualities: _ = [] } = E.data, [k] = _;
|
|
@@ -9156,12 +9184,12 @@ class QuickVO extends Room {
|
|
|
9156
9184
|
/**
|
|
9157
9185
|
* cwsIns 发送消息前
|
|
9158
9186
|
*/
|
|
9159
|
-
|
|
9187
|
+
at(this, ee, () => {
|
|
9160
9188
|
});
|
|
9161
9189
|
/**
|
|
9162
9190
|
* 重连成功
|
|
9163
9191
|
*/
|
|
9164
|
-
|
|
9192
|
+
at(this, ie, () => {
|
|
9165
9193
|
this.cwsIns.onReconnectSuccess = async () => {
|
|
9166
9194
|
await this.syncRoomInfo();
|
|
9167
9195
|
};
|
|
@@ -9169,7 +9197,7 @@ class QuickVO extends Room {
|
|
|
9169
9197
|
/**
|
|
9170
9198
|
* 重连停止
|
|
9171
9199
|
*/
|
|
9172
|
-
|
|
9200
|
+
at(this, ne, async () => {
|
|
9173
9201
|
});
|
|
9174
9202
|
/**
|
|
9175
9203
|
* 添加 FrameRequestCallback
|
|
@@ -9178,13 +9206,13 @@ class QuickVO extends Room {
|
|
|
9178
9206
|
*/
|
|
9179
9207
|
Z(this, "addRequestAnimationFrame", async (u, E) => {
|
|
9180
9208
|
{
|
|
9181
|
-
const k = J(this,
|
|
9209
|
+
const k = J(this, Tt).get(u);
|
|
9182
9210
|
k && cancelAnimationFrame(k);
|
|
9183
9211
|
}
|
|
9184
9212
|
const _ = (k = Date.now()) => {
|
|
9185
9213
|
E(k);
|
|
9186
9214
|
const e = requestAnimationFrame(_);
|
|
9187
|
-
J(this,
|
|
9215
|
+
J(this, Tt).set(u, e);
|
|
9188
9216
|
};
|
|
9189
9217
|
_();
|
|
9190
9218
|
});
|
|
@@ -9193,10 +9221,10 @@ class QuickVO extends Room {
|
|
|
9193
9221
|
* @param keys string[] = []
|
|
9194
9222
|
*/
|
|
9195
9223
|
Z(this, "clearRequestAnimationFrame", async (u = []) => {
|
|
9196
|
-
u.length === 0 && (u = [...J(this,
|
|
9224
|
+
u.length === 0 && (u = [...J(this, Tt).keys()]);
|
|
9197
9225
|
const E = [];
|
|
9198
9226
|
for (const _ of u) {
|
|
9199
|
-
const k = J(this,
|
|
9227
|
+
const k = J(this, Tt).get(_);
|
|
9200
9228
|
k && (cancelAnimationFrame(k), E.push(k));
|
|
9201
9229
|
}
|
|
9202
9230
|
return E;
|
|
@@ -9208,10 +9236,10 @@ class QuickVO extends Room {
|
|
|
9208
9236
|
Z(this, "destroy", async () => {
|
|
9209
9237
|
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();
|
|
9210
9238
|
});
|
|
9211
|
-
J(this,
|
|
9239
|
+
J(this, ee).call(this), J(this, ie).call(this), J(this, ne).call(this), J(this, te).call(this);
|
|
9212
9240
|
}
|
|
9213
9241
|
}
|
|
9214
|
-
|
|
9242
|
+
Tt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), ne = new WeakMap();
|
|
9215
9243
|
export {
|
|
9216
9244
|
QuickVO,
|
|
9217
9245
|
ignoreEvent
|