quickvo-sdk-js 0.5.0 → 0.5.2

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
@@ -7425,6 +7425,7 @@ class RoomBase {
7425
7425
  debug: !1,
7426
7426
  newPublishAutoSubscribe: !0
7427
7427
  });
7428
+ Z(this, "localStreamActiveMap", /* @__PURE__ */ new Map());
7428
7429
  Z(this, "prohibitNotify", !1);
7429
7430
  // 是否禁止通知
7430
7431
  Z(this, "isEarly", !1);
@@ -7546,7 +7547,7 @@ class RoomBase {
7546
7547
  /**
7547
7548
  * 处理为应用层数据
7548
7549
  */
7549
- Z(this, "usersFilter", (I) => ft(I, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "updateStreams", "permissions", "isPublished"]).sort((_, k) => _.id.localeCompare(k.id, "en")));
7550
+ Z(this, "usersFilter", (I) => ft(I, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "permissions", "isPublished", "updateStreams"]).sort((_, k) => _.id.localeCompare(k.id, "en")));
7550
7551
  this.initAsyncQueue();
7551
7552
  }
7552
7553
  }
@@ -7766,9 +7767,8 @@ class RoomMedias extends RoomBase {
7766
7767
  break;
7767
7768
  }
7768
7769
  {
7769
- this.emitNotifyUpdateUsersStreams([{ userId: E, updateStreams: { [u]: !0 } }]);
7770
7770
  const k = this.getUserStreams(E);
7771
- this.cwsIns.emitNotify("onLocalStream", { code: 200, data: k, desc: "local stream is change." });
7771
+ this.cwsIns.emitNotify("onLocalStream", { code: 200, data: k, desc: "local stream is change." }), this.emitNotifyUpdateUsersStreams([{ userId: E, updateStreams: { [u]: !0 } }]);
7772
7772
  }
7773
7773
  });
7774
7774
  /**
@@ -7799,7 +7799,7 @@ class RoomMedias extends RoomBase {
7799
7799
  * @param deviceId 设备ID
7800
7800
  */
7801
7801
  Z(this, "setDeviceKind", async (u, E) => {
7802
- if (V(this, bt).set(u, E), u === "audioinput" && await this.initLocalStream("microphoneCamera_audio"), u === "videoinput" && await this.initLocalStream("microphoneCamera_video"), u === "audiooutput") {
7802
+ if (V(this, bt).set(u, E), u === "audiooutput") {
7803
7803
  const _ = V(this, _t).values();
7804
7804
  for (const k of _)
7805
7805
  k.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype && k.audioContext.setSinkId(E);
@@ -8153,15 +8153,10 @@ class RoomPeer extends RoomUsers {
8153
8153
  */
8154
8154
  Z(this, "setMediaDeviceKind", async (u, E) => {
8155
8155
  await this.setDeviceKind(u, E);
8156
- const _ = await this.getCaller(), { tracks: k = [] } = _;
8157
- switch (u) {
8158
- case "audioinput":
8159
- k.find((n) => n.mediaType === "microphoneCamera_audio") && await this.replaceSenderStream(["microphoneCamera_audio"], !0);
8160
- break;
8161
- case "videoinput":
8162
- k.find((n) => n.mediaType === "microphoneCamera_video") && await this.replaceSenderStream(["microphoneCamera_video"], !0);
8163
- break;
8164
- }
8156
+ const _ = await this.getCaller(), { tracks: k = [] } = _, e = async (n) => {
8157
+ this.localStreamActiveMap.get(n) && await this.initLocalStream(n), k.find(($) => $.mediaType === n) && await this.replaceSenderStream([n], !0);
8158
+ };
8159
+ u === "audioinput" && await e("microphoneCamera_audio"), u === "videoinput" && await e("microphoneCamera_video");
8165
8160
  });
8166
8161
  /**
8167
8162
  * 替换发射器媒体流
@@ -8502,7 +8497,7 @@ class RoomCalls extends RoomPeer {
8502
8497
  Z(this, "setLocalStream", (u, E) => new Promise(async (_, k) => {
8503
8498
  try {
8504
8499
  const { userId: e } = this.options;
8505
- if (E ? await this.initLocalStream(u) : this.removeUserMediaStreamContext(e, u), u === "screenSharing_audio" || u === "screenSharing_video") {
8500
+ if (E ? (this.localStreamActiveMap.set(u, !0), await this.initLocalStream(u)) : (this.localStreamActiveMap.set(u, !1), this.removeUserMediaStreamContext(e, u)), u === "screenSharing_audio" || u === "screenSharing_video") {
8506
8501
  {
8507
8502
  const $ = this.getUserStream(e, "screenSharing_audio").getTracks();
8508
8503
  for (const N of $)
@@ -8515,7 +8510,7 @@ class RoomCalls extends RoomPeer {
8515
8510
  }
8516
8511
  }
8517
8512
  const n = this.getUserStreams(e);
8518
- this.cwsIns.emitNotify("onLocalStream", { code: 200, data: n, desc: "local stream is change." }), _(n);
8513
+ _(n);
8519
8514
  } catch (e) {
8520
8515
  k(e);
8521
8516
  }
@@ -8647,7 +8642,7 @@ class RoomCalls extends RoomPeer {
8647
8642
  _(`publish is error: ${e.message || e}`);
8648
8643
  }
8649
8644
  };
8650
- this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "createTrack", "subscribe"], { describe: "replaceSenderStream" });
8645
+ this.taskQueue.addTask(k, ["createWs", "createSession", "ice", "joinRoom", "createTrack", "subscribe"], { describe: "replaceSenderStream" });
8651
8646
  }));
8652
8647
  /**
8653
8648
  * 停止发布流