我想用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);
嗨!這是令人尷尬的,但你說B不是大寫字母。但現在,它的工作,視頻始終從頭開始(而不是從尋求點)..爲什麼會這樣? –