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