Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 Video - what is the maximum playback rate?

Tags:

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.

like image 588
Don P Avatar asked Jun 22 '15 01:06

Don P


1 Answers

Updated 07/08/2021 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.h

like image 139
Roman Pletnev Avatar answered Sep 27 '22 21:09

Roman Pletnev