2022-03-30 12:32:08 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-04-29 01:44:37 +00:00
|
|
|
<video
|
|
|
|
ref="player"
|
|
|
|
controls
|
|
|
|
autoplay
|
|
|
|
:src="vidSrc"
|
|
|
|
width="100%"
|
|
|
|
style="max-height: 50vh; display: block"
|
|
|
|
@webkitfullscreenchange="handleFullscreenChange"
|
|
|
|
/>
|
|
|
|
<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> -->
|
|
|
|
{{ vidSrc }}
|
2022-03-30 12:32:08 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2022-04-29 01:44:37 +00:00
|
|
|
props: ["sources"],
|
2022-03-30 12:32:08 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2022-04-29 01:44:37 +00:00
|
|
|
vidSrc: "",
|
2022-03-30 12:32:08 +00:00
|
|
|
|
2022-04-29 01:44:37 +00:00
|
|
|
percentage: 0,
|
|
|
|
buffered: 0,
|
2022-03-30 12:32:08 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2022-04-29 01:44:37 +00:00
|
|
|
this.vidSrc = this.sources[this.sources.length-1].url;
|
2022-04-24 04:07:05 +00:00
|
|
|
|
2022-04-29 01:44:37 +00:00
|
|
|
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;
|
|
|
|
});
|
2022-03-30 12:32:08 +00:00
|
|
|
},
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-04-29 01:44:37 +00:00
|
|
|
getPlayer() {
|
|
|
|
return this.$refs.player;
|
2022-03-30 12:32:08 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|