diff --git a/src/page/Meeting/index.tsx b/src/page/Meeting/index.tsx index 0786db1..fd64671 100644 --- a/src/page/Meeting/index.tsx +++ b/src/page/Meeting/index.tsx @@ -174,22 +174,13 @@ const Meeting: React.FC = () => { }) }, onAudioVolumeIndication: async (speakers: any) => { - setRoomUserList((res: any) => { - speakers.forEach((item: any) => { - if (item.uid) { - let itemUser = res.find((row: any) => row.uid === String(item.uid)) - if (itemUser) { - itemUser.volumeNumber = (item.volume / 255) * 100; - } - } else { - let me = res.find((row: any) => row.uid === userInfo.uid) - if (me) { - me.volumeNumber = (item.volume / 255) * 100; - } - } - }); - return res - }) + speakers.forEach((item: any) => { + let dom = document.getElementById(`micr-${item.uid ? item.uid : userInfo.uid}`); + if (dom) { + const percentage = (item.volume / 255) * 100 + dom.style.width = `${percentage}%` + } + }); } }) agora.startCameraCapture() @@ -988,7 +979,7 @@ const Meeting: React.FC = () => {
- {item.enableMicr ?
: null} + {item.enableMicr ?
: null}
} diff --git a/src/utils/package/agora.ts b/src/utils/package/agora.ts index 6647a55..4291806 100644 --- a/src/utils/package/agora.ts +++ b/src/utils/package/agora.ts @@ -87,6 +87,7 @@ const agora = { if (setting.playBackVolume) agora.setPlaybackDeviceVolume(setting.playBackVolume) // 设置播放设备音量 if (setting.ecordingDeviceId) agora.setRecordingDevice(setting.ecordingDeviceId) // 设置音频采集设备 if (setting.ecordingVolume) agora.setRecordingDeviceVolume(setting.ecordingVolume) // 设置音频设备音量 + rtcEngine.enableAudioVolumeIndication(100, 1, true) } }, 1000); }, @@ -186,7 +187,6 @@ const agora = { }, // 加入频道 joinChannel: () => { - // rtcEngine.enableAudioVolumeIndication(200, 10, true) rtcEngine.joinChannel(option.token, option.channelId, option.uid, { autoSubscribeAudio: true,//设置是否自动订阅所有音频流 autoSubscribeVideo: true,//设置是否自动订阅所有视频流