forked from bluerobotics/cockpit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VideoPlayer.vue
95 lines (84 loc) · 1.84 KB
/
VideoPlayer.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
<template>
<div v-if="openDialog" class="modal">
<div class="overlay" @click="closeDialog">
<span class="close-icon mdi mdi-close" @click.stop="closeDialog"></span>
</div>
<div class="modal-content">
<video id="video-player" class="w-[100%]" controls autoplay preload="auto">
<source :src="videoFileUrl" type="video/webm" />
</video>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, watchEffect } from 'vue'
const props = defineProps({
videoUrl: {
type: String,
default: '',
},
openVideoPlayerDialog: Boolean,
})
const emit = defineEmits(['update:openVideoPlayerDialog'])
const videoFileUrl = ref(props.videoUrl)
const openDialog = ref(props.openVideoPlayerDialog)
const closeDialog = (): void => {
openDialog.value = false
emit('update:openVideoPlayerDialog', false)
}
watchEffect(() => {
videoFileUrl.value = props.videoUrl
openDialog.value = props.openVideoPlayerDialog
})
</script>
<style scoped>
.modal {
position: fixed;
top: 50%;
left: 50%;
display: flex;
align-items: center;
justify-content: center;
padding: 30px;
z-index: 1000;
backdrop-filter: blur(10px);
}
.overlay {
position: fixed;
top: 0;
left: 0;
background-color: rgba(255, 255, 255, 0.2);
z-index: 990;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12px;
}
.close-icon {
position: absolute;
top: 0px;
right: 5px;
cursor: pointer;
color: white;
font-size: 24px;
border-radius: 8px;
}
.modal-content {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: rgba(255, 255, 255, 0.5);
border-radius: 8px;
padding: 5px;
width: 1000px;
height: 565px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
z-index: 1200;
}
video {
height: 580px;
}
</style>