This commit is contained in:
parent
523efcae2e
commit
37c309a279
|
|
@ -148,35 +148,37 @@ const JoinSetting = forwardRef((_props: any, ref: any) => {
|
|||
<div>
|
||||
{
|
||||
joinRoomSettingForm.list.map((item, index) => {
|
||||
return <div key={index} onClick={async () => {
|
||||
return <div key={index} onClick={() => {
|
||||
let msg = '';
|
||||
setDeviceList((res: any) => {
|
||||
if (index === 0) {
|
||||
if (!res.audioList.length) {
|
||||
msg = '未检测到麦克风!'
|
||||
console.log(msg);
|
||||
|
||||
}
|
||||
} else {
|
||||
if (!res.videoList.length) {
|
||||
msg = '未检测到麦克风!'
|
||||
}
|
||||
}
|
||||
if (msg) {
|
||||
message.error('未检测到麦克风!')
|
||||
return
|
||||
}
|
||||
const list = [...joinRoomSettingForm.list]
|
||||
list[index].active = !list[index].active
|
||||
setJoinRoomSettingForm({
|
||||
...joinRoomSettingForm,
|
||||
list
|
||||
})
|
||||
if (index === 1) {
|
||||
if (list[index].active) {
|
||||
agora.startPreview('videoPreview', Number(user.account))
|
||||
}
|
||||
}
|
||||
return res
|
||||
})
|
||||
if (msg) {
|
||||
message.error('未检测到麦克风!')
|
||||
return
|
||||
}
|
||||
const list = [...joinRoomSettingForm.list]
|
||||
list[index].active = !list[index].active
|
||||
setJoinRoomSettingForm({
|
||||
...joinRoomSettingForm,
|
||||
list
|
||||
})
|
||||
if (index === 1) {
|
||||
if (list[index].active) {
|
||||
await agora.startPreview('videoPreview', Number(user.account))
|
||||
}
|
||||
}
|
||||
}}>
|
||||
<img src={item.active ? item.icon : item.iconActive} alt="" />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue