Skip to content

Instantly share code, notes, and snippets.

@hardiksondagar
Last active September 6, 2021 14:38
Show Gist options
  • Save hardiksondagar/ba8bad0baf01d5ec8d75efda383db28b to your computer and use it in GitHub Desktop.
Save hardiksondagar/ba8bad0baf01d5ec8d75efda383db28b to your computer and use it in GitHub Desktop.
Mute ads on sonyliv.com
/**
*
* Tired/irritated of hearing ads on sonyliv.com while watching cricket match?
* Follow below steps to mute when ads are running.
* 1. Start live cricket match
* 2. Open console ( press F12 in chrome ) and paste all the code below.
*
* @author : Hardik Sondagar
*
*/
function muteAds() {
// mute ads on sonyliv.com
var elems = document.querySelectorAll("video");
[].forEach.call(elems, function(elem) {
// var is_ads_running = document.querySelector(".adClick").style.display == "block";
var is_ads_running = document.querySelector('.vjs-tech').style["pointer-events"] == "none";
if (is_ads_running) {
elem.muted = true;
} else {
elem.muted = false;
}
});
}
setInterval(function(){
muteAds()
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment