quickvo-sdk-js 0.6.9 → 0.7.1

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;
@@ -732,7 +732,6 @@ class AudioMediaContext {
732
732
  // 音量
733
733
  Z(this, "enhanceGain", 0);
734
734
  // 音量增强
735
- Z(this, "audio", new Audio());
736
735
  // @ts-ignore 音频上下文
737
736
  Z(this, "audioContext", new (window.AudioContext || window.webkitAudioContext)());
738
737
  // 媒体流音频源节点
@@ -749,6 +748,12 @@ class AudioMediaContext {
749
748
  Z(this, "analyserNode");
750
749
  // 缓冲区 存储分析节点的时域数据
751
750
  Z(this, "analyserArrayData");
751
+ // 初始化节点
752
+ Z(this, "initNode", () => {
753
+ 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);
754
+ const { gainNode: I, analyserNode: a } = this;
755
+ I.connect(a), this.audioContext.state === "suspended" && (this.audioContext.resume(), document.addEventListener("click", () => this.audioContext.resume(), { once: !0 })), this.setFilter();
756
+ });
752
757
  /**
753
758
  * 停止
754
759
  */
@@ -763,11 +768,11 @@ class AudioMediaContext {
763
768
  * 替换媒体
764
769
  */
765
770
  Z(this, "replaceStream", (I) => {
766
- const a = this.stream.getTracks();
767
- for (const _ of a)
768
- this.stream.removeTrack(_);
769
- const [E] = I.getAudioTracks();
770
- E && this.stream.addTrack(E);
771
+ const a = this.stream, E = a.getTracks();
772
+ for (const k of E)
773
+ a.removeTrack(k);
774
+ const [_] = I.getAudioTracks();
775
+ _ && a.addTrack(_), this.initNode();
771
776
  });
772
777
  /**
773
778
  * 获取数据流
@@ -819,9 +824,7 @@ class AudioMediaContext {
819
824
  let N = k;
820
825
  return a && N.connect(e), E && N.connect(n), _ && N.connect(O), N.connect($), I;
821
826
  });
822
- 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);
823
- const { gainNode: a, analyserNode: E } = this;
824
- a.connect(E), this.audioContext.state === "suspended" && (this.audioContext.resume(), document.addEventListener("click", () => this.audioContext.resume(), { once: !0 })), this.setFilter();
827
+ this.stream.addTrack(I), this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), this.initNode();
825
828
  }
826
829
  }
827
830
  class VideoMediaContext {
@@ -840,11 +843,11 @@ class VideoMediaContext {
840
843
  * 替换媒体
841
844
  */
842
845
  Z(this, "replaceStream", (I) => {
843
- const a = this.stream.getTracks();
844
- for (const _ of a)
845
- this.stream.removeTrack(_);
846
- const [E] = I.getVideoTracks();
847
- E && this.stream.addTrack(E);
846
+ const a = this.stream, E = a.getTracks();
847
+ for (const k of E)
848
+ a.removeTrack(k);
849
+ const [_] = I.getVideoTracks();
850
+ _ && a.addTrack(_);
848
851
  });
849
852
  /**
850
853
  * 获取数据流
@@ -6162,7 +6165,7 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
6162
6165
  };
6163
6166
  const BAD$1 = 16209, TYPE$1 = 16191;
6164
6167
  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;
6168
+ let E, _, k, e, n, O, $, N, D, q, P, j, V, J, z, Y, et, tt, nt, ut, it, at, st, rt;
6166
6169
  const ct = I.state;
6167
6170
  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
6171
  t:
@@ -6186,13 +6189,13 @@ var inffast = function u(I, a) {
6186
6189
  I.msg = "invalid distance too far back", ct.mode = BAD$1;
6187
6190
  break t;
6188
6191
  }
6189
- if (it = 0, lt = q, D === 0) {
6192
+ if (it = 0, at = q, D === 0) {
6190
6193
  if (it += $ - tt, tt < nt) {
6191
6194
  nt -= tt;
6192
6195
  do
6193
6196
  rt[k++] = q[it++];
6194
6197
  while (--tt);
6195
- it = k - ut, lt = rt;
6198
+ it = k - ut, at = rt;
6196
6199
  }
6197
6200
  } else if (D < tt) {
6198
6201
  if (it += $ + D - tt, tt -= D, tt < nt) {
@@ -6205,7 +6208,7 @@ var inffast = function u(I, a) {
6205
6208
  do
6206
6209
  rt[k++] = q[it++];
6207
6210
  while (--tt);
6208
- it = k - ut, lt = rt;
6211
+ it = k - ut, at = rt;
6209
6212
  }
6210
6213
  }
6211
6214
  } else if (it += D - tt, tt < nt) {
@@ -6213,11 +6216,11 @@ var inffast = function u(I, a) {
6213
6216
  do
6214
6217
  rt[k++] = q[it++];
6215
6218
  while (--tt);
6216
- it = k - ut, lt = rt;
6219
+ it = k - ut, at = rt;
6217
6220
  }
6218
6221
  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++]));
6222
+ rt[k++] = at[it++], rt[k++] = at[it++], rt[k++] = at[it++], nt -= 3;
6223
+ nt && (rt[k++] = at[it++], nt > 1 && (rt[k++] = at[it++]));
6221
6224
  } else {
6222
6225
  it = k - ut;
6223
6226
  do
@@ -6385,9 +6388,9 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
6385
6388
  64
6386
6389
  ]), inflate_table = (u, I, a, E, _, k, e, n) => {
6387
6390
  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;
6391
+ 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
6392
  const rt = new Uint16Array(MAXBITS + 1), ct = new Uint16Array(MAXBITS + 1);
6390
- let $t = null, oe, Ut, Mt;
6393
+ let $t = null, ne, Ct, Ut;
6391
6394
  for ($ = 0; $ <= MAXBITS; $++)
6392
6395
  rt[$] = 0;
6393
6396
  for (N = 0; N < E; N++)
@@ -6407,12 +6410,12 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
6407
6410
  ct[$ + 1] = ct[$] + rt[$];
6408
6411
  for (N = 0; N < E; N++)
6409
6412
  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)
6413
+ 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
6414
  return 1;
6412
6415
  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;
6416
+ 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
6417
  do
6415
- tt -= et, _[it + (Y >> V) + tt] = oe << 24 | Ut << 16 | Mt | 0;
6418
+ tt -= et, _[it + (Y >> V) + tt] = ne << 24 | Ct << 16 | Ut | 0;
6416
6419
  while (tt !== 0);
6417
6420
  for (et = 1 << $ - 1; Y & et; )
6418
6421
  et >>= 1;
@@ -6500,7 +6503,7 @@ const fixedtables = (u) => {
6500
6503
  const k = u.state;
6501
6504
  return k.window === null && (k.wsize = 1 << k.wbits, k.wnext = 0, k.whave = 0, k.window = new Uint8Array(k.wsize)), E >= k.wsize ? (k.window.set(I.subarray(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
6505
  }, 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;
6506
+ let a, E, _, k, e, n, O, $, N, D, q, P, j, V, J = 0, z, Y, et, tt, nt, ut, it, at;
6504
6507
  const st = new Uint8Array(4);
6505
6508
  let rt, ct;
6506
6509
  const $t = (
@@ -6509,7 +6512,7 @@ const fixedtables = (u) => {
6509
6512
  );
6510
6513
  if (inflateStateCheck(u) || !u.output || !u.input && u.avail_in !== 0)
6511
6514
  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;
6515
+ 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
6516
  t:
6514
6517
  for (; ; )
6515
6518
  switch (a.mode) {
@@ -6733,7 +6736,7 @@ const fixedtables = (u) => {
6733
6736
  }
6734
6737
  for (; a.have < 19; )
6735
6738
  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) {
6739
+ 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
6740
  u.msg = "invalid code lengths set", a.mode = BAD;
6738
6741
  break;
6739
6742
  }
@@ -6789,11 +6792,11 @@ const fixedtables = (u) => {
6789
6792
  u.msg = "invalid code -- missing end-of-block", a.mode = BAD;
6790
6793
  break;
6791
6794
  }
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) {
6795
+ 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
6796
  u.msg = "invalid literal/lengths set", a.mode = BAD;
6794
6797
  break;
6795
6798
  }
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) {
6799
+ 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
6800
  u.msg = "invalid distances set", a.mode = BAD;
6798
6801
  break;
6799
6802
  }
@@ -6935,10 +6938,10 @@ const fixedtables = (u) => {
6935
6938
  a.mode = DONE;
6936
6939
  /* falls through */
6937
6940
  case DONE:
6938
- lt = Z_STREAM_END$1;
6941
+ at = Z_STREAM_END$1;
6939
6942
  break t;
6940
6943
  case BAD:
6941
- lt = Z_DATA_ERROR$1;
6944
+ at = Z_DATA_ERROR$1;
6942
6945
  break t;
6943
6946
  case MEM:
6944
6947
  return Z_MEM_ERROR$1;
@@ -6948,7 +6951,7 @@ const fixedtables = (u) => {
6948
6951
  return Z_STREAM_ERROR$1;
6949
6952
  }
6950
6953
  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;
6954
+ 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
6955
  }, inflateEnd = (u) => {
6953
6956
  if (inflateStateCheck(u))
6954
6957
  return Z_STREAM_ERROR$1;
@@ -7182,12 +7185,12 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
7182
7185
  }
7183
7186
  return u;
7184
7187
  };
7185
- var wt, dt, xt, yt, kt, Pt, Lt, Bt, jt, Nt, Zt, Ft, Ht;
7188
+ var wt, dt, xt, yt, kt, Mt, Pt, Lt, Bt, Nt, jt, Zt, Ft;
7186
7189
  class CallsWebSocket {
7187
7190
  // 状态
7188
7191
  constructor(I) {
7189
- at(this, wt);
7190
- at(this, dt, {
7192
+ lt(this, wt);
7193
+ lt(this, dt, {
7191
7194
  url: "wss://demo.putplay.cc/websocket",
7192
7195
  // 地址
7193
7196
  debug: !1,
@@ -7196,10 +7199,10 @@ class CallsWebSocket {
7196
7199
  // 最大重连次数
7197
7200
  timeout: 30 * 1e3
7198
7201
  });
7199
- at(this, xt, "");
7202
+ lt(this, xt, "");
7200
7203
  // 缓存登录凭证
7201
- at(this, yt, {});
7202
- at(this, kt, {});
7204
+ lt(this, yt, {});
7205
+ lt(this, kt, {});
7203
7206
  Z(this, "state", "closed");
7204
7207
  // 外部 发送消息之前
7205
7208
  Z(this, "sendMessageBefore", async () => {
@@ -7211,26 +7214,26 @@ class CallsWebSocket {
7211
7214
  Z(this, "onReconnectStop", (I) => {
7212
7215
  });
7213
7216
  // 是否需要重连
7214
- at(this, Pt, (I) => {
7217
+ lt(this, Mt, (I) => {
7215
7218
  let a = !0;
7216
7219
  const { code: E = 1e3, reason: _ = "" } = I;
7217
7220
  return E === 1e3 && (_ === "quit success!" || _ === "replace old connection!") && (a = !1), a;
7218
7221
  });
7219
7222
  // 重连成功
7220
- at(this, Lt, async (I) => {
7223
+ lt(this, Pt, async (I) => {
7221
7224
  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
7225
  });
7223
7226
  // 重连停止
7224
- at(this, Bt, async (I) => {
7227
+ lt(this, Lt, async (I) => {
7225
7228
  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
7229
  });
7227
7230
  // 自定义心跳规则
7228
- at(this, jt, () => {
7231
+ lt(this, Bt, () => {
7229
7232
  const I = { event: "heartbeat", sn: +`${F(1e5, 999999)}` };
7230
7233
  return com.quick.voice.proto.CommonReq.encode(I).finish();
7231
7234
  });
7232
7235
  // 更新日志
7233
- at(this, Nt, (I, a = {}) => {
7236
+ lt(this, Nt, (I, a = {}) => {
7234
7237
  try {
7235
7238
  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
7239
  let N = {};
@@ -7269,7 +7272,7 @@ class CallsWebSocket {
7269
7272
  }
7270
7273
  });
7271
7274
  // 创建事件
7272
- at(this, Zt, (I, { resolve: a, reject: E }) => {
7275
+ lt(this, jt, (I, { resolve: a, reject: E }) => {
7273
7276
  const { sn: _ } = I, k = () => {
7274
7277
  const n = Q(this, yt)[_];
7275
7278
  clearTimeout(n.destructionTimer), delete Q(this, yt)[_];
@@ -7280,13 +7283,13 @@ class CallsWebSocket {
7280
7283
  Q(this, yt)[_] = { message: I, resolve: a, reject: E, destruction: k, destructionTimer: e };
7281
7284
  });
7282
7285
  // 获取事件
7283
- at(this, Ft, (I) => Q(this, yt)[I]);
7286
+ lt(this, Zt, (I) => Q(this, yt)[I]);
7284
7287
  // 接收消息
7285
- at(this, Ht, async (I) => {
7288
+ lt(this, Ft, async (I) => {
7286
7289
  const a = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(a), { sn: _, event: k } = E, e = onMessageFormat(E);
7287
7290
  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
7291
  return this.emitNotify(k, L(e, ["code", "data", "desc"]));
7289
- const O = Q(this, Ft).call(this, _);
7292
+ const O = Q(this, Zt).call(this, _);
7290
7293
  if (O) {
7291
7294
  const { resolve: $ = (D) => {
7292
7295
  }, destruction: N = () => {
@@ -7316,11 +7319,11 @@ class CallsWebSocket {
7316
7319
  ...Q(this, dt),
7317
7320
  url: E,
7318
7321
  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)
7322
+ onMessage: Q(this, Ft),
7323
+ checkReconnect: Q(this, Mt),
7324
+ getHeartbeatMsg: Q(this, Bt),
7325
+ onReconnectSuccess: Q(this, Pt),
7326
+ onReconnectStop: Q(this, Lt)
7324
7327
  })), 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
7328
  }));
7326
7329
  /**
@@ -7352,7 +7355,7 @@ class CallsWebSocket {
7352
7355
  compress: !1,
7353
7356
  ...e
7354
7357
  });
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: _ });
7358
+ 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
7359
  const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
7357
7360
  (N = Q(this, wt)) == null || N.sendMessage($);
7358
7361
  }));
@@ -7397,7 +7400,7 @@ class CallsWebSocket {
7397
7400
  St(this, dt, { ...Q(this, dt), ...I });
7398
7401
  }
7399
7402
  }
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();
7403
+ 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
7404
  var y = Object.defineProperty, x = (u) => {
7402
7405
  throw TypeError(u);
7403
7406
  }, 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 +7456,7 @@ class K {
7453
7456
  }
7454
7457
  }
7455
7458
  d = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap();
7456
- var zt;
7459
+ var Ht;
7457
7460
  class RoomBase {
7458
7461
  constructor(I) {
7459
7462
  Z(this, "options", {
@@ -7529,7 +7532,7 @@ class RoomBase {
7529
7532
  }
7530
7533
  }
7531
7534
  });
7532
- at(this, zt, () => {
7535
+ lt(this, Ht, () => {
7533
7536
  this.taskQueue.setCondition("createWs", !0), this.taskQueue.setCondition("createSession", !1), this.taskQueue.setCondition("ice", !1);
7534
7537
  });
7535
7538
  /**
@@ -7630,36 +7633,36 @@ class RoomBase {
7630
7633
  * 处理为应用层数据
7631
7634
  */
7632
7635
  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);
7636
+ this.setOptions(I), this.cwsIns = new CallsWebSocket({ ...I }), Q(this, Ht).call(this);
7634
7637
  }
7635
7638
  }
7636
- zt = new WeakMap();
7637
- var It, bt, _t, vt, gt, Jt, Wt, Rt, Kt;
7639
+ Ht = new WeakMap();
7640
+ var It, bt, _t, vt, gt, zt, Jt, Rt, Wt;
7638
7641
  class RoomMedias extends RoomBase {
7639
7642
  // 本地流活动状态管理
7640
7643
  constructor(a) {
7641
7644
  super(a);
7642
- at(this, It, []);
7645
+ lt(this, It, []);
7643
7646
  // 可用媒体设备列表
7644
- at(this, bt, /* @__PURE__ */ new Map());
7647
+ lt(this, bt, /* @__PURE__ */ new Map());
7645
7648
  // 媒体流设备管理
7646
- at(this, _t, /* @__PURE__ */ new Map());
7649
+ lt(this, _t, /* @__PURE__ */ new Map());
7647
7650
  // 媒体轨道参数管理
7648
- at(this, vt, /* @__PURE__ */ new Map());
7651
+ lt(this, vt, /* @__PURE__ */ new Map());
7649
7652
  // 媒体流上下文
7650
- at(this, gt, /* @__PURE__ */ new Map());
7653
+ lt(this, gt, /* @__PURE__ */ new Map());
7651
7654
  // 本地流管理
7652
7655
  Z(this, "localStreamsActionMap", /* @__PURE__ */ new Map());
7653
7656
  /**
7654
7657
  * 初始化媒体参数
7655
7658
  */
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", {});
7659
+ lt(this, zt, () => {
7660
+ 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
7661
  });
7659
7662
  /**
7660
7663
  * 初始化媒体设备类型
7661
7664
  */
7662
- at(this, Wt, () => {
7665
+ lt(this, Jt, () => {
7663
7666
  Q(this, bt).set("audioinput", "default"), Q(this, bt).set("videoinput", "default"), Q(this, bt).set("audiooutput", "default");
7664
7667
  });
7665
7668
  /**
@@ -7889,15 +7892,15 @@ class RoomMedias extends RoomBase {
7889
7892
  /**
7890
7893
  * 获取媒体设备列表
7891
7894
  */
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);
7895
+ 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) => {
7896
+ St(this, It, a.sort((E, _) => E.label.localeCompare(_.label, "zh-Hans-CN", { sensitivity: "accent" })));
7894
7897
  }).catch(function(a) {
7895
7898
  console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", a);
7896
7899
  }), Q(this, It)));
7897
7900
  /**
7898
7901
  * 媒体设备发生变化
7899
7902
  */
7900
- at(this, Kt, () => {
7903
+ lt(this, Wt, () => {
7901
7904
  navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
7902
7905
  await Q(this, Rt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
7903
7906
  }), Q(this, Rt).call(this);
@@ -7908,22 +7911,26 @@ class RoomMedias extends RoomBase {
7908
7911
  * @returns deviceId 设备ID
7909
7912
  */
7910
7913
  Z(this, "getMediaDeviceKind", (a) => Q(this, bt).get(a));
7914
+ /**
7915
+ * 更改音频输出
7916
+ */
7917
+ Z(this, "changeAudiooutput", () => {
7918
+ const a = Q(this, vt).values();
7919
+ for (const E of a)
7920
+ if (E.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype)
7921
+ try {
7922
+ E.audioContext.setSinkId(deviceId);
7923
+ } catch (_) {
7924
+ console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setSinkId is error.", _);
7925
+ }
7926
+ });
7911
7927
  /**
7912
7928
  * 设置正在使用的媒体设备
7913
7929
  * @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
7914
7930
  * @param deviceId 设备ID
7915
7931
  */
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
- }
7932
+ Z(this, "setDeviceKind", (a, E) => {
7933
+ Q(this, bt).set(a, E);
7927
7934
  });
7928
7935
  /**
7929
7936
  * 设置音频输出设备
@@ -7952,10 +7959,10 @@ class RoomMedias extends RoomBase {
7952
7959
  * @returns MediaDeviceInfo[]
7953
7960
  */
7954
7961
  Z(this, "getEnumerateVideoinputDevices", () => this.getEnumerateDevices("videoinput"));
7955
- Q(this, Kt).call(this), Q(this, Wt).call(this), Q(this, Jt).call(this);
7962
+ Q(this, Wt).call(this), Q(this, Jt).call(this), Q(this, zt).call(this);
7956
7963
  }
7957
7964
  }
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();
7965
+ 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
7966
  class RoomUsers extends RoomMedias {
7960
7967
  constructor(a) {
7961
7968
  super(a);
@@ -8259,11 +8266,11 @@ const createMutedAudioStream = () => {
8259
8266
  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
8267
  }, 100), E.captureStream(a);
8261
8268
  };
8262
- var Ot, Gt, At, Qt, Vt, Yt;
8269
+ var Ot, Kt, Gt, Qt, Vt;
8263
8270
  class RoomPeer extends RoomUsers {
8264
8271
  constructor(a) {
8265
8272
  super(a);
8266
- at(this, Ot, /* @__PURE__ */ new Map());
8273
+ lt(this, Ot, /* @__PURE__ */ new Map());
8267
8274
  // 假媒体流 (创建轨道用)
8268
8275
  Z(this, "getPeerStatsTimer", 0);
8269
8276
  // 获取报告的定时器
@@ -8282,10 +8289,10 @@ class RoomPeer extends RoomUsers {
8282
8289
  // 网络抖动
8283
8290
  });
8284
8291
  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);
8292
+ this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), Q(this, Gt).call(this), Q(this, Vt).call(this);
8286
8293
  });
8287
8294
  // 初始化假数据流
8288
- at(this, Gt, () => {
8295
+ lt(this, Kt, () => {
8289
8296
  for (const a of mediaType_keys) {
8290
8297
  const E = Q(this, Ot).get(a);
8291
8298
  if (E) {
@@ -8310,7 +8317,7 @@ class RoomPeer extends RoomUsers {
8310
8317
  }
8311
8318
  });
8312
8319
  // 获取假数据流
8313
- at(this, At, (a) => Q(this, Ot).get(a));
8320
+ Z(this, "getPhoneyStreams", (a) => Q(this, Ot).get(a));
8314
8321
  /**
8315
8322
  * 替换发射器媒体流
8316
8323
  */
@@ -8322,7 +8329,7 @@ class RoomPeer extends RoomUsers {
8322
8329
  let n;
8323
8330
  if (e) {
8324
8331
  const { sender: O } = e;
8325
- E ? n = this.getUserStream(_, k) : n = Q(this, At).call(this, k);
8332
+ E ? n = this.getUserStream(_, k) : n = this.getPhoneyStreams(k);
8326
8333
  const [$] = n.getTracks();
8327
8334
  $ && await O.replaceTrack($);
8328
8335
  }
@@ -8351,7 +8358,7 @@ class RoomPeer extends RoomUsers {
8351
8358
  const E = [];
8352
8359
  for (const _ of a) {
8353
8360
  if (this.transceiverMap.get(_)) continue;
8354
- const e = Q(this, At).call(this, _), [n] = e.getTracks(), O = this.peerIns.addTransceiver(n, { direction: "sendonly" });
8361
+ const e = this.getPhoneyStreams(_), [n] = e.getTracks(), O = this.peerIns.addTransceiver(n, { direction: "sendonly" });
8355
8362
  this.transceiverMap.set(_, O), E.push(_);
8356
8363
  }
8357
8364
  if (a.length === 0 || E.length !== 0) {
@@ -8437,7 +8444,7 @@ class RoomPeer extends RoomUsers {
8437
8444
  /**
8438
8445
  * 监听webrtc ice通讯连接
8439
8446
  */
8440
- at(this, Qt, () => {
8447
+ lt(this, Gt, () => {
8441
8448
  let a = 0;
8442
8449
  const E = () => {
8443
8450
  this.setRoomState("closed");
@@ -8587,7 +8594,7 @@ class RoomPeer extends RoomUsers {
8587
8594
  /**
8588
8595
  * 计算网络质量
8589
8596
  */
8590
- at(this, Vt, async () => {
8597
+ lt(this, Qt, async () => {
8591
8598
  try {
8592
8599
  const a = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...a.values()].filter((nt) => E.includes(nt.type));
8593
8600
  let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
@@ -8597,23 +8604,23 @@ class RoomPeer extends RoomUsers {
8597
8604
  }
8598
8605
  this.reports = k;
8599
8606
  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));
8607
+ const { bytesReceived: ut, bytesSent: it, packetsSent: at, packetsLost: st, jitter: rt, roundTripTime: ct } = nt;
8608
+ 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
8609
  }
8603
8610
  P.sort().reverse(), q.sort().reverse();
8604
8611
  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
8612
  this.peerNetwork = et;
8606
8613
  const tt = (nt, ut, it) => {
8607
- const lt = Number(nt), st = Number(ut), rt = Number(it);
8614
+ const at = Number(nt), st = Number(ut), rt = Number(it);
8608
8615
  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);
8616
+ 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
8617
  };
8611
8618
  {
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) {
8619
+ 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);
8620
+ if (await this.updateUserNetwork(this.options.userId, at), st) {
8614
8621
  this.emitNotifyUpdateUsers();
8615
8622
  const { userId: rt, roomId: ct } = this.options;
8616
- this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...lt, userId: rt, roomId: ct } }, !1);
8623
+ this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...at, userId: rt, roomId: ct } }, !1);
8617
8624
  }
8618
8625
  }
8619
8626
  } catch (a) {
@@ -8623,9 +8630,9 @@ class RoomPeer extends RoomUsers {
8623
8630
  /**
8624
8631
  * 获取连接的所有轨道分析数据
8625
8632
  */
8626
- at(this, Yt, () => {
8633
+ lt(this, Vt, () => {
8627
8634
  const a = async () => {
8628
- this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this, Vt).call(this);
8635
+ this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this, Qt).call(this);
8629
8636
  };
8630
8637
  this.getPeerStatsTimer = setInterval(a, 1 * 1e3);
8631
8638
  });
@@ -8633,11 +8640,11 @@ class RoomPeer extends RoomUsers {
8633
8640
  * 停止网络报告分析
8634
8641
  */
8635
8642
  Z(this, "stopGetPeerStats", () => clearInterval(this.getPeerStatsTimer));
8636
- Q(this, Gt).call(this);
8643
+ Q(this, Kt).call(this);
8637
8644
  }
8638
8645
  }
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;
8646
+ Ot = new WeakMap(), Kt = new WeakMap(), Gt = new WeakMap(), Qt = new WeakMap(), Vt = new WeakMap();
8647
+ var Yt, Et, At, qt, Dt;
8641
8648
  class RoomCalls extends RoomPeer {
8642
8649
  constructor(a) {
8643
8650
  super(a);
@@ -8647,7 +8654,7 @@ class RoomCalls extends RoomPeer {
8647
8654
  * 广播给房间其他人
8648
8655
  * 只有当自己建立了发射轨道 并且 加入房间后才进行广播
8649
8656
  */
8650
- at(this, Xt, async (a) => {
8657
+ lt(this, Yt, async (a) => {
8651
8658
  const { roomId: E } = this.options;
8652
8659
  if (!E) return;
8653
8660
  const { id: _, tracks: k = [] } = await this.getCaller();
@@ -8658,7 +8665,7 @@ class RoomCalls extends RoomPeer {
8658
8665
  /**
8659
8666
  * 更新自己通话状态
8660
8667
  */
8661
- at(this, Et, async (a) => new Promise(async (E, _) => {
8668
+ lt(this, Et, async (a) => new Promise(async (E, _) => {
8662
8669
  const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: a } };
8663
8670
  await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
8664
8671
  const { code: $ = 0 } = O;
@@ -8669,7 +8676,7 @@ class RoomCalls extends RoomPeer {
8669
8676
  /**
8670
8677
  * 创建连接
8671
8678
  */
8672
- at(this, qt, () => new Promise(async (a, E) => {
8679
+ lt(this, At, () => new Promise(async (a, E) => {
8673
8680
  try {
8674
8681
  if (["connecting", "connected"].includes(this.cwsIns.state)) return a(!0);
8675
8682
  this.taskQueue.setCondition("createWs", !1), this.cwsIns.clearEvents(), this.initPeer();
@@ -8696,7 +8703,7 @@ class RoomCalls extends RoomPeer {
8696
8703
  /**
8697
8704
  * 创建cf会话
8698
8705
  */
8699
- at(this, Dt, () => {
8706
+ lt(this, qt, () => {
8700
8707
  if (!["connecting", "connected"].includes(this.roomState))
8701
8708
  return this.setRoomState("connecting"), new Promise((a) => {
8702
8709
  const E = async () => {
@@ -8732,12 +8739,12 @@ class RoomCalls extends RoomPeer {
8732
8739
  * @example quickvo.earlyConnect(['microphoneCamera_audio', 'microphoneCamera_video'])
8733
8740
  */
8734
8741
  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);
8742
+ 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
8743
  });
8737
8744
  /**
8738
8745
  * 创建媒体轨道
8739
8746
  */
8740
- at(this, Ct, async (a) => new Promise((E) => {
8747
+ lt(this, Dt, async (a) => new Promise((E) => {
8741
8748
  const _ = async () => {
8742
8749
  try {
8743
8750
  this.taskQueue.setCondition("createTrack", !1);
@@ -8797,10 +8804,10 @@ class RoomCalls extends RoomPeer {
8797
8804
  * @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
8798
8805
  * @param deviceId 设备ID
8799
8806
  */
8800
- Z(this, "setMediaDeviceKind", async (a, E) => new Promise(async (_, k) => {
8801
- await this.setDeviceKind(a, E);
8807
+ Z(this, "setMediaDeviceKind", (a, E) => new Promise(async (_, k) => {
8808
+ this.setDeviceKind(a, E);
8802
8809
  const e = await this.getCaller(), { id: n, tracks: O = [], callActionMap: $ } = e, N = [], D = async (q) => {
8803
- const P = this.localStreamsActionMap.get(q);
8810
+ const P = this.localStreamsActionMap.get(q), j = O.find((J) => J.mediaType === q), V = $[q];
8804
8811
  if (P) {
8805
8812
  N.push(q), await this.stopLocalStreams([q]);
8806
8813
  try {
@@ -8809,20 +8816,20 @@ class RoomCalls extends RoomPeer {
8809
8816
  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
8817
  }
8811
8818
  }
8812
- const j = O.find((J) => J.mediaType === q), V = $[q];
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) {
8819
+ if (j) {
8814
8820
  const J = this.getLocalStream(q);
8815
8821
  if (J) {
8816
8822
  const z = this.getUserMediaStreamContext(n, q);
8817
8823
  z == null || z.replaceStream(J), V && await this.replaceSenderStream([q], !0);
8818
8824
  }
8819
8825
  }
8826
+ 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 });
8827
+ {
8828
+ const J = this.getLocalStreams(N);
8829
+ this.cwsIns.emitNotify("onLocalStream", { code: 200, data: J, desc: "local stream is change." }), _(!0);
8830
+ }
8820
8831
  };
8821
- a === "audioinput" && await D("microphoneCamera_audio"), a === "videoinput" && await D("microphoneCamera_video");
8822
- {
8823
- const q = this.getLocalStreams(N);
8824
- this.cwsIns.emitNotify("onLocalStream", { code: 200, data: q, desc: "local stream is change." }), _(q);
8825
- }
8832
+ a === "audioinput" && D("microphoneCamera_audio"), a === "videoinput" && D("microphoneCamera_video"), a === "audiooutput" && (this.changeAudiooutput(), _(!0));
8826
8833
  }));
8827
8834
  /**
8828
8835
  * 改变屏幕共享流
@@ -8845,7 +8852,7 @@ class RoomCalls extends RoomPeer {
8845
8852
  * @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1' , newPublishAutoSubscribe: true })
8846
8853
  * @returns Promise<boolean>
8847
8854
  */
8848
- Z(this, "joinRoom", async (a) => (this.setOptions(a), await Q(this, qt).call(this), new Promise((E, _) => {
8855
+ Z(this, "joinRoom", async (a) => (this.setOptions(a), await Q(this, At).call(this), new Promise((E, _) => {
8849
8856
  this.clearUsers();
8850
8857
  let k = "";
8851
8858
  const e = async () => {
@@ -8864,7 +8871,7 @@ class RoomCalls extends RoomPeer {
8864
8871
  if (q !== 200) return _(P);
8865
8872
  const { roomId: V = "", roomUsers: J = [] } = j;
8866
8873
  if (V !== O) return _("加入的房间不匹配");
8867
- this.isInRoom = !0, Q(this, Dt).call(this), await this.updateUsers(J), e();
8874
+ this.isInRoom = !0, Q(this, qt).call(this), await this.updateUsers(J), e();
8868
8875
  });
8869
8876
  } catch (O) {
8870
8877
  this.taskQueue.setCondition("joinRoom", !0), this.reportLogs("join_room_error", O.message || O), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
@@ -8936,15 +8943,25 @@ class RoomCalls extends RoomPeer {
8936
8943
  }
8937
8944
  const n = [];
8938
8945
  for (const q of a) {
8939
- const P = this.getLocalStream(q);
8940
- P ? await this.initUserMediaStreamContext(e.id, q, P) : n.push(q);
8946
+ {
8947
+ const P = this.getPhoneyStreams(q);
8948
+ await this.initUserMediaStreamContext(e.id, q, P);
8949
+ }
8950
+ {
8951
+ const P = this.getLocalStream(q);
8952
+ if (P) {
8953
+ const j = this.getUserMediaStreamContext(e.id, q);
8954
+ j == null || j.replaceStream(P);
8955
+ } else
8956
+ n.push(q);
8957
+ }
8941
8958
  }
8942
8959
  const O = a.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
8943
- await this.replaceSenderStream(a, !1), await Q(this, Ct).call(this, O);
8960
+ await this.replaceSenderStream(a, !1), await Q(this, Dt).call(this, O);
8944
8961
  const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
8945
8962
  await this.updateUsertracks(e.id, N, !0);
8946
8963
  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, Xt).call(this, a);
8964
+ 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
8965
  {
8949
8966
  await this.emitNotifyUpdateUsers();
8950
8967
  const q = await this.getCaller();
@@ -9104,18 +9121,19 @@ class RoomCalls extends RoomPeer {
9104
9121
  const k = await this.getCaller();
9105
9122
  if (!k || !k.id) return _(!0);
9106
9123
  const { tracks: e = [] } = k, n = [...e];
9107
- await this.replaceSenderStream(a, !0);
9108
9124
  for (let $ of n) {
9109
9125
  const { mediaType: N } = $;
9110
9126
  if (N && a.includes(N)) {
9111
9127
  $.enabled = E;
9112
- const q = this.getUserStream(k.id, N).getTracks();
9128
+ const D = this.getLocalStream(N);
9129
+ if (!D) continue;
9130
+ const q = D.getTracks();
9113
9131
  for (const P of q)
9114
9132
  P.enabled = E;
9115
9133
  }
9116
9134
  }
9117
9135
  const O = await this.getCallAction(n);
9118
- await Q(this, Et).call(this, O), E === !1 && await this.replaceSenderStream(a, !1), await this.emitNotifyUpdateUsers(), _(!0);
9136
+ await Q(this, Et).call(this, O), await this.replaceSenderStream(a, E), await this.emitNotifyUpdateUsers(), _(!0);
9119
9137
  }));
9120
9138
  /**
9121
9139
  * 远端调试
@@ -9130,21 +9148,21 @@ class RoomCalls extends RoomPeer {
9130
9148
  }));
9131
9149
  }
9132
9150
  }
9133
- Xt = new WeakMap(), Et = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap();
9151
+ Yt = new WeakMap(), Et = new WeakMap(), At = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap();
9134
9152
  class Room extends RoomCalls {
9135
9153
  constructor(I) {
9136
9154
  super(I);
9137
9155
  }
9138
9156
  }
9139
- var Tt, te, ee, ie, ne;
9157
+ var Tt, Xt, te, ee, ie;
9140
9158
  class QuickVO extends Room {
9141
9159
  constructor(a) {
9142
9160
  super(a);
9143
- at(this, Tt, /* @__PURE__ */ new Map());
9161
+ lt(this, Tt, /* @__PURE__ */ new Map());
9144
9162
  /**
9145
9163
  * 添加内部监听事件
9146
9164
  */
9147
- at(this, te, () => {
9165
+ lt(this, Xt, () => {
9148
9166
  {
9149
9167
  const a = async (E) => {
9150
9168
  const { qualities: _ = [] } = E.data, [k] = _;
@@ -9225,12 +9243,12 @@ class QuickVO extends Room {
9225
9243
  /**
9226
9244
  * cwsIns 发送消息前
9227
9245
  */
9228
- at(this, ee, () => {
9246
+ lt(this, te, () => {
9229
9247
  });
9230
9248
  /**
9231
9249
  * 重连成功
9232
9250
  */
9233
- at(this, ie, () => {
9251
+ lt(this, ee, () => {
9234
9252
  this.cwsIns.onReconnectSuccess = async () => {
9235
9253
  await this.syncRoomInfo();
9236
9254
  };
@@ -9238,7 +9256,7 @@ class QuickVO extends Room {
9238
9256
  /**
9239
9257
  * 重连停止
9240
9258
  */
9241
- at(this, ne, async () => {
9259
+ lt(this, ie, async () => {
9242
9260
  });
9243
9261
  /**
9244
9262
  * 添加 FrameRequestCallback
@@ -9277,10 +9295,10 @@ class QuickVO extends Room {
9277
9295
  Z(this, "destroy", async () => {
9278
9296
  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
9297
  });
9280
- Q(this, ee).call(this), Q(this, ie).call(this), Q(this, ne).call(this), Q(this, te).call(this);
9298
+ Q(this, te).call(this), Q(this, ee).call(this), Q(this, ie).call(this), Q(this, Xt).call(this);
9281
9299
  }
9282
9300
  }
9283
- Tt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), ne = new WeakMap();
9301
+ Tt = new WeakMap(), Xt = new WeakMap(), te = new WeakMap(), ee = new WeakMap(), ie = new WeakMap();
9284
9302
  export {
9285
9303
  QuickVO,
9286
9304
  ignoreEvent