quickvo-sdk-js 0.6.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +153 -139
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomCalls.d.ts +1 -1
- package/dist/room/RoomMedias.d.ts +6 -2
- package/dist/room/RoomPeer.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var oe = (u) => {
|
|
3
3
|
throw TypeError(u);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var Z = (u, I, a) =>
|
|
7
|
-
var Q = (u, I, a) => (
|
|
5
|
+
var se = (u, I, a) => I in u ? ce(u, I, { enumerable: !0, configurable: !0, writable: !0, value: a }) : u[I] = a;
|
|
6
|
+
var Z = (u, I, a) => se(u, typeof I != "symbol" ? I + "" : I, a), re = (u, I, a) => I.has(u) || oe("Cannot " + a);
|
|
7
|
+
var Q = (u, I, a) => (re(u, I, "read from private field"), a ? a.call(u) : I.get(u)), lt = (u, I, a) => I.has(u) ? oe("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(u) : I.set(u, a), St = (u, I, a, E) => (re(u, I, "write to private field"), E ? E.call(u, a) : I.set(u, a), a);
|
|
8
8
|
const ot = (u, I = {}) => {
|
|
9
9
|
const a = { unit: "B", splitStr: " ", ...I };
|
|
10
10
|
let { unit: E, splitStr: _ } = a;
|
|
@@ -6162,7 +6162,7 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
|
|
|
6162
6162
|
};
|
|
6163
6163
|
const BAD$1 = 16209, TYPE$1 = 16191;
|
|
6164
6164
|
var inffast = function u(I, a) {
|
|
6165
|
-
let E, _, k, e, n, O, $, N, D, q, P, j, V, J, z, Y, et, tt, nt, ut, it,
|
|
6165
|
+
let E, _, k, e, n, O, $, N, D, q, P, j, V, J, z, Y, et, tt, nt, ut, it, at, st, rt;
|
|
6166
6166
|
const ct = I.state;
|
|
6167
6167
|
E = I.next_in, st = I.input, _ = E + (I.avail_in - 5), k = I.next_out, rt = I.output, e = k - (a - 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, J = ct.distcode, z = (1 << ct.lenbits) - 1, Y = (1 << ct.distbits) - 1;
|
|
6168
6168
|
t:
|
|
@@ -6186,13 +6186,13 @@ var inffast = function u(I, a) {
|
|
|
6186
6186
|
I.msg = "invalid distance too far back", ct.mode = BAD$1;
|
|
6187
6187
|
break t;
|
|
6188
6188
|
}
|
|
6189
|
-
if (it = 0,
|
|
6189
|
+
if (it = 0, at = q, D === 0) {
|
|
6190
6190
|
if (it += $ - tt, tt < nt) {
|
|
6191
6191
|
nt -= tt;
|
|
6192
6192
|
do
|
|
6193
6193
|
rt[k++] = q[it++];
|
|
6194
6194
|
while (--tt);
|
|
6195
|
-
it = k - ut,
|
|
6195
|
+
it = k - ut, at = rt;
|
|
6196
6196
|
}
|
|
6197
6197
|
} else if (D < tt) {
|
|
6198
6198
|
if (it += $ + D - tt, tt -= D, tt < nt) {
|
|
@@ -6205,7 +6205,7 @@ var inffast = function u(I, a) {
|
|
|
6205
6205
|
do
|
|
6206
6206
|
rt[k++] = q[it++];
|
|
6207
6207
|
while (--tt);
|
|
6208
|
-
it = k - ut,
|
|
6208
|
+
it = k - ut, at = rt;
|
|
6209
6209
|
}
|
|
6210
6210
|
}
|
|
6211
6211
|
} else if (it += D - tt, tt < nt) {
|
|
@@ -6213,11 +6213,11 @@ var inffast = function u(I, a) {
|
|
|
6213
6213
|
do
|
|
6214
6214
|
rt[k++] = q[it++];
|
|
6215
6215
|
while (--tt);
|
|
6216
|
-
it = k - ut,
|
|
6216
|
+
it = k - ut, at = rt;
|
|
6217
6217
|
}
|
|
6218
6218
|
for (; nt > 2; )
|
|
6219
|
-
rt[k++] =
|
|
6220
|
-
nt && (rt[k++] =
|
|
6219
|
+
rt[k++] = at[it++], rt[k++] = at[it++], rt[k++] = at[it++], nt -= 3;
|
|
6220
|
+
nt && (rt[k++] = at[it++], nt > 1 && (rt[k++] = at[it++]));
|
|
6221
6221
|
} else {
|
|
6222
6222
|
it = k - ut;
|
|
6223
6223
|
do
|
|
@@ -6385,9 +6385,9 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6385
6385
|
64
|
|
6386
6386
|
]), inflate_table = (u, I, a, E, _, k, e, n) => {
|
|
6387
6387
|
const O = n.bits;
|
|
6388
|
-
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, J = 0, z = 0, Y = 0, et, tt, nt, ut, it,
|
|
6388
|
+
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, J = 0, z = 0, Y = 0, et, tt, nt, ut, it, at = null, st;
|
|
6389
6389
|
const rt = new Uint16Array(MAXBITS + 1), ct = new Uint16Array(MAXBITS + 1);
|
|
6390
|
-
let $t = null,
|
|
6390
|
+
let $t = null, ne, Ct, Ut;
|
|
6391
6391
|
for ($ = 0; $ <= MAXBITS; $++)
|
|
6392
6392
|
rt[$] = 0;
|
|
6393
6393
|
for (N = 0; N < E; N++)
|
|
@@ -6407,12 +6407,12 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6407
6407
|
ct[$ + 1] = ct[$] + rt[$];
|
|
6408
6408
|
for (N = 0; N < E; N++)
|
|
6409
6409
|
I[a + N] !== 0 && (e[ct[I[a + N]]++] = N);
|
|
6410
|
-
if (u === CODES$1 ? (
|
|
6410
|
+
if (u === CODES$1 ? (at = $t = e, st = 20) : u === LENS$1 ? (at = lbase, $t = lext, st = 257) : (at = dbase, $t = dext, st = 0), Y = 0, N = 0, $ = D, it = k, j = P, V = 0, nt = -1, z = 1 << P, ut = z - 1, u === LENS$1 && z > ENOUGH_LENS$1 || u === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6411
6411
|
return 1;
|
|
6412
6412
|
for (; ; ) {
|
|
6413
|
-
|
|
6413
|
+
ne = $ - V, e[N] + 1 < st ? (Ct = 0, Ut = e[N]) : e[N] >= st ? (Ct = $t[e[N] - st], Ut = at[e[N] - st]) : (Ct = 96, Ut = 0), et = 1 << $ - V, tt = 1 << j, D = tt;
|
|
6414
6414
|
do
|
|
6415
|
-
tt -= et, _[it + (Y >> V) + tt] =
|
|
6415
|
+
tt -= et, _[it + (Y >> V) + tt] = ne << 24 | Ct << 16 | Ut | 0;
|
|
6416
6416
|
while (tt !== 0);
|
|
6417
6417
|
for (et = 1 << $ - 1; Y & et; )
|
|
6418
6418
|
et >>= 1;
|
|
@@ -6500,7 +6500,7 @@ const fixedtables = (u) => {
|
|
|
6500
6500
|
const k = u.state;
|
|
6501
6501
|
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(a - k.wsize, a), 0), k.wnext = 0, k.whave = k.wsize) : (_ = k.wsize - k.wnext, _ > E && (_ = E), k.window.set(I.subarray(a - E, a - E + _), k.wnext), E -= _, E ? (k.window.set(I.subarray(a - E, a), 0), k.wnext = E, k.whave = k.wsize) : (k.wnext += _, k.wnext === k.wsize && (k.wnext = 0), k.whave < k.wsize && (k.whave += _))), 0;
|
|
6502
6502
|
}, inflate$2 = (u, I) => {
|
|
6503
|
-
let a, E, _, k, e, n, O, $, N, D, q, P, j, V, J = 0, z, Y, et, tt, nt, ut, it,
|
|
6503
|
+
let a, E, _, k, e, n, O, $, N, D, q, P, j, V, J = 0, z, Y, et, tt, nt, ut, it, at;
|
|
6504
6504
|
const st = new Uint8Array(4);
|
|
6505
6505
|
let rt, ct;
|
|
6506
6506
|
const $t = (
|
|
@@ -6509,7 +6509,7 @@ const fixedtables = (u) => {
|
|
|
6509
6509
|
);
|
|
6510
6510
|
if (inflateStateCheck(u) || !u.output || !u.input && u.avail_in !== 0)
|
|
6511
6511
|
return Z_STREAM_ERROR$1;
|
|
6512
|
-
a = u.state, a.mode === TYPE && (a.mode = TYPEDO), e = u.next_out, _ = u.output, O = u.avail_out, k = u.next_in, E = u.input, n = u.avail_in, $ = a.hold, N = a.bits, D = n, q = O,
|
|
6512
|
+
a = u.state, a.mode === TYPE && (a.mode = TYPEDO), e = u.next_out, _ = u.output, O = u.avail_out, k = u.next_in, E = u.input, n = u.avail_in, $ = a.hold, N = a.bits, D = n, q = O, at = Z_OK$1;
|
|
6513
6513
|
t:
|
|
6514
6514
|
for (; ; )
|
|
6515
6515
|
switch (a.mode) {
|
|
@@ -6733,7 +6733,7 @@ const fixedtables = (u) => {
|
|
|
6733
6733
|
}
|
|
6734
6734
|
for (; a.have < 19; )
|
|
6735
6735
|
a.lens[$t[a.have++]] = 0;
|
|
6736
|
-
if (a.lencode = a.lendyn, a.lenbits = 7, rt = { bits: a.lenbits },
|
|
6736
|
+
if (a.lencode = a.lendyn, a.lenbits = 7, rt = { bits: a.lenbits }, at = inftrees(CODES, a.lens, 0, 19, a.lencode, 0, a.work, rt), a.lenbits = rt.bits, at) {
|
|
6737
6737
|
u.msg = "invalid code lengths set", a.mode = BAD;
|
|
6738
6738
|
break;
|
|
6739
6739
|
}
|
|
@@ -6789,11 +6789,11 @@ const fixedtables = (u) => {
|
|
|
6789
6789
|
u.msg = "invalid code -- missing end-of-block", a.mode = BAD;
|
|
6790
6790
|
break;
|
|
6791
6791
|
}
|
|
6792
|
-
if (a.lenbits = 9, rt = { bits: a.lenbits },
|
|
6792
|
+
if (a.lenbits = 9, rt = { bits: a.lenbits }, at = inftrees(LENS, a.lens, 0, a.nlen, a.lencode, 0, a.work, rt), a.lenbits = rt.bits, at) {
|
|
6793
6793
|
u.msg = "invalid literal/lengths set", a.mode = BAD;
|
|
6794
6794
|
break;
|
|
6795
6795
|
}
|
|
6796
|
-
if (a.distbits = 6, a.distcode = a.distdyn, rt = { bits: a.distbits },
|
|
6796
|
+
if (a.distbits = 6, a.distcode = a.distdyn, rt = { bits: a.distbits }, at = inftrees(DISTS, a.lens, a.nlen, a.ndist, a.distcode, 0, a.work, rt), a.distbits = rt.bits, at) {
|
|
6797
6797
|
u.msg = "invalid distances set", a.mode = BAD;
|
|
6798
6798
|
break;
|
|
6799
6799
|
}
|
|
@@ -6935,10 +6935,10 @@ const fixedtables = (u) => {
|
|
|
6935
6935
|
a.mode = DONE;
|
|
6936
6936
|
/* falls through */
|
|
6937
6937
|
case DONE:
|
|
6938
|
-
|
|
6938
|
+
at = Z_STREAM_END$1;
|
|
6939
6939
|
break t;
|
|
6940
6940
|
case BAD:
|
|
6941
|
-
|
|
6941
|
+
at = Z_DATA_ERROR$1;
|
|
6942
6942
|
break t;
|
|
6943
6943
|
case MEM:
|
|
6944
6944
|
return Z_MEM_ERROR$1;
|
|
@@ -6948,7 +6948,7 @@ const fixedtables = (u) => {
|
|
|
6948
6948
|
return Z_STREAM_ERROR$1;
|
|
6949
6949
|
}
|
|
6950
6950
|
return u.next_out = e, u.avail_out = O, u.next_in = k, u.avail_in = n, a.hold = $, a.bits = N, (a.wsize || q !== u.avail_out && a.mode < BAD && (a.mode < CHECK || I !== Z_FINISH$1)) && updatewindow(u, u.output, u.next_out, q - u.avail_out), D -= u.avail_in, q -= u.avail_out, u.total_in += D, u.total_out += q, a.total += q, a.wrap & 4 && q && (u.adler = a.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
|
|
6951
|
-
a.flags ? crc32_1(a.check, _, q, u.next_out - q) : adler32_1(a.check, _, q, u.next_out - q)), u.data_type = a.bits + (a.last ? 64 : 0) + (a.mode === TYPE ? 128 : 0) + (a.mode === LEN_ || a.mode === COPY_ ? 256 : 0), (D === 0 && q === 0 || I === Z_FINISH$1) &&
|
|
6951
|
+
a.flags ? crc32_1(a.check, _, q, u.next_out - q) : adler32_1(a.check, _, q, u.next_out - q)), u.data_type = a.bits + (a.last ? 64 : 0) + (a.mode === TYPE ? 128 : 0) + (a.mode === LEN_ || a.mode === COPY_ ? 256 : 0), (D === 0 && q === 0 || I === Z_FINISH$1) && at === Z_OK$1 && (at = Z_BUF_ERROR), at;
|
|
6952
6952
|
}, inflateEnd = (u) => {
|
|
6953
6953
|
if (inflateStateCheck(u))
|
|
6954
6954
|
return Z_STREAM_ERROR$1;
|
|
@@ -7182,12 +7182,12 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
|
|
|
7182
7182
|
}
|
|
7183
7183
|
return u;
|
|
7184
7184
|
};
|
|
7185
|
-
var wt, dt, xt, yt, kt, Pt, Lt, Bt,
|
|
7185
|
+
var wt, dt, xt, yt, kt, Mt, Pt, Lt, Bt, Nt, jt, Zt, Ft;
|
|
7186
7186
|
class CallsWebSocket {
|
|
7187
7187
|
// 状态
|
|
7188
7188
|
constructor(I) {
|
|
7189
|
-
|
|
7190
|
-
|
|
7189
|
+
lt(this, wt);
|
|
7190
|
+
lt(this, dt, {
|
|
7191
7191
|
url: "wss://demo.putplay.cc/websocket",
|
|
7192
7192
|
// 地址
|
|
7193
7193
|
debug: !1,
|
|
@@ -7196,10 +7196,10 @@ class CallsWebSocket {
|
|
|
7196
7196
|
// 最大重连次数
|
|
7197
7197
|
timeout: 30 * 1e3
|
|
7198
7198
|
});
|
|
7199
|
-
|
|
7199
|
+
lt(this, xt, "");
|
|
7200
7200
|
// 缓存登录凭证
|
|
7201
|
-
|
|
7202
|
-
|
|
7201
|
+
lt(this, yt, {});
|
|
7202
|
+
lt(this, kt, {});
|
|
7203
7203
|
Z(this, "state", "closed");
|
|
7204
7204
|
// 外部 发送消息之前
|
|
7205
7205
|
Z(this, "sendMessageBefore", async () => {
|
|
@@ -7211,26 +7211,26 @@ class CallsWebSocket {
|
|
|
7211
7211
|
Z(this, "onReconnectStop", (I) => {
|
|
7212
7212
|
});
|
|
7213
7213
|
// 是否需要重连
|
|
7214
|
-
|
|
7214
|
+
lt(this, Mt, (I) => {
|
|
7215
7215
|
let a = !0;
|
|
7216
7216
|
const { code: E = 1e3, reason: _ = "" } = I;
|
|
7217
7217
|
return E === 1e3 && (_ === "quit success!" || _ === "replace old connection!") && (a = !1), a;
|
|
7218
7218
|
});
|
|
7219
7219
|
// 重连成功
|
|
7220
|
-
|
|
7220
|
+
lt(this, Pt, async (I) => {
|
|
7221
7221
|
Q(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);
|
|
7222
7222
|
});
|
|
7223
7223
|
// 重连停止
|
|
7224
|
-
|
|
7224
|
+
lt(this, Lt, async (I) => {
|
|
7225
7225
|
Q(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);
|
|
7226
7226
|
});
|
|
7227
7227
|
// 自定义心跳规则
|
|
7228
|
-
|
|
7228
|
+
lt(this, Bt, () => {
|
|
7229
7229
|
const I = { event: "heartbeat", sn: +`${F(1e5, 999999)}` };
|
|
7230
7230
|
return com.quick.voice.proto.CommonReq.encode(I).finish();
|
|
7231
7231
|
});
|
|
7232
7232
|
// 更新日志
|
|
7233
|
-
|
|
7233
|
+
lt(this, Nt, (I, a = {}) => {
|
|
7234
7234
|
try {
|
|
7235
7235
|
const { time: E, event: _, data: k = {}, data_original: e = {}, data_remote: n, ...O } = a, $ = U(E, "YYYY-MM-DD hh:mm:ss", { offset: 480 });
|
|
7236
7236
|
let N = {};
|
|
@@ -7269,7 +7269,7 @@ class CallsWebSocket {
|
|
|
7269
7269
|
}
|
|
7270
7270
|
});
|
|
7271
7271
|
// 创建事件
|
|
7272
|
-
|
|
7272
|
+
lt(this, jt, (I, { resolve: a, reject: E }) => {
|
|
7273
7273
|
const { sn: _ } = I, k = () => {
|
|
7274
7274
|
const n = Q(this, yt)[_];
|
|
7275
7275
|
clearTimeout(n.destructionTimer), delete Q(this, yt)[_];
|
|
@@ -7280,13 +7280,13 @@ class CallsWebSocket {
|
|
|
7280
7280
|
Q(this, yt)[_] = { message: I, resolve: a, reject: E, destruction: k, destructionTimer: e };
|
|
7281
7281
|
});
|
|
7282
7282
|
// 获取事件
|
|
7283
|
-
|
|
7283
|
+
lt(this, Zt, (I) => Q(this, yt)[I]);
|
|
7284
7284
|
// 接收消息
|
|
7285
|
-
|
|
7285
|
+
lt(this, Ft, async (I) => {
|
|
7286
7286
|
const a = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(a), { sn: _, event: k } = E, e = onMessageFormat(E);
|
|
7287
7287
|
if (Q(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) || Q(this, Nt).call(this, "res", e)), notifyName_keys.includes(k))
|
|
7288
7288
|
return this.emitNotify(k, L(e, ["code", "data", "desc"]));
|
|
7289
|
-
const O = Q(this,
|
|
7289
|
+
const O = Q(this, Zt).call(this, _);
|
|
7290
7290
|
if (O) {
|
|
7291
7291
|
const { resolve: $ = (D) => {
|
|
7292
7292
|
}, destruction: N = () => {
|
|
@@ -7316,11 +7316,11 @@ class CallsWebSocket {
|
|
|
7316
7316
|
...Q(this, dt),
|
|
7317
7317
|
url: E,
|
|
7318
7318
|
binaryType: "arraybuffer",
|
|
7319
|
-
onMessage: Q(this,
|
|
7320
|
-
checkReconnect: Q(this,
|
|
7321
|
-
getHeartbeatMsg: Q(this,
|
|
7322
|
-
onReconnectSuccess: Q(this,
|
|
7323
|
-
onReconnectStop: Q(this,
|
|
7319
|
+
onMessage: Q(this, Ft),
|
|
7320
|
+
checkReconnect: Q(this, Mt),
|
|
7321
|
+
getHeartbeatMsg: Q(this, Bt),
|
|
7322
|
+
onReconnectSuccess: Q(this, Pt),
|
|
7323
|
+
onReconnectStop: Q(this, Lt)
|
|
7324
7324
|
})), this.state = "connecting", await Q(this, wt).connect(), this.state = "connected", Q(this, dt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", Q(this, kt)), a(Q(this, wt));
|
|
7325
7325
|
}));
|
|
7326
7326
|
/**
|
|
@@ -7352,7 +7352,7 @@ class CallsWebSocket {
|
|
|
7352
7352
|
compress: !1,
|
|
7353
7353
|
...e
|
|
7354
7354
|
});
|
|
7355
|
-
Q(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) || Q(this, Nt).call(this, "req", O)), a && Q(this,
|
|
7355
|
+
Q(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) || Q(this, Nt).call(this, "req", O)), a && Q(this, jt).call(this, O, { resolve: E, reject: _ });
|
|
7356
7356
|
const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
|
|
7357
7357
|
(N = Q(this, wt)) == null || N.sendMessage($);
|
|
7358
7358
|
}));
|
|
@@ -7397,7 +7397,7 @@ class CallsWebSocket {
|
|
|
7397
7397
|
St(this, dt, { ...Q(this, dt), ...I });
|
|
7398
7398
|
}
|
|
7399
7399
|
}
|
|
7400
|
-
wt = new WeakMap(), dt = new WeakMap(), xt = new WeakMap(), yt = new WeakMap(), kt = new WeakMap(),
|
|
7400
|
+
wt = new WeakMap(), dt = new WeakMap(), xt = new WeakMap(), yt = new WeakMap(), kt = new WeakMap(), Mt = new WeakMap(), Pt = new WeakMap(), Lt = new WeakMap(), Bt = new WeakMap(), Nt = new WeakMap(), jt = new WeakMap(), Zt = new WeakMap(), Ft = new WeakMap();
|
|
7401
7401
|
var y = Object.defineProperty, x = (u) => {
|
|
7402
7402
|
throw TypeError(u);
|
|
7403
7403
|
}, g = (u, I, a) => I in u ? y(u, I, { enumerable: !0, configurable: !0, writable: !0, value: a }) : u[I] = a, h = (u, I, a) => g(u, typeof I != "symbol" ? I + "" : I, a), b = (u, I, a) => I.has(u) || x("Cannot " + a), o = (u, I, a) => (b(u, I, "read from private field"), a ? a.call(u) : I.get(u)), f = (u, I, a) => I.has(u) ? x("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(u) : I.set(u, a), p = (u, I, a, E) => (b(u, I, "write to private field"), I.set(u, a), a), d, c, l;
|
|
@@ -7453,7 +7453,7 @@ class K {
|
|
|
7453
7453
|
}
|
|
7454
7454
|
}
|
|
7455
7455
|
d = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
|
|
7456
|
-
var
|
|
7456
|
+
var Ht;
|
|
7457
7457
|
class RoomBase {
|
|
7458
7458
|
constructor(I) {
|
|
7459
7459
|
Z(this, "options", {
|
|
@@ -7529,7 +7529,7 @@ class RoomBase {
|
|
|
7529
7529
|
}
|
|
7530
7530
|
}
|
|
7531
7531
|
});
|
|
7532
|
-
|
|
7532
|
+
lt(this, Ht, () => {
|
|
7533
7533
|
this.taskQueue.setCondition("createWs", !0), this.taskQueue.setCondition("createSession", !1), this.taskQueue.setCondition("ice", !1);
|
|
7534
7534
|
});
|
|
7535
7535
|
/**
|
|
@@ -7630,36 +7630,36 @@ class RoomBase {
|
|
|
7630
7630
|
* 处理为应用层数据
|
|
7631
7631
|
*/
|
|
7632
7632
|
Z(this, "usersFilter", (I) => ft(I, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "permissions", "isPublished", "updateStreams"]).sort((_, k) => _.id.localeCompare(k.id, "en")));
|
|
7633
|
-
this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), Q(this,
|
|
7633
|
+
this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), Q(this, Ht).call(this);
|
|
7634
7634
|
}
|
|
7635
7635
|
}
|
|
7636
|
-
|
|
7637
|
-
var It, bt, _t, vt, gt,
|
|
7636
|
+
Ht = new WeakMap();
|
|
7637
|
+
var It, bt, _t, vt, gt, zt, Jt, Rt, Wt;
|
|
7638
7638
|
class RoomMedias extends RoomBase {
|
|
7639
7639
|
// 本地流活动状态管理
|
|
7640
7640
|
constructor(a) {
|
|
7641
7641
|
super(a);
|
|
7642
|
-
|
|
7642
|
+
lt(this, It, []);
|
|
7643
7643
|
// 可用媒体设备列表
|
|
7644
|
-
|
|
7644
|
+
lt(this, bt, /* @__PURE__ */ new Map());
|
|
7645
7645
|
// 媒体流设备管理
|
|
7646
|
-
|
|
7646
|
+
lt(this, _t, /* @__PURE__ */ new Map());
|
|
7647
7647
|
// 媒体轨道参数管理
|
|
7648
|
-
|
|
7648
|
+
lt(this, vt, /* @__PURE__ */ new Map());
|
|
7649
7649
|
// 媒体流上下文
|
|
7650
|
-
|
|
7650
|
+
lt(this, gt, /* @__PURE__ */ new Map());
|
|
7651
7651
|
// 本地流管理
|
|
7652
7652
|
Z(this, "localStreamsActionMap", /* @__PURE__ */ new Map());
|
|
7653
7653
|
/**
|
|
7654
7654
|
* 初始化媒体参数
|
|
7655
7655
|
*/
|
|
7656
|
-
|
|
7657
|
-
Q(this, _t).set("microphoneCamera_audio", {}), Q(this, _t).set("microphoneCamera_video", {
|
|
7656
|
+
lt(this, zt, () => {
|
|
7657
|
+
Q(this, _t).set("microphoneCamera_audio", {}), Q(this, _t).set("microphoneCamera_video", { frameRate: { min: 10, ideal: 30 } }), Q(this, _t).set("screenSharing_video", { frameRate: { min: 10, ideal: 30 } }), Q(this, _t).set("screenSharing_audio", {});
|
|
7658
7658
|
});
|
|
7659
7659
|
/**
|
|
7660
7660
|
* 初始化媒体设备类型
|
|
7661
7661
|
*/
|
|
7662
|
-
|
|
7662
|
+
lt(this, Jt, () => {
|
|
7663
7663
|
Q(this, bt).set("audioinput", "default"), Q(this, bt).set("videoinput", "default"), Q(this, bt).set("audiooutput", "default");
|
|
7664
7664
|
});
|
|
7665
7665
|
/**
|
|
@@ -7889,15 +7889,15 @@ class RoomMedias extends RoomBase {
|
|
|
7889
7889
|
/**
|
|
7890
7890
|
* 获取媒体设备列表
|
|
7891
7891
|
*/
|
|
7892
|
-
|
|
7893
|
-
St(this, It, a);
|
|
7892
|
+
lt(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((a) => {
|
|
7893
|
+
St(this, It, a.sort((E, _) => E.label.localeCompare(_.label, "zh-Hans-CN", { sensitivity: "accent" })));
|
|
7894
7894
|
}).catch(function(a) {
|
|
7895
7895
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", a);
|
|
7896
7896
|
}), Q(this, It)));
|
|
7897
7897
|
/**
|
|
7898
7898
|
* 媒体设备发生变化
|
|
7899
7899
|
*/
|
|
7900
|
-
|
|
7900
|
+
lt(this, Wt, () => {
|
|
7901
7901
|
navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
|
|
7902
7902
|
await Q(this, Rt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
|
|
7903
7903
|
}), Q(this, Rt).call(this);
|
|
@@ -7908,22 +7908,26 @@ class RoomMedias extends RoomBase {
|
|
|
7908
7908
|
* @returns deviceId 设备ID
|
|
7909
7909
|
*/
|
|
7910
7910
|
Z(this, "getMediaDeviceKind", (a) => Q(this, bt).get(a));
|
|
7911
|
+
/**
|
|
7912
|
+
* 更改音频输出
|
|
7913
|
+
*/
|
|
7914
|
+
Z(this, "changeAudiooutput", () => {
|
|
7915
|
+
const a = Q(this, vt).values();
|
|
7916
|
+
for (const E of a)
|
|
7917
|
+
if (E.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype)
|
|
7918
|
+
try {
|
|
7919
|
+
E.audioContext.setSinkId(deviceId);
|
|
7920
|
+
} catch (_) {
|
|
7921
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setSinkId is error.", _);
|
|
7922
|
+
}
|
|
7923
|
+
});
|
|
7911
7924
|
/**
|
|
7912
7925
|
* 设置正在使用的媒体设备
|
|
7913
7926
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7914
7927
|
* @param deviceId 设备ID
|
|
7915
7928
|
*/
|
|
7916
|
-
Z(this, "setDeviceKind",
|
|
7917
|
-
|
|
7918
|
-
const _ = Q(this, vt).values();
|
|
7919
|
-
for (const k of _)
|
|
7920
|
-
if (k.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype)
|
|
7921
|
-
try {
|
|
7922
|
-
k.audioContext.setSinkId(E);
|
|
7923
|
-
} catch (e) {
|
|
7924
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setSinkId is error.", e);
|
|
7925
|
-
}
|
|
7926
|
-
}
|
|
7929
|
+
Z(this, "setDeviceKind", (a, E) => {
|
|
7930
|
+
Q(this, bt).set(a, E);
|
|
7927
7931
|
});
|
|
7928
7932
|
/**
|
|
7929
7933
|
* 设置音频输出设备
|
|
@@ -7952,10 +7956,10 @@ class RoomMedias extends RoomBase {
|
|
|
7952
7956
|
* @returns MediaDeviceInfo[]
|
|
7953
7957
|
*/
|
|
7954
7958
|
Z(this, "getEnumerateVideoinputDevices", () => this.getEnumerateDevices("videoinput"));
|
|
7955
|
-
Q(this,
|
|
7959
|
+
Q(this, Wt).call(this), Q(this, Jt).call(this), Q(this, zt).call(this);
|
|
7956
7960
|
}
|
|
7957
7961
|
}
|
|
7958
|
-
It = new WeakMap(), bt = new WeakMap(), _t = new WeakMap(), vt = new WeakMap(), gt = new WeakMap(),
|
|
7962
|
+
It = new WeakMap(), bt = new WeakMap(), _t = new WeakMap(), vt = new WeakMap(), gt = new WeakMap(), zt = new WeakMap(), Jt = new WeakMap(), Rt = new WeakMap(), Wt = new WeakMap();
|
|
7959
7963
|
class RoomUsers extends RoomMedias {
|
|
7960
7964
|
constructor(a) {
|
|
7961
7965
|
super(a);
|
|
@@ -8259,11 +8263,11 @@ const createMutedAudioStream = () => {
|
|
|
8259
8263
|
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;
|
|
8260
8264
|
}, 100), E.captureStream(a);
|
|
8261
8265
|
};
|
|
8262
|
-
var Ot,
|
|
8266
|
+
var Ot, Kt, Gt, Qt, Vt;
|
|
8263
8267
|
class RoomPeer extends RoomUsers {
|
|
8264
8268
|
constructor(a) {
|
|
8265
8269
|
super(a);
|
|
8266
|
-
|
|
8270
|
+
lt(this, Ot, /* @__PURE__ */ new Map());
|
|
8267
8271
|
// 假媒体流 (创建轨道用)
|
|
8268
8272
|
Z(this, "getPeerStatsTimer", 0);
|
|
8269
8273
|
// 获取报告的定时器
|
|
@@ -8282,10 +8286,10 @@ class RoomPeer extends RoomUsers {
|
|
|
8282
8286
|
// 网络抖动
|
|
8283
8287
|
});
|
|
8284
8288
|
Z(this, "initPeer", () => {
|
|
8285
|
-
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), Q(this,
|
|
8289
|
+
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), Q(this, Gt).call(this), Q(this, Vt).call(this);
|
|
8286
8290
|
});
|
|
8287
8291
|
// 初始化假数据流
|
|
8288
|
-
|
|
8292
|
+
lt(this, Kt, () => {
|
|
8289
8293
|
for (const a of mediaType_keys) {
|
|
8290
8294
|
const E = Q(this, Ot).get(a);
|
|
8291
8295
|
if (E) {
|
|
@@ -8310,21 +8314,20 @@ class RoomPeer extends RoomUsers {
|
|
|
8310
8314
|
}
|
|
8311
8315
|
});
|
|
8312
8316
|
// 获取假数据流
|
|
8313
|
-
|
|
8317
|
+
Z(this, "getPhoneyStreams", (a) => Q(this, Ot).get(a));
|
|
8314
8318
|
/**
|
|
8315
8319
|
* 替换发射器媒体流
|
|
8316
8320
|
*/
|
|
8317
8321
|
Z(this, "replaceSenderStream", async (a = [], E) => {
|
|
8318
|
-
const { userId: _ } = this.options;
|
|
8319
8322
|
a.length === 0 && (a = mediaType_keys);
|
|
8320
|
-
for (const
|
|
8321
|
-
const
|
|
8322
|
-
let
|
|
8323
|
-
if (
|
|
8324
|
-
const { sender:
|
|
8325
|
-
E ?
|
|
8326
|
-
const [
|
|
8327
|
-
|
|
8323
|
+
for (const _ of a) {
|
|
8324
|
+
const k = this.transceiverMap.get(_);
|
|
8325
|
+
let e;
|
|
8326
|
+
if (k) {
|
|
8327
|
+
const { sender: n } = k;
|
|
8328
|
+
E ? e = this.getLocalStream(_) : e = this.getPhoneyStreams(_);
|
|
8329
|
+
const [O] = (e == null ? void 0 : e.getTracks()) || [];
|
|
8330
|
+
O && await n.replaceTrack(O);
|
|
8328
8331
|
}
|
|
8329
8332
|
}
|
|
8330
8333
|
});
|
|
@@ -8351,7 +8354,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8351
8354
|
const E = [];
|
|
8352
8355
|
for (const _ of a) {
|
|
8353
8356
|
if (this.transceiverMap.get(_)) continue;
|
|
8354
|
-
const e =
|
|
8357
|
+
const e = this.getPhoneyStreams(_), [n] = e.getTracks(), O = this.peerIns.addTransceiver(n, { direction: "sendonly" });
|
|
8355
8358
|
this.transceiverMap.set(_, O), E.push(_);
|
|
8356
8359
|
}
|
|
8357
8360
|
if (a.length === 0 || E.length !== 0) {
|
|
@@ -8437,7 +8440,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8437
8440
|
/**
|
|
8438
8441
|
* 监听webrtc ice通讯连接
|
|
8439
8442
|
*/
|
|
8440
|
-
|
|
8443
|
+
lt(this, Gt, () => {
|
|
8441
8444
|
let a = 0;
|
|
8442
8445
|
const E = () => {
|
|
8443
8446
|
this.setRoomState("closed");
|
|
@@ -8587,7 +8590,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8587
8590
|
/**
|
|
8588
8591
|
* 计算网络质量
|
|
8589
8592
|
*/
|
|
8590
|
-
|
|
8593
|
+
lt(this, Qt, async () => {
|
|
8591
8594
|
try {
|
|
8592
8595
|
const a = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...a.values()].filter((nt) => E.includes(nt.type));
|
|
8593
8596
|
let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
|
|
@@ -8597,23 +8600,23 @@ class RoomPeer extends RoomUsers {
|
|
|
8597
8600
|
}
|
|
8598
8601
|
this.reports = k;
|
|
8599
8602
|
for (const nt of this.reports) {
|
|
8600
|
-
const { bytesReceived: ut, bytesSent: it, packetsSent:
|
|
8601
|
-
ut && (e = ut), it && (n = it),
|
|
8603
|
+
const { bytesReceived: ut, bytesSent: it, packetsSent: at, packetsLost: st, jitter: rt, roundTripTime: ct } = nt;
|
|
8604
|
+
ut && (e = ut), it && (n = it), at && (N += at), st && (D += st), ct && q.push((ct * 100).toFixed(2)), rt && P.push(rt.toFixed(2));
|
|
8602
8605
|
}
|
|
8603
8606
|
P.sort().reverse(), q.sort().reverse();
|
|
8604
8607
|
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 };
|
|
8605
8608
|
this.peerNetwork = et;
|
|
8606
8609
|
const tt = (nt, ut, it) => {
|
|
8607
|
-
const
|
|
8610
|
+
const at = Number(nt), st = Number(ut), rt = Number(it);
|
|
8608
8611
|
let ct = "0";
|
|
8609
|
-
return
|
|
8612
|
+
return at < 0.03 && st < 100 && rt < 0.05 ? ct = "5" : at < 0.06 && st < 160 && rt < 0.1 ? ct = "4" : at < 0.1 && st < 250 && rt < 0.15 ? ct = "3" : at < 0.15 && st < 400 && rt < 0.2 ? ct = "2" : ct = "1", Number(ct);
|
|
8610
8613
|
};
|
|
8611
8614
|
{
|
|
8612
|
-
const nt = tt(J, z, Y), ut = await this.getCaller(), { network: it } = ut,
|
|
8613
|
-
if (await this.updateUserNetwork(this.options.userId,
|
|
8615
|
+
const nt = tt(J, z, Y), ut = await this.getCaller(), { network: it } = ut, at = { egress: nt, ingress: nt }, st = JSON.stringify(it) !== JSON.stringify(at);
|
|
8616
|
+
if (await this.updateUserNetwork(this.options.userId, at), st) {
|
|
8614
8617
|
this.emitNotifyUpdateUsers();
|
|
8615
8618
|
const { userId: rt, roomId: ct } = this.options;
|
|
8616
|
-
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...
|
|
8619
|
+
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...at, userId: rt, roomId: ct } }, !1);
|
|
8617
8620
|
}
|
|
8618
8621
|
}
|
|
8619
8622
|
} catch (a) {
|
|
@@ -8623,9 +8626,9 @@ class RoomPeer extends RoomUsers {
|
|
|
8623
8626
|
/**
|
|
8624
8627
|
* 获取连接的所有轨道分析数据
|
|
8625
8628
|
*/
|
|
8626
|
-
|
|
8629
|
+
lt(this, Vt, () => {
|
|
8627
8630
|
const a = async () => {
|
|
8628
|
-
this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this,
|
|
8631
|
+
this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this, Qt).call(this);
|
|
8629
8632
|
};
|
|
8630
8633
|
this.getPeerStatsTimer = setInterval(a, 1 * 1e3);
|
|
8631
8634
|
});
|
|
@@ -8633,11 +8636,11 @@ class RoomPeer extends RoomUsers {
|
|
|
8633
8636
|
* 停止网络报告分析
|
|
8634
8637
|
*/
|
|
8635
8638
|
Z(this, "stopGetPeerStats", () => clearInterval(this.getPeerStatsTimer));
|
|
8636
|
-
Q(this,
|
|
8639
|
+
Q(this, Kt).call(this);
|
|
8637
8640
|
}
|
|
8638
8641
|
}
|
|
8639
|
-
Ot = new WeakMap(),
|
|
8640
|
-
var
|
|
8642
|
+
Ot = new WeakMap(), Kt = new WeakMap(), Gt = new WeakMap(), Qt = new WeakMap(), Vt = new WeakMap();
|
|
8643
|
+
var Yt, Et, At, qt, Dt;
|
|
8641
8644
|
class RoomCalls extends RoomPeer {
|
|
8642
8645
|
constructor(a) {
|
|
8643
8646
|
super(a);
|
|
@@ -8647,7 +8650,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8647
8650
|
* 广播给房间其他人
|
|
8648
8651
|
* 只有当自己建立了发射轨道 并且 加入房间后才进行广播
|
|
8649
8652
|
*/
|
|
8650
|
-
|
|
8653
|
+
lt(this, Yt, async (a) => {
|
|
8651
8654
|
const { roomId: E } = this.options;
|
|
8652
8655
|
if (!E) return;
|
|
8653
8656
|
const { id: _, tracks: k = [] } = await this.getCaller();
|
|
@@ -8658,7 +8661,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8658
8661
|
/**
|
|
8659
8662
|
* 更新自己通话状态
|
|
8660
8663
|
*/
|
|
8661
|
-
|
|
8664
|
+
lt(this, Et, async (a) => new Promise(async (E, _) => {
|
|
8662
8665
|
const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: a } };
|
|
8663
8666
|
await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
|
|
8664
8667
|
const { code: $ = 0 } = O;
|
|
@@ -8669,7 +8672,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8669
8672
|
/**
|
|
8670
8673
|
* 创建连接
|
|
8671
8674
|
*/
|
|
8672
|
-
|
|
8675
|
+
lt(this, At, () => new Promise(async (a, E) => {
|
|
8673
8676
|
try {
|
|
8674
8677
|
if (["connecting", "connected"].includes(this.cwsIns.state)) return a(!0);
|
|
8675
8678
|
this.taskQueue.setCondition("createWs", !1), this.cwsIns.clearEvents(), this.initPeer();
|
|
@@ -8696,7 +8699,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8696
8699
|
/**
|
|
8697
8700
|
* 创建cf会话
|
|
8698
8701
|
*/
|
|
8699
|
-
|
|
8702
|
+
lt(this, qt, () => {
|
|
8700
8703
|
if (!["connecting", "connected"].includes(this.roomState))
|
|
8701
8704
|
return this.setRoomState("connecting"), new Promise((a) => {
|
|
8702
8705
|
const E = async () => {
|
|
@@ -8732,12 +8735,12 @@ class RoomCalls extends RoomPeer {
|
|
|
8732
8735
|
* @example quickvo.earlyConnect(['microphoneCamera_audio', 'microphoneCamera_video'])
|
|
8733
8736
|
*/
|
|
8734
8737
|
Z(this, "earlyConnect", (a = []) => {
|
|
8735
|
-
this.isEarly = !0, Q(this,
|
|
8738
|
+
this.isEarly = !0, Q(this, At).call(this), Q(this, qt).call(this), a.length === 0 && (a = ["microphoneCamera_audio", "microphoneCamera_video"]), Q(this, Dt).call(this, a);
|
|
8736
8739
|
});
|
|
8737
8740
|
/**
|
|
8738
8741
|
* 创建媒体轨道
|
|
8739
8742
|
*/
|
|
8740
|
-
|
|
8743
|
+
lt(this, Dt, async (a) => new Promise((E) => {
|
|
8741
8744
|
const _ = async () => {
|
|
8742
8745
|
try {
|
|
8743
8746
|
this.taskQueue.setCondition("createTrack", !1);
|
|
@@ -8797,10 +8800,10 @@ class RoomCalls extends RoomPeer {
|
|
|
8797
8800
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
8798
8801
|
* @param deviceId 设备ID
|
|
8799
8802
|
*/
|
|
8800
|
-
Z(this, "setMediaDeviceKind",
|
|
8801
|
-
|
|
8803
|
+
Z(this, "setMediaDeviceKind", (a, E) => new Promise(async (_, k) => {
|
|
8804
|
+
this.setDeviceKind(a, E);
|
|
8802
8805
|
const e = await this.getCaller(), { id: n, tracks: O = [], callActionMap: $ } = e, N = [], D = async (q) => {
|
|
8803
|
-
const P = this.localStreamsActionMap.get(q);
|
|
8806
|
+
const P = this.localStreamsActionMap.get(q), j = O.find((J) => J.mediaType === q), V = $[q];
|
|
8804
8807
|
if (P) {
|
|
8805
8808
|
N.push(q), await this.stopLocalStreams([q]);
|
|
8806
8809
|
try {
|
|
@@ -8809,20 +8812,20 @@ class RoomCalls extends RoomPeer {
|
|
|
8809
8812
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: initLocalStream is error.", J), await this.inactiveTracks([q], !1), k(J);
|
|
8810
8813
|
}
|
|
8811
8814
|
}
|
|
8812
|
-
|
|
8813
|
-
if (this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setMediaDeviceKind", { active: P, hadTrack: j, action: V }), j) {
|
|
8815
|
+
if (j) {
|
|
8814
8816
|
const J = this.getLocalStream(q);
|
|
8815
8817
|
if (J) {
|
|
8816
8818
|
const z = this.getUserMediaStreamContext(n, q);
|
|
8817
8819
|
z == null || z.replaceStream(J), V && await this.replaceSenderStream([q], !0);
|
|
8818
8820
|
}
|
|
8819
8821
|
}
|
|
8822
|
+
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setMediaDeviceKind", { mediaType: q, isOpen: P, hadTrack: j, isActive: V });
|
|
8823
|
+
{
|
|
8824
|
+
const J = this.getLocalStreams(N);
|
|
8825
|
+
this.cwsIns.emitNotify("onLocalStream", { code: 200, data: J, desc: "local stream is change." }), _(!0);
|
|
8826
|
+
}
|
|
8820
8827
|
};
|
|
8821
|
-
a === "audioinput" &&
|
|
8822
|
-
{
|
|
8823
|
-
const q = this.getLocalStreams(N);
|
|
8824
|
-
this.cwsIns.emitNotify("onLocalStream", { code: 200, data: q, desc: "local stream is change." }), _(q);
|
|
8825
|
-
}
|
|
8828
|
+
a === "audioinput" && D("microphoneCamera_audio"), a === "videoinput" && D("microphoneCamera_video"), a === "audiooutput" && (this.changeAudiooutput(), _(!0));
|
|
8826
8829
|
}));
|
|
8827
8830
|
/**
|
|
8828
8831
|
* 改变屏幕共享流
|
|
@@ -8845,7 +8848,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8845
8848
|
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
|
|
8846
8849
|
* @returns Promise<boolean>
|
|
8847
8850
|
*/
|
|
8848
|
-
Z(this, "joinRoom", async (a) => (this.setOptions(a), await Q(this,
|
|
8851
|
+
Z(this, "joinRoom", async (a) => (this.setOptions(a), await Q(this, At).call(this), new Promise((E, _) => {
|
|
8849
8852
|
this.clearUsers();
|
|
8850
8853
|
let k = "";
|
|
8851
8854
|
const e = async () => {
|
|
@@ -8864,7 +8867,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8864
8867
|
if (q !== 200) return _(P);
|
|
8865
8868
|
const { roomId: V = "", roomUsers: J = [] } = j;
|
|
8866
8869
|
if (V !== O) return _("加入的房间不匹配");
|
|
8867
|
-
this.isInRoom = !0, Q(this,
|
|
8870
|
+
this.isInRoom = !0, Q(this, qt).call(this), await this.updateUsers(J), e();
|
|
8868
8871
|
});
|
|
8869
8872
|
} catch (O) {
|
|
8870
8873
|
this.taskQueue.setCondition("joinRoom", !0), this.reportLogs("join_room_error", O.message || O), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
|
|
@@ -8936,15 +8939,25 @@ class RoomCalls extends RoomPeer {
|
|
|
8936
8939
|
}
|
|
8937
8940
|
const n = [];
|
|
8938
8941
|
for (const q of a) {
|
|
8939
|
-
|
|
8940
|
-
|
|
8942
|
+
{
|
|
8943
|
+
const P = this.getPhoneyStreams(q);
|
|
8944
|
+
await this.initUserMediaStreamContext(e.id, q, P);
|
|
8945
|
+
}
|
|
8946
|
+
{
|
|
8947
|
+
const P = this.getLocalStream(q);
|
|
8948
|
+
if (P) {
|
|
8949
|
+
const j = this.getUserMediaStreamContext(e.id, q);
|
|
8950
|
+
j == null || j.replaceStream(P);
|
|
8951
|
+
} else
|
|
8952
|
+
n.push(q);
|
|
8953
|
+
}
|
|
8941
8954
|
}
|
|
8942
8955
|
const O = a.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
|
|
8943
|
-
await this.replaceSenderStream(a, !1), await Q(this,
|
|
8956
|
+
await this.replaceSenderStream(a, !1), await Q(this, Dt).call(this, O);
|
|
8944
8957
|
const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
|
|
8945
8958
|
await this.updateUsertracks(e.id, N, !0);
|
|
8946
8959
|
const D = await this.getCallAction(N);
|
|
8947
|
-
await Q(this, Et).call(this, D), n.length !== 0 && await this.inactiveTracks(n, !1), O.length !== 0 && await this.replaceSenderStream(O, !0), Q(this,
|
|
8960
|
+
await Q(this, Et).call(this, D), n.length !== 0 && await this.inactiveTracks(n, !1), O.length !== 0 && await this.replaceSenderStream(O, !0), Q(this, Yt).call(this, a);
|
|
8948
8961
|
{
|
|
8949
8962
|
await this.emitNotifyUpdateUsers();
|
|
8950
8963
|
const q = await this.getCaller();
|
|
@@ -9104,18 +9117,19 @@ class RoomCalls extends RoomPeer {
|
|
|
9104
9117
|
const k = await this.getCaller();
|
|
9105
9118
|
if (!k || !k.id) return _(!0);
|
|
9106
9119
|
const { tracks: e = [] } = k, n = [...e];
|
|
9107
|
-
await this.replaceSenderStream(a, !0);
|
|
9108
9120
|
for (let $ of n) {
|
|
9109
9121
|
const { mediaType: N } = $;
|
|
9110
9122
|
if (N && a.includes(N)) {
|
|
9111
9123
|
$.enabled = E;
|
|
9112
|
-
const
|
|
9124
|
+
const D = this.getLocalStream(N);
|
|
9125
|
+
if (!D) continue;
|
|
9126
|
+
const q = D.getTracks();
|
|
9113
9127
|
for (const P of q)
|
|
9114
9128
|
P.enabled = E;
|
|
9115
9129
|
}
|
|
9116
9130
|
}
|
|
9117
9131
|
const O = await this.getCallAction(n);
|
|
9118
|
-
await Q(this, Et).call(this, O),
|
|
9132
|
+
await Q(this, Et).call(this, O), await this.replaceSenderStream(a, E), await this.emitNotifyUpdateUsers(), _(!0);
|
|
9119
9133
|
}));
|
|
9120
9134
|
/**
|
|
9121
9135
|
* 远端调试
|
|
@@ -9130,21 +9144,21 @@ class RoomCalls extends RoomPeer {
|
|
|
9130
9144
|
}));
|
|
9131
9145
|
}
|
|
9132
9146
|
}
|
|
9133
|
-
|
|
9147
|
+
Yt = new WeakMap(), Et = new WeakMap(), At = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap();
|
|
9134
9148
|
class Room extends RoomCalls {
|
|
9135
9149
|
constructor(I) {
|
|
9136
9150
|
super(I);
|
|
9137
9151
|
}
|
|
9138
9152
|
}
|
|
9139
|
-
var Tt, te, ee, ie
|
|
9153
|
+
var Tt, Xt, te, ee, ie;
|
|
9140
9154
|
class QuickVO extends Room {
|
|
9141
9155
|
constructor(a) {
|
|
9142
9156
|
super(a);
|
|
9143
|
-
|
|
9157
|
+
lt(this, Tt, /* @__PURE__ */ new Map());
|
|
9144
9158
|
/**
|
|
9145
9159
|
* 添加内部监听事件
|
|
9146
9160
|
*/
|
|
9147
|
-
|
|
9161
|
+
lt(this, Xt, () => {
|
|
9148
9162
|
{
|
|
9149
9163
|
const a = async (E) => {
|
|
9150
9164
|
const { qualities: _ = [] } = E.data, [k] = _;
|
|
@@ -9225,12 +9239,12 @@ class QuickVO extends Room {
|
|
|
9225
9239
|
/**
|
|
9226
9240
|
* cwsIns 发送消息前
|
|
9227
9241
|
*/
|
|
9228
|
-
|
|
9242
|
+
lt(this, te, () => {
|
|
9229
9243
|
});
|
|
9230
9244
|
/**
|
|
9231
9245
|
* 重连成功
|
|
9232
9246
|
*/
|
|
9233
|
-
|
|
9247
|
+
lt(this, ee, () => {
|
|
9234
9248
|
this.cwsIns.onReconnectSuccess = async () => {
|
|
9235
9249
|
await this.syncRoomInfo();
|
|
9236
9250
|
};
|
|
@@ -9238,7 +9252,7 @@ class QuickVO extends Room {
|
|
|
9238
9252
|
/**
|
|
9239
9253
|
* 重连停止
|
|
9240
9254
|
*/
|
|
9241
|
-
|
|
9255
|
+
lt(this, ie, async () => {
|
|
9242
9256
|
});
|
|
9243
9257
|
/**
|
|
9244
9258
|
* 添加 FrameRequestCallback
|
|
@@ -9277,10 +9291,10 @@ class QuickVO extends Room {
|
|
|
9277
9291
|
Z(this, "destroy", async () => {
|
|
9278
9292
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {}, desc: "sdk is destroy." }), this.stopLocalStreams(), await new Promise((a) => setTimeout(() => a(!0), 300)), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.cwsIns.close();
|
|
9279
9293
|
});
|
|
9280
|
-
Q(this,
|
|
9294
|
+
Q(this, te).call(this), Q(this, ee).call(this), Q(this, ie).call(this), Q(this, Xt).call(this);
|
|
9281
9295
|
}
|
|
9282
9296
|
}
|
|
9283
|
-
Tt = new WeakMap(),
|
|
9297
|
+
Tt = new WeakMap(), Xt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap();
|
|
9284
9298
|
export {
|
|
9285
9299
|
QuickVO,
|
|
9286
9300
|
ignoreEvent
|