Answer the question
In order to leave comments, you need to log in
How to stop iframe of Youtube video using javascript?
Tell me how to stop a YouTube video on a page created by a tag
Tried the Youtube API, while unsuccessfully doing this:
document.getElementById('video').contentWindow.postMessage('{"event":"command","func":"pauseVideo" ,"args":""}', '*');
And here is the iframe itself:
<iframe id='Youtube' class='center-block' src='https://www.youtube.com/embed/$YoutubeCode?enablejsapi=1' frameborder='0' allowfullscreen></iframe>
Answer the question
In order to leave comments, you need to log in
var player = document.getElementById('Youtube');
player.stopVideo();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question