HTML5 Video - what is the maximum playback rate?

痞子三分冷 提交于 2020-01-14 07:07:48

问题


You can set the playback rate for a HTML5 video element:

var player = document.getElementById("video");
player.playbackRate = 100;

The w3 spec does not define a limit. What is the maximum playback rate of the <video> element in Chrome and Firefox? If the playback rate is not browser dependent, then what determines it?

Research:

MDN HTML Media Element says that some browsers will stop playing audio outside of a playback range between 0.25x - 4x. It does not say whether the video element will continue to play video.

YouTube's player supports speeds between 0.25x - 2x. This is a flash player, not an HTML5 video element, and I'm not interested in it.

Personally, I have created a test page locally on my computer with a <video> element and a local video file. I can set the playbackrate to anything (e.g. 100), but the video does not seem to play faster than ~5x. I can't actually check the playbackrate speed, since it just returns the value "100" that I set.


回答1:


Updated 30/11/2017 to reflect the latest changes in browser behavior

Firefox:

According to the source code, Firefox should clamp effective playback rate to the 0.0625 - 16.0 range. In my tests, it no longer follows that and does not clamp the playback rate at all. However, it still mutes the audio if the playback rate is lower than 0.5, or is higher than 4.0.

Source - Firefox source code at dom\html\HTMLMediaElement.cpp

Chrome:

Chrome clamps playback rate to a range of 0.0625 - 16.0. In my tests, it also mutes the audio if the rate is lower than 0.5, or higher than 4.0.

Source - Chromium source code at third_party/blink/renderer/core/html/media/html_media_element.cc




回答2:


Technically there should be no limit.

But where is the reason in playing a 30 seconds long Video in not even one second?




回答3:


Most browsers stop playing audio outside playbackRate bounds of 0.5 and 4, leaving the video playing silently. It's therefore recommended for most applications that you limit the range to between 0.5 and 4.

from Mozilla Developer Network. may be that is the reason why your video playback rate did not go higher than 5 ( may be 4 ).

Edit:

A play back rate demo application can be found here.

It shows playback rate upto 10(but without sound).

Update

The playbackRate property represents a multiplier of the video's intrinsic or normal playback rate, with the default setting of 1. If you set the property to 2, it doubles the playback speed, while .5 will play at half speed. If playbackRate is set to a negative value, in Windows Internet Explorer 9, it rounds it back to zero, essentially pausing playback. In Internet Explorer 10, negative values for playbackRate cause the video to play in reverse. The W3C spec doesn't recommend an upper limit, but Internet Explorer limits playbackRate up to 8x speed.

Source: https://msdn.microsoft.com/library/hh924823(v=vs.85).aspx

It will also depend on the power of your processor. A higher processor speed will give you higher playback limit possible.



来源:https://stackoverflow.com/questions/30970920/html5-video-what-is-the-maximum-playback-rate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!