0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-01 01:12:39 +00:00
VueTube/NUXT/components/videoPlayer.vue

61 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<div>
<video
2022-04-15 03:14:52 +00:00
ref="player"
controls
autoplay
:src="vidSrc"
width="100%"
2022-04-15 03:14:52 +00:00
style="max-height: 50vh; display: block"
@webkitfullscreenchange="handleFullscreenChange"
/>
2022-04-15 03:14:52 +00:00
<v-progress-linear
active
background-color="primary"
background-opacity="0.5"
:buffer-value="buffered"
color="primary"
height="3"
query
:value="percentage"
/>
<!-- <v-slider v-model="value" step="0"></v-slider> -->
</div>
</template>
<script>
export default {
props: ["vidSrc"],
2022-04-15 03:14:52 +00:00
data() {
return {
percentage: 0,
buffered: 0,
};
},
mounted() {
let vid = this.$refs.player;
vid.ontimeupdate = () => {
this.percentage = (vid.currentTime / vid.duration) * 100;
};
vid.addEventListener("progress", () => {
this.buffered = (vid.buffered.end(0) / vid.duration) * 100;
});
},
methods: {
handleFullscreenChange() {
if (document.fullscreenElement === this.$refs.player) {
this.$vuetube.statusBar.hide();
this.$vuetube.navigationBar.hide();
} else {
this.$vuetube.statusBar.show();
this.$vuetube.navigationBar.show();
}
},
getPlayer() {
return this.$refs.player;
},
},
};
</script>