Browse Source

change mirror

master
zhangtao 1 year ago
parent
commit
285c149943
2 changed files with 9 additions and 8 deletions
  1. +2
    -2
      src/views/home/components/Device.vue
  2. +7
    -6
      src/views/home/index.vue

+ 2
- 2
src/views/home/components/Device.vue View File

@@ -41,14 +41,14 @@ export default defineComponent({
cameraId: data.videoDeviceId,
microphoneId: data.audioDeviceId
})
emit('switch', { type: 'video', cameraId: data.videoDeviceId })
emit('switch', { type: 'video', cameraId: data.videoDeviceId, isMirror: false })
} else {
data.videoDeviceId = data.videoList[0].deviceId
emit('init', {
cameraId: data.videoDeviceId,
microphoneId: data.audioDeviceId
})
emit('switch', { type: 'video', cameraId: data.videoDeviceId })
emit('switch', { type: 'video', cameraId: data.videoDeviceId, isMirror: true })
}
}


+ 7
- 6
src/views/home/index.vue View File

@@ -85,7 +85,8 @@ export default {
userSig: null,
roomId: null,
taskId: null,
remoteStreamList: []
remoteStreamList: [],
isMirror: true
})

const settings = reactive({
@@ -295,8 +296,7 @@ export default {
video: true,
userId: data.userId,
cameraId: settings.cameraId,
microphoneId: settings.microphoneId,
mirror: false
microphoneId: settings.microphoneId
})
try {
await settings.localStream.initialize()
@@ -313,7 +313,7 @@ export default {
if (settings.localStream && settings.isPlayingLocalStream) {
settings.isPlayingLocalStream = false
}
settings.localStream.play('localStream')
settings.localStream.play('localStream', { mirror: data.isMirror })
.then(() => {
settings.isPlayingLocalStream = true
})
@@ -431,10 +431,12 @@ export default {
* @param {*} cameraId
* @return {*}
*/
const handleCamareSwitch = ({ type, cameraId }) => {
const handleCamareSwitch = ({ type, cameraId, isMirror = true }) => {
try {
if (settings.localStream) {
data.isMirror = isMirror
settings.localStream.switchDevice(type, cameraId)
playLocalStream()
}
} catch (error) {
console.error('switchDevice failed', error)
@@ -498,7 +500,6 @@ export default {
}
await axios.put(`/api/meeting/heartbeatTime`, params)
}

/**
* @description: 翻转摄像头
* @return {*}

Loading…
Cancel
Save