Can’t pause video programmatically
-
There is a slider in which the video should stop when changing slide.
It worked well without lazy load:... get slide ... var iframe = slide.getElementsByTagName("iframe")[0]; if (iframe) { iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); }Default html was:
<div class='embed-responsive embed-responsive-16by9'> <iframe class='embed-responsive-item' src='https://www.youtube.com/embed/f98z9tqweqwe?enablejsapi=1' frameborder='0' allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture' allowfullscreen></iframe> </div>And when I enable lazy load and use lyte_preparse it works, but no longer pause after slide change, with no errors. I know that iframe.contentWindow.postMessage requires enablejsapi=1, but it also presents in plugin generetad iframe. What can be wrong?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘Can’t pause video programmatically’ is closed to new replies.