I am trying to make controller for iframe by placing button: play, pause. But am unable to understand why i am getting fail everytime. I am using javascript but fail to understand the reason: here is my code:
<!DOCTYPE html>
<html>
<body>
<button onclick="playVid()" type="button">Play Video</button>
<button onclick="pauseVid()" type="button">Pause Video</button><br>
<iframe id="myVideo" width="100%" height="419" src="small.mp4" frameborder="0" allowfullscreen></iframe>
<script>
var vid = document.getElementById("myVideo");
function playVid() {
vid.play();
}
function pauseVid() {
vid.pause();
}
</script>
<p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
I also have seen thes post: Pausing YouTube iFrame API in JavaScript
Stop all playing iframe videos on click a link javascript
as for example but fail......