This commit is contained in:
yj 2024-08-15 16:18:06 +08:00
parent 01c642c0e9
commit dece2d8418
2 changed files with 9 additions and 18 deletions

View File

@ -174,22 +174,13 @@ const Meeting: React.FC = () => {
}) })
}, },
onAudioVolumeIndication: async (speakers: any) => { onAudioVolumeIndication: async (speakers: any) => {
setRoomUserList((res: any) => { speakers.forEach((item: any) => {
speakers.forEach((item: any) => { let dom = document.getElementById(`micr-${item.uid ? item.uid : userInfo.uid}`);
if (item.uid) { if (dom) {
let itemUser = res.find((row: any) => row.uid === String(item.uid)) const percentage = (item.volume / 255) * 100
if (itemUser) { dom.style.width = `${percentage}%`
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
})
} }
}) })
agora.startCameraCapture() agora.startCameraCapture()
@ -988,7 +979,7 @@ const Meeting: React.FC = () => {
</div> </div>
</Popover> </Popover>
<div className={styles.meetingContentSwiperCardBorder}> <div className={styles.meetingContentSwiperCardBorder}>
{item.enableMicr ? <div style={{ width: `${item.volumeNumber}%` }}></div> : null} {item.enableMicr ? <div id={`micr-${item.uid}`}></div> : null}
</div> </div>
</div> </div>
} }

View File

@ -87,6 +87,7 @@ const agora = {
if (setting.playBackVolume) agora.setPlaybackDeviceVolume(setting.playBackVolume) // 设置播放设备音量 if (setting.playBackVolume) agora.setPlaybackDeviceVolume(setting.playBackVolume) // 设置播放设备音量
if (setting.ecordingDeviceId) agora.setRecordingDevice(setting.ecordingDeviceId) // 设置音频采集设备 if (setting.ecordingDeviceId) agora.setRecordingDevice(setting.ecordingDeviceId) // 设置音频采集设备
if (setting.ecordingVolume) agora.setRecordingDeviceVolume(setting.ecordingVolume) // 设置音频设备音量 if (setting.ecordingVolume) agora.setRecordingDeviceVolume(setting.ecordingVolume) // 设置音频设备音量
rtcEngine.enableAudioVolumeIndication(100, 1, true)
} }
}, 1000); }, 1000);
}, },
@ -186,7 +187,6 @@ const agora = {
}, },
// 加入频道 // 加入频道
joinChannel: () => { joinChannel: () => {
// rtcEngine.enableAudioVolumeIndication(200, 10, true)
rtcEngine.joinChannel(option.token, option.channelId, option.uid, { rtcEngine.joinChannel(option.token, option.channelId, option.uid, {
autoSubscribeAudio: true,//设置是否自动订阅所有音频流 autoSubscribeAudio: true,//设置是否自动订阅所有音频流
autoSubscribeVideo: true,//设置是否自动订阅所有视频流 autoSubscribeVideo: true,//设置是否自动订阅所有视频流