我正在尝试用javascript控制html5视频。我想要的是,当用户点击一个按钮,视频将跳转到另一个帧,并继续从那里播放。在我当前的代码中,回放总是在搜索之后停止。
function jumpToTime(){
var video = $("video")[0];
video.currentTime = 160;
document.getElementbyId("videoclip").play(); //not working
};
//the following code is probably not really related to the question:
var endtimeoffset = 2000;
video.addEventListener("timeupdate", function() {
if (video.currentTime >= endtimeoffset) {
video.pause();
}
}, false);发布于 2014-06-25 05:54:20
我遇到了类似的问题,并找到了一个解决方案,暂停视频,然后设置currentTime,然后播放视频。要更新您的代码:
function jumpToTime(){
var video = $("video")[0];
video.pause();
video.currentTime = 160;
video.play();
};发布于 2012-05-25 22:05:23
一些我会尝试的事情:
’引用上调用
发布于 2012-05-25 22:26:41
function jumpToTime(){
document.getElementById("videoclip").currentTime = 160;
document.getElementById("videoclip").play(); //not working
};getElementbyId --> getElementById -- b --> B
通过id获取直接对象...
https://stackoverflow.com/questions/10755374
复制相似问题