I'm using the Youtube video iframe API and everything works perfect. There's only one thing left for it to work as i spected: I want to detect when the video focus is out, even if it happends in the same window or browser tab, for it to stop playing, or pause.
i have been trying with jquery:
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING) {
player.blur(function(){
$(this).stopVideo();
});
}
}
But it doesn't seems to work. Can somebody help?