简体   繁体   English

HTML5 <video> 标签性能

[英]HTML5 <video> Tag Performance

I have a <video> element at the top of my page playing an animation in the background (very similar to the one found on the Google Hangouts page). 我的页面顶部有一个<video>元素,在后台播放动画(非常类似于Google Hangouts页面上的动画)。 On most computers, the video plays smoothly and it seems fine, but on older hardware there is a lot of lag and the browser slows down quite a lot. 在大多数计算机上,视频播放顺畅,看起来很好,但在较旧的硬件上存在很多延迟,浏览器速度相当慢。

Is there anyway to detect the performance of the video playback? 无论如何都有检测视频播放的性能? I'd like to either replace the video with a static image or pause the video if performance is an issue. 我想用静态图像替换视频,或者如果性能有问题则暂停视频。

Use the video metrics if available in your browser. 如果您的浏览器可以使用视频指标。 Here's an example using webkit prefixed DroppedFrameCount. 这是使用webkit前缀DroppedFrameCount的示例。

http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=chrome/test/data/media/html/media_stat_perf.html http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=chrome/test/data/media/html/media_stat_perf.html

See also: http://wiki.whatwg.org/wiki/Video_Metrics for the Moz prefix. 另请参阅: http ://wiki.whatwg.org/wiki/Video_Metrics,了解Moz前缀。

您可以使用获取加载页面的时间戳来确定用户加载页面的速度,然后如果其带宽低于指定阈值,则提供图像而不是变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM