call-live-sdk1 0.0.32 → 0.0.33
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/call-live-sdk.es.js
CHANGED
|
@@ -202847,6 +202847,48 @@ const useVideoSlotBinding = ({
|
|
|
202847
202847
|
livePlayerRef,
|
|
202848
202848
|
getter
|
|
202849
202849
|
]);
|
|
202850
|
+
reactExports.useEffect(() => {
|
|
202851
|
+
const handleLocalCameraChanged = () => {
|
|
202852
|
+
var _a2;
|
|
202853
|
+
if (item.objectType !== "videoSlot" || !selectedValue || !livePlayerRef.current)
|
|
202854
|
+
return;
|
|
202855
|
+
const [userId] = selectedValue.split(fenge);
|
|
202856
|
+
const { callConfig } = useCallStore.getState();
|
|
202857
|
+
if (userId !== callConfig.rtc_userid)
|
|
202858
|
+
return;
|
|
202859
|
+
console.log("检测到本地摄像头切换,重新绑定视频槽:", item.id);
|
|
202860
|
+
const canvas = getter().fabricInstance;
|
|
202861
|
+
if (!canvas) {
|
|
202862
|
+
console.error("画布未初始化");
|
|
202863
|
+
return;
|
|
202864
|
+
}
|
|
202865
|
+
const videoSlotObj = (_a2 = canvas.getObjects()) == null ? void 0 : _a2.find((o2) => o2.id === item.id);
|
|
202866
|
+
if (!videoSlotObj) {
|
|
202867
|
+
console.error("找不到对应的连麦嘉宾对象:", item.id);
|
|
202868
|
+
return;
|
|
202869
|
+
}
|
|
202870
|
+
const [, streamIndex = "main"] = selectedValue.split(fenge);
|
|
202871
|
+
const user = callUsers.find((user2) => user2.rtc_userid === userId);
|
|
202872
|
+
if (user && user.isVideoEnabled) {
|
|
202873
|
+
try {
|
|
202874
|
+
livePlayerRef.current.bindVideoSlotToFirstEmpty({
|
|
202875
|
+
id: item.id,
|
|
202876
|
+
userId,
|
|
202877
|
+
streamIndex: streamIndex === "screen" ? "screen" : "main",
|
|
202878
|
+
userName: user.nickname
|
|
202879
|
+
});
|
|
202880
|
+
videoSlotObj.userId = userId;
|
|
202881
|
+
videoSlotObj.streamIndex = streamIndex;
|
|
202882
|
+
} catch (bindError) {
|
|
202883
|
+
console.error("重新绑定视频流失败:", bindError);
|
|
202884
|
+
}
|
|
202885
|
+
}
|
|
202886
|
+
};
|
|
202887
|
+
eventBus.on("localCameraChanged", handleLocalCameraChanged);
|
|
202888
|
+
return () => {
|
|
202889
|
+
eventBus.off("localCameraChanged", handleLocalCameraChanged);
|
|
202890
|
+
};
|
|
202891
|
+
}, [item, selectedValue, fenge, livePlayerRef, getter, callUsers]);
|
|
202850
202892
|
return {
|
|
202851
202893
|
selectedValue,
|
|
202852
202894
|
setSelectedValue,
|
|
@@ -279779,6 +279821,9 @@ const MediaSettings = () => {
|
|
|
279779
279821
|
cameraId: newCameraId
|
|
279780
279822
|
}
|
|
279781
279823
|
});
|
|
279824
|
+
eventBus.emit("localCameraChanged", {
|
|
279825
|
+
cameraId: newCameraId
|
|
279826
|
+
});
|
|
279782
279827
|
} else {
|
|
279783
279828
|
console.error("摄像头切换失败:", result.message);
|
|
279784
279829
|
staticMethods.error("摄像头切换失败");
|