15 June, 2022
The HTML5 <video> tag is used to play all of these videos. The browser tries to play source1 video first. If it can't, it tries source2. You should have many sources for your video to make sure they play on all devices and browsers.
Try loading this page on different browsers and desktop as well as mobile devices and see which source video plays on each.
See this demo for how to use the open source Videojs player. This consistantly plays HLS version on almost all browsers and devices.
This article explains how using HLS for videos can save money and provide a better user experience.
<video width="320" height="180" controls poster="https://www.managedtime.com/videos/forest-h5-poster.jpg">
<source src="https://www.managedtime.com//videos/forest_scene_h5_1080p_AVC_6_mp4.mp4" type="video/mp4">
<source src="https://www.managedtime.com/videos/forest_scene_imovie_1080p_mediumQuality_ogg.ogg" type="video/ogg">
Your browser is not HTML5 capable
</video>
<video width="320" height="180" controls poster="https://www.managedtime.com/videos/forest-h5-poster.jpg">
<source src="https://www.managedtime.com//videos/forest_scene_h5_1080p_AVC_6_mp4.mp4" type="video/mp4">
<source src="https://www.managedtime.com/videos/forest_scene_h5_1080p_HEVC_4_5_webm.webm" type="video/webm">
Your browser is not HTML5 capable
</video>
<video width="320" height="180" controls poster="https://www.managedtime.com/videos/forest-h5-poster.jpg">
<source src="https://managedtime.com/videos/forest_scene_h5_AVC_HLS/5b9f053ac8009981b24e64c393f5659a.m3u8" type="application/x-mpegURL">
<source src="https://www.managedtime.com/videos/forest_scene_h5_1080p_AVC_6_mp4.mp4" type="video/mp4">
Your browser is not HTML5 capable
</video>
<video width="320" height="180" controls poster="https://www.managedtime.com/videos/forest-h5-poster.jpg">
<source src="https://www.managedtime.com/videos/forest_scene_h5_AVC_DASH/110514add6124abeb185835747cc66af.mpd" type="application/dash+xml">
<source src="https://www.managedtime.com/videos/forest_scene_h5_1080p_AVC_6_mp4.mp4" type="video/mp4">
Your browser is not HTML5 capable
</video>
About The Author
Technology expert from Austin, TX. Writes about cloud computing, video processing and technology. Follow him on social media.