fix: voice UX

This commit is contained in:
Tristan Yang
2023-03-31 09:38:32 +08:00
parent 340b98d799
commit ab064dc75c
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -42,6 +42,11 @@ const Voice = () => {
if (mediaType == "audio") {
// 播放远端音频
user.audioTrack?.play();
const level = user.audioTrack?.getVolumeLevel();
if (level === 0) {
// 远端静音
dispatch(updateVoicingMember({ uid: +user.uid, info: { muted: true } }));
}
window.VOICE_TRACK_MAP[+user.uid] = user.audioTrack;
}
agoraEngine.on("user-unpublished", (user) => {
@@ -54,11 +59,9 @@ const Voice = () => {
case "Quit":
case "ServerTimeOut": {
dispatch(removeVoiceMember(+user.uid as number));
console.log(user, "has left the channel");
}
break;
default:
break;
}
@@ -88,7 +91,6 @@ const Voice = () => {
// todo
dispatch(updateVoicingMember({ uid: +uid, info: { muted: false } }));
break;
default:
break;
}
@@ -112,7 +114,6 @@ const Voice = () => {
localTrack.close();
localTrack = null;
window.VOICE_CLIENT.leave();
}
// window.VOICE_CLIENT=null
};
@@ -27,7 +27,7 @@ const VoiceManagement = ({ info, setMute, setDeafen, leave }: Props) => {
});
if (!info) return null;
const { deafen, muted } = info;
const nameClass = clsx(`text-sm text-gray-500 max-w-[190px] truncate font-semibold dark:text-white`);
const nameClass = clsx(`text-sm text-gray-500 max-w-[120px] truncate font-semibold dark:text-white`);
const members = voicingMembers.ids;
const membersData = voicingMembers.byId;
return (