Closed bogdanptr closed 5 years ago
You should be able to do this with the tabby
event and the method described in this article.
Something like this.
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe !== null ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
}
if ( video !== null ) {
video.pause();
}
};
document.addEventListener('tabby', function (event) {
stopVideo(event.target);
}, false);
Hello! I was wondering if there is a way to stop youtube embedded videos when a tab is inactive.