diff --git a/cadmium-playercore-shim.js b/cadmium-playercore-shim.js index cdcc5fd..e869cc7 100644 --- a/cadmium-playercore-shim.js +++ b/cadmium-playercore-shim.js @@ -39,86 +39,77 @@ request.send(); var cadmium_src = request.responseText; // eslint-disable-next-line no-unused-vars -function get_profile_list() { +function get_profile_list(original_profiles) { + var profiles = original_profiles; // Always add h264 main profiles - var custom_profiles = [ - "playready-h264mpl30-dash", - "playready-h264mpl31-dash", - "playready-h264mpl40-dash", - ]; - - if (window.MSMediaKeys) { - // PlayReady Specific - - // Always add 2.0 AAC profiles, some manifests fail without them - custom_profiles = custom_profiles.concat([ - "heaac-2-dash", - "heaac-2hq-dash", + if (original_profiles.includes("playready-h264mpl30-dash")) { + profiles = profiles.concat([ + "playready-h264mpl30-dash", + "playready-h264mpl31-dash", + "playready-h264mpl40-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 { - // Widevine Specific - custom_profiles = custom_profiles.concat([ + if (original_profiles.includes("playready-h264hpl30-dash")) { + profiles = profiles.concat([ "playready-h264hpl30-dash", "playready-h264hpl31-dash", "playready-h264hpl40-dash", ]); + } - 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", - ]); - } + if (original_profiles.includes("h264hpl30-dash-playready-live")) { + profiles = profiles.concat([ + "h264hpl30-dash-playready-live", + "h264hpl31-dash-playready-live", + "h264hpl40-dash-playready-live", + ]); + } - custom_profiles = custom_profiles.concat([ - "heaac-2-dash", - "heaac-2hq-dash", + if (!globalOptions.disableVP9 && original_profiles.includes("vp9-profile0-L30-dash-cenc")) { + profiles = profiles.concat([ + "vp9-profile0-L30-dash-cenc", + "vp9-profile0-L31-dash-cenc", + "vp9-profile0-L40-dash-cenc", + ]); + } else { + profiles = profiles.filter(val => !val.includes("vp9-")); + } + + if (!globalOptions.disableAV1 && original_profiles.includes("av1-main-L30-dash-cbcs-prk")) { + profiles = profiles.concat([ + "av1-main-L30-dash-cbcs-prk", + "av1-main-L31-dash-cbcs-prk", + "av1-main-L40-dash-cbcs-prk", + ]); + } else { + profiles = profiles.filter(val => !val.includes("av1-")); + } + + if (globalOptions.useDDPlus && MediaSource.isTypeSupported('audio/mp4; codecs="ec-3"')) { + // Dolby Digital + profiles = profiles.concat([ + "ddplus-2.0-dash", ]); if (globalOptions.use6Channels) { - custom_profiles = custom_profiles.concat([ + profiles = profiles.concat([ + "ddplus-5.1-dash", + "ddplus-5.1hq-dash", + "ddplus-atmos-dash", + ]); + } + } else { + // No Dolby Digital + if (globalOptions.use6Channels) { + profiles = profiles.concat([ "heaac-5.1-dash", ]); } } - // Always add subtitles - custom_profiles = custom_profiles.concat([ - "dfxp-ls-sdh", - "simplesdh", - "nflx-cmisc", - "imsc1.1", - "BIF240", - "BIF320", - ]); - - return custom_profiles; + profiles = [...new Set(profiles)].sort(); + return profiles; } // eslint-disable-next-line no-unused-vars @@ -139,14 +130,14 @@ do_patch( do_patch( "Custom profiles", - /(viewableId:.,profiles:).,/, - "$1 get_profile_list()," + /(viewableId:.,profiles:)(.),/, + "$1 get_profile_list($2)," ); do_patch( "Custom profiles 2", - /(name:"default",profiles:).}/, - "$1 get_profile_list()}" + /(name:"default",profiles:)(.)}/, + "$1 get_profile_list($2)}" ); do_patch( diff --git a/content_script.js b/content_script.js index 7e54d78..d6ed47b 100644 --- a/content_script.js +++ b/content_script.js @@ -46,6 +46,7 @@ chromeStorageGet({ showAllTracks: true, setMaxBitrate: false, disableVP9: false, + disableAV1: true, useDDPlus: false, preferredLocale: null, preferredTextLocale: null, diff --git a/manifest.json b/manifest.json index 5a49433..ab66991 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.15", + "version": "2.0.16", "author": "shirt", "browser_action": { "default_icon": "img/icon128.png", diff --git a/pages/options.html b/pages/options.html index 5bf7140..6f1598f 100644 --- a/pages/options.html +++ b/pages/options.html @@ -19,6 +19,8 @@

+ +

diff --git a/pages/options.js b/pages/options.js index 55d2ad5..9f4498c 100644 --- a/pages/options.js +++ b/pages/options.js @@ -4,6 +4,7 @@ function save_options() { const showAllTracks = document.getElementById("showAllTracks").checked; const setMaxBitrate = document.getElementById("setMaxBitrate").checked; const disableVP9 = document.getElementById("disableVP9").checked; + const disableAV1 = document.getElementById("disableAV1").checked; const useDDPlus = document.getElementById("useDDPlus").checked; const preferredLocale = document.getElementById("preferredLocale").value; const preferredTextLocale = document.getElementById("preferredTextLocale").value; @@ -13,6 +14,7 @@ function save_options() { showAllTracks: showAllTracks, setMaxBitrate: setMaxBitrate, disableVP9: disableVP9, + disableAV1: disableAV1, useDDPlus: useDDPlus, preferredLocale: preferredLocale, preferredTextLocale: preferredTextLocale, @@ -30,6 +32,7 @@ function reset_options() { document.getElementById("showAllTracks").checked = true; document.getElementById("setMaxBitrate").checked = false; document.getElementById("disableVP9").checked = false; + document.getElementById("disableAV1").checked = true; document.getElementById("useDDPlus").checked = false; document.getElementById("preferredLocale").value = null; document.getElementById("preferredTextLocale").value = null; @@ -39,6 +42,7 @@ function reset_options() { showAllTracks: true, setMaxBitrate: false, disableVP9: false, + disableAV1: true, useDDPlus: false, preferredLocale: null, preferredTextLocale: null, @@ -57,6 +61,7 @@ function restore_options() { showAllTracks: true, setMaxBitrate: false, disableVP9: false, + disableAV1: true, useDDPlus: false, preferredLocale: null, preferredTextLocale: null, @@ -65,6 +70,7 @@ function restore_options() { document.getElementById("showAllTracks").checked = items.showAllTracks; document.getElementById("setMaxBitrate").checked = items.setMaxBitrate; document.getElementById("disableVP9").checked = items.disableVP9; + document.getElementById("disableAV1").checked = items.disableAV1; document.getElementById("useDDPlus").checked = items.useDDPlus; document.getElementById("preferredLocale").value = items.preferredLocale; document.getElementById("preferredTextLocale").value = items.preferredTextLocale;