diff --git a/src/components/Player.vue b/src/components/Player.vue index 883a1048..6175bd30 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -56,11 +56,19 @@ export default { }, preferredVideoCodecs: _this => { var preferredVideoCodecs = []; + const enabledCodecs = _this.getPreferenceString("enabledCodecs", "av1,vp9,avc").split(","); - if (_this.$refs.videoEl.canPlayType('video/mp4; codecs="av01.0.08M.08"') !== "") + if ( + _this.$refs.videoEl.canPlayType('video/mp4; codecs="av01.0.08M.08"') !== "" && + enabledCodecs.includes("av1") + ) preferredVideoCodecs.push("av01"); - if (_this.$refs.videoEl.canPlayType('video/webm; codecs="vp9"') !== "") preferredVideoCodecs.push("vp9"); - if (_this.$refs.videoEl.canPlayType('video/mp4; codecs="avc1.4d401f"') !== "") + if (_this.$refs.videoEl.canPlayType('video/webm; codecs="vp9"') !== "" && enabledCodecs.includes("vp9")) + preferredVideoCodecs.push("vp9"); + if ( + _this.$refs.videoEl.canPlayType('video/mp4; codecs="avc1.4d401f"') !== "" && + enabledCodecs.includes("avc") + ) preferredVideoCodecs.push("avc1"); return preferredVideoCodecs; diff --git a/src/components/Preferences.vue b/src/components/Preferences.vue index efc9bbff..3a09f2c0 100644 --- a/src/components/Preferences.vue +++ b/src/components/Preferences.vue @@ -98,6 +98,14 @@ +
+ +
+

@@ -170,6 +178,7 @@ export default { { code: "nb_NO", name: "Norwegian Bokmål" }, { code: "tr", name: "Turkish" }, ], + enabledCodecs: ["av1", "vp9", "avc"], }; }, activated() { @@ -255,6 +264,7 @@ export default { this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false); this.watchHistory = this.getPreferenceBoolean("watchHistory", false); this.selectedLanguage = this.getPreferenceString("hl", "en"); + this.enabledCodecs = this.getPreferenceString("enabledCodecs", "av1,vp9,avc").split(","); } }, methods: { @@ -265,7 +275,8 @@ export default { if ( this.getPreferenceString("theme", "dark") !== this.selectedTheme || this.getPreferenceBoolean("watchHistory", false) != this.watchHistory || - this.getPreferenceString("hl", "en") !== this.selectedLanguage + this.getPreferenceString("hl", "en") !== this.selectedLanguage || + this.getPreferenceString("enabledCodecs", "av1,vp9,avc") !== this.enabledCodecs.join(",") ) shouldReload = true; @@ -293,6 +304,7 @@ export default { localStorage.setItem("minimizeDescription", this.minimizeDescription); localStorage.setItem("watchHistory", this.watchHistory); localStorage.setItem("hl", this.selectedLanguage); + localStorage.setItem("enabledCodecs", this.enabledCodecs.join(",")); if (shouldReload) window.location.reload(); } diff --git a/src/locales/en.json b/src/locales/en.json index 24093944..79c9c85f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -43,6 +43,7 @@ "minimize_description": "Minimize Description by default", "store_watch_history": "Store Watch History", "language_selection": "Language Selection", - "instances_list": "Instances List" + "instances_list": "Instances List", + "enabled_codecs": "Enabled Codecs (Multiple)" } }