开发者

Getting buffering progress value in HTML5 video player

开发者 https://www.devze.com 2023-01-16 06:51 出处:网络
In Firefox, when I see the simple video element in this example, it has default 开发者_如何学编程browser controls. Right after the page is loaded the video starts to load; I see how the buffering (loa

In Firefox, when I see the simple video element in this example, it has default 开发者_如何学编程browser controls. Right after the page is loaded the video starts to load; I see how the buffering (loading) line is moving to the right side of the default browser controls.

How can I get this value for the buffer?

I have tried a number of different ways, including video.buffered and progress event listener with e.total, e.loaded.

I have Firefox 3.6.3, which doesn't seem to support .buffered or .total / .loaded.

How do the default browser controls initialize this buffering progress?

By the way, I have other examples of different HTML5 players, which do the same as the default browser controls:

  • http://sublimevideo.net/demo
  • http://videojs.com


View the source at this example :

http://people.mozilla.com/~cpearce/buffered-demo.html

Essentially, you need to get your control and check the "buffered" property of it.

var v = document.getElementById('buffered_v');
var r = v.buffered.end(0);

That should be your buffered value.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号