quickvo-sdk-js 0.6.8 → 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 CHANGED
@@ -1,10 +1,10 @@
1
- var se = Object.defineProperty;
2
- var re = (u) => {
1
+ var ce = Object.defineProperty;
2
+ var oe = (u) => {
3
3
  throw TypeError(u);
4
4
  };
5
- var ae = (u, I, a) => I in u ? se(u, I, { enumerable: !0, configurable: !0, writable: !0, value: a }) : u[I] = a;
6
- var Z = (u, I, a) => ae(u, typeof I != "symbol" ? I + "" : I, a), ce = (u, I, a) => I.has(u) || re("Cannot " + a);
7
- var Q = (u, I, a) => (ce(u, I, "read from private field"), a ? a.call(u) : I.get(u)), at = (u, I, a) => I.has(u) ? re("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(u) : I.set(u, a), St = (u, I, a, E) => (ce(u, I, "write to private field"), E ? E.call(u, a) : I.set(u, a), 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, lt, st, rt;
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, lt = q, D === 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, lt = rt;
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, lt = rt;
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, lt = rt;
6216
+ it = k - ut, at = rt;
6217
6217
  }
6218
6218
  for (; nt > 2; )
6219
- rt[k++] = lt[it++], rt[k++] = lt[it++], rt[k++] = lt[it++], nt -= 3;
6220
- nt && (rt[k++] = lt[it++], nt > 1 && (rt[k++] = lt[it++]));
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, lt = null, st;
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, oe, Ut, Mt;
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 ? (lt = $t = e, st = 20) : u === 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, u === LENS$1 && z > ENOUGH_LENS$1 || u === DISTS$1 && z > ENOUGH_DISTS$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
- 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;
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] = oe << 24 | Ut << 16 | Mt | 0;
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, lt;
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, lt = Z_OK$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, 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 }, lt = inftrees(CODES, a.lens, 0, 19, a.lencode, 0, a.work, rt), a.lenbits = rt.bits, lt) {
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 }, lt = inftrees(LENS, a.lens, 0, a.nlen, a.lencode, 0, a.work, rt), a.lenbits = rt.bits, lt) {
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 }, lt = inftrees(DISTS, a.lens, a.nlen, a.ndist, a.distcode, 0, a.work, rt), a.distbits = rt.bits, lt) {
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
- lt = Z_STREAM_END$1;
6938
+ at = Z_STREAM_END$1;
6939
6939
  break t;
6940
6940
  case BAD:
6941
- lt = Z_DATA_ERROR$1;
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) && lt === Z_OK$1 && (lt = Z_BUF_ERROR), lt;
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, jt, Nt, Zt, Ft, Ht;
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
- at(this, wt);
7190
- at(this, dt, {
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
- at(this, xt, "");
7199
+ lt(this, xt, "");
7200
7200
  // 缓存登录凭证
7201
- at(this, yt, {});
7202
- at(this, kt, {});
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
- at(this, Pt, (I) => {
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
- at(this, Lt, async (I) => {
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
- at(this, Bt, async (I) => {
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
- at(this, jt, () => {
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
- at(this, Nt, (I, a = {}) => {
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
- at(this, Zt, (I, { resolve: a, reject: E }) => {
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
- at(this, Ft, (I) => Q(this, yt)[I]);
7283
+ lt(this, Zt, (I) => Q(this, yt)[I]);
7284
7284
  // 接收消息
7285
- at(this, Ht, async (I) => {
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, Ft).call(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, Ht),
7320
- checkReconnect: Q(this, Pt),
7321
- getHeartbeatMsg: Q(this, jt),
7322
- onReconnectSuccess: Q(this, Lt),
7323
- onReconnectStop: Q(this, Bt)
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, Zt).call(this, O, { resolve: E, reject: _ });
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(), Pt = new WeakMap(), Lt = new WeakMap(), Bt = new WeakMap(), jt = new WeakMap(), Nt = new WeakMap(), Zt = new WeakMap(), Ft = new WeakMap(), Ht = 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 zt;
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
- at(this, zt, () => {
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, zt).call(this);
7633
+ this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), Q(this, Ht).call(this);
7634
7634
  }
7635
7635
  }
7636
- zt = new WeakMap();
7637
- var It, bt, _t, vt, gt, Jt, Wt, Rt, Kt;
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
- at(this, It, []);
7642
+ lt(this, It, []);
7643
7643
  // 可用媒体设备列表
7644
- at(this, bt, /* @__PURE__ */ new Map());
7644
+ lt(this, bt, /* @__PURE__ */ new Map());
7645
7645
  // 媒体流设备管理
7646
- at(this, _t, /* @__PURE__ */ new Map());
7646
+ lt(this, _t, /* @__PURE__ */ new Map());
7647
7647
  // 媒体轨道参数管理
7648
- at(this, vt, /* @__PURE__ */ new Map());
7648
+ lt(this, vt, /* @__PURE__ */ new Map());
7649
7649
  // 媒体流上下文
7650
- at(this, gt, /* @__PURE__ */ new Map());
7650
+ lt(this, gt, /* @__PURE__ */ new Map());
7651
7651
  // 本地流管理
7652
7652
  Z(this, "localStreamsActionMap", /* @__PURE__ */ new Map());
7653
7653
  /**
7654
7654
  * 初始化媒体参数
7655
7655
  */
7656
- at(this, Jt, () => {
7657
- Q(this, _t).set("microphoneCamera_audio", {}), Q(this, _t).set("microphoneCamera_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), Q(this, _t).set("screenSharing_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), Q(this, _t).set("screenSharing_audio", {});
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
- at(this, Wt, () => {
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
- 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((a) => {
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
- at(this, Kt, () => {
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", async (a, E) => {
7917
- if (Q(this, bt).set(a, E), a === "audiooutput") {
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, Kt).call(this), Q(this, Wt).call(this), Q(this, Jt).call(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(), Jt = new WeakMap(), Wt = new WeakMap(), Rt = new WeakMap(), Kt = 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, Gt, At, Qt, Vt, Yt;
8266
+ var Ot, Kt, Gt, Qt, Vt;
8263
8267
  class RoomPeer extends RoomUsers {
8264
8268
  constructor(a) {
8265
8269
  super(a);
8266
- at(this, Ot, /* @__PURE__ */ new Map());
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, Qt).call(this), Q(this, Yt).call(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
- at(this, Gt, () => {
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
- at(this, At, (a) => Q(this, Ot).get(a));
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 k of a) {
8321
- const e = this.transceiverMap.get(k);
8322
- let n;
8323
- if (e) {
8324
- const { sender: O } = e;
8325
- E ? n = this.getUserStream(_, k) : n = Q(this, At).call(this, k);
8326
- const [$] = n.getTracks();
8327
- $ && await O.replaceTrack($);
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 = Q(this, At).call(this, _), [n] = e.getTracks(), O = this.peerIns.addTransceiver(n, { direction: "sendonly" });
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
- at(this, Qt, () => {
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
- at(this, Vt, async () => {
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: lt, packetsLost: st, jitter: rt, roundTripTime: ct } = nt;
8601
- 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));
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 lt = Number(nt), st = Number(ut), rt = Number(it);
8610
+ const at = Number(nt), st = Number(ut), rt = Number(it);
8608
8611
  let ct = "0";
8609
- 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);
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, lt = { egress: nt, ingress: nt }, st = JSON.stringify(it) !== JSON.stringify(lt);
8613
- if (await this.updateUserNetwork(this.options.userId, lt), st) {
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: { ...lt, userId: rt, roomId: ct } }, !1);
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
- at(this, Yt, () => {
8629
+ lt(this, Vt, () => {
8627
8630
  const a = async () => {
8628
- this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this, Vt).call(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, Gt).call(this);
8639
+ Q(this, Kt).call(this);
8637
8640
  }
8638
8641
  }
8639
- Ot = new WeakMap(), Gt = new WeakMap(), At = new WeakMap(), Qt = new WeakMap(), Vt = new WeakMap(), Yt = new WeakMap();
8640
- var Xt, Et, qt, Dt, Ct;
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
- at(this, Xt, async (a) => {
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
- at(this, Et, async (a) => new Promise(async (E, _) => {
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
- at(this, qt, () => new Promise(async (a, E) => {
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
- at(this, Dt, () => {
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, qt).call(this), Q(this, Dt).call(this), a.length === 0 && (a = ["microphoneCamera_audio", "microphoneCamera_video"]), Q(this, Ct).call(this, a);
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
- at(this, Ct, async (a) => new Promise((E) => {
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,11 @@ class RoomCalls extends RoomPeer {
8797
8800
  * @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
8798
8801
  * @param deviceId 设备ID
8799
8802
  */
8800
- Z(this, "setMediaDeviceKind", async (a, E) => new Promise(async (_, k) => {
8801
- await this.setDeviceKind(a, E);
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
- if (this.localStreamsActionMap.get(q)) {
8806
+ const P = this.localStreamsActionMap.get(q), j = O.find((J) => J.mediaType === q), V = $[q];
8807
+ if (P) {
8804
8808
  N.push(q), await this.stopLocalStreams([q]);
8805
8809
  try {
8806
8810
  await this.initLocalStream(q);
@@ -8808,7 +8812,6 @@ class RoomCalls extends RoomPeer {
8808
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);
8809
8813
  }
8810
8814
  }
8811
- const j = O.find((J) => J.mediaType === q), V = $[q];
8812
8815
  if (j) {
8813
8816
  const J = this.getLocalStream(q);
8814
8817
  if (J) {
@@ -8816,12 +8819,13 @@ class RoomCalls extends RoomPeer {
8816
8819
  z == null || z.replaceStream(J), V && await this.replaceSenderStream([q], !0);
8817
8820
  }
8818
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
+ }
8819
8827
  };
8820
- a === "audioinput" && await D("microphoneCamera_audio"), a === "videoinput" && await D("microphoneCamera_video");
8821
- {
8822
- const q = this.getLocalStreams(N);
8823
- this.cwsIns.emitNotify("onLocalStream", { code: 200, data: q, desc: "local stream is change." }), _(q);
8824
- }
8828
+ a === "audioinput" && D("microphoneCamera_audio"), a === "videoinput" && D("microphoneCamera_video"), a === "audiooutput" && (this.changeAudiooutput(), _(!0));
8825
8829
  }));
8826
8830
  /**
8827
8831
  * 改变屏幕共享流
@@ -8844,7 +8848,7 @@ class RoomCalls extends RoomPeer {
8844
8848
  * @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
8845
8849
  * @returns Promise<boolean>
8846
8850
  */
8847
- Z(this, "joinRoom", async (a) => (this.setOptions(a), await Q(this, qt).call(this), new Promise((E, _) => {
8851
+ Z(this, "joinRoom", async (a) => (this.setOptions(a), await Q(this, At).call(this), new Promise((E, _) => {
8848
8852
  this.clearUsers();
8849
8853
  let k = "";
8850
8854
  const e = async () => {
@@ -8863,7 +8867,7 @@ class RoomCalls extends RoomPeer {
8863
8867
  if (q !== 200) return _(P);
8864
8868
  const { roomId: V = "", roomUsers: J = [] } = j;
8865
8869
  if (V !== O) return _("加入的房间不匹配");
8866
- this.isInRoom = !0, Q(this, Dt).call(this), await this.updateUsers(J), e();
8870
+ this.isInRoom = !0, Q(this, qt).call(this), await this.updateUsers(J), e();
8867
8871
  });
8868
8872
  } catch (O) {
8869
8873
  this.taskQueue.setCondition("joinRoom", !0), this.reportLogs("join_room_error", O.message || O), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
@@ -8935,15 +8939,25 @@ class RoomCalls extends RoomPeer {
8935
8939
  }
8936
8940
  const n = [];
8937
8941
  for (const q of a) {
8938
- const P = this.getLocalStream(q);
8939
- P ? await this.initUserMediaStreamContext(e.id, q, P) : n.push(q);
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
+ }
8940
8954
  }
8941
8955
  const O = a.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
8942
- await this.replaceSenderStream(a, !1), await Q(this, Ct).call(this, O);
8956
+ await this.replaceSenderStream(a, !1), await Q(this, Dt).call(this, O);
8943
8957
  const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
8944
8958
  await this.updateUsertracks(e.id, N, !0);
8945
8959
  const D = await this.getCallAction(N);
8946
- 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, Xt).call(this, a);
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);
8947
8961
  {
8948
8962
  await this.emitNotifyUpdateUsers();
8949
8963
  const q = await this.getCaller();
@@ -9103,18 +9117,19 @@ class RoomCalls extends RoomPeer {
9103
9117
  const k = await this.getCaller();
9104
9118
  if (!k || !k.id) return _(!0);
9105
9119
  const { tracks: e = [] } = k, n = [...e];
9106
- await this.replaceSenderStream(a, !0);
9107
9120
  for (let $ of n) {
9108
9121
  const { mediaType: N } = $;
9109
9122
  if (N && a.includes(N)) {
9110
9123
  $.enabled = E;
9111
- const q = this.getUserStream(k.id, N).getTracks();
9124
+ const D = this.getLocalStream(N);
9125
+ if (!D) continue;
9126
+ const q = D.getTracks();
9112
9127
  for (const P of q)
9113
9128
  P.enabled = E;
9114
9129
  }
9115
9130
  }
9116
9131
  const O = await this.getCallAction(n);
9117
- await Q(this, Et).call(this, O), E === !1 && await this.replaceSenderStream(a, !1), await this.emitNotifyUpdateUsers(), _(!0);
9132
+ await Q(this, Et).call(this, O), await this.replaceSenderStream(a, E), await this.emitNotifyUpdateUsers(), _(!0);
9118
9133
  }));
9119
9134
  /**
9120
9135
  * 远端调试
@@ -9129,21 +9144,21 @@ class RoomCalls extends RoomPeer {
9129
9144
  }));
9130
9145
  }
9131
9146
  }
9132
- Xt = new WeakMap(), Et = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap();
9147
+ Yt = new WeakMap(), Et = new WeakMap(), At = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap();
9133
9148
  class Room extends RoomCalls {
9134
9149
  constructor(I) {
9135
9150
  super(I);
9136
9151
  }
9137
9152
  }
9138
- var Tt, te, ee, ie, ne;
9153
+ var Tt, Xt, te, ee, ie;
9139
9154
  class QuickVO extends Room {
9140
9155
  constructor(a) {
9141
9156
  super(a);
9142
- at(this, Tt, /* @__PURE__ */ new Map());
9157
+ lt(this, Tt, /* @__PURE__ */ new Map());
9143
9158
  /**
9144
9159
  * 添加内部监听事件
9145
9160
  */
9146
- at(this, te, () => {
9161
+ lt(this, Xt, () => {
9147
9162
  {
9148
9163
  const a = async (E) => {
9149
9164
  const { qualities: _ = [] } = E.data, [k] = _;
@@ -9224,12 +9239,12 @@ class QuickVO extends Room {
9224
9239
  /**
9225
9240
  * cwsIns 发送消息前
9226
9241
  */
9227
- at(this, ee, () => {
9242
+ lt(this, te, () => {
9228
9243
  });
9229
9244
  /**
9230
9245
  * 重连成功
9231
9246
  */
9232
- at(this, ie, () => {
9247
+ lt(this, ee, () => {
9233
9248
  this.cwsIns.onReconnectSuccess = async () => {
9234
9249
  await this.syncRoomInfo();
9235
9250
  };
@@ -9237,7 +9252,7 @@ class QuickVO extends Room {
9237
9252
  /**
9238
9253
  * 重连停止
9239
9254
  */
9240
- at(this, ne, async () => {
9255
+ lt(this, ie, async () => {
9241
9256
  });
9242
9257
  /**
9243
9258
  * 添加 FrameRequestCallback
@@ -9276,10 +9291,10 @@ class QuickVO extends Room {
9276
9291
  Z(this, "destroy", async () => {
9277
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();
9278
9293
  });
9279
- Q(this, ee).call(this), Q(this, ie).call(this), Q(this, ne).call(this), Q(this, te).call(this);
9294
+ Q(this, te).call(this), Q(this, ee).call(this), Q(this, ie).call(this), Q(this, Xt).call(this);
9280
9295
  }
9281
9296
  }
9282
- Tt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), ne = new WeakMap();
9297
+ Tt = new WeakMap(), Xt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap();
9283
9298
  export {
9284
9299
  QuickVO,
9285
9300
  ignoreEvent