简体   繁体   中英

html5 video fast forward skip slideshow

I'm trying to create a slideshow-like video where if you click the fast forward button it takes you to a certain time in the video. (and rewind etc..) The video is one long video so I'm just trying to get it to jump to a certain time if the current time is less than the pause marks I already have implemented.

This is my 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)
        }
    }

This is in my html < input type="button" value="►►" id="fwdButton" onclick="Fwd()" class="button" /> (minus the space in front of input)

The button will play the next scene starting at 17.91 seconds when it reaches 17.91 seconds, but only then. It won't jump to 17.91 if the time is less than that.

Please help. I'm new to javascript! Thanks!

ok so this works but I still need to figure out how to get it to auto play:

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)
            }}

Update: Solution for auto play found here: autoplay after jump to currentTime in html5 video

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM