@@ -33,7 +33,6 @@ export default defineComponent({ | |||
const handleCameraReverse = () => { | |||
const index = data.videoList.findIndex((item) => item.deviceId === data.videoDeviceId) | |||
const len = data.videoList.length | |||
alert(len) | |||
if (len <= 1) { | |||
return | |||
} else if (index === 0) { | |||
@@ -42,14 +41,14 @@ export default defineComponent({ | |||
cameraId: data.videoDeviceId, | |||
microphoneId: data.audioDeviceId | |||
}) | |||
emit('switch', { type: 'video', deviceId: data.cameraId }) | |||
emit('switch', { type: 'video', cameraId: data.videoDeviceId }) | |||
} else { | |||
data.videoDeviceId = data.videoList[0].deviceId | |||
emit('init', { | |||
cameraId: data.videoDeviceId, | |||
microphoneId: data.audioDeviceId | |||
}) | |||
emit('switch', { type: 'video', deviceId: data.cameraId }) | |||
emit('switch', { type: 'video', cameraId: data.videoDeviceId }) | |||
} | |||
} | |||
@@ -1,8 +1,8 @@ | |||
<template> | |||
<div class="room"> | |||
<!-- <DeviceSelect v-show="false" ref="cameraRef" v-model:value="cameraId" device-type="video" @switch="handleDeviceSwitch" /> --> | |||
<!-- <DeviceSelect v-show="false" v-model:value="microphoneId" device-type="audio" @switch="handleDeviceSwitch" /> --> | |||
<Device ref="cameraRef" @init="deviceInit" @switch="handleDeviceSwitch" /> | |||
<!-- <DeviceSelect v-show="false" ref="cameraRef" v-model:value="cameraId" device-type="video" @switch="handleCamareSwitch" /> --> | |||
<!-- <DeviceSelect v-show="false" v-model:value="microphoneId" device-type="audio" /> --> | |||
<Device ref="cameraRef" @init="deviceInit" @switch="handleCamareSwitch" /> | |||
<!-- 远端 --> | |||
<div class="remote-container"> | |||
@@ -427,13 +427,13 @@ export default { | |||
/** | |||
* @description: 切换音频 | |||
* @param {*} type | |||
* @param {*} deviceId | |||
* @param {*} cameraId | |||
* @return {*} | |||
*/ | |||
const handleDeviceSwitch = ({ type, deviceId }) => { | |||
const handleCamareSwitch = ({ type, cameraId }) => { | |||
try { | |||
if (settings.localStream) { | |||
settings.localStream.switchDevice(type, deviceId) | |||
settings.localStream.switchDevice(type, cameraId) | |||
} | |||
} catch (error) { | |||
console.error('switchDevice failed', error) | |||
@@ -557,7 +557,7 @@ export default { | |||
handleAudioMute, | |||
handleAudioUnMute, | |||
handelCameraReverse, | |||
handleDeviceSwitch, | |||
handleCamareSwitch, | |||
leaveMeetingRoom | |||
} | |||
} |