Video 视频中的Popcorn.js循环
我正在使用Popcorn.js制作一个交互式视频,但我对JavaScript还很陌生。我试图循环视频中的一个特定部分。我在尝试一个if语句,当达到当前时间时,当前时间将被延迟。不幸的是,这不起作用Video 视频中的Popcorn.js循环,video,html5-video,popcornjs,Video,Html5 Video,Popcornjs,我正在使用Popcorn.js制作一个交互式视频,但我对JavaScript还很陌生。我试图循环视频中的一个特定部分。我在尝试一个if语句,当达到当前时间时,当前时间将被延迟。不幸的是,这不起作用 function loop() { var video = document.getElementById('video'); if (video.currentTime = 82) { (video.currentTime = 77) } } 你们
function loop() {
var video = document.getElementById('video');
if (video.currentTime = 82)
{
(video.currentTime = 77)
}
}
你们有什么建议/解决方案吗?所以,我面前没有任何东西可以验证这一点,但您应该可以通过附加到
timeupdate
事件来实现这一点。您应该能够这样做:
document.getElementById('video').timeupdate = function () {
var video = document.getElementById('video');
if (video.currentTime == 82) {
video.currentTime = 77
}
};
您可以在与整个应用程序相关的任何地方这样做。您只是在使用
baseplayer
?