Twitch - Mute and hide ads, while keeping the audio of the stream on

Automatically mutes and hides the Twitch player when an advertisement started and revert it back to normal once finished. The stream can still be heard during ads. You can also display ads via the "Ads Options" button.

< 脚本 Twitch - Mute and hide ads, while keeping the audio of the stream on 的反馈

提问 / 留言

§
发布于:2025-07-22

Would you like to add GM_setValue and GM_getValue to your userscript? This way, our options could be stored in the script's storage. It could be useful for us to set disableDisplay to true and have other settings preserved across updates. 🤔 You could even preserve adsDisplayed in the script's storage. 🥰

§
发布于:2025-07-22

Maybe something like this: https://gist.githubusercontent.com/sn-o-w/a490b5dba9a36ada0a52cf8fd9c8f396/raw/c962f47d4f250840d2eea116be17bcd5e9ac3f07/userscript-experiment

???

Hope this is useful and you can do other modifications over my modified file. 🥰

§
发布于:2025-07-22

Since I cannot edit my comment anymore, please ignore the above URL and take this into consideration: https://gist.githubusercontent.com/sn-o-w/a490b5dba9a36ada0a52cf8fd9c8f396/raw/12aab8a8c7299a18547d482b590e55674eeb5446/userscript-experiment

🤔

Harest作者
§
发布于:2025-07-23

Hello,

Could be an idea indeed. At first i didn't want to use any grant mainly to not scare anyone. But for this purpose specifically, it could be interesting. Also i wasn't aware const on objects didn't protect their properties. But i still prefer to use var there, to make it clear it's not constants.

Thanks for the submission! I'll see to update the script in the next days probably.

§
发布于:2025-07-23

I didn't just want to suggest a feature request, but to help a little more. 😊

Hope that helps and it is useful. 😎

Harest作者
§
发布于:2025-07-29
编辑于:2025-07-29

Testing it a bit, there's some issues with all this atm. I feel like there's no standard around this and something like GreaseMonkey v4.0+ doesn't support GM_setValue and GM_getValue. So i can also use the new GM.setValue / GM.getValue (checking the typeof before use), but then the logic changes as it's now Promises being used. And is it also the case for all the userscript managers too (Tamper/Violentmonkey)? Some seem to support both. Assuming the GM. functions are all async, while the others are not, i tried something but it seems like for now GreaseMonkey doesn't like the use of await, i don't even get an error in the console. Not sure why as it's used in the doc. I never used Promises yet, so i'll need to check how to handle that too.

So atm: Supposedly async functions GM.setValue / GM.getValue are not ?! async in GreaseMonkey v4.0+, as using await breaks the script without any error, while the examples is the doc states we should use it. Removing that keyword works but then the values are full of Promise { <state>: "fulfilled", <value>: undefined } which obviously fucks the script. So if you've an idea, feel free. Here's the WIP script.

Harest作者
§
发布于:2025-07-29
编辑于:2025-07-29

Checking again, i think i got it. Tbf i'm totally unfamiliar with all the async & Promise stuff. I just needed to define as asynchronous the 2 functions with the GM set/get calls.
I'll test it a bit, and push the update if everything is working as intended.

发布留言

登录以发布留言。