quickvo-sdk-js 0.6.6 → 0.6.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
@@ -7782,7 +7782,6 @@ class RoomMedias extends RoomBase {
7782
7782
  // 麦克风
7783
7783
  case "microphoneCamera_audio":
7784
7784
  {
7785
- this.removeUserMediaStreamContext(E, "microphoneCamera_audio");
7786
7785
  const _ = J(this, bt).get("audioinput"), k = J(this, _t).get("microphoneCamera_audio"), e = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...k }, video: !1 });
7787
7786
  J(this, St).push(e), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", e);
7788
7787
  }
@@ -7790,7 +7789,6 @@ class RoomMedias extends RoomBase {
7790
7789
  // 摄像头
7791
7790
  case "microphoneCamera_video":
7792
7791
  {
7793
- this.removeUserMediaStreamContext(E, "microphoneCamera_video");
7794
7792
  const _ = J(this, bt).get("videoinput"), k = J(this, _t).get("microphoneCamera_video"), e = await navigator.mediaDevices.getUserMedia({ audio: !1, video: { deviceId: _, ...k } });
7795
7793
  J(this, St).push(e), await this.initUserMediaStreamContext(E, "microphoneCamera_video", e);
7796
7794
  }
@@ -7798,15 +7796,25 @@ class RoomMedias extends RoomBase {
7798
7796
  // 麦克风 + 摄像头
7799
7797
  case "microphoneCamera":
7800
7798
  {
7801
- this.removeUserMediaStreamContext(E, "microphoneCamera_audio"), this.removeUserMediaStreamContext(E, "microphoneCamera_video");
7802
7799
  const _ = J(this, bt).get("audioinput"), k = J(this, bt).get("videoinput"), e = J(this, _t).get("microphoneCamera_audio"), n = J(this, _t).get("microphoneCamera_video"), O = await navigator.mediaDevices.getUserMedia({ audio: { deviceId: _, ...e }, video: { deviceId: k, ...n } });
7803
- J(this, St).push(O), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", O);
7800
+ J(this, St).push(O);
7801
+ const $ = O.getTracks();
7802
+ for (const N of $) {
7803
+ const { kind: D } = N;
7804
+ if (D === "audio") {
7805
+ const q = new MediaStream();
7806
+ q.addTrack(N), await this.initUserMediaStreamContext(E, "microphoneCamera_audio", q);
7807
+ }
7808
+ if (D === "video") {
7809
+ const q = new MediaStream();
7810
+ q.addTrack(N), await this.initUserMediaStreamContext(E, "microphoneCamera_video", q);
7811
+ }
7812
+ }
7804
7813
  }
7805
7814
  break;
7806
7815
  // 屏幕共享 音频
7807
7816
  case "screenSharing_audio":
7808
7817
  {
7809
- this.removeUserMediaStreamContext(E, "screenSharing_audio");
7810
7818
  const _ = J(this, _t).get("screenSharing_audio"), k = await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._ });
7811
7819
  J(this, St).push(k);
7812
7820
  const e = k.getTracks();
@@ -7822,7 +7830,6 @@ class RoomMedias extends RoomBase {
7822
7830
  // 屏幕共享 视频
7823
7831
  case "screenSharing_video":
7824
7832
  {
7825
- this.removeUserMediaStreamContext(E, u);
7826
7833
  const _ = J(this, _t).get(u), k = await navigator.mediaDevices.getDisplayMedia({ audio: !1, video: !0, ..._ });
7827
7834
  J(this, St).push(k);
7828
7835
  const e = k.getTracks();
@@ -7838,7 +7845,6 @@ class RoomMedias extends RoomBase {
7838
7845
  // 屏幕共享 音频+视频
7839
7846
  case "screenSharing":
7840
7847
  {
7841
- this.removeUserMediaStreamContext(E, "screenSharing_audio"), this.removeUserMediaStreamContext(E, "screenSharing_video");
7842
7848
  const _ = J(this, _t).get("screenSharing_audio"), k = J(this, _t).get("screenSharing_video"), e = await navigator.mediaDevices.getDisplayMedia({ audio: !0, video: !0, ..._, ...k });
7843
7849
  J(this, St).push(e);
7844
7850
  const n = e.getTracks();
@@ -8716,9 +8722,7 @@ class RoomCalls extends RoomPeer {
8716
8722
  const _ = async () => {
8717
8723
  try {
8718
8724
  this.taskQueue.setCondition("createTrack", !1);
8719
- const k = await this.addSenders(u);
8720
- await this.replaceSenderStream(u, !1);
8721
- const e = await this.getSenderTracks(k);
8725
+ const k = await this.addSenders(u), e = await this.getSenderTracks(k);
8722
8726
  if (e.length === 0)
8723
8727
  return this.taskQueue.setCondition("createTrack", !0), E(!0);
8724
8728
  await this.cwsIns.sendMessage({
@@ -8749,7 +8753,7 @@ class RoomCalls extends RoomPeer {
8749
8753
  typeof u == "string" && (u = [u]);
8750
8754
  const { userId: e = "" } = this.options;
8751
8755
  for (const O of u)
8752
- this.removeUserMediaStreamContext(e, O), this.setLocalStreamActiveMap.set(O, E);
8756
+ this.setLocalStreamActiveMap.set(O, !1), E === !1 && this.removeUserMediaStreamContext(e, O);
8753
8757
  if (E) {
8754
8758
  if (u.includes("microphoneCamera_audio") && u.includes("microphoneCamera_video") ? await this.initLocalStream("microphoneCamera") : u.includes("microphoneCamera_audio") ? await this.initLocalStream("microphoneCamera_audio") : u.includes("microphoneCamera_video") ? await this.initLocalStream("microphoneCamera_video") : u.includes("screenSharing_audio") && u.includes("screenSharing_video") ? await this.initLocalStream("screenSharing") : u.includes("screenSharing_audio") && !u.includes("screenSharing_video") ? await this.initLocalStream("screenSharing_audio") : u.includes("screenSharing_video") && !u.includes("screenSharing_audio") && await this.initLocalStream("screenSharing_video"), u.includes("screenSharing_audio")) {
8755
8759
  const $ = this.getUserStream(e, "screenSharing_audio").getTracks();
@@ -8901,7 +8905,7 @@ class RoomCalls extends RoomPeer {
8901
8905
  for (const q of u)
8902
8906
  this.getUserStream(e.id, q).getTracks().length === 0 && n.push(q);
8903
8907
  const O = u.filter((q) => !n.includes(q) || ["microphoneCamera_audio", "microphoneCamera_video"].includes(q));
8904
- await J(this, Ct).call(this, O);
8908
+ await this.replaceSenderStream(u, !1), await J(this, Ct).call(this, O);
8905
8909
  const $ = await this.getSenderTracks(O), N = [...e.tracks, ...$];
8906
8910
  await this.updateUsertracks(e.id, N, !0);
8907
8911
  const D = await this.getCallAction(N);