如何更改 HTML5 中视频的播放速度? [英] How to change the playing speed of videos in HTML5?

查看:65
本文介绍了如何更改 HTML5 中视频的播放速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 HTML5 中更改视频播放速度?我已经在 w3school 中检查了 视频标签的属性,但无法解决这个问题.任何帮助都会不胜感激!

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!

推荐答案

根据 这个站点,这在 playbackRatedefaultPlaybackRate 属性中受支持,可通过 DOM 访问.示例:

According to this site, this is supported in the playbackRate and defaultPlaybackRate attributes, accessible via the DOM. Example:

/* play video twice as fast */
document.querySelector('video').defaultPlaybackRate = 2.0;
document.querySelector('video').play();

/* now play three times as fast just for the heck of it */
document.querySelector('video').playbackRate = 3.0;

上述适用于 Chrome 43+,Firefox 20+、IE 9+、Edge 12+.

The above works on Chrome 43+, Firefox 20+, IE 9+, Edge 12+.

这篇关于如何更改 HTML5 中视频的播放速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆