call-live-sdk1 0.0.32 → 0.0.34
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("摄像头切换失败");
|
|
@@ -290637,20 +290682,25 @@ const WaitingUserList = ({
|
|
|
290637
290682
|
waitingUsers
|
|
290638
290683
|
}) => {
|
|
290639
290684
|
const {
|
|
290640
|
-
|
|
290685
|
+
updateCallUser,
|
|
290641
290686
|
getter,
|
|
290642
290687
|
kickRoomUser
|
|
290643
290688
|
} = useCallStore();
|
|
290644
290689
|
const handleAdmitUser = (userId) => {
|
|
290645
290690
|
var _a2;
|
|
290691
|
+
updateCallUser(userId, {
|
|
290692
|
+
waiting_mode_state: WaitingModeState.ADMITTED
|
|
290693
|
+
});
|
|
290694
|
+
const latestCallUsers = getter().callUsers;
|
|
290646
290695
|
(_a2 = getter().rtc) == null ? void 0 : _a2.engine.sendRoomMessage(JSON.stringify({
|
|
290647
290696
|
type: "waiting_mode",
|
|
290648
290697
|
data: {
|
|
290649
290698
|
rtc_userid: userId,
|
|
290650
290699
|
waiting_mode_state: WaitingModeState.ADMITTED,
|
|
290651
|
-
users:
|
|
290700
|
+
users: latestCallUsers.map((user) => ({
|
|
290652
290701
|
rtc_userid: user.rtc_userid,
|
|
290653
|
-
|
|
290702
|
+
// 如果是当前准入的用户,使用最新的 ADMITTED 状态
|
|
290703
|
+
waiting_mode_state: user.rtc_userid === userId ? WaitingModeState.ADMITTED : user.waiting_mode_state
|
|
290654
290704
|
}))
|
|
290655
290705
|
}
|
|
290656
290706
|
}));
|
|
@@ -301766,9 +301816,17 @@ const useRoomMessageHandler = (params = {}) => {
|
|
|
301766
301816
|
console.log("处理用户变更消息", {
|
|
301767
301817
|
user,
|
|
301768
301818
|
users,
|
|
301769
|
-
action
|
|
301819
|
+
action,
|
|
301820
|
+
senderId: userid
|
|
301770
301821
|
});
|
|
301771
301822
|
try {
|
|
301823
|
+
if (action === "confirm" && (user == null ? void 0 : user.waiting_mode_state) === WaitingModeState.ADMITTED) {
|
|
301824
|
+
console.log(`[准入确认] 用户 ${userid} 确认准入`);
|
|
301825
|
+
updateCallUser(userid, {
|
|
301826
|
+
waiting_mode_state: WaitingModeState.ADMITTED
|
|
301827
|
+
});
|
|
301828
|
+
return;
|
|
301829
|
+
}
|
|
301772
301830
|
if (user) {
|
|
301773
301831
|
updateCallUser(userid, {
|
|
301774
301832
|
...user
|
|
@@ -301801,7 +301859,7 @@ const useRoomMessageHandler = (params = {}) => {
|
|
|
301801
301859
|
userid
|
|
301802
301860
|
});
|
|
301803
301861
|
}
|
|
301804
|
-
}, [updateCallUser]);
|
|
301862
|
+
}, [updateCallUser, callConfig.rtc_userid]);
|
|
301805
301863
|
const handleChangeMediaMessage = reactExports.useCallback((data2, userid) => {
|
|
301806
301864
|
var _a2;
|
|
301807
301865
|
const mediaData = data2.data;
|