Noob_C
Noob_C

Reputation: 55

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!

Upvotes: 0

Views: 4327

Answers (1)

Noob_C
Noob_C

Reputation: 55

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

Upvotes: 2

Related Questions