0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-26 05:05:23 +00:00

fix: Beta Player Updates

fix beta player (again), add 'seekbar' module and improve readability
This commit is contained in:
Kenny 2022-04-29 07:49:32 -04:00
parent 3c732c5f76
commit 36a995781a
3 changed files with 52 additions and 22 deletions

View file

@ -9,42 +9,27 @@
style="max-height: 50vh; display: block" style="max-height: 50vh; display: block"
@webkitfullscreenchange="handleFullscreenChange" @webkitfullscreenchange="handleFullscreenChange"
/> />
<v-progress-linear <seekbar :video=$refs.player v-if="$refs.player" />
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> --> <!-- <v-slider v-model="value" step="0"></v-slider> -->
{{ vidSrc }} {{ vidSrc }}
</div> </div>
</template> </template>
<script> <script>
import seekbar from '~/components/Player/seekbar.vue';
export default { export default {
props: ["sources"], props: ["sources"],
components: {
seekbar
},
data() { data() {
return { return {
vidSrc: "", vidSrc: "",
percentage: 0,
buffered: 0,
}; };
}, },
mounted() { mounted() {
this.vidSrc = this.sources[this.sources.length-1].url; this.vidSrc = this.sources[this.sources.length-1].url;
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: { methods: {
handleFullscreenChange() { handleFullscreenChange() {

View file

@ -0,0 +1,45 @@
<template>
<div>
<v-progress-linear
active
background-color="primary"
background-opacity="0.5"
:buffer-value="buffered"
color="primary"
height="3"
query
:value="percentage"
/>
{{ percentage }}
{{ buffered }}
</div>
</template>
<script>
export default {
props: ["video"],
data() {
return {
percentage: 0,
buffered: 0
}
},
mounted() {
this.video.ontimeupdate = () => {
this.percentage = (this.video.currentTime / this.video.duration) * 100;
};
this.video.addEventListener("progress", () => {
this.buffered = (this.video.buffered.end(0) / this.video.duration) * 100;
});
}
}
</script>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="accent"> <div>
<player :sources="sources" v-if="sources.length > 0" /> <player :sources="sources" v-if="sources.length > 0" />