I have html5 video on webpage. But I want it to be pause / play on video itself but not clicking on video controls like volume etc.
Thanks in advance for your precious help
I have html5 video on webpage. But I want it to be pause / play on video itself but not clicking on video controls like volume etc.
Thanks in advance for your precious help
HTML5 <video>
tag does not allow this option by default. However, you can use javascript to control your video (make it react to various events).
Here are few links that deals with these issues:
Try any of the approaches in these arcitcles and it should be easy - and try showing some of your code when asking a question - it will make it easier for us to give you more detailed answer :-)
For example, you can add some onClickEvent to your video or its container and then write js function to stop the video (by accessing it with its id)...
Here is what you can do
var myVideo = document.getElementById("video1");
/*
* for playing and pausing the video
*/
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
HTML
<button onclick="playPause()">Play/Pause</button>
<video id="video1" width="420">
<source src="resources/videos/your_video.webm" type="video/webm">
Your browser does not support HTML5 video.
</source>
</video>
Hope this solves your problem.