从JavaScript更改HTML5视频的质量 [英] Change HTML5 video’s quality from JavaScript
本文介绍了从JavaScript更改HTML5视频的质量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在YouTube中,我们可以通过360p,144p,240p等下拉列表更改视频质量。我们可以使用JavaScript中的HTML5视频元素执行相同操作吗?
In YouTube, we can change the quality of the video from a dropdown like 360p, 144p, 240p, etc. Can we do the same with HTML5 video element from JavaScript?
推荐答案
手动选择质量只需要:
- 保存
currentTime
在变量中 - 将视频
src
设置为其他视频的网址(具有不同质量的相同内容) - 将
currentTime
设置为变量中的值 - 播放视频
- Saving the
currentTime
in a variable - setting the video
src
to the URL of a different video (with the same content at a different quality) - Setting the
currentTime
to the value in the variable - Playing the video
这篇关于从JavaScript更改HTML5视频的质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文