仅加载来自html5视频/音频的元数据 [英] load only metadata from html5 video/audio

查看:340
本文介绍了仅加载来自html5视频/音频的元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我想问一下这个问题。没有任何其他视频内容我无法加载元数据。 preload =metadata无效。我在Win Chrome上测试,不知道它在Safari / FF / IE / Opera上是如何工作的。因此,我无法快速加载六个或更多视频剪辑。 Chrome可能会在类似的端口/协议/域中仅保留六个已打开的连接。如果我加载了六个以上的视频,则前六个视频完全加载时,最后一个视频无法开始加载。

At first, I'd like to ask that question. I can not load metadata without any other video content. preload = "metadata" is not working. I test on Win Chrome and don't know how it works on Safari/FF/IE/Opera. Thus I can't load six and more video clips fast. Chrome may keep only six opened connections at similar port/protocol/domain. And if I load more than six videos then last videos does not start load while first six videos fully complete loading.

jsfiddle是否需要?我可以创造,但我认为没有必要。例如。 HTML:10 html5 < video> 每个大约100mb和 preload = metadata 属性。 JS(使用jQuery只是为了清晰):

Does jsfiddle need? I can create but I think that is not necessary. For example. HTML: 10 html5 <video> each around 100mb and preload=metadata attribute. JS (using jQuery just for clearness):

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

然后在Chrome开发者工具栏中打开网络标签并重新加载页面。六个视频将开始加载并将加载完整内容,而其他四个视频将等待(待定)标记。首先,在控制台中会出现6条消息。完全加载任何第一个视频后会出现新消息。

Then open "Network" tab in Chrome Dev Tools and reload page. Six videos would start to load and would load full content while other four videos would wait with (pending) mark. At first, in console would appear 6 messages. New messages would appear after fully load any first videos.

我尝试了很多东西但是每个都掉了。现在我关于在服务器端获取元数据。有没有关于PHP的解决方案?但JS解决方案会更好。

I tried a lot of things but each one has fall. Now I thing about getting metadata on server side. Are there any solutions on PHP maybe? But JS solution would be better.

我也知道使用Youtube的解决方案,可能是Vimeo和其他一些网站。这是在一些子域名(s1.youtube.com,s2.youtube.com等)上保留视频。但我无法使用它。我制作网站模板并且有一些要求。

I also know about solution which using Youtube, probably Vimeo and some other websites. That is keeping videos on some subdomains (s1.youtube.com, s2.youtube.com, etc). But I can not use it. I make website template and it have some requirements.

我有很多视频的视频库。玩家必须在第一次视频播放前显示持续时间并知道宽度/高度。另外我想从视频中间拍摄视频海报。任何停止视频加载和关闭连接的解决方案都是我需要的。它确实解决了获取元数据的麻烦。

I have video gallery with a lot of videos. Player must show duration and know width/height before first video play. Also I want to take frame from middle of video for video poster. Any solution for stop video loading and close connection is best I need. And it solve trouble with getting metadata indeed.

推荐答案

v42现在情况会更糟(目前是测试版 - 所以希望如此将被修复)

The situation is now going to be worse with v42 (currently beta - so hopefully will be fixed)

它现在尊重 preload ='metadata'但不会释放连接回到在6个视频加载之后它就会完全卡住!

It now respects preload='metadata' but doesn't release the connections back to the pool so after 6 videos load it just gets completely stuck!

查看错误报告: https://code.google.com/p/chromium/issues/detail?id=468930

这篇关于仅加载来自html5视频/音频的元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆