zhangtao преди 2 години
родител
ревизия
2698ba7007
променени са 1 файла, в които са добавени 34 реда и са изтрити 8 реда
  1. +34
    -8
      src/views/home/index.vue

+ 34
- 8
src/views/home/index.vue Целия файл

<template> <template>
<div class="room"> <div class="room">
<DeviceSelect v-show="false" v-model:value="cameraId" device-type="camera" />
<DeviceSelect v-show="false" v-model:value="microphoneId" device-type="microphone" />
<DeviceSelect v-model:value="cameraId" device-type="camera" />
<DeviceSelect v-model:value="microphoneId" device-type="microphone" />


<!-- 远端 --> <!-- 远端 -->
<div class="remote-container"> <div class="remote-container">
<div id="localStream" class="local-stream-content" /> <div id="localStream" class="local-stream-content" />
<!-- 本地流操作栏 --> <!-- 本地流操作栏 -->
<div v-if="isPlayingLocalStream" class="local-stream-control"> <div v-if="isPlayingLocalStream" class="local-stream-control">
<div class="video-control control">
<n-icon v-if="!isReverseCamera" size="40" @click="handleVideoMute">
<CameraOutline />
</n-icon>
<n-icon v-if="isReverseCamera" size="40" @click="handleVideoUnMute">
<CameraReverseOutline />
</n-icon>
</div>
<div class="video-control control"> <div class="video-control control">
<n-icon v-if="!isMutedVideo" size="40" @click="handleVideoMute"> <n-icon v-if="!isMutedVideo" size="40" @click="handleVideoMute">
<VideocamOutline /> <VideocamOutline />
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import DeviceSelect from './components/Device.vue' import DeviceSelect from './components/Device.vue'
import { reactive, toRefs, onMounted, watch, nextTick } from 'vue' import { reactive, toRefs, onMounted, watch, nextTick } from 'vue'
import { VideocamOutline, VideocamOffOutline } from '@vicons/ionicons5'
import { CameraOutline, CameraReverseOutline, VideocamOutline, VideocamOffOutline } from '@vicons/ionicons5'
import { AudioOutlined, AudioMutedOutlined } from '@vicons/antd' import { AudioOutlined, AudioMutedOutlined } from '@vicons/antd'
import { isUndef } from '@/utils/is.js' import { isUndef } from '@/utils/is.js'
// import { Screen, ScreenOff } from '@vicons/carbon' // import { Screen, ScreenOff } from '@vicons/carbon'
name: 'HomePage', name: 'HomePage',
components: { components: {
DeviceSelect, DeviceSelect,
CameraOutline,
CameraReverseOutline,
VideocamOutline, VideocamOutline,
VideocamOffOutline, VideocamOffOutline,
AudioOutlined, AudioOutlined,
} }
} }


const handelCameraReverse = () => {
if (this.video) {
this.video.pause()
}
this.constraints.video.facingMode = this.isFront ? 'environment' : 'user'
const stream = this.video.srcObject
const tracks = stream.getTracks()
tracks.forEach(function(track) {
track.stop()
})
this.video.srcObject = null
this.init()
this.isFront = !this.isFront
}

onMounted(() => { onMounted(() => {
const { userId, roomId } = route.query const { userId, roomId } = route.query
data.userId = userId data.userId = userId
}) })
watch(() => [settings.cameraId, settings.microphoneId], async([cameraId, microphoneId]) => { watch(() => [settings.cameraId, settings.microphoneId], async([cameraId, microphoneId]) => {
if (cameraId && microphoneId) { if (cameraId && microphoneId) {
await createMeetingRoom()
await joinMeetingRoom()
await initLocalStream()
await playLocalStream()
await publishStream()
// await createMeetingRoom()
// await joinMeetingRoom()
// await initLocalStream()
// await playLocalStream()
// await publishStream()
} }
}) })


handleVideoUnMute, handleVideoUnMute,
handleAudioMute, handleAudioMute,
handleAudioUnMute, handleAudioUnMute,
handelCameraReverse,
leaveMeetingRoom leaveMeetingRoom
} }
} }

Loading…
Отказ
Запис