Twitch - Mute ads and optionally hide them

Automatically mutes the Twitch player when an advertisement started and unmute it once finished. You can also hide ads by setting disableDisplay to true.

< Feedback on Twitch - Mute ads and optionally hide them

Review: Good - script works

§
Posted: 27.5.2021

version: 1.141
Ad container IDs updated again on twitch breaking it again.

Here is what i did to get to functioning agian.

under var _tmuteSelectors for the "hw"
"adNotice": "avap-ads-container"
change to
"adNotice": "sc-AxjAm fPolDm"

var advert = document.getElementsByClassName(currentSelector.adNotice)[0].parentNode;
change to
var advert = document.getElementsByClassName(currentSelector.adNotice)[1].parentNode;

did not try to fix the "old" section.

HarestAuthor
§
Posted: 28.5.2021
Edited: 28.5.2021

Are you sure? I still have it working just fine, the class avap-ads-container is still there in sc-AxjAm fPolDm avap-ads-container but i'm not sure it's a good idea to use these probably temp class names, hence why i tried to keep "attacking" names that shouldn't move too much.

Regarding that "old" section, technically i could remove it all together as the transition has been completed for a while now and only the Highwind player exists. I'll probably clear this up with the next potential update there may be depending on what Twitch will reserve us. I'll just keep the structure in case of a new transition that could occur in the next years.

§
Posted: 29.5.2021
Edited: 29.5.2021

avap-ads-container does not exist for me when viewing the twitch page elements (in DevTools) and the ads where not being muted/detected for me by the script.

I am using google chrome.
Just checked in firefox and sc-AxjAm fPolDm avap-ads-container is there so that would probably explain it. Odd that it was working fine before and they changed something for chrome for class names on twitch.

Chrome:
https://i.imgur.com/5JodP5E.png
https://i.imgur.com/CxMd5G8.png

Firefox:
https://i.imgur.com/UrBWgzv.png
https://i.imgur.com/KcUcElm.png

HarestAuthor
§
Posted: 29.5.2021
Edited: 29.5.2021

Wow, okay. That's weird behavior. I'm indeed using Firefox exclusively. Btw in the modification you put, you could just target var advert = document.getElementsByClassName(currentSelector.adNotice)[0]; instead. The parentNode was there initially because avap-ads-container is on the first child div of it but if you don't have it in Chrome :/.

I'll update the script to include the required change for Chrome there too.
Thanks for the info.

§
Posted: 30.5.2021

NP. yeah I just wanted to make as little changes as possible since I wasn't familiar with the layout of the containers and haven't ever touched getElements/etc before.

Thanks for the great script.

HarestAuthor
§
Posted: 1.7.2021
Edited: 1.7.2021

Just saw today (it's probably the case for a while now) also in Firefox the class avap-ads-container is no more. I could update to set the main class as the current fallback one but it works just fine so i'll let it like that for now.

Post reply

Sign in to post a reply.