使用jQuery更改视频质量 [英] Change video quality using jquery
问题描述
我现在有一个简单的视频播放器,我想像在youtube上一样更改视频质量,更改视频源后,它应该与当前时间完全相同,它不应该从0开始 >(IPHONE问题).
I have a simple video player now I would like to change the quality of the video as on youtube, after changing the video source it should start exactly like the current time, IT SHOULD NOT START FROM 0 (IPHONE PROBLEM).
这是我到目前为止所拥有的
Here I what I have so far
HTML
<div id="video-container">
<video id="videoplayer" width="750" height="421" webkit-playsinline
</video>
</div>
<select class="qualitypick" autocomplete="off"> </select>
现在在android,chrome,edge等设备上可以正常运行,但是当我在iPhone Safari上打开演示时,我在几秒钟后播放了视频,但质量却降低了,但是视频从头开始,而不是从头开始从当前时间开始.
上面的代码有什么问题?任何帮助或建议将不胜感激
What is wrong with the code above? any help or suggestions will be appreciated
推荐答案
如果它不起作用,请尝试
If it doesn't work, try this
var videoDOM = '';
var curtime = '';
var source = '';
var vide0 = '';
var formats = {
deomill.pl/editorv1/molecular_player/quality/molecular_360_converted.mp4",
deomill.pl/editorv1/molecular_player/quality/molecular_360_converted.mp4",
};
$(document).ready(function(){
for (var format in formats) {
$('.qualitypick').append($("<option value='" + format + "'>" + format + "</option>"));
}
$('.qualitypick').change(function () {
video = document.getElementById("videoplayer");
curtime = video.currentTime;
video.src = formats[$(this).val()];
video.currentTime = curtime;
video.play();
})
})
这在我的Windows计算机上有效
This worked on my windows computer
这篇关于使用jQuery更改视频质量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!