Nata2ha Mayan2
Nata2ha Mayan2

Reputation: 484

prevent video array from looping

this seems like the opposite problem that anyone ever has. Basically, the videos (html5) in an array play, but for the life of me, I can't seem to keep them from automatically looping. I've tried just having it play the next video only if the index value is less that the array length,

if(currentVideo < videos.length){
                playVideo( (currentVideo + 1) % videos.length );

            }

but for some reason its still looping, and it shouldn't... What am i doing wrong here? Or iis there a better way?

Upvotes: 0

Views: 80

Answers (1)

Will
Will

Reputation: 20235

Try incrementing currentVideo.

if ( currentVideo < videos.length ) {
    playVideo( currentVideo++ );
}

Upvotes: 1

Related Questions