How to change the playing speed of videos in HTML5?

自古美人都是妖i 提交于 2019-11-26 10:08:37

问题


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!


回答1:


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;

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




回答2:


Just type

document.querySelector('video').playbackRate = 1.25;

in JS console of your modern browser.




回答3:


javascript:document.getElementsByClassName("video-stream html5-main-video")[0].playbackRate = 0.1;

you can put any number here just don't go to far so you don't overun your computer.



来源:https://stackoverflow.com/questions/3027707/how-to-change-the-playing-speed-of-videos-in-html5

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