quickvo-sdk-js 0.2.5 → 0.2.7

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
@@ -6852,7 +6852,7 @@ class RoomBase {
6852
6852
  K(this, "usersFilter", (D) => mt(D, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "updateStreams", "permissions", "isPublished"]).sort((R, N) => R.id.localeCompare(N.id, "en")));
6853
6853
  }
6854
6854
  }
6855
- var wt, vt, kt, Pt, Bt, It, Lt;
6855
+ var wt, vt, kt, Pt, Bt, Tt, Lt;
6856
6856
  class RoomMedias extends RoomBase {
6857
6857
  // 媒体流上下文
6858
6858
  constructor() {
@@ -6972,7 +6972,7 @@ class RoomMedias extends RoomBase {
6972
6972
  /**
6973
6973
  * 清除所有媒体流使用
6974
6974
  */
6975
- K(this, "clearUserStreams", async () => {
6975
+ K(this, "clearUserStreams", () => {
6976
6976
  const $ = G(this, kt).values();
6977
6977
  for (const U of $)
6978
6978
  U.stop();
@@ -7037,7 +7037,7 @@ class RoomMedias extends RoomBase {
7037
7037
  /**
7038
7038
  * 获取媒体设备列表
7039
7039
  */
7040
- st(this, It, 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(($) => {
7040
+ 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(($) => {
7041
7041
  this.mediaDevices = $;
7042
7042
  }).catch(function($) {
7043
7043
  console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", $);
@@ -7047,8 +7047,8 @@ class RoomMedias extends RoomBase {
7047
7047
  */
7048
7048
  st(this, Lt, () => {
7049
7049
  navigator.mediaDevices.ondevicechange = async () => {
7050
- await G(this, It).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
7051
- }, G(this, It).call(this);
7050
+ await G(this, Tt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
7051
+ }, G(this, Tt).call(this);
7052
7052
  });
7053
7053
  /**
7054
7054
  * 获取正在使用的媒体设备ID
@@ -7107,7 +7107,7 @@ class RoomMedias extends RoomBase {
7107
7107
  * @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
7108
7108
  * @returns MediaDeviceInfo[]
7109
7109
  */
7110
- K(this, "getEnumerateDevices", async ($) => (await G(this, It).call(this), this.mediaDevices.filter((R) => R.kind === $)));
7110
+ K(this, "getEnumerateDevices", async ($) => (await G(this, Tt).call(this), this.mediaDevices.filter((R) => R.kind === $)));
7111
7111
  /**
7112
7112
  * 获取可用音频输入设备
7113
7113
  * @returns MediaDeviceInfo[]
@@ -7126,7 +7126,7 @@ class RoomMedias extends RoomBase {
7126
7126
  G(this, Lt).call(this), G(this, Bt).call(this), G(this, Pt).call(this);
7127
7127
  }
7128
7128
  }
7129
- wt = new WeakMap(), vt = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(), It = new WeakMap(), Lt = new WeakMap();
7129
+ wt = new WeakMap(), vt = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(), Tt = new WeakMap(), Lt = new WeakMap();
7130
7130
  class RoomUsers extends RoomMedias {
7131
7131
  constructor() {
7132
7132
  super();
@@ -7422,9 +7422,7 @@ class RoomPeer extends RoomUsers {
7422
7422
  });
7423
7423
  K(this, "connectedResolveMap", /* @__PURE__ */ new Map());
7424
7424
  K(this, "initPeer", () => {
7425
- this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.peerIns.ontrack = async ($) => {
7426
- console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: e", $);
7427
- }, G(this, Zt).call(this), G(this, Ht).call(this);
7425
+ this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), G(this, Zt).call(this), G(this, Ht).call(this);
7428
7426
  });
7429
7427
  /**
7430
7428
  * 初始化发射器
@@ -7524,7 +7522,7 @@ class RoomPeer extends RoomUsers {
7524
7522
  st(this, Zt, async () => {
7525
7523
  let $ = 0;
7526
7524
  const U = () => {
7527
- this.setRoomState("disconnected"), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {}, desc: "sdk is destroy." });
7525
+ this.setRoomState("disconnected");
7528
7526
  };
7529
7527
  this.peerIns.onconnectionstatechange = async () => {
7530
7528
  const R = this.peerIns.connectionState;
@@ -7738,7 +7736,7 @@ class RoomPeer extends RoomUsers {
7738
7736
  }
7739
7737
  }
7740
7738
  Zt = new WeakMap(), Ft = new WeakMap(), jt = new WeakMap(), Ht = new WeakMap();
7741
- var Ot, Tt, zt;
7739
+ var Ot, It, zt;
7742
7740
  class RoomCalls extends RoomPeer {
7743
7741
  constructor() {
7744
7742
  super();
@@ -7805,7 +7803,7 @@ class RoomCalls extends RoomPeer {
7805
7803
  */
7806
7804
  K(this, "quitRoom", async () => new Promise(async ($) => {
7807
7805
  const { roomId: U, userId: R } = this.options, N = { roomId: U, user: { id: R } };
7808
- this.cwsIns.sendMessage({ event: "quitRoom", data: N }), await new Promise((e) => setTimeout(() => e(!0), 300)), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {}, desc: "sdk is destroy." }), $(!0);
7806
+ this.cwsIns.sendMessage({ event: "quitRoom", data: N }), this.stopGetPeerStats(), this.asyncQueue.clear(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), await new Promise((e) => setTimeout(() => e(!0), 300)), $(!0);
7809
7807
  }));
7810
7808
  /**
7811
7809
  * 同步房间信息
@@ -7857,7 +7855,7 @@ class RoomCalls extends RoomPeer {
7857
7855
  throw this.options.debug && console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: publish is error. count 0", { mediaTypes: $ }), new Error(z);
7858
7856
  }
7859
7857
  const { remoteSdp: W } = V;
7860
- await this.setRemoteDescription({ type: "answer", sdp: W }), await this.connectionICE(), await this.updateUsertracks(o.id, M, !0), await G(this, Tt).call(this, L), G(this, Ot) || this.cwsIns.sendMessage({ event: "pubNotify", data: { roomId: "", user: { id: o.id, tracks: A } } });
7858
+ await this.setRemoteDescription({ type: "answer", sdp: W }), await this.connectionICE(), await this.updateUsertracks(o.id, M, !0), await G(this, It).call(this, L), G(this, Ot) || this.cwsIns.sendMessage({ event: "pubNotify", data: { roomId: "", user: { id: o.id, tracks: A } } });
7861
7859
  {
7862
7860
  await this.emitNotifyUpdateUsers();
7863
7861
  const J = await this.getCaller();
@@ -7891,7 +7889,7 @@ class RoomCalls extends RoomPeer {
7891
7889
  await this.closeUserTracks(e.id, o, !0);
7892
7890
  {
7893
7891
  const M = await this.getCallAction(e.tracks);
7894
- await G(this, Tt).call(this, M);
7892
+ await G(this, It).call(this, M);
7895
7893
  }
7896
7894
  await this.createOffer(), await this.cwsIns.sendMessage({
7897
7895
  event: "closeTrack",
@@ -8014,7 +8012,7 @@ class RoomCalls extends RoomPeer {
8014
8012
  }
8015
8013
  }
8016
8014
  const A = await this.getCallAction(o);
8017
- await G(this, Tt).call(this, A), await this.emitNotifyUpdateUsers();
8015
+ await G(this, It).call(this, A), await this.emitNotifyUpdateUsers();
8018
8016
  };
8019
8017
  return this.asyncQueue.add(R, { key: "inactiveTracks" });
8020
8018
  });
@@ -8032,7 +8030,7 @@ class RoomCalls extends RoomPeer {
8032
8030
  /**
8033
8031
  * 更新自己通话状态
8034
8032
  */
8035
- st(this, Tt, async ($) => new Promise(async (U, R) => {
8033
+ st(this, It, async ($) => new Promise(async (U, R) => {
8036
8034
  const { roomId: N, userId: e } = this.options, o = { roomId: N, user: { id: e, callAction: $ } };
8037
8035
  await this.cwsIns.sendMessage({ event: "updateCall", data: o }).then(async (A) => {
8038
8036
  const { code: M = 0 } = A;
@@ -8084,7 +8082,7 @@ class RoomCalls extends RoomPeer {
8084
8082
  this.setRoomState("ready");
8085
8083
  }
8086
8084
  }
8087
- Ot = new WeakMap(), Tt = new WeakMap(), zt = new WeakMap();
8085
+ Ot = new WeakMap(), It = new WeakMap(), zt = new WeakMap();
8088
8086
  class Room extends RoomCalls {
8089
8087
  constructor() {
8090
8088
  super();
@@ -8187,7 +8185,7 @@ class QuickVO extends Room {
8187
8185
  };
8188
8186
  this.cwsIns.addNotify({ event: "onUpdatePermissions", callback: $ }, !0);
8189
8187
  }
8190
- this.cwsIns.addNotify({ event: "onTokenExpired", callback: async ($) => this.destroy() }, !0), this.cwsIns.addNotify({ event: "destroyRoom", callback: this.destroy }, !0), this.cwsIns.addNotify({ event: "onDestroy", callback: this.destroy }, !0);
8188
+ this.cwsIns.addNotify({ event: "onTokenExpired", callback: async ($) => this.destroy() }, !0), this.cwsIns.addNotify({ event: "destroyRoom", callback: this.destroy }, !0);
8191
8189
  });
8192
8190
  /**
8193
8191
  * 重连成功
@@ -8240,7 +8238,7 @@ class QuickVO extends Room {
8240
8238
  * @example quickvo.destroy()
8241
8239
  */
8242
8240
  K(this, "destroy", async () => {
8243
- this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.stopGetPeerStats(), this.asyncQueue.clear(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), await this.cwsIns.close();
8241
+ this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.stopGetPeerStats(), this.asyncQueue.clear(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {}, desc: "sdk is destroy." }), await this.cwsIns.close();
8244
8242
  });
8245
8243
  this.setOptions($), this.initCwsCall(), G(this, Kt).call(this), G(this, Wt).call(this), G(this, Jt).call(this);
8246
8244
  }