diff --git a/NUXT/components/Player/index.vue b/NUXT/components/Player/index.vue index 2f1438a..052d815 100644 --- a/NUXT/components/Player/index.vue +++ b/NUXT/components/Player/index.vue @@ -33,8 +33,12 @@ :height="isFullscreen ? '100%' : 'auto'" style="transition: filter 0.15s ease-in-out, transform 0.15s linear" :class=" - controls || seeking || skipping - ? verticalFullscreen + controls || + seeking || + skipping || + ($store.state.player.preload && buffered < 100) + ? verticalFullscreen && + !($store.state.player.preload && buffered < 100) ? 'dim-ish' : 'dim' : '' @@ -137,6 +141,7 @@
+ + + {{ buffered }}% +
@@ -381,7 +402,7 @@ export default { let vid = this.$refs.player; // TODO: this.$store.state.player.quality, check if exists and select the closest one - if (this.$store.state.player.prebuffer) this.prebuffer(this.sources[0].url); + if (this.$store.state.player.preload) this.prebuffer(this.sources[0].url); else { this.audSrc = this.sources[this.sources.length - 1].url; this.vidSrc = this.sources[0].url; @@ -439,26 +460,29 @@ export default { ); }, beforeDestroy() { + this.xhr.abort(); if (this.isFullscreen) this.exitFullscreen(); screen.orientation.removeEventListener("change"); }, methods: { prebuffer(url) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, true); - xhr.responseType = "blob"; + this.xhr = new XMLHttpRequest(); + this.xhr.open("GET", url, true); + this.xhr.responseType = "blob"; - xhr.addEventListener( + this.xhr.addEventListener( "load", () => { - if (xhr.status === 200) { - var blob = xhr.response; + if (this.xhr.status === 200) { + var blob = this.xhr.response; + console.error(this.xhr); this.blobToDataURL(blob, (dataurl) => { console.log(dataurl); this.vidSrc = dataurl; + this.buffered = 100; }); } else { - console.error("errorred pre-fetch", xhr.status); + console.error("errorred pre-fetch", this.xhr.status); } }, false @@ -466,17 +490,18 @@ export default { var prev_pc = 0; // TODO: big progress overlay (##%) to replace controls while loading if pre-buffering is enabled - xhr.addEventListener("progress", (event) => { + this.xhr.addEventListener("progress", (event) => { if (event.lengthComputable) { var pc = Math.round((event.loaded / event.total) * 100); if (pc != prev_pc) { prev_pc = pc; // ##% - console.log("buffering progress", pc); + if (pc < 100) this.buffered = pc; + console.warn(this.xhr); } } }); - xhr.send(); + this.xhr.send(); }, blobToDataURL(blob, callback) { var a = new FileReader(); diff --git a/NUXT/pages/mods/player.vue b/NUXT/pages/mods/player.vue index bab9dce..5ff7061 100644 --- a/NUXT/pages/mods/player.vue +++ b/NUXT/pages/mods/player.vue @@ -6,63 +6,92 @@ - + - +

mdi-speedometer @@ -79,7 +108,7 @@ > + {}, + value: false, + name: "Mute", + icon: "mdi-volume-off", + disabled: true, + }, + { + action: () => { + this.loop = !this.loop; + }, + value: this.loop, + name: "Loop", + icon: "mdi-sync-circle", + }, + ], + }; + }, }, }; diff --git a/NUXT/pages/mods/theme.vue b/NUXT/pages/mods/theme.vue index 6d3ec40..8be24ba 100644 --- a/NUXT/pages/mods/theme.vue +++ b/NUXT/pages/mods/theme.vue @@ -126,7 +126,7 @@
diff --git a/NUXT/pages/watch.vue b/NUXT/pages/watch.vue index 5b82f8d..b688faa 100644 --- a/NUXT/pages/watch.vue +++ b/NUXT/pages/watch.vue @@ -53,7 +53,7 @@ mdi-chevron-down