Line data Source code
1 : <script setup lang="ts">
2 : import { ref, useTemplateRef } from 'vue'
3 :
4 : const { src } = defineProps<{
5 : src: string
6 : label?: string
7 : }>()
8 :
9 2355 : const videoRef = useTemplateRef('videoRef')
10 1 : const width = ref('')
11 1 : const height = ref('')
12 1 : </script>
13 : <template>
14 : <video
15 : ref="videoRef"
16 : :src
17 : controls
18 : v-bind="$attrs"
19 : @loadedmetadata="
20 : () => {
21 : if (!videoRef) return
22 : width = `${videoRef.videoWidth}`
23 : height = `${videoRef.videoHeight}`
24 : }
25 : "
26 : />
27 : <span class="z-10 self-center">
28 : {{ `${width} x ${height}` }}
29 : <template v-if="label"> | {{ label }}</template>
30 : </span>
31 : </template>
|