change device

This commit is contained in:
zhangtao 2022-10-28 10:04:15 +08:00
parent 69356dd714
commit ca616cfb08
1 changed files with 3 additions and 3 deletions

View File

@ -39,16 +39,16 @@ export default defineComponent({
const handleReverse = () => {
const index = data.videoList.findIndex((item) => item.deviceId === data.activeDeviceId)
const len = data.videoList.length
if (len === 1) {
if (len <= 1) {
return
} else if (index === 0) {
data.videoDeviceId = data.deviceList[len - 1].deviceId
data.videoDeviceId = data.videoList[len - 1].deviceId
emit('init', {
cameraId: data.videoDeviceId,
microphoneId: data.audioDeviceId
})
} else {
data.videoDeviceId = data.deviceList[0].deviceId
data.videoDeviceId = data.videoList[0].deviceId
emit('init', {
cameraId: data.videoDeviceId,
microphoneId: data.audioDeviceId