How to change the video play speed in HTML5? I've checked video tag's attributes in w3school but couldn't approach that.Any help would be appreciated!
+2
A:
According to this site, this is supported in the playbackRate
and defaultPlaybackRate
attributes, accessible via the DOM. Example:
<!DOCTYPE html>
<video id="my-video" src="chubby-bubbies.ogv" ...></video>
<script type="text/javascript">
/* play video twice as fast */
document.getElementById("my-video").defaultPlaybackRate = 2.0;
document.getElementById("my-video").play();
/* now play three times as fast just for the heck of it */
document.getElementById("my-video").playbackRate = 3.0;
</script>
Disclaimer: the above does not mean it is supported in every browser. I have seen this working on YouTube on Chrome, but doubt it works in other browsers. (Heck, most haven’t implemented fullscreen mode yet.)
Jeremy Visser
2010-06-12 08:05:58
Thanks for the helpful resource.Though Firefox doesn't support the attribute I've made a demo in Chrome which works fine.I guess my boss will like that.Thank you!
SpawnCxy
2010-06-12 09:31:30