Skip to content

Commit

Permalink
修复视频童话BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
gmingchen committed Jul 1, 2024
1 parent 6574950 commit 887bd8d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
18 changes: 0 additions & 18 deletions src/components/empty/index.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<template>
<el-empty class="empty height-full width-full" :class="absolute ? 'position-center' : ''" :image="Logo">
<template v-if="icon">
<el-image :src="Logo"></el-image>
<el-icon class="cursor-pointer" size="160">
<component :is="component"></component>
</el-icon>
</template>
<template #description>
<div class="margin_t-20" v-if="text">{{ text }}</div>
</template>
Expand All @@ -18,10 +12,6 @@ import { VideoCamera } from '@element-plus/icons-vue'
import Logo from '@/assets/images/logo.png'
const props = defineProps({
icon: {
type: String,
default: () => ''
},
text: {
type: String,
default: () => ''
Expand All @@ -31,14 +21,6 @@ const props = defineProps({
default: () => false
}
})
const component = computed(() => {
if (props.icon === 'VideoCamera') {
return VideoCamera
}
return null
})
</script>

<style lang="scss" scoped>
Expand Down
7 changes: 6 additions & 1 deletion src/stores/modules/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ const candidateHandler = (connection) => {
if (connection.localDescription) {
return resolve(connection.localDescription)
}
let localDescription = null
connection.onicecandidate = ({ candidate }) => {
if (!candidate) {
if (!localDescription) {
localDescription = connection.localDescription
resolve(connection.localDescription)
}
}
Expand Down Expand Up @@ -70,6 +72,7 @@ export const useMediaStore = defineStore('media', {
// ontrack 事件
ontrack: (event) => {
const video = document.getElementById('video')
console.log(video);
video.srcObject = event.streams[0];
video.play()
console.log('ontrack', event);
Expand Down Expand Up @@ -198,6 +201,8 @@ export const useMediaStore = defineStore('media', {
channelHandler(this)
}

console.log(1233);

this.connection.setRemoteDescription(description)

const answer = await this.connection.createAnswer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<template #content>
<div class="flex_a_i-center">
<div class="flex-item_f-1 ellipse">{{ message }}</div>
<MessageSendStatus :message="conversation.message"></MessageSendStatus>
<MessageSendStatus :message="conversation.message" v-if="conversation.message"></MessageSendStatus>
</div>
</template>
</Card>
Expand Down
7 changes: 5 additions & 2 deletions src/views/layout/components/media-dialog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<UserBox v-if="!showVideo" :avatar="active.avatar" :name="active.name"></UserBox>
<Status v-if="!showVideo" :active="active"></Status>
<Operation class="opreation margin_b-10" :active="active"></Operation>
<video id="video"></video>
<video id="video" v-show="showVideo"></video>
<div v-if="showVideo" class="video-empty">
<Empty icon="VideoCamera"></Empty>
<Empty></Empty>
</div>
</div>
</el-dialog>
Expand Down Expand Up @@ -70,6 +70,9 @@ onMounted(async () => {
#video {
z-index: 1;
}
.video-empty {
bottom: 10%;
}
}
}
</style>

0 comments on commit 887bd8d

Please sign in to comment.