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

cameraId: data.videoDeviceId, cameraId: data.videoDeviceId,
microphoneId: data.audioDeviceId microphoneId: data.audioDeviceId
}) })
emit('switch', { type: 'video', cameraId: data.videoDeviceId })
emit('switch', { type: 'video', cameraId: data.videoDeviceId, isMirror: false })
} else { } else {
data.videoDeviceId = data.videoList[0].deviceId data.videoDeviceId = data.videoList[0].deviceId
emit('init', { emit('init', {
cameraId: data.videoDeviceId, cameraId: data.videoDeviceId,
microphoneId: data.audioDeviceId 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

userSig: null, userSig: null,
roomId: null, roomId: null,
taskId: null, taskId: null,
remoteStreamList: []
remoteStreamList: [],
isMirror: true
}) })


const settings = reactive({ const settings = reactive({
video: true, video: true,
userId: data.userId, userId: data.userId,
cameraId: settings.cameraId, cameraId: settings.cameraId,
microphoneId: settings.microphoneId,
mirror: false
microphoneId: settings.microphoneId
}) })
try { try {
await settings.localStream.initialize() await settings.localStream.initialize()
if (settings.localStream && settings.isPlayingLocalStream) { if (settings.localStream && settings.isPlayingLocalStream) {
settings.isPlayingLocalStream = false settings.isPlayingLocalStream = false
} }
settings.localStream.play('localStream')
settings.localStream.play('localStream', { mirror: data.isMirror })
.then(() => { .then(() => {
settings.isPlayingLocalStream = true settings.isPlayingLocalStream = true
}) })
* @param {*} cameraId * @param {*} cameraId
* @return {*} * @return {*}
*/ */
const handleCamareSwitch = ({ type, cameraId }) => {
const handleCamareSwitch = ({ type, cameraId, isMirror = true }) => {
try { try {
if (settings.localStream) { if (settings.localStream) {
data.isMirror = isMirror
settings.localStream.switchDevice(type, cameraId) settings.localStream.switchDevice(type, cameraId)
playLocalStream()
} }
} catch (error) { } catch (error) {
console.error('switchDevice failed', error) console.error('switchDevice failed', error)
} }
await axios.put(`/api/meeting/heartbeatTime`, params) await axios.put(`/api/meeting/heartbeatTime`, params)
} }

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

Loading…
Cancel
Save