mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
2.5 KiB
118 lines
2.5 KiB
4 months ago
|
<script setup lang="ts">
|
||
4 months ago
|
import videojs from 'video.js'
|
||
|
import { stripUndefinedOrNull } from '~/utils/objectUtils'
|
||
|
import 'video.js/dist/video-js.css'
|
||
|
|
||
4 months ago
|
interface Props {
|
||
4 months ago
|
autoplay?: boolean
|
||
|
controls?: boolean
|
||
|
height?: string | number
|
||
|
loop?: boolean
|
||
|
muted?: boolean
|
||
|
poster?: string
|
||
|
preload?: 'auto' | 'metadata' | 'none'
|
||
|
width?: string | number
|
||
|
aspectRatio?: string
|
||
|
audioOnlyMode?: boolean
|
||
|
audioPosterMode?: boolean
|
||
|
autoSetup?: boolean
|
||
|
disablePictureInPicture?: boolean
|
||
|
enableDocumentPictireInPicture?: boolean
|
||
|
enableSmoothSeeking?: boolean
|
||
|
fluid?: boolean
|
||
|
src?: string
|
||
|
fullScreen?: {
|
||
|
options?: {
|
||
|
navigationUI?: 'hide' | 'show'
|
||
|
id?: string
|
||
|
}
|
||
|
}
|
||
|
inactivityTimeout?: number
|
||
|
language?: string
|
||
|
liveui?: boolean
|
||
|
notSupportedMessage?: string
|
||
|
playbackRates?: number[]
|
||
|
playsinline?: boolean
|
||
|
plugins?: Record<string, any>
|
||
|
preferFullWindow?: boolean
|
||
|
responsive?: boolean
|
||
|
restoreEl?: Element | boolean
|
||
|
skipButtons?: {
|
||
|
forward?: number
|
||
|
back?: number
|
||
|
}
|
||
|
sources?: {
|
||
|
src: string
|
||
|
type: string
|
||
|
}[]
|
||
|
suppressNotSupportedError?: boolean
|
||
|
techOrder?: string[]
|
||
|
userActions?: {
|
||
|
click?: (event: Event) => void | boolean
|
||
|
doubleClick?: (event: Event) => void | boolean
|
||
|
hotkeys?: (event: Event) => void | boolean | Record<string, (event: Event) => void>
|
||
|
}
|
||
|
class?: string
|
||
|
}
|
||
|
|
||
|
const props = withDefaults(defineProps<Props>(), {
|
||
|
preload: 'metadata',
|
||
|
aspectRatio: '16:9',
|
||
|
controls: true,
|
||
|
audioOnlyMode: false,
|
||
|
audioPosterMode: false,
|
||
|
autoSetup: true,
|
||
|
disablePictureInPicture: false,
|
||
|
enableDocumentPictireInPicture: false,
|
||
|
enableSmoothSeeking: true,
|
||
|
fluid: true,
|
||
|
fullScreen: {
|
||
|
options: {
|
||
|
navigationUI: 'hide',
|
||
|
id: undefined,
|
||
|
},
|
||
|
},
|
||
|
language: 'en',
|
||
|
liveui: false,
|
||
|
playsinline: true,
|
||
|
preferFullWindow: false,
|
||
|
responsive: false,
|
||
|
restoreEl: false,
|
||
|
})
|
||
|
|
||
|
const emit = defineEmits<Emits>()
|
||
|
|
||
|
interface Emits {
|
||
|
(event: 'init', player: any): void
|
||
4 months ago
|
}
|
||
|
|
||
4 months ago
|
const videoPlayer = ref<Element>()
|
||
|
|
||
|
const player = ref()
|
||
4 months ago
|
|
||
4 months ago
|
onMounted(() => {
|
||
|
if (!videoPlayer.value) return
|
||
|
player.value = videojs(videoPlayer.value, stripUndefinedOrNull(props))
|
||
|
emit('init', player.value)
|
||
|
})
|
||
4 months ago
|
|
||
4 months ago
|
onBeforeUnmount(() => {
|
||
|
if (player.value) {
|
||
|
player.value.dispose()
|
||
|
}
|
||
|
})
|
||
4 months ago
|
</script>
|
||
|
|
||
|
<template>
|
||
4 months ago
|
<div
|
||
|
class="w-full"
|
||
|
:class="{
|
||
|
[props.class]: props.class,
|
||
|
}"
|
||
|
>
|
||
|
<video ref="videoPlayer" class="video-js h-full w-full"></video>
|
||
|
</div>
|
||
4 months ago
|
</template>
|
||
|
|
||
|
<style scoped lang="scss"></style>
|