From c529b003b29dcacfe7fa1b1ca166fc9c85b8c73d Mon Sep 17 00:00:00 2001
From: FireMasterK <20838718+FireMasterK@users.noreply.github.com>
Date: Fri, 27 Aug 2021 13:03:55 +0530
Subject: [PATCH] Add support for enabling / disabling codecs.
---
src/components/Player.vue | 14 +++++++++++---
src/components/Preferences.vue | 14 +++++++++++++-
src/locales/en.json | 3 ++-
3 files changed, 26 insertions(+), 5 deletions(-)
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 @@
+
+
+
+