-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathChatVideo.vue
127 lines (119 loc) · 3.65 KB
/
ChatVideo.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
<div
class="vdb-c-relative vdb-c-flex vdb-c-w-full vdb-c-flex-col vdb-c-gap-8 vdb-c-py-14 vdb-c-text-left"
>
<LoadingMessage
:status="content.status"
:message="content.status_message"
:is-last-conv="isLastConv"
/>
<transition name="fade" mode="out-in">
<div
v-if="content.status === 'success' && content.video.stream_url"
class="vdb-c-w-full vdb-c-py-6"
>
<div
:class="
isFullScreen
? 'vdb-c-fixed vdb-c-inset-0 vdb-c-z-50 vdb-c-flex vdb-c-h-full vdb-c-w-full vdb-c-flex-col vdb-c-items-center vdb-c-justify-center vdb-c-overflow-y-hidden vdb-c-bg-black-64'
: 'vdb-c-full xl:vdb-c-1/2 vdb-c-overflow-hidden vdb-c-rounded-20 sm:vdb-c-w-3/4 lg:vdb-c-w-3/5 xl:vdb-c-w-1/2'
"
>
<VideoDBPlayer
:class="isFullScreen ? 'vdb-c-h-screen vdb-c-w-screen' : ''"
:stream-url="content.video.stream_url"
:default-controls="false"
:default-overlay="false"
@fullScreenChange="handleFullScreenChange"
>
<template #overlay>
<BigCenterButton
class="vdb-c-absolute vdb-c-left-1/2 vdb-c-top-1/2 vdb-c-h-32 vdb-c-w-32 md:vdb-c-h-48 md:vdb-c-w-48"
/>
</template>
<template #controls>
<div class="vdb-p-pt-0 vdb-c-p-20">
<div class="sm:vdb-p-mx-8 vdb-c-mb-8 md:vdb-c-mb-12">
<ProgressBar :stream-url="content.video.stream_url" />
</div>
<div class="vdb-c-flex vdb-c-w-full vdb-c-justify-between">
<div
class="vdb-c-z-10 vdb-c-ml-0 vdb-c-flex vdb-c-items-center"
>
<PlayPauseButton />
<VolumeControlButton />
<TimeCode />
</div>
<FullScreenButton class="" />
</div>
</div>
</template>
</VideoDBPlayer>
</div>
</div>
<div v-else-if="content.status === 'progress'">
<div
class="vdb-c-full xl:vdb-c-1/2 vdb-c-animate-pulse vdb-c-overflow-hidden vdb-c-rounded-20 sm:vdb-c-w-3/4 lg:vdb-c-w-3/5 xl:vdb-c-w-1/2"
>
<div class="vdb-c-relative vdb-c-w-full" style="padding-top: 56.25%">
<div
class="vdb-c-absolute vdb-c-inset-0 vdb-c-flex vdb-c-items-center vdb-c-justify-center vdb-c-bg-gray-200"
></div>
</div>
</div>
</div>
<div
v-else-if="content.status === 'not_generated'"
class="vdb-c-flex vdb-c-flex-col"
></div>
</transition>
</div>
</template>
<script setup>
import { ref } from "vue";
import {
VideoDBPlayer,
TimeCode,
BigCenterButton,
VolumeControlButton,
PlayPauseButton,
FullScreenButton,
ProgressBar,
} from "@videodb/player-vue";
import "@videodb/player-vue/dist/style.css";
import LoadingMessage from "./elements/LoadingMessage.vue";
const props = defineProps({
content: {
type: Object,
required: true,
},
isLastConv: {
type: Boolean,
default: false,
},
});
const isFullScreen = ref(false);
const handleFullScreenChange = () => {
isFullScreen.value = !isFullScreen.value;
if (isFullScreen.value) {
document.documentElement.requestFullscreen();
} else {
document.exitFullscreen();
}
};
</script>
<style lang="scss">
.video-js .vjs-big-play-button {
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.1s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>