Wednesday, 8 August 2018

HTML 5 Video tag

As always, I was working on a project which contains bugs. but this time a video was issue. Issue was video was playing in most of browser but not in Internet Explorer. As a part of analysis I found that client was using some third party browser to render video.

So I checked alternative for that. And what I get is HTML 5 video tag. Below is code that I used for testing:

<html>
<head>
</head>
<body>
<video controls autoplay loop>
  <source src="https://www.w3schools.com/tags/movie.mp4" type="video/m4v">
Your browser does not support the video tag.
</video>
</body>
</html>

Few things that it provides is very good. for example, below attributes

  • Autoplay - if you add this in video tag, video will start automatically. 
  • Loop - Provides a way to play video continuously.
You can check other attributes as well in reference link below.

Our client was using "M4a" format. But video tag supports below formats only. So we change our video format in "MP4"
  • MP4 - This only is supported in IE, Chrome and Firefox.
  • WebM
  • Ogg

Note: The video tag is not supported in Internet Explorer 8 and earlier versions.

As it solved my problem, I thought its worth sharing for my future reference and it my help you.

Reference:
https://www.w3schools.com/tags/tag_video.asp

No comments:

Post a Comment