quickvo-sdk-js 0.6.0 → 0.6.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
@@ -4,7 +4,7 @@ var ne = (a) => {
4
4
  };
5
5
  var ce = (a, I, u) => I in a ? re(a, I, { enumerable: !0, configurable: !0, writable: !0, value: u }) : a[I] = u;
6
6
  var Z = (a, I, u) => ce(a, typeof I != "symbol" ? I + "" : I, u), oe = (a, I, u) => I.has(a) || ne("Cannot " + u);
7
- var Q = (a, I, u) => (oe(a, I, "read from private field"), u ? u.call(a) : I.get(a)), st = (a, I, u) => I.has(a) ? ne("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), wt = (a, I, u, E) => (oe(a, I, "write to private field"), E ? E.call(a, u) : I.set(a, u), u);
7
+ var Q = (a, I, u) => (oe(a, I, "read from private field"), u ? u.call(a) : I.get(a)), at = (a, I, u) => I.has(a) ? ne("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), wt = (a, I, u, E) => (oe(a, I, "write to private field"), E ? E.call(a, u) : I.set(a, u), u);
8
8
  const L = (a, I = []) => {
9
9
  const u = { ...a }, E = Object.keys(u);
10
10
  for (const _ of E)
@@ -768,7 +768,7 @@ class AudioMediaContext {
768
768
  * 静音
769
769
  */
770
770
  Z(this, "setMute", (I = !0) => {
771
- I ? this.analyserNode.disconnect(this.audioContext.destination) : this.analyserNode.connect(this.audioContext.destination);
771
+ I ? this.analyserNode.disconnect(this.destination) : this.analyserNode.connect(this.destination);
772
772
  });
773
773
  /**
774
774
  * 设置音量
@@ -810,8 +810,8 @@ class AudioMediaContext {
810
810
  return u && N.connect(e), E && N.connect(n), _ && N.connect(O), N.connect($), I;
811
811
  });
812
812
  this.stream.addTrack(I), this.audio.srcObject = this.stream, this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), this.mediaStreamAudioSourceNode = this.audioContext.createMediaStreamSource(this.stream), this.destination = this.audioContext.createMediaStreamDestination(), 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);
813
- const { gainNode: u, destination: E, analyserNode: _ } = this;
814
- u.connect(E), u.connect(_), this.audioContext.state === "suspended" && (this.audioContext.resume(), document.addEventListener("click", () => this.audioContext.resume(), { once: !0 })), this.setFilter();
813
+ const { gainNode: u, analyserNode: E, destination: _ } = this;
814
+ u.connect(E), E.connect(_), this.audioContext.state === "suspended" && (this.audioContext.resume(), document.addEventListener("click", () => this.audioContext.resume(), { once: !0 })), this.setFilter();
815
815
  }
816
816
  }
817
817
  class VideoMediaContext {
@@ -6150,7 +6150,7 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
6150
6150
  };
6151
6151
  const BAD$1 = 16209, TYPE$1 = 16191;
6152
6152
  var inffast = function a(I, u) {
6153
- let E, _, k, e, n, O, $, N, D, q, P, j, V, J, z, Y, et, tt, nt, lt, it, at, ct, ot;
6153
+ let E, _, k, e, n, O, $, N, D, q, P, j, V, J, z, Y, et, tt, nt, lt, it, st, ct, ot;
6154
6154
  const rt = I.state;
6155
6155
  E = I.next_in, ct = I.input, _ = E + (I.avail_in - 5), k = I.next_out, ot = I.output, e = k - (u - I.avail_out), n = k + (I.avail_out - 257), O = rt.dmax, $ = rt.wsize, N = rt.whave, D = rt.wnext, q = rt.window, P = rt.hold, j = rt.bits, V = rt.lencode, J = rt.distcode, z = (1 << rt.lenbits) - 1, Y = (1 << rt.distbits) - 1;
6156
6156
  t:
@@ -6174,13 +6174,13 @@ var inffast = function a(I, u) {
6174
6174
  I.msg = "invalid distance too far back", rt.mode = BAD$1;
6175
6175
  break t;
6176
6176
  }
6177
- if (it = 0, at = q, D === 0) {
6177
+ if (it = 0, st = q, D === 0) {
6178
6178
  if (it += $ - tt, tt < nt) {
6179
6179
  nt -= tt;
6180
6180
  do
6181
6181
  ot[k++] = q[it++];
6182
6182
  while (--tt);
6183
- it = k - lt, at = ot;
6183
+ it = k - lt, st = ot;
6184
6184
  }
6185
6185
  } else if (D < tt) {
6186
6186
  if (it += $ + D - tt, tt -= D, tt < nt) {
@@ -6193,7 +6193,7 @@ var inffast = function a(I, u) {
6193
6193
  do
6194
6194
  ot[k++] = q[it++];
6195
6195
  while (--tt);
6196
- it = k - lt, at = ot;
6196
+ it = k - lt, st = ot;
6197
6197
  }
6198
6198
  }
6199
6199
  } else if (it += D - tt, tt < nt) {
@@ -6201,11 +6201,11 @@ var inffast = function a(I, u) {
6201
6201
  do
6202
6202
  ot[k++] = q[it++];
6203
6203
  while (--tt);
6204
- it = k - lt, at = ot;
6204
+ it = k - lt, st = ot;
6205
6205
  }
6206
6206
  for (; nt > 2; )
6207
- ot[k++] = at[it++], ot[k++] = at[it++], ot[k++] = at[it++], nt -= 3;
6208
- nt && (ot[k++] = at[it++], nt > 1 && (ot[k++] = at[it++]));
6207
+ ot[k++] = st[it++], ot[k++] = st[it++], ot[k++] = st[it++], nt -= 3;
6208
+ nt && (ot[k++] = st[it++], nt > 1 && (ot[k++] = st[it++]));
6209
6209
  } else {
6210
6210
  it = k - lt;
6211
6211
  do
@@ -6373,7 +6373,7 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
6373
6373
  64
6374
6374
  ]), inflate_table = (a, I, u, E, _, k, e, n) => {
6375
6375
  const O = n.bits;
6376
- let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, J = 0, z = 0, Y = 0, et, tt, nt, lt, it, at = null, ct;
6376
+ let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, V = 0, J = 0, z = 0, Y = 0, et, tt, nt, lt, it, st = null, ct;
6377
6377
  const ot = new Uint16Array(MAXBITS + 1), rt = new Uint16Array(MAXBITS + 1);
6378
6378
  let Ot = null, ie, Dt, Ct;
6379
6379
  for ($ = 0; $ <= MAXBITS; $++)
@@ -6395,10 +6395,10 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
6395
6395
  rt[$ + 1] = rt[$] + ot[$];
6396
6396
  for (N = 0; N < E; N++)
6397
6397
  I[u + N] !== 0 && (e[rt[I[u + N]]++] = N);
6398
- if (a === CODES$1 ? (at = Ot = e, ct = 20) : a === LENS$1 ? (at = lbase, Ot = lext, ct = 257) : (at = dbase, Ot = dext, ct = 0), Y = 0, N = 0, $ = D, it = k, j = P, V = 0, nt = -1, z = 1 << P, lt = z - 1, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
6398
+ if (a === CODES$1 ? (st = Ot = e, ct = 20) : a === LENS$1 ? (st = lbase, Ot = lext, ct = 257) : (st = dbase, Ot = dext, ct = 0), Y = 0, N = 0, $ = D, it = k, j = P, V = 0, nt = -1, z = 1 << P, lt = z - 1, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
6399
6399
  return 1;
6400
6400
  for (; ; ) {
6401
- ie = $ - V, e[N] + 1 < ct ? (Dt = 0, Ct = e[N]) : e[N] >= ct ? (Dt = Ot[e[N] - ct], Ct = at[e[N] - ct]) : (Dt = 96, Ct = 0), et = 1 << $ - V, tt = 1 << j, D = tt;
6401
+ ie = $ - V, e[N] + 1 < ct ? (Dt = 0, Ct = e[N]) : e[N] >= ct ? (Dt = Ot[e[N] - ct], Ct = st[e[N] - ct]) : (Dt = 96, Ct = 0), et = 1 << $ - V, tt = 1 << j, D = tt;
6402
6402
  do
6403
6403
  tt -= et, _[it + (Y >> V) + tt] = ie << 24 | Dt << 16 | Ct | 0;
6404
6404
  while (tt !== 0);
@@ -6488,7 +6488,7 @@ const fixedtables = (a) => {
6488
6488
  const k = a.state;
6489
6489
  return k.window === null && (k.wsize = 1 << k.wbits, k.wnext = 0, k.whave = 0, k.window = new Uint8Array(k.wsize)), E >= k.wsize ? (k.window.set(I.subarray(u - k.wsize, u), 0), k.wnext = 0, k.whave = k.wsize) : (_ = k.wsize - k.wnext, _ > E && (_ = E), k.window.set(I.subarray(u - E, u - E + _), k.wnext), E -= _, E ? (k.window.set(I.subarray(u - E, u), 0), k.wnext = E, k.whave = k.wsize) : (k.wnext += _, k.wnext === k.wsize && (k.wnext = 0), k.whave < k.wsize && (k.whave += _))), 0;
6490
6490
  }, inflate$2 = (a, I) => {
6491
- let u, E, _, k, e, n, O, $, N, D, q, P, j, V, J = 0, z, Y, et, tt, nt, lt, it, at;
6491
+ let u, E, _, k, e, n, O, $, N, D, q, P, j, V, J = 0, z, Y, et, tt, nt, lt, it, st;
6492
6492
  const ct = new Uint8Array(4);
6493
6493
  let ot, rt;
6494
6494
  const Ot = (
@@ -6497,7 +6497,7 @@ const fixedtables = (a) => {
6497
6497
  );
6498
6498
  if (inflateStateCheck(a) || !a.output || !a.input && a.avail_in !== 0)
6499
6499
  return Z_STREAM_ERROR$1;
6500
- u = a.state, u.mode === TYPE && (u.mode = TYPEDO), e = a.next_out, _ = a.output, O = a.avail_out, k = a.next_in, E = a.input, n = a.avail_in, $ = u.hold, N = u.bits, D = n, q = O, at = Z_OK$1;
6500
+ u = a.state, u.mode === TYPE && (u.mode = TYPEDO), e = a.next_out, _ = a.output, O = a.avail_out, k = a.next_in, E = a.input, n = a.avail_in, $ = u.hold, N = u.bits, D = n, q = O, st = Z_OK$1;
6501
6501
  t:
6502
6502
  for (; ; )
6503
6503
  switch (u.mode) {
@@ -6721,7 +6721,7 @@ const fixedtables = (a) => {
6721
6721
  }
6722
6722
  for (; u.have < 19; )
6723
6723
  u.lens[Ot[u.have++]] = 0;
6724
- if (u.lencode = u.lendyn, u.lenbits = 7, ot = { bits: u.lenbits }, at = inftrees(CODES, u.lens, 0, 19, u.lencode, 0, u.work, ot), u.lenbits = ot.bits, at) {
6724
+ if (u.lencode = u.lendyn, u.lenbits = 7, ot = { bits: u.lenbits }, st = inftrees(CODES, u.lens, 0, 19, u.lencode, 0, u.work, ot), u.lenbits = ot.bits, st) {
6725
6725
  a.msg = "invalid code lengths set", u.mode = BAD;
6726
6726
  break;
6727
6727
  }
@@ -6777,11 +6777,11 @@ const fixedtables = (a) => {
6777
6777
  a.msg = "invalid code -- missing end-of-block", u.mode = BAD;
6778
6778
  break;
6779
6779
  }
6780
- if (u.lenbits = 9, ot = { bits: u.lenbits }, at = inftrees(LENS, u.lens, 0, u.nlen, u.lencode, 0, u.work, ot), u.lenbits = ot.bits, at) {
6780
+ if (u.lenbits = 9, ot = { bits: u.lenbits }, st = inftrees(LENS, u.lens, 0, u.nlen, u.lencode, 0, u.work, ot), u.lenbits = ot.bits, st) {
6781
6781
  a.msg = "invalid literal/lengths set", u.mode = BAD;
6782
6782
  break;
6783
6783
  }
6784
- if (u.distbits = 6, u.distcode = u.distdyn, ot = { bits: u.distbits }, at = inftrees(DISTS, u.lens, u.nlen, u.ndist, u.distcode, 0, u.work, ot), u.distbits = ot.bits, at) {
6784
+ if (u.distbits = 6, u.distcode = u.distdyn, ot = { bits: u.distbits }, st = inftrees(DISTS, u.lens, u.nlen, u.ndist, u.distcode, 0, u.work, ot), u.distbits = ot.bits, st) {
6785
6785
  a.msg = "invalid distances set", u.mode = BAD;
6786
6786
  break;
6787
6787
  }
@@ -6923,10 +6923,10 @@ const fixedtables = (a) => {
6923
6923
  u.mode = DONE;
6924
6924
  /* falls through */
6925
6925
  case DONE:
6926
- at = Z_STREAM_END$1;
6926
+ st = Z_STREAM_END$1;
6927
6927
  break t;
6928
6928
  case BAD:
6929
- at = Z_DATA_ERROR$1;
6929
+ st = Z_DATA_ERROR$1;
6930
6930
  break t;
6931
6931
  case MEM:
6932
6932
  return Z_MEM_ERROR$1;
@@ -6936,7 +6936,7 @@ const fixedtables = (a) => {
6936
6936
  return Z_STREAM_ERROR$1;
6937
6937
  }
6938
6938
  return a.next_out = e, a.avail_out = O, a.next_in = k, a.avail_in = n, u.hold = $, u.bits = N, (u.wsize || q !== a.avail_out && u.mode < BAD && (u.mode < CHECK || I !== Z_FINISH$1)) && updatewindow(a, a.output, a.next_out, q - a.avail_out), D -= a.avail_in, q -= a.avail_out, a.total_in += D, a.total_out += q, u.total += q, u.wrap & 4 && q && (a.adler = u.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
6939
- u.flags ? crc32_1(u.check, _, q, a.next_out - q) : adler32_1(u.check, _, q, a.next_out - q)), a.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (D === 0 && q === 0 || I === Z_FINISH$1) && at === Z_OK$1 && (at = Z_BUF_ERROR), at;
6939
+ u.flags ? crc32_1(u.check, _, q, a.next_out - q) : adler32_1(u.check, _, q, a.next_out - q)), a.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (D === 0 && q === 0 || I === Z_FINISH$1) && st === Z_OK$1 && (st = Z_BUF_ERROR), st;
6940
6940
  }, inflateEnd = (a) => {
6941
6941
  if (inflateStateCheck(a))
6942
6942
  return Z_STREAM_ERROR$1;
@@ -7170,12 +7170,12 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
7170
7170
  }
7171
7171
  return a;
7172
7172
  };
7173
- var vt, ut, Rt, yt, _t, Ut, Mt, Pt, Bt, Et, Lt, jt, Zt;
7173
+ var vt, ut, Rt, _t, yt, Ut, Mt, Pt, Lt, Et, Bt, jt, Zt;
7174
7174
  class CallsWebSocket {
7175
7175
  // 状态
7176
7176
  constructor(I) {
7177
- st(this, vt);
7178
- st(this, ut, {
7177
+ at(this, vt);
7178
+ at(this, ut, {
7179
7179
  url: "wss://demo.putplay.cc/websocket",
7180
7180
  // 地址
7181
7181
  debug: !1,
@@ -7184,10 +7184,10 @@ class CallsWebSocket {
7184
7184
  // 最大重连次数
7185
7185
  timeout: 30 * 1e3
7186
7186
  });
7187
- st(this, Rt, "");
7187
+ at(this, Rt, "");
7188
7188
  // 缓存登录凭证
7189
- st(this, yt, {});
7190
- st(this, _t, {});
7189
+ at(this, _t, {});
7190
+ at(this, yt, {});
7191
7191
  Z(this, "state", "closed");
7192
7192
  // 外部 发送消息之前
7193
7193
  Z(this, "sendMessageBefore", async () => {
@@ -7199,26 +7199,26 @@ class CallsWebSocket {
7199
7199
  Z(this, "onReconnectStop", (I) => {
7200
7200
  });
7201
7201
  // 是否需要重连
7202
- st(this, Ut, (I) => {
7202
+ at(this, Ut, (I) => {
7203
7203
  let u = !0;
7204
7204
  const { code: E = 1e3, reason: _ = "" } = I;
7205
7205
  return E === 1e3 && (_ === "quit success!" || _ === "replace old connection!") && (u = !1), u;
7206
7206
  });
7207
7207
  // 重连成功
7208
- st(this, Mt, async (I) => {
7208
+ at(this, Mt, async (I) => {
7209
7209
  Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重连成功", I), this.state = "connected", this.onReconnectSuccess(I);
7210
7210
  });
7211
7211
  // 重连停止
7212
- st(this, Pt, async (I) => {
7212
+ at(this, Pt, async (I) => {
7213
7213
  Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重连停止", I), this.close(), this.state = "closed", this.onReconnectStop(I);
7214
7214
  });
7215
7215
  // 自定义心跳规则
7216
- st(this, Bt, () => {
7216
+ at(this, Lt, () => {
7217
7217
  const I = { event: "heartbeat", sn: +`${F(1e5, 999999)}` };
7218
7218
  return com.quick.voice.proto.CommonReq.encode(I).finish();
7219
7219
  });
7220
7220
  // 更新日志
7221
- st(this, Et, (I, u = {}) => {
7221
+ at(this, Et, (I, u = {}) => {
7222
7222
  try {
7223
7223
  const { time: E, event: _, data: k = {}, data_original: e = {}, data_remote: n, ...O } = u, $ = U(E, "YYYY-MM-DD hh:mm:ss", { offset: 480 });
7224
7224
  let N = {};
@@ -7257,20 +7257,20 @@ class CallsWebSocket {
7257
7257
  }
7258
7258
  });
7259
7259
  // 创建事件
7260
- st(this, Lt, (I, { resolve: u, reject: E }) => {
7260
+ at(this, Bt, (I, { resolve: u, reject: E }) => {
7261
7261
  const { sn: _ } = I, k = () => {
7262
- const n = Q(this, yt)[_];
7263
- clearTimeout(n.destructionTimer), delete Q(this, yt)[_];
7262
+ const n = Q(this, _t)[_];
7263
+ clearTimeout(n.destructionTimer), delete Q(this, _t)[_];
7264
7264
  }, e = setTimeout(() => {
7265
- const n = Q(this, yt)[_];
7265
+ const n = Q(this, _t)[_];
7266
7266
  console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo:event is timeout", n.message), k(), E("event is timeout");
7267
7267
  }, Q(this, ut).timeout);
7268
- Q(this, yt)[_] = { message: I, resolve: u, reject: E, destruction: k, destructionTimer: e };
7268
+ Q(this, _t)[_] = { message: I, resolve: u, reject: E, destruction: k, destructionTimer: e };
7269
7269
  });
7270
7270
  // 获取事件
7271
- st(this, jt, (I) => Q(this, yt)[I]);
7271
+ at(this, jt, (I) => Q(this, _t)[I]);
7272
7272
  // 接收消息
7273
- st(this, Zt, async (I) => {
7273
+ at(this, Zt, async (I) => {
7274
7274
  const u = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(u), { sn: _, event: k } = E, e = onMessageFormat(E);
7275
7275
  if (Q(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", e), ignoreEvent.includes(k) || Q(this, Et).call(this, "res", e)), notifyName_keys.includes(k))
7276
7276
  return this.emitNotify(k, L(e, ["code", "data", "desc"]));
@@ -7284,12 +7284,12 @@ class CallsWebSocket {
7284
7284
  });
7285
7285
  // 清除事件
7286
7286
  Z(this, "clearEvents", (I = []) => {
7287
- const u = Object.keys(Q(this, yt));
7287
+ const u = Object.keys(Q(this, _t));
7288
7288
  I.length === 0 && (I = u);
7289
7289
  for (const E of u) {
7290
7290
  if (!I.includes(E)) continue;
7291
- const _ = Q(this, yt)[E];
7292
- clearTimeout(_.destructionTimer), delete Q(this, yt)[E];
7291
+ const _ = Q(this, _t)[E];
7292
+ clearTimeout(_.destructionTimer), delete Q(this, _t)[E];
7293
7293
  }
7294
7294
  });
7295
7295
  /**
@@ -7306,10 +7306,10 @@ class CallsWebSocket {
7306
7306
  binaryType: "arraybuffer",
7307
7307
  onMessage: Q(this, Zt),
7308
7308
  checkReconnect: Q(this, Ut),
7309
- getHeartbeatMsg: Q(this, Bt),
7309
+ getHeartbeatMsg: Q(this, Lt),
7310
7310
  onReconnectSuccess: Q(this, Mt),
7311
7311
  onReconnectStop: Q(this, Pt)
7312
- })), this.state = "connecting", await Q(this, vt).connect(), this.state = "connected", Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", Q(this, _t)), u(Q(this, vt));
7312
+ })), this.state = "connecting", await Q(this, vt).connect(), this.state = "connected", Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", Q(this, yt)), u(Q(this, vt));
7313
7313
  }));
7314
7314
  /**
7315
7315
  * 关闭
@@ -7317,12 +7317,12 @@ class CallsWebSocket {
7317
7317
  Z(this, "close", async () => {
7318
7318
  var u;
7319
7319
  Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
7320
- const I = Object.keys(Q(this, yt));
7320
+ const I = Object.keys(Q(this, _t));
7321
7321
  for (const E of I) {
7322
- const { destructionTimer: _ } = Q(this, yt)[E];
7322
+ const { destructionTimer: _ } = Q(this, _t)[E];
7323
7323
  clearTimeout(_);
7324
7324
  }
7325
- wt(this, yt, {}), await ((u = Q(this, vt)) == null ? void 0 : u.close()), wt(this, vt, void 0), this.state = "closed";
7325
+ wt(this, _t, {}), await ((u = Q(this, vt)) == null ? void 0 : u.close()), wt(this, vt, void 0), this.state = "closed";
7326
7326
  });
7327
7327
  /**
7328
7328
  * 发送消息
@@ -7340,7 +7340,7 @@ class CallsWebSocket {
7340
7340
  compress: !1,
7341
7341
  ...e
7342
7342
  });
7343
- Q(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", O), ignoreEvent.includes(k) || Q(this, Et).call(this, "req", O)), u && Q(this, Lt).call(this, O, { resolve: E, reject: _ });
7343
+ Q(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", O), ignoreEvent.includes(k) || Q(this, Et).call(this, "req", O)), u && Q(this, Bt).call(this, O, { resolve: E, reject: _ });
7344
7344
  const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
7345
7345
  (N = Q(this, vt)) == null || N.sendMessage($);
7346
7346
  }));
@@ -7350,7 +7350,7 @@ class CallsWebSocket {
7350
7350
  * @param result 事件响应值
7351
7351
  */
7352
7352
  Z(this, "emitNotify", async (I, u) => {
7353
- const E = Q(this, _t)[I] || [];
7353
+ const E = Q(this, yt)[I] || [];
7354
7354
  for (const _ of E) {
7355
7355
  const { callback: k = async () => {
7356
7356
  } } = _;
@@ -7365,8 +7365,8 @@ class CallsWebSocket {
7365
7365
  */
7366
7366
  Z(this, "addNotify", (I, u = !1) => {
7367
7367
  const { event: E, sn: _ = ht(32) } = I;
7368
- Q(this, _t)[E] || (Q(this, _t)[E] = []);
7369
- const k = Q(this, _t)[E], e = k.findIndex((n) => n.sn === _);
7368
+ Q(this, yt)[E] || (Q(this, yt)[E] = []);
7369
+ const k = Q(this, yt)[E], e = k.findIndex((n) => n.sn === _);
7370
7370
  return e !== -1 && k.splice(e, 1), u ? k.unshift(I) : k.push(I), _;
7371
7371
  });
7372
7372
  /**
@@ -7374,18 +7374,18 @@ class CallsWebSocket {
7374
7374
  */
7375
7375
  Z(this, "removeNotify", (I = []) => {
7376
7376
  if (I.length === 0)
7377
- wt(this, _t, {});
7377
+ wt(this, yt, {});
7378
7378
  else {
7379
- const u = Object.keys(Q(this, _t));
7379
+ const u = Object.keys(Q(this, yt));
7380
7380
  for (const E of u)
7381
- Q(this, _t)[E] = Q(this, _t)[E].filter((_) => !I.includes(_.sn || ""));
7381
+ Q(this, yt)[E] = Q(this, yt)[E].filter((_) => !I.includes(_.sn || ""));
7382
7382
  }
7383
- Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", Q(this, _t));
7383
+ Q(this, ut).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", Q(this, yt));
7384
7384
  });
7385
7385
  wt(this, ut, { ...Q(this, ut), ...I });
7386
7386
  }
7387
7387
  }
7388
- vt = new WeakMap(), ut = new WeakMap(), Rt = new WeakMap(), yt = new WeakMap(), _t = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(), Et = new WeakMap(), Lt = new WeakMap(), jt = new WeakMap(), Zt = new WeakMap();
7388
+ vt = new WeakMap(), ut = new WeakMap(), Rt = new WeakMap(), _t = new WeakMap(), yt = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap(), Pt = new WeakMap(), Lt = new WeakMap(), Et = new WeakMap(), Bt = new WeakMap(), jt = new WeakMap(), Zt = new WeakMap();
7389
7389
  var y = Object.defineProperty, x = (a) => {
7390
7390
  throw TypeError(a);
7391
7391
  }, g = (a, I, u) => I in a ? y(a, I, { enumerable: !0, configurable: !0, writable: !0, value: u }) : a[I] = u, h = (a, I, u) => g(a, typeof I != "symbol" ? I + "" : I, u), b = (a, I, u) => I.has(a) || x("Cannot " + u), o = (a, I, u) => (b(a, I, "read from private field"), u ? u.call(a) : I.get(a)), f = (a, I, u) => I.has(a) ? x("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), p = (a, I, u, E) => (b(a, I, "write to private field"), I.set(a, u), u), d, c, l;
@@ -7453,6 +7453,8 @@ class RoomBase {
7453
7453
  // 预连接ID
7454
7454
  callType: 0,
7455
7455
  debug: !1,
7456
+ logUrl: "https://log1.putplay.cc",
7457
+ // 日志上报地址
7456
7458
  newPublishAutoSubscribe: !0
7457
7459
  });
7458
7460
  Z(this, "prohibitNotify", !1);
@@ -7487,14 +7489,17 @@ class RoomBase {
7487
7489
  * 提交日志
7488
7490
  */
7489
7491
  Z(this, "reportLogs", (I, u = "未知错误") => {
7490
- const { appid: E, userId: _, earlyId: k } = this.options;
7491
- console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: obj", { origin: "web", type: I, app_id: E, user_id: _, ins_id: k, comment: u });
7492
+ const { appid: E, userId: _, earlyId: k = "", logUrl: e } = this.options, n = "web";
7493
+ {
7494
+ const O = { origin: n, type: I, app_id: E, user_id: _, ins_id: k, comment: u }, $ = new URLSearchParams(O).toString(), N = `${e}/upload/log?${$}`;
7495
+ console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: reportLogs", O), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: reportLogs", N);
7496
+ }
7492
7497
  {
7493
7498
  const O = localStorage.getItem("#quickvo.logs") || JSON.stringify([]), N = new TextEncoder().encode(O);
7494
- console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: binaryStream", N);
7499
+ console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: reportLogs", N);
7495
7500
  }
7496
7501
  });
7497
- st(this, Ft, () => {
7502
+ at(this, Ft, () => {
7498
7503
  this.taskQueue.setCondition("createWs", !0), this.taskQueue.setCondition("createSession", !1), this.taskQueue.setCondition("ice", !1);
7499
7504
  });
7500
7505
  /**
@@ -7596,23 +7601,23 @@ class RoomMedias extends RoomBase {
7596
7601
  // 媒体流上下文
7597
7602
  constructor(u) {
7598
7603
  super(u);
7599
- st(this, $t, []);
7604
+ at(this, $t, []);
7600
7605
  // 可用媒体设备列表
7601
- st(this, kt, /* @__PURE__ */ new Map());
7606
+ at(this, kt, /* @__PURE__ */ new Map());
7602
7607
  // 媒体流设备管理
7603
- st(this, dt, /* @__PURE__ */ new Map());
7608
+ at(this, dt, /* @__PURE__ */ new Map());
7604
7609
  // 媒体轨道参数管理
7605
- st(this, bt, /* @__PURE__ */ new Map());
7610
+ at(this, bt, /* @__PURE__ */ new Map());
7606
7611
  /**
7607
7612
  * 初始化媒体参数
7608
7613
  */
7609
- st(this, Ht, () => {
7614
+ at(this, Ht, () => {
7610
7615
  Q(this, dt).set("microphoneCamera_audio", {}), Q(this, dt).set("microphoneCamera_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), Q(this, dt).set("screenSharing_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), Q(this, dt).set("screenSharing_audio", {});
7611
7616
  });
7612
7617
  /**
7613
7618
  * 初始化媒体设备类型
7614
7619
  */
7615
- st(this, zt, () => {
7620
+ at(this, zt, () => {
7616
7621
  Q(this, kt).set("audioinput", "default"), Q(this, kt).set("videoinput", "default"), Q(this, kt).set("audiooutput", "default");
7617
7622
  });
7618
7623
  /**
@@ -7814,7 +7819,7 @@ class RoomMedias extends RoomBase {
7814
7819
  /**
7815
7820
  * 获取媒体设备列表
7816
7821
  */
7817
- st(this, Tt, async () => !navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 不支持 enumerateDevices"), []) : (await navigator.mediaDevices.enumerateDevices().then((u) => {
7822
+ at(this, Tt, async () => !navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 不支持 enumerateDevices"), []) : (await navigator.mediaDevices.enumerateDevices().then((u) => {
7818
7823
  wt(this, $t, u);
7819
7824
  }).catch(function(u) {
7820
7825
  console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", u);
@@ -7822,7 +7827,7 @@ class RoomMedias extends RoomBase {
7822
7827
  /**
7823
7828
  * 媒体设备发生变化
7824
7829
  */
7825
- st(this, Jt, () => {
7830
+ at(this, Jt, () => {
7826
7831
  navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
7827
7832
  await Q(this, Tt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
7828
7833
  }), Q(this, Tt).call(this);
@@ -8188,7 +8193,7 @@ var St, Wt, xt, Kt, Gt, Qt;
8188
8193
  class RoomPeer extends RoomUsers {
8189
8194
  constructor(u) {
8190
8195
  super(u);
8191
- st(this, St, /* @__PURE__ */ new Map());
8196
+ at(this, St, /* @__PURE__ */ new Map());
8192
8197
  // 假媒体流 (创建轨道用)
8193
8198
  Z(this, "getPeerStatsTimer", 0);
8194
8199
  // 获取报告的定时器
@@ -8210,7 +8215,7 @@ class RoomPeer extends RoomUsers {
8210
8215
  this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), Q(this, Kt).call(this), Q(this, Qt).call(this);
8211
8216
  });
8212
8217
  // 初始化假数据流
8213
- st(this, Wt, () => {
8218
+ at(this, Wt, () => {
8214
8219
  for (const u of mediaType_keys)
8215
8220
  switch (u) {
8216
8221
  case "microphoneCamera_audio":
@@ -8228,7 +8233,7 @@ class RoomPeer extends RoomUsers {
8228
8233
  }
8229
8234
  });
8230
8235
  // 获取假数据流
8231
- st(this, xt, (u) => Q(this, St).get(u));
8236
+ at(this, xt, (u) => Q(this, St).get(u));
8232
8237
  /**
8233
8238
  * 替换发射器媒体流
8234
8239
  */
@@ -8242,14 +8247,14 @@ class RoomPeer extends RoomUsers {
8242
8247
  const { sender: O } = e;
8243
8248
  E ? n = this.getUserStream(_, k) : n = Q(this, xt).call(this, k);
8244
8249
  const [$] = n.getTracks();
8245
- O.replaceTrack($);
8250
+ await O.replaceTrack($);
8246
8251
  }
8247
8252
  }
8248
8253
  });
8249
8254
  /**
8250
8255
  * 获取发射器轨道信息
8251
8256
  */
8252
- Z(this, "getSenderTracks", (u = []) => {
8257
+ Z(this, "getSenderTracks", async (u = []) => {
8253
8258
  const E = [];
8254
8259
  for (const _ of u) {
8255
8260
  const k = this.transceiverMap.get(_);
@@ -8354,7 +8359,7 @@ class RoomPeer extends RoomUsers {
8354
8359
  /**
8355
8360
  * 监听webrtc ice通讯连接
8356
8361
  */
8357
- st(this, Kt, () => {
8362
+ at(this, Kt, () => {
8358
8363
  let u = 0;
8359
8364
  const E = () => {
8360
8365
  this.setRoomState("closed");
@@ -8393,20 +8398,21 @@ class RoomPeer extends RoomUsers {
8393
8398
  const { trackName: N, msid: D } = $;
8394
8399
  k.push(N), D && k.push(D);
8395
8400
  }
8396
- const e = ($) => k.includes($), n = await this.getUser(u);
8397
- if (!n) return;
8398
- for (const $ of n.tracks) {
8399
- const { trackName: N, msid: D, userId: q, mediaType: P } = $;
8400
- !q || !P || !e(N) || (this.removeUserMediaStreamContext(q, P), D && delete $.msid);
8401
- }
8402
- if (_) {
8403
- const $ = n.tracks.filter(({ trackName: N }) => !e(N));
8404
- await this.updateUsertracks(u, $, !1);
8405
- }
8406
- const O = this.peerIns.getTransceivers();
8407
- for (const $ of O) {
8401
+ const e = ($) => k.includes($), n = this.peerIns.getTransceivers();
8402
+ for (const $ of n) {
8408
8403
  const { sender: N, receiver: D } = $;
8409
- N.track && e(N.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: sender: ${N.track.id} is stop.`, $), N.track.enabled = !1, N.track.stop(), this.peerIns.removeTrack(N), $.stop()), D.track && e(D.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: receiver: ${D.track.id} is stop.`, $), D.track.enabled = !1, D.track.stop(), $.stop());
8404
+ N.track && e(N.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: sender: ${N.track.id} is stop.`, $), $.stop()), D.track && e(D.track.id) && (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: receiver: ${D.track.id} is stop.`, $), $.stop());
8405
+ }
8406
+ const O = await this.getUser(u);
8407
+ if (O) {
8408
+ for (const $ of O.tracks) {
8409
+ const { trackName: N, msid: D, userId: q, mediaType: P } = $;
8410
+ !q || !P || !e(N) || (this.removeUserMediaStreamContext(q, P), D && delete $.msid);
8411
+ }
8412
+ if (_) {
8413
+ const $ = O.tracks.filter(({ trackName: N }) => !e(N));
8414
+ await this.updateUsertracks(u, $, !1);
8415
+ }
8410
8416
  }
8411
8417
  });
8412
8418
  Z(this, "createOffer", async () => {
@@ -8503,7 +8509,7 @@ class RoomPeer extends RoomUsers {
8503
8509
  /**
8504
8510
  * 计算网络质量
8505
8511
  */
8506
- st(this, Gt, async () => {
8512
+ at(this, Gt, async () => {
8507
8513
  try {
8508
8514
  const u = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...u.values()].filter((nt) => E.includes(nt.type));
8509
8515
  let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
@@ -8513,23 +8519,23 @@ class RoomPeer extends RoomUsers {
8513
8519
  }
8514
8520
  this.reports = k;
8515
8521
  for (const nt of this.reports) {
8516
- const { bytesReceived: lt, bytesSent: it, packetsSent: at, packetsLost: ct, jitter: ot, roundTripTime: rt } = nt;
8517
- lt && (e = lt), it && (n = it), at && (N += at), ct && (D += ct), rt && q.push((rt * 100).toFixed(2)), ot && P.push(ot.toFixed(2));
8522
+ const { bytesReceived: lt, bytesSent: it, packetsSent: st, packetsLost: ct, jitter: ot, roundTripTime: rt } = nt;
8523
+ lt && (e = lt), it && (n = it), st && (N += st), ct && (D += ct), rt && q.push((rt * 100).toFixed(2)), ot && P.push(ot.toFixed(2));
8518
8524
  }
8519
8525
  P.sort().reverse(), q.sort().reverse();
8520
8526
  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 };
8521
8527
  this.peerNetwork = et;
8522
8528
  const tt = (nt, lt, it) => {
8523
- const at = Number(nt), ct = Number(lt), ot = Number(it);
8529
+ const st = Number(nt), ct = Number(lt), ot = Number(it);
8524
8530
  let rt = "0";
8525
- return at < 0.03 && ct < 100 && ot < 0.05 ? rt = "5" : at < 0.06 && ct < 160 && ot < 0.1 ? rt = "4" : at < 0.1 && ct < 250 && ot < 0.15 ? rt = "3" : at < 0.15 && ct < 400 && ot < 0.2 ? rt = "2" : rt = "1", Number(rt);
8531
+ return st < 0.03 && ct < 100 && ot < 0.05 ? rt = "5" : st < 0.06 && ct < 160 && ot < 0.1 ? rt = "4" : st < 0.1 && ct < 250 && ot < 0.15 ? rt = "3" : st < 0.15 && ct < 400 && ot < 0.2 ? rt = "2" : rt = "1", Number(rt);
8526
8532
  };
8527
8533
  {
8528
- const nt = tt(J, z, Y), lt = await this.getCaller(), { network: it } = lt, at = { egress: nt, ingress: nt }, ct = JSON.stringify(it) !== JSON.stringify(at);
8529
- if (await this.updateUserNetwork(this.options.userId, at), ct) {
8534
+ const nt = tt(J, z, Y), lt = await this.getCaller(), { network: it } = lt, st = { egress: nt, ingress: nt }, ct = JSON.stringify(it) !== JSON.stringify(st);
8535
+ if (await this.updateUserNetwork(this.options.userId, st), ct) {
8530
8536
  this.emitNotifyUpdateUsers();
8531
8537
  const { userId: ot, roomId: rt } = this.options;
8532
- this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...at, userId: ot, roomId: rt } }, !1);
8538
+ this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...st, userId: ot, roomId: rt } }, !1);
8533
8539
  }
8534
8540
  }
8535
8541
  } catch (u) {
@@ -8539,7 +8545,7 @@ class RoomPeer extends RoomUsers {
8539
8545
  /**
8540
8546
  * 获取连接的所有轨道分析数据
8541
8547
  */
8542
- st(this, Qt, () => {
8548
+ at(this, Qt, () => {
8543
8549
  const u = async () => {
8544
8550
  this.peerIns.connectionState !== "connected" || !this.options.roomId || Q(this, Gt).call(this);
8545
8551
  };
@@ -8563,7 +8569,7 @@ class RoomCalls extends RoomPeer {
8563
8569
  * 广播给房间其他人
8564
8570
  * 只有当自己建立了发射轨道 并且 加入房间后才进行广播
8565
8571
  */
8566
- st(this, Vt, async (u) => {
8572
+ at(this, Vt, async (u) => {
8567
8573
  const { roomId: E } = this.options;
8568
8574
  if (!E) return;
8569
8575
  const { id: _, tracks: k = [] } = await this.getCaller();
@@ -8574,7 +8580,7 @@ class RoomCalls extends RoomPeer {
8574
8580
  /**
8575
8581
  * 更新自己通话状态
8576
8582
  */
8577
- st(this, It, async (u) => new Promise(async (E, _) => {
8583
+ at(this, It, async (u) => new Promise(async (E, _) => {
8578
8584
  const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: u } };
8579
8585
  await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
8580
8586
  const { code: $ = 0 } = O;
@@ -8585,7 +8591,7 @@ class RoomCalls extends RoomPeer {
8585
8591
  /**
8586
8592
  * 创建连接
8587
8593
  */
8588
- st(this, Nt, () => new Promise(async (u, E) => {
8594
+ at(this, Nt, () => new Promise(async (u, E) => {
8589
8595
  try {
8590
8596
  if (["connecting", "connected"].includes(this.cwsIns.state)) return u(!0);
8591
8597
  this.taskQueue.setCondition("createWs", !1), this.cwsIns.clearEvents(), this.initPeer();
@@ -8612,7 +8618,7 @@ class RoomCalls extends RoomPeer {
8612
8618
  /**
8613
8619
  * 创建cf会话
8614
8620
  */
8615
- st(this, At, () => {
8621
+ at(this, At, () => {
8616
8622
  if (!["connecting", "connected"].includes(this.roomState))
8617
8623
  return this.setRoomState("connecting"), new Promise((u) => {
8618
8624
  const E = async () => {
@@ -8624,7 +8630,16 @@ class RoomCalls extends RoomPeer {
8624
8630
  const { code: k = 0, desc: e, data: n } = _;
8625
8631
  if (k !== 200) throw new Error(e);
8626
8632
  const { remoteSdp: O } = n;
8627
- this.taskQueue.setCondition("ice", !1), await this.setRemoteDescription({ type: "answer", sdp: O }), this.taskQueue.setCondition("createSession", !0), u(!0);
8633
+ this.taskQueue.setCondition("ice", !1), await this.setRemoteDescription({ type: "answer", sdp: O }), this.taskQueue.setCondition("createSession", !0);
8634
+ {
8635
+ let $ = 0;
8636
+ $ = setTimeout(() => {
8637
+ this.reportLogs("webrtc_c_timeout", "ice连接无响应(30s)");
8638
+ }, 3e4);
8639
+ const N = () => clearTimeout($);
8640
+ this.taskQueue.addTask(N, ["ice"], { describe: "createSession" });
8641
+ }
8642
+ u(!0);
8628
8643
  });
8629
8644
  } catch (_) {
8630
8645
  this.taskQueue.setCondition("createSession", !0), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo create session is error.", _);
@@ -8644,11 +8659,11 @@ class RoomCalls extends RoomPeer {
8644
8659
  /**
8645
8660
  * 创建媒体轨道
8646
8661
  */
8647
- st(this, qt, async (u) => new Promise((E) => {
8662
+ at(this, qt, async (u) => new Promise((E) => {
8648
8663
  const _ = async () => {
8649
8664
  try {
8650
8665
  this.taskQueue.setCondition("createTrack", !1);
8651
- const k = await this.addSenders(u), e = this.getSenderTracks(k);
8666
+ const k = await this.addSenders(u), e = await this.getSenderTracks(k);
8652
8667
  if (e.length === 0)
8653
8668
  return this.taskQueue.setCondition("createTrack", !0), E(!0);
8654
8669
  await this.cwsIns.sendMessage({
@@ -8762,7 +8777,7 @@ class RoomCalls extends RoomPeer {
8762
8777
  this.isInRoom = !0, Q(this, At).call(this), await this.updateUsers(J), e();
8763
8778
  });
8764
8779
  } catch (O) {
8765
- this.taskQueue.setCondition("joinRoom", !0), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
8780
+ this.taskQueue.setCondition("joinRoom", !0), this.reportLogs("join_room_error", O.message || O), _(`加入房间失败: ${O.message || O || "服务器繁忙"}`);
8766
8781
  }
8767
8782
  };
8768
8783
  k = this.taskQueue.addTask(n, ["createWs", "joinRoom"], { describe: "joinRoom", strict: !0 });
@@ -8775,8 +8790,11 @@ class RoomCalls extends RoomPeer {
8775
8790
  Z(this, "quitRoom", () => new Promise(async (u) => {
8776
8791
  const { roomId: E, userId: _ } = this.options, k = { roomId: E, user: { id: _ } };
8777
8792
  try {
8778
- this.isInRoom = !1, this.stopPublish(), this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.setRoomState("ready");
8779
- } catch {
8793
+ this.isInRoom = !1, this.stopPublish().then(() => {
8794
+ this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.setRoomState("ready");
8795
+ });
8796
+ } catch (e) {
8797
+ this.reportLogs("quit_room_error", e.message || e);
8780
8798
  }
8781
8799
  await new Promise((e) => setTimeout(() => e(!0), 300)), this.taskQueue.setCondition("closeTrack", !0), this.cwsIns.sendMessage({ event: "quitRoom", data: k }), u(!0);
8782
8800
  }));
@@ -8788,8 +8806,11 @@ class RoomCalls extends RoomPeer {
8788
8806
  Z(this, "quitRoomEx", () => new Promise(async (u) => {
8789
8807
  const { roomId: E, userId: _ } = this.options, k = { roomId: E, user: { id: _ } };
8790
8808
  try {
8791
- this.isInRoom = !1, this.stopPublish(), this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams(), await this.replaceSenderStream([], !1);
8792
- } catch {
8809
+ this.isInRoom = !1, this.stopPublish().then(() => {
8810
+ this.stopSubscribe(), this.stopGetPeerStats(), this.clearUsers(), this.clearUserStreams();
8811
+ });
8812
+ } catch (e) {
8813
+ this.reportLogs("quit_room_error", e.message || e);
8793
8814
  }
8794
8815
  await new Promise((e) => setTimeout(() => e(!0), 300)), this.cwsIns.sendMessage({ event: "quitRoomEx", data: k }), u(!0);
8795
8816
  }));
@@ -8821,8 +8842,8 @@ class RoomCalls extends RoomPeer {
8821
8842
  Z(this, "publish", (u) => new Promise(async (E, _) => {
8822
8843
  const k = async () => {
8823
8844
  try {
8824
- await this.replaceSenderStream(u, !1);
8825
8845
  const e = await this.getCaller();
8846
+ await this.replaceSenderStream(u, !1);
8826
8847
  try {
8827
8848
  await this.setLocalStream(u, !0);
8828
8849
  } catch {
@@ -8832,17 +8853,17 @@ class RoomCalls extends RoomPeer {
8832
8853
  this.getUserStream(e.id, q).getTracks().length === 0 && n.push(q);
8833
8854
  const O = u.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
8834
8855
  await Q(this, qt).call(this, O);
8835
- const $ = this.getSenderTracks(O), N = [...e.tracks, ...$];
8856
+ const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
8836
8857
  await this.updateUsertracks(e.id, N, !0);
8837
8858
  const D = await this.getCallAction(N);
8838
- await Q(this, It).call(this, D), await this.replaceSenderStream(u, !0), Q(this, Vt).call(this, u), n.length !== 0 && await this.inactiveTracks(n, !1);
8859
+ await Q(this, It).call(this, D), Q(this, Vt).call(this, u), await this.replaceSenderStream(u, !0), n.length !== 0 && await this.inactiveTracks(n, !1);
8839
8860
  {
8840
8861
  await this.emitNotifyUpdateUsers();
8841
8862
  const q = await this.getCaller();
8842
8863
  E(q);
8843
8864
  }
8844
8865
  } catch (e) {
8845
- _(`publish is error: ${e.message || e}`);
8866
+ this.reportLogs("publish_error", e.message || e), _(`publish is error: ${e.message || e}`);
8846
8867
  }
8847
8868
  };
8848
8869
  this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "joinRoom", "createTrack", "subscribe"], { describe: "replaceSenderStream" });
@@ -8865,7 +8886,7 @@ class RoomCalls extends RoomPeer {
8865
8886
  await this.emitNotifyUpdateUsers(), E($);
8866
8887
  };
8867
8888
  if (n.length === 0) return O();
8868
- await this.replaceSenderStream(u, !0), await this.removeSenders(u), await this.closeUserTracks(e.id, n, !0);
8889
+ await this.replaceSenderStream(u, !1), await this.closeUserTracks(e.id, n, !0), await this.removeSenders(u);
8869
8890
  {
8870
8891
  const $ = await this.getCallAction(e.tracks);
8871
8892
  await Q(this, It).call(this, $);
@@ -8878,7 +8899,7 @@ class RoomCalls extends RoomPeer {
8878
8899
  await this.setRemoteDescription({ type: "answer", sdp: N });
8879
8900
  }), O();
8880
8901
  } catch (e) {
8881
- this.taskQueue.setCondition("closeTrack", !0), _(`stop publish is error: ${e.message || e}`);
8902
+ this.taskQueue.setCondition("closeTrack", !0), this.reportLogs("close_track_error", e.message || e), _(`stop publish is error: ${e.message || e}`);
8882
8903
  }
8883
8904
  };
8884
8905
  this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "createTrack", "subscribe"], { describe: "stopPublish" });
@@ -8932,7 +8953,7 @@ class RoomCalls extends RoomPeer {
8932
8953
  };
8933
8954
  await D();
8934
8955
  } catch (n) {
8935
- this.taskQueue.setCondition("subscribe", !0), k(`subscribe is error: ${n.message || n}`);
8956
+ this.taskQueue.setCondition("subscribe", !0), this.reportLogs("subscribe_error", n.message || n), k(`subscribe is error: ${n.message || n}`);
8936
8957
  }
8937
8958
  };
8938
8959
  this.taskQueue.addTask(e, ["createWs", "createSession", "ice", "createTrack", "closeTrack"], { describe: "subscribe" });
@@ -8980,7 +9001,7 @@ class RoomCalls extends RoomPeer {
8980
9001
  await this.setRemoteDescription({ type: "answer", sdp: N });
8981
9002
  }), O();
8982
9003
  } catch (e) {
8983
- this.taskQueue.setCondition("closeTrack", !0), _(`stop subscribe is error: ${e.message || e}`);
9004
+ this.taskQueue.setCondition("closeTrack", !0), this.reportLogs("close_track_error", e.message || e), _(`stop subscribe is error: ${e.message || e}`);
8984
9005
  }
8985
9006
  };
8986
9007
  this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "createTrack", "subscribe"], { describe: "closeTrack" });
@@ -9031,11 +9052,11 @@ var gt, Yt, Xt, te, ee;
9031
9052
  class QuickVO extends Room {
9032
9053
  constructor(u) {
9033
9054
  super(u);
9034
- st(this, gt, /* @__PURE__ */ new Map());
9055
+ at(this, gt, /* @__PURE__ */ new Map());
9035
9056
  /**
9036
9057
  * 添加内部监听事件
9037
9058
  */
9038
- st(this, Yt, () => {
9059
+ at(this, Yt, () => {
9039
9060
  {
9040
9061
  const u = async (E) => {
9041
9062
  const { qualities: _ = [] } = E.data, [k] = _;
@@ -9116,12 +9137,12 @@ class QuickVO extends Room {
9116
9137
  /**
9117
9138
  * cwsIns 发送消息前
9118
9139
  */
9119
- st(this, Xt, () => {
9140
+ at(this, Xt, () => {
9120
9141
  });
9121
9142
  /**
9122
9143
  * 重连成功
9123
9144
  */
9124
- st(this, te, () => {
9145
+ at(this, te, () => {
9125
9146
  this.cwsIns.onReconnectSuccess = async () => {
9126
9147
  await this.syncRoomInfo();
9127
9148
  };
@@ -9129,7 +9150,7 @@ class QuickVO extends Room {
9129
9150
  /**
9130
9151
  * 重连停止
9131
9152
  */
9132
- st(this, ee, async () => {
9153
+ at(this, ee, async () => {
9133
9154
  });
9134
9155
  /**
9135
9156
  * 添加 FrameRequestCallback