This commit is contained in:
yj 2024-08-12 17:49:02 +08:00
parent 009875711f
commit a4b5e86cbf
2 changed files with 13 additions and 1 deletions

View File

@ -218,6 +218,18 @@ const Meeting: React.FC = () => {
const item = roomUserList.find((item: any) => item.screenShareId === String(isShare))
setIsShareUser(item || null)
}
function moveObjectToFront(arr: any, objToMove: any) {
const index = arr.findIndex((item: any) => {
return item.uid === objToMove.uid;
});
if (index !== -1) {
const movedObj = arr.splice(index, 1)[0];
arr.unshift(movedObj);
}
return arr;
}
setRoomUserList(moveObjectToFront(roomUserList, userInfo))
}, [isShare, roomUserList]);
useEffect(() => {

View File

@ -28,7 +28,7 @@ const agora = {
const setting = JSON.parse(storage.getItem('setting') as string)
if (setting.videoDeviceId) {
agora.getVideoDeviceManager().then(async (res) => {
let item = res.find((item: any) => item.deviceId === setting.videoDeviceId);
let item = res.list.find((item: any) => item.deviceId === setting.videoDeviceId);
if (item) {
agora.setVideoDeviceManager(setting.videoDeviceId) //通过设备 ID 指定视频采集设备。
} else {