1
0
mirror of https://github.com/pixeltris/TwitchAdSolutions.git synced 2024-11-22 02:12:45 +01:00

Possibly fix midroll pause/play issue

This commit is contained in:
pixeltris 2021-06-30 13:01:44 +01:00
parent ac04e98d61
commit e476b5d661
5 changed files with 28 additions and 23 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name TwitchAdSolutions
// @namespace https://github.com/pixeltris/TwitchAdSolutions
// @version 1.9
// @version 1.10
// @description Multiple solutions for blocking Twitch ads
// @author pixeltris
// @match *://*.twitch.tv/*
@ -148,7 +148,7 @@
break;
}
}
streamInfo.HadAds = true;
streamInfo.HadAds[url] = true;
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
@ -272,9 +272,9 @@
streamInfo.BackupUrl = null;
return '';
}
if (streamInfo.HadAds) {
if (streamInfo.HadAds[url]) {
postMessage({key:'UboPauseResumePlayer'});
streamInfo.HadAds = false;
streamInfo.HadAds[url] = false;
}
postMessage({key:'UboHideAdBanner'});
return textStr;
@ -340,7 +340,7 @@
streamInfo.BackupRegUrl = null;
streamInfo.BackupRegRes = null;
streamInfo.IsMidroll = false;
streamInfo.HadAds = false;
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
var lines = encodingsM3u8.replace('\r', '').split('\n');
for (var i = 0; i < lines.length; i++) {
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
@ -351,6 +351,7 @@
streamInfo.Urls[lines[i]] = res;
}
}
streamInfo.HadAds[lines[i]] = false;
StreamInfosByUrl[lines[i]] = streamInfo;
}
}

View File

@ -139,7 +139,7 @@ twitch-videoad.js application/javascript
break;
}
}
streamInfo.HadAds = true;
streamInfo.HadAds[url] = true;
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
@ -263,9 +263,9 @@ twitch-videoad.js application/javascript
streamInfo.BackupUrl = null;
return '';
}
if (streamInfo.HadAds) {
if (streamInfo.HadAds[url]) {
postMessage({key:'UboPauseResumePlayer'});
streamInfo.HadAds = false;
streamInfo.HadAds[url] = false;
}
postMessage({key:'UboHideAdBanner'});
return textStr;
@ -331,7 +331,7 @@ twitch-videoad.js application/javascript
streamInfo.BackupRegUrl = null;
streamInfo.BackupRegRes = null;
streamInfo.IsMidroll = false;
streamInfo.HadAds = false;
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
var lines = encodingsM3u8.replace('\r', '').split('\n');
for (var i = 0; i < lines.length; i++) {
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
@ -342,6 +342,7 @@ twitch-videoad.js application/javascript
streamInfo.Urls[lines[i]] = res;
}
}
streamInfo.HadAds[lines[i]] = false;
StreamInfosByUrl[lines[i]] = streamInfo;
}
}

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name TwitchAdSolutions (notify-reload)
// @namespace https://github.com/pixeltris/TwitchAdSolutions
// @version 1.9
// @version 1.10
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
// @description Multiple solutions for blocking Twitch ads (notify-reload)
@ -150,7 +150,7 @@
break;
}
}
streamInfo.HadAds = true;
streamInfo.HadAds[url] = true;
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
@ -274,9 +274,9 @@
streamInfo.BackupUrl = null;
return '';
}
if (streamInfo.HadAds) {
if (streamInfo.HadAds[url]) {
postMessage({key:'UboPauseResumePlayer'});
streamInfo.HadAds = false;
streamInfo.HadAds[url] = false;
}
postMessage({key:'UboHideAdBanner'});
return textStr;
@ -342,7 +342,7 @@
streamInfo.BackupRegUrl = null;
streamInfo.BackupRegRes = null;
streamInfo.IsMidroll = false;
streamInfo.HadAds = false;
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
var lines = encodingsM3u8.replace('\r', '').split('\n');
for (var i = 0; i < lines.length; i++) {
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
@ -353,6 +353,7 @@
streamInfo.Urls[lines[i]] = res;
}
}
streamInfo.HadAds[lines[i]] = false;
StreamInfosByUrl[lines[i]] = streamInfo;
}
}

View File

@ -139,7 +139,7 @@ twitch-videoad.js application/javascript
break;
}
}
streamInfo.HadAds = true;
streamInfo.HadAds[url] = true;
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
@ -263,9 +263,9 @@ twitch-videoad.js application/javascript
streamInfo.BackupUrl = null;
return '';
}
if (streamInfo.HadAds) {
if (streamInfo.HadAds[url]) {
postMessage({key:'UboPauseResumePlayer'});
streamInfo.HadAds = false;
streamInfo.HadAds[url] = false;
}
postMessage({key:'UboHideAdBanner'});
return textStr;
@ -331,7 +331,7 @@ twitch-videoad.js application/javascript
streamInfo.BackupRegUrl = null;
streamInfo.BackupRegRes = null;
streamInfo.IsMidroll = false;
streamInfo.HadAds = false;
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
var lines = encodingsM3u8.replace('\r', '').split('\n');
for (var i = 0; i < lines.length; i++) {
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
@ -342,6 +342,7 @@ twitch-videoad.js application/javascript
streamInfo.Urls[lines[i]] = res;
}
}
streamInfo.HadAds[lines[i]] = false;
StreamInfosByUrl[lines[i]] = streamInfo;
}
}

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name TwitchAdSolutions (notify-strip)
// @namespace https://github.com/pixeltris/TwitchAdSolutions
// @version 1.9
// @version 1.10
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
// @description Multiple solutions for blocking Twitch ads (notify-strip)
@ -150,7 +150,7 @@
break;
}
}
streamInfo.HadAds = true;
streamInfo.HadAds[url] = true;
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
@ -274,9 +274,9 @@
streamInfo.BackupUrl = null;
return '';
}
if (streamInfo.HadAds) {
if (streamInfo.HadAds[url]) {
postMessage({key:'UboPauseResumePlayer'});
streamInfo.HadAds = false;
streamInfo.HadAds[url] = false;
}
postMessage({key:'UboHideAdBanner'});
return textStr;
@ -342,7 +342,7 @@
streamInfo.BackupRegUrl = null;
streamInfo.BackupRegRes = null;
streamInfo.IsMidroll = false;
streamInfo.HadAds = false;
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
var lines = encodingsM3u8.replace('\r', '').split('\n');
for (var i = 0; i < lines.length; i++) {
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
@ -353,6 +353,7 @@
streamInfo.Urls[lines[i]] = res;
}
}
streamInfo.HadAds[lines[i]] = false;
StreamInfosByUrl[lines[i]] = streamInfo;
}
}