Skip to content

Instantly share code, notes, and snippets.

@rachelbaker
Forked from cayuu/MuteRdioAds.js
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rachelbaker/ccaaedcef1cd3a3ba676 to your computer and use it in GitHub Desktop.
Save rachelbaker/ccaaedcef1cd3a3ba676 to your computer and use it in GitHub Desktop.
var r = R.player, oVol = r.volume(), tf = r._onTrackFinished, ar = r._onAudioReady;
r._onTrackFinished = function() {
return .001 !== r.volume() && (oVol = r.volume()), r.volume(.001), tf.apply(this, arguments);
};
r._onAudioReady = function() {
return r.playingAd() || r.volume(oVol), ar.apply(this, arguments);
};
@allanforms
Copy link

Hi there! I've been using this from some days ago and I just loved it!
The only thing I'd add is the manual skip, it still plays the ad.
So if you want to add to your code here is what I did (thanks a lot for your code!!!)

var r = R.player, oVol = r.volume(), tf = r._onTrackFinished, ar = r._onAudioReady, n = r._next;

r._onTrackFinished = function() {
  return .001 !== r.volume() && (oVol = r.volume()), r.volume(.001), tf.apply(this, arguments);
};

r._onAudioReady = function() {
  return r.playingAd() || r.volume(oVol), ar.apply(this, arguments);
};

r._next = function() {
  arguments[0] = false;
  return n.apply(this, arguments);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment