Implement @level3tjg's 360p fallback
Ref: https://github.com/cleanlock/VideoAdBlockForTwitch/pull/96
This commit is contained in:
@@ -58,9 +58,9 @@ twitch-videoad.js text/javascript
|
||||
scope.ClientVersion = 'null';
|
||||
scope.ClientSession = 'null';
|
||||
//scope.PlayerType1 = 'site'; //Source - NOTE: This is unused as it's implicitly used by the website iself
|
||||
scope.PlayerType2 = 'embed'; //Source
|
||||
scope.PlayerType2 = 'autoplay'; //360p
|
||||
scope.PlayerType3 = 'proxy'; //Source
|
||||
scope.PlayerType4 = 'thunderdome'; //480p
|
||||
scope.PlayerType4 = 'embed'; //Source
|
||||
scope.CurrentChannelName = null;
|
||||
scope.UsherParams = null;
|
||||
scope.WasShowingAd = false;
|
||||
@@ -163,8 +163,8 @@ twitch-videoad.js text/javascript
|
||||
if (OriginalVideoPlayerQuality == null) {
|
||||
OriginalVideoPlayerQuality = currentQuality;
|
||||
}
|
||||
if (!currentQuality.includes('480') || e.data.value != null) {
|
||||
if (!OriginalVideoPlayerQuality.includes('480')) {
|
||||
if (!currentQuality.includes('360') || e.data.value != null) {
|
||||
if (!OriginalVideoPlayerQuality.includes('360')) {
|
||||
var settingsMenu = document.querySelector('div[data-a-target="player-settings-menu"]');
|
||||
if (settingsMenu == null) {
|
||||
var settingsCog = document.querySelector('button[data-a-target="player-settings-button"]');
|
||||
@@ -176,7 +176,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
var lowQuality = document.querySelectorAll('input[data-a-target="tw-radio"');
|
||||
if (lowQuality) {
|
||||
var qualityToSelect = lowQuality.length - 3;
|
||||
var qualityToSelect = lowQuality.length - 2;
|
||||
if (e.data.value != null) {
|
||||
if (e.data.value.includes('original')) {
|
||||
e.data.value = OriginalVideoPlayerQuality;
|
||||
@@ -223,6 +223,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
var currentQualityLS = window.localStorage.getItem('video-quality');
|
||||
lowQuality[qualityToSelect].click();
|
||||
settingsCog.click();
|
||||
window.localStorage.setItem('video-quality', currentQualityLS);
|
||||
if (e.data.value != null) {
|
||||
OriginalVideoPlayerQuality = null;
|
||||
@@ -643,7 +644,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
function getAccessToken(channelName, playerType, realFetch) {
|
||||
var body = null;
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "ios", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "ios", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
body = {
|
||||
operationName: 'PlaybackAccessToken_Template',
|
||||
query: templateQuery,
|
||||
|
||||
Reference in New Issue
Block a user