From ded0aa2eb444c24ede1a49f39923f9e32d3eb722 Mon Sep 17 00:00:00 2001 From: Georgiy Date: Mon, 8 May 2023 13:41:11 +0300 Subject: [PATCH] refactor(qualitySelection): Updated video quality selection list. 1. Sorted from top to bottom, from best to worst quality. 2. Changed bps to Mbps 3. Auto selection high quality video and audio --- NUXT/components/Player/index.vue | 14 ++++++++++---- NUXT/components/Player/quality.vue | 19 ++++++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/NUXT/components/Player/index.vue b/NUXT/components/Player/index.vue index 57eda1a..ad2a8db 100644 --- a/NUXT/components/Player/index.vue +++ b/NUXT/components/Player/index.vue @@ -420,10 +420,16 @@ export default { this.vid = this.$refs.player; // TODO: this.$store.state.player.quality, check if exists and select the closest one - if (this.$store.state.player.preload) this.prebuffer(this.sources[5].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[5].url; + this.prebuffer(this.sources[0].url); + this.sources.forEach((source) => { + if (source.mimeType.indexOf("audio") > -1) { + this.audSrc = source.url; + this.vidSrc = this.sources[0].url; + } + }); } this.$youtube.getSponsorBlock(this.video.id, (data) => { @@ -463,9 +469,9 @@ export default { // // There is not enough data to keep playing from this point // } if (this.vid.readyState >= 3) { - this.$refs.audio.play(); this.bufferingDetected = false; this.$refs.audio.currentTime = this.vid.currentTime; + this.$refs.audio.play(); if (!this.isMusic) { this.$refs.audio.playbackRate = this.$store.state.player.speed; diff --git a/NUXT/components/Player/quality.vue b/NUXT/components/Player/quality.vue index 0e38b1e..ad0f421 100644 --- a/NUXT/components/Player/quality.vue +++ b/NUXT/components/Player/quality.vue @@ -7,7 +7,14 @@ scrollable >