2020-04-16 12:27:03 -04:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div v-if="options.sources">
|
|
|
|
<video
|
|
|
|
:id="reference"
|
|
|
|
class="video-js vjs-default-skin vjs-big-play-centered vjs-16-9"
|
|
|
|
width="1024"
|
|
|
|
height="576"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
<script setup lang="ts">
|
2020-04-16 12:27:03 -04:00
|
|
|
import videojs from 'video.js'
|
2022-12-20 04:04:45 -05:00
|
|
|
import 'video.js/dist/video-js.css'
|
2020-04-16 12:27:03 -04:00
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
const player = ref()
|
2020-04-16 12:27:03 -04:00
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
const props = defineProps({
|
|
|
|
options: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
2020-04-16 12:27:03 -04:00
|
|
|
},
|
2023-01-11 04:54:25 -05:00
|
|
|
reference: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2020-04-16 12:27:03 -04:00
|
|
|
},
|
2023-01-11 04:54:25 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
player.value = videojs(props.reference, props.options, function onPlayerReady() {
|
|
|
|
// console.log('onPlayerReady', this);
|
|
|
|
})
|
|
|
|
})
|
2020-04-16 12:27:03 -04:00
|
|
|
|
2023-01-11 04:54:25 -05:00
|
|
|
onBeforeUnmount(() => {
|
|
|
|
if (player.value) {
|
|
|
|
player.value.dispose()
|
2020-04-16 12:27:03 -04:00
|
|
|
}
|
2023-01-11 04:54:25 -05:00
|
|
|
})
|
2020-04-16 12:27:03 -04:00
|
|
|
</script>
|