Disable autostart/autoplay HTML5 video tag

62 Likes Comment

How to change autoplay off?

Just a simple javascript will help you to disable autoplay feature of video tag in HTML5

<video src="video.mp4" preload="metadata" controls="controls" id="mediaVideo_007" poster="video-poster.jpg"></video>
<script >
  var vid = document.getElementById("mediaVideo_007");
  vid.volume = 0.50;
  $('#mediaVideo_007').click(function() {
  $('#mediaVideo_007').get(0).play()
});	
</script>
  • Remember to remove autoplay param from video tag
  • Set and unique class id of video
  • Make sure the video file, video url play normally.

You might like

About the Author: Toc Xoan

This guy likes taking photos, hunting cheap tours, exploring the unique culture of every cities of Vietnam. Contact: [email protected]. I've created a dogecoin wallet to receive blog funding: DE6F5FisSCy7yz5rpHY1ChMSGYnDMpFZ1Q

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.