If I open the Chrome developer tools console and change HTMLMediaElement.prototype.play
, it works just fine.
> HTMLMediaElement.prototype.play = function(){debugger;}
function (){debugger;}
> HTMLMediaElement.prototype.play
function (){debugger;}
However, if I change it from a user script, the function always seems to revert to the native implementation.
> HTMLMediaElement.prototype.play
function play() { [native code] }
I have verified that the user script loads correctly, and I even tried an ugly setInterval approach, to see if at least that works:
var myFunction = function(){debugger;};
window.setInterval(function(){
if (window.HTMLMediaElement.prototype.play != myFunction)
window.HTMLMediaElement.prototype.play = myFunction;
}, 900);
But even with this I always end back up with the native implementation.