Mutes the audio ads on play.spotify.com, while they are still being played, so *everyone* is happy.
< Feedback on Swyter Tweaks for Spotify
My main problem is that I cannot seem to get any ads. I don't know if any of my AdBlock subcriptions managed to reliably block the adverts or the people at Spotify know my account.
Without a way of testing it I'm pretty much working blindly. The good thing is that the underlying JS client backend has stayed the same since 2013, they are just not tagging the audio tracks as ads anymore, even if I can still reliably guess by seeing what elements of the interface are disabled.
Thanks for the quick response! I've tried three different adblockers and none have worked (uBlock, Adblock, and AdBlock Plus. ABP actually completely broke Spotify and music wouldn't play at all). Guess I'm stuck with ads for now. Either way, thanks for the script. It was great for a long time!
I played around with your script and it is now capable to detect the ads again. But unfortunately the script can't skip the ads. If we would be able to mute the whole volume of firefox, at least we would be able to not hear the ads. But I don't know how to access something which could mute sound directly from firefox. Do you know something?
Have a look at the script attached and contact me if you want to discuss (mattoef _at_ yahoo.de).
I just pasted this in the console to grab the global Spotify framework context reference in the window._core
variable:
// Bruteforce our way to get the instance reference, nice spaguetti code, JS at its finest!
// F*ck you Firefox, I'm elegant!— Said the angry programmer with the hair-raising voice of a stud.
var _core = Spotify.Instances.get(
document.querySelector("object[id*='SPFBIn_']").id.match(/.+\d+/)
);
Then I played a song and these still seem to work fine:
_core.audioManager.getActivePlayer().setVolume(0);
_core.audioManager.getActivePlayer().setVolume(1); // 100%
_core.audioManager.getActivePlayer().setVolume(.1);
_core.audioManager.getActivePlayer().setVolume(.6);
_core.audioManager.getActivePlayer().seek(50 * 1e3); // 50 seconds in
They aren't working with ads anymore? If they have capped it in the JS shim we still should be able to call the Flash bridge methods directly. See this reimplemented Flash bridge I hacked together to get rid of Flash altogether:
https://greasyfork.org/scripts/14035-html5-thingie-for-spotify-web-player/code (I still haven't updated this to support the double MP3 ciphering that songs in the mp3-enc branch use nowadays)
Especially interesting are the sp_setVolume
and sp_seek
JS methods exposed by the SPFBIn_**random-numbers-here**
SWC object in the window context. The first argument is the player ID string (which you can also find through the getActivePlayer()
family of functions, generally "main:A" for normal tracks, but ads use a secondary channel) and the second one is the same value than the functions above.
Shouldn't be that hard to whip something out that just works.
Doesn't seem to be working anymore.
I'm running TamperMonkey with this script and I'm still getting full volume ads in Chrome. I tried the basic stuff of clearing cache and restarting, but I'm still getting ads. Just thought I'd let you know. Thanks for the script.