HTML5 video video playlist -
this simplistic, simplified html5 video playlist. surprisingly me, seems working fine in mozzila / chrome / opera mean - ogv specified in script.
question - have specify mp4 , webm ?
if - how in particular case ?
what ie ?
regards
the code:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>html5_video</title> <script> var videoplayer; var video_count = 1; window.onload = function (){ videoplayer = document.getelementbyid("homevideo"); videoplayer.addeventlistener("ended", function (){ video_count++; if (video_count == 4) video_count = 1; var nextvideo = video_count+".ogv"; videoplayer.src = nextvideo; }, false); } </script> </head> <body> <video id="homevideo" width="640" height="360" autoplay autobuffer src="1.ogv"></video> </body> </html>
firefox, chrome, , opera support ogv , webm (in desktop version); webm has better quality ogv same browser support better choice. if want support ie, safari, , mobile need mp4 version of video. there not 1 format work on browsers if have both webm (or ogv) , mp4 @ least 1 of them should work in modern browser supports html5 video.
you can either use multiple <source>
tags inside of <video>
tag list 2 versions of video , let browser choose 1 use, or use canplaytype()
to determine whether browser supports particular video format, e.g. videoplayer.canplaytype('video/mp4')
, , insert first format have browser can play.
if want support old browsers not support html5 video @ (ie8 , earlier), may want flash video player fallback use in case. flash video players can use same mp4
video used ie9/10, safari, , mobile.
Comments
Post a Comment