From a7bb37d62f30130b9467927168670b38f70a9a9a Mon Sep 17 00:00:00 2001 From: shirt <2660574+shirt-dev@users.noreply.github.com> Date: Mon, 9 May 2022 08:01:25 -0400 Subject: [PATCH] Disable AV1 in non-chromium browsers --- cadmium-playercore-shim.js | 25 ++++++++++++++++++++++--- manifest.json | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cadmium-playercore-shim.js b/cadmium-playercore-shim.js index 9e35f94..f409fdf 100644 --- a/cadmium-playercore-shim.js +++ b/cadmium-playercore-shim.js @@ -2,6 +2,20 @@ // This script runs as a drop-in replacement of the original cadmium-playercore. This is not a content script. console.log("Netflix International script active!"); +/* eslint-disable no-undef */ +// https://stackoverflow.com/a/45985333 +function getBrowser() { + if (typeof chrome !== "undefined") { + if (typeof browser !== "undefined") { + return "Firefox"; + } else { + return "Chrome"; + } + } else { + return "Edge"; + } +} + function do_patch(desc, needle, replacement) { var match = cadmium_src.match(needle); if (!match) { @@ -79,10 +93,15 @@ function get_profile_list() { "vp9-profile0-L30-dash-cenc", "vp9-profile0-L31-dash-cenc", "vp9-profile0-L40-dash-cenc", - "av1-main-L30-dash-cbcs-prk", - "av1-main-L31-dash-cbcs-prk", - "av1-main-L40-dash-cbcs-prk", ]); + + if (getBrowser() == "Chrome") { + custom_profiles = custom_profiles.concat([ + "av1-main-L30-dash-cbcs-prk", + "av1-main-L31-dash-cbcs-prk", + "av1-main-L40-dash-cbcs-prk", + ]); + } } custom_profiles = custom_profiles.concat([ diff --git a/manifest.json b/manifest.json index a503762..c14f974 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Netflix International", "description": "Displays all available Netflix audio and subtitle tracks.", - "version": "2.0.13", + "version": "2.0.14", "author": "shirt", "browser_action": { "default_icon": "img/icon128.png",