quickvo-sdk-js 0.7.2 → 0.7.4

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
@@ -8379,16 +8379,6 @@ class RoomPeer extends RoomUsers {
8379
8379
  for (const E of a)
8380
8380
  this.transceiverMap.has(E) && this.transceiverMap.delete(E);
8381
8381
  });
8382
- /**
8383
- * 清理收发器
8384
- */
8385
- Z(this, "clearTransceivers", async () => {
8386
- const a = await this.getAllUserTrackMids(), E = this.peerIns.getTransceivers();
8387
- for (const _ of E) {
8388
- const { mid: k } = _;
8389
- Number(k) === 0 || a.includes(k) || (_.stop(), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: clearTransceivers: ${k} is stop.`, _));
8390
- }
8391
- });
8392
8382
  /**
8393
8383
  * 监听订阅轨道结果
8394
8384
  */
@@ -8480,13 +8470,13 @@ class RoomPeer extends RoomUsers {
8480
8470
  Z(this, "closeUserTracks", async (a, E = [], _ = !1) => {
8481
8471
  const k = [];
8482
8472
  for (const $ of E) {
8483
- const { mid: N, trackName: D, msid: q } = $;
8484
- k.push(D), N && k.push(N), q && k.push(q);
8473
+ const { trackName: N, msid: D } = $;
8474
+ k.push(N), D && k.push(D);
8485
8475
  }
8486
8476
  const e = ($) => k.includes($), n = this.peerIns.getTransceivers();
8487
8477
  for (const $ of n) {
8488
- const { mid: N } = $;
8489
- N && e(N) && ($.stop(), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: transceiver: ${N} is stop.`, $));
8478
+ const { mid: N, sender: D, receiver: q } = $;
8479
+ D.track && e(D.track.id) && ($.stop(), this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: transceiver.sender: ${N} is stop.`, $)), q.track && e(q.track.id) && ($.stop(), this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", `------->quickvo: transceiver.receiver: ${N} is stop.`, $));
8490
8480
  }
8491
8481
  const O = await this.getUser(a);
8492
8482
  if (O) {
@@ -8777,24 +8767,29 @@ class RoomCalls extends RoomPeer {
8777
8767
  Z(this, "setLocalStream", (a, E) => new Promise(async (_, k) => {
8778
8768
  try {
8779
8769
  typeof a == "string" && (a = [a]);
8780
- const { userId: e = "" } = this.options;
8781
- for (const O of a)
8782
- this.localStreamsActionMap.set(O, E);
8770
+ for (const n of a)
8771
+ this.localStreamsActionMap.set(n, E);
8783
8772
  if (E) {
8784
8773
  if (a.includes("microphoneCamera_audio") && a.includes("microphoneCamera_video") ? await this.initLocalStream("microphoneCamera") : a.includes("microphoneCamera_audio") ? await this.initLocalStream("microphoneCamera_audio") : a.includes("microphoneCamera_video") ? await this.initLocalStream("microphoneCamera_video") : a.includes("screenSharing_audio") && a.includes("screenSharing_video") ? await this.initLocalStream("screenSharing") : a.includes("screenSharing_audio") && !a.includes("screenSharing_video") ? await this.initLocalStream("screenSharing_audio") : a.includes("screenSharing_video") && !a.includes("screenSharing_audio") && await this.initLocalStream("screenSharing_video"), a.includes("screenSharing_audio")) {
8785
- const $ = this.getUserStream(e, "screenSharing_audio").getTracks();
8786
- for (const N of $)
8787
- N.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
8774
+ const n = this.getLocalStream("screenSharing_audio");
8775
+ if (n) {
8776
+ const O = n.getTracks();
8777
+ for (const $ of O)
8778
+ $.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
8779
+ }
8788
8780
  }
8789
8781
  if (a.includes("screenSharing_video")) {
8790
- const $ = this.getUserStream(e, "screenSharing_video").getTracks();
8791
- for (const N of $)
8792
- N.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
8782
+ const n = this.getLocalStream("screenSharing_video");
8783
+ if (n) {
8784
+ const O = n.getTracks();
8785
+ for (const $ of O)
8786
+ $.onended = () => this.stopPublish(["screenSharing_audio", "screenSharing_video"]);
8787
+ }
8793
8788
  }
8794
8789
  } else
8795
8790
  await this.stopLocalStreams(a);
8796
- const n = this.getLocalStreams(a);
8797
- this.cwsIns.emitNotify("onLocalStream", { code: 200, data: n, desc: "local stream is change." }), _(n);
8791
+ const e = this.getLocalStreams(a);
8792
+ this.cwsIns.emitNotify("onLocalStream", { code: 200, data: e, desc: "local stream is change." }), _(e);
8798
8793
  } catch (e) {
8799
8794
  k(e);
8800
8795
  }
@@ -9007,7 +9002,7 @@ class RoomCalls extends RoomPeer {
9007
9002
  this.taskQueue.setCondition("closeTrack", !0), this.reportLogs("close_track_error", e.message || e), _(`stop publish is error: ${e.message || e}`);
9008
9003
  }
9009
9004
  };
9010
- this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "createTrack", "subscribe"], { describe: "stopPublish" });
9005
+ this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "createTrack", "subscribe", "closeTrack"], { describe: "stopPublish" });
9011
9006
  }));
9012
9007
  /**
9013
9008
  * 订阅流