php - load only metadata from html5 video/audio -
at first, i'd ask question. can not load metadata without other video content. preload = "metadata"
not working. test on win chrome , don't know how works on safari/ff/ie/opera. can't load 6 , more video clips fast. chrome may keep only 6 opened connections @ similar port/protocol/domain. , if load more 6 videos last videos not start load while first 6 videos fully complete loading.
does jsfiddle need? can create think not necessary. example. html: 10 html5 <video>
each around 100mb , preload=metadata
attribute. js (using jquery clearness):
$('video').on('loadedmetadata',function(){ console.log(this.duration); }).each(function(i){ this.load(); });
then open “network” tab in chrome dev tools , reload page. 6 videos start load , load full content while other 4 videos wait (pending)
mark. @ first, in console appear 6 messages. new messages appear after load first videos.
i tried lot of things each 1 has fall. thing getting metadata on server side. there solutions on php maybe? js solution better.
i know solution using youtube, vimeo , other websites. keeping videos on subdomains (s1.youtube.com, s2.youtube.com, etc). can not use it. make website template , have requirements.
i have video gallery lot of videos. player must show duration , know width/height before first video play. want take frame middle of video video poster. solution stop video loading , close connection best need. , solve trouble getting metadata indeed.
if want load more 6 videos in chrome, need use .webm
format.
note: if have bunch of sources in video tag, so:
<video width="320" height="240" controls autoplay> <source src="vid.webm" type="video/webm"> <source src="vid.mp4" type="video/mp4"> </video>
i think chrome default mp4
, not webm
. you'll have jquery magic working. advice on can seen here.
Comments
Post a Comment