From 087295e482dd20f7937d5da23112e0821ff02b9c Mon Sep 17 00:00:00 2001 From: shirt <2660574+shirt-dev@users.noreply.github.com> Date: Sat, 25 Sep 2021 20:14:42 -0400 Subject: [PATCH] v2.0.7: Chromium Edge Support --- cadmium-playercore-shim.js | 75 +++++++++++++++++++++++++++++++------- content_script.js | 1 + manifest.json | 2 +- pages/options.html | 2 + pages/options.js | 11 ++++-- 5 files changed, 72 insertions(+), 19 deletions(-) diff --git a/cadmium-playercore-shim.js b/cadmium-playercore-shim.js index 23c887e..56edca2 100644 --- a/cadmium-playercore-shim.js +++ b/cadmium-playercore-shim.js @@ -26,33 +26,80 @@ var cadmium_src = request.responseText; // eslint-disable-next-line no-unused-vars function get_profile_list() { + // Always add h264 profiles var custom_profiles = [ "playready-h264mpl30-dash", "playready-h264mpl31-dash", "playready-h264mpl40-dash", "playready-h264hpl30-dash", "playready-h264hpl31-dash", - "playready-h264hpl40-dash", - "heaac-2-dash", - "heaac-2hq-dash", - "simplesdh", - "nflx-cmisc", - "BIF240", - "BIF320" + "playready-h264hpl40-dash", ]; - if (!globalOptions.disableVP9) { + if (window.MSMediaKeys) { + // Chromium Edge Specific + + // Always add 2.0 AAC profiles, some manifests fail without them custom_profiles = custom_profiles.concat([ - "vp9-profile0-L30-dash-cenc", - "vp9-profile0-L31-dash-cenc", - "vp9-profile0-L40-dash-cenc", + "heaac-2-dash", + "heaac-2hq-dash", ]); - } - if (globalOptions.use6Channels) { - custom_profiles.push("heaac-5.1-dash"); + if (globalOptions.useDDPlus) { + // Dolby Digital + custom_profiles = custom_profiles.concat([ + "ddplus-2.0-dash", + ]); + + if (globalOptions.use6Channels) { + custom_profiles = custom_profiles.concat([ + "ddplus-5.1-dash", + "ddplus-5.1hq-dash", + "ddplus-atmos-dash", + ]); + } + } else { + // No Dolby Digital + if (globalOptions.use6Channels) { + custom_profiles = custom_profiles.concat([ + "heaac-5.1-dash", + ]); + } + } + + + } else { + // Chrome, Firefox Specific + + if (!globalOptions.disableVP9) { + // Add VP9 Profiles if wanted + custom_profiles = custom_profiles.concat([ + "vp9-profile0-L30-dash-cenc", + "vp9-profile0-L31-dash-cenc", + "vp9-profile0-L40-dash-cenc", + ]); + } + + custom_profiles = custom_profiles.concat([ + "heaac-2-dash", + "heaac-2hq-dash", + ]); + + if (globalOptions.use6Channels) { + custom_profiles = custom_profiles.concat([ + "heaac-5.1-dash", + ]); + } } + // Always add subtitles + custom_profiles = custom_profiles.concat([ + "simplesdh", + "nflx-cmisc", + "BIF240", + "BIF320", + ]); + return custom_profiles; } diff --git a/content_script.js b/content_script.js index dbdd5b9..8e83fec 100644 --- a/content_script.js +++ b/content_script.js @@ -46,6 +46,7 @@ chromeStorageGet({ showAllTracks: true, setMaxBitrate: false, disableVP9: false, + useDDPlus: false, }).then(items => { // very messy workaround for accessing chrome storage outside of background / content scripts let mainScript = document.createElement("script"); diff --git a/manifest.json b/manifest.json index 8f93608..c1225ce 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Netflix International", "description": "Displays all available Netflix audio tracks.", - "version": "2.0.6", + "version": "2.0.7", "author": "shirt", "browser_action": { "default_icon": "img/icon128.png" diff --git a/pages/options.html b/pages/options.html index 8fdee4a..15620b8 100644 --- a/pages/options.html +++ b/pages/options.html @@ -13,6 +13,8 @@
+
+
diff --git a/pages/options.js b/pages/options.js index 036b895..12bda4c 100644 --- a/pages/options.js +++ b/pages/options.js @@ -4,12 +4,14 @@ function save_options() { const showAllTracks = document.getElementById("showAllTracks").checked; const setMaxBitrate = document.getElementById("setMaxBitrate").checked; const disableVP9 = document.getElementById("disableVP9").checked; + const useDDPlus = document.getElementById("useDDPlus").checked; chrome.storage.sync.set({ - use6Channels, - showAllTracks, - setMaxBitrate, - disableVP9, + use6Channels: use6Channels, + showAllTracks: showAllTracks, + setMaxBitrate: setMaxBitrate, + disableVP9: disableVP9, + useDDPlus: useDDPlus, }, function() { var status = document.getElementById("status"); status.textContent = "Options saved."; @@ -25,6 +27,7 @@ function restore_options() { showAllTracks: true, setMaxBitrate: false, disableVP9: false, + useDDPlus: false, }, function(items) { document.getElementById("use51").checked = items.use6Channels; document.getElementById("showAllTracks").checked = items.showAllTracks;