safetwitch/src/components/VideoPlayer.vue

36 lines
682 B
Vue
Raw Normal View History

2023-03-17 21:20:51 -04:00
<template>
<div>
<video id="video-player" class="video-js vjs-defaultskin"></video>
</div>
</template>
<script lang="ts">
// Importing video-js
2023-03-18 13:49:02 -04:00
import videojs from 'video.js'
import qualityLevels from 'videojs-contrib-quality-levels'
videojs.registerPlugin('qualityLevels', qualityLevels)
2023-03-17 21:20:51 -04:00
export default {
name: 'VideoJsPlayer',
props: {
options: {
type: Object,
default() {
2023-03-18 13:49:02 -04:00
return {}
2023-03-17 21:20:51 -04:00
}
}
},
data() {
let player: any
return {
player
}
},
// initializing the video player
// when the component is being mounted
mounted() {
2023-03-29 10:26:55 -04:00
this.player = videojs('video-player', this.options, () => {})
2023-03-17 21:20:51 -04:00
}
}
2023-03-18 13:49:02 -04:00
</script>