Download only metadata from html5 video / audio

First I would like to ask this question. I cannot upload metadata without any other video content. preload = "metadata" does not work. I am testing Win Win and do not know how it works in Safari / FF / IE / Opera. Thus, I cannot quickly download six or more videos. Chrome can only store six open connections in the same port / protocol / domain. And if I upload more than six videos, then the last videos do not load, and the first six videos are fully completed .

Is jsfiddle required? I can create, but I think this is not necessary. For instance. HTML: 10 html5 <video> each attribute is about 100mb and preload=metadata . JS (using jQuery for clarity only):

 $('video').on('loadedmetadata',function(){ console.log(this.duration); }).each(function(i){ this.load(); }); 

Then open the Network tab in the Chrome Dev Tools section and reload the page. Six videos will start loading and will download full content, while the other four videos will wait with a mark (pending) . First, 6 messages will appear in the console. New messages will appear after fully loading any first videos.

I tried a lot of things, but each one fell out. Now I want to get server side metadata. Are any PHP solutions possible? But a JS solution would be better.

I also know about the solution that Youtube uses, maybe Vimeo and some other websites. This is saving videos on some subdomains (s1.youtube.com, s2.youtube.com, etc.). But I can’t use it. I am making a website template and it has some requirements.

I have a video gallery with a lot of videos. The player must show the duration and know the width / height before the first video playback. I also want to take a frame from the middle of the video for the video poster. Any solution for stopping video downloads and tight connections is best I need. And he solves the problems with getting metadata.

+4
source share
2 answers

If you want to upload more than 6 videos in chrome, you need to use the .webm format.

Note. If your video tag has many sources, for example:

<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 will be mp4 by default, not webm . You will need to do some jquery magic to make it work. Tips on this can be seen here.

0
source

The situation will now be worse with v42 (currently the beta version, hopefully, will be fixed)

Now it refers to preload='metadata' , but does not output the connection back to the pool, so after downloading 6 videos it just gets completely stuck!

See bug report: https://code.google.com/p/chromium/issues/detail?id=468930

0
source

Source: https://habr.com/ru/post/1479755/


All Articles