html5视频快进跳过幻灯片

时间:2012-12-21 17:57:28

标签: javascript html5 custom-controls html5-video

我正在尝试制作类似幻灯片的视频,如果您点击快进按钮,它会将您带到视频中的特定时间。 (和倒带等..)视频是一个长视频,所以我只是试图让它跳到一定时间,如果当前时间小于我已经实现的暂停标记。

这是我的javascript

function Fwd(){
        if (video.currentTime < 17.91)
        { video.play(17.91)
        }
        if ( video.currentTime < 35.93 && video.currentTime > 17.91)
        { video.play(35.93)
        }
    }

这是我的HTML &LT; input type =“button”value =“►►”id =“fwdButton”onclick =“Fwd()”class =“button”/&gt; (减去输入前面的空格)

按钮将在17.91秒时播放下一个场景,当它达到17.91秒,但仅此时。如果时间少于那个,它将不会跳到17.91。

请帮忙。我是javascript的新手! 谢谢!

1 个答案:

答案 0 :(得分:1)

好的,这样可行,但我仍然需要弄清楚如何让它自动播放:

function Fwd(){
    if (video.currentTime <= 17.91 && video.currentTime >= 0)
    { (video.currentTime = 17.92)
    }
    else if (video.currentTime <= 35.93 && video.currentTime > 17.91)
    { (video.currentTime = 35.94)
            }}

更新:此处的自动播放解决方案:autoplay after jump to currentTime in html5 video