Skip to main content
Participant
September 29, 2019
Question

How do I make HTML5 play next frame after video component end?

  • September 29, 2019
  • 2 replies
  • 2272 views

I place start button in the frame 0 and video component in the frame 1(only autoplay check) and 2(loop), if I assign "click to go to frame 1 and play" HTML5 will skip video 1 because it is only 1 frame duration if I assign "click to go to frame 1 and stop" it will end at video 1 last frame and not play video 2 at frame 4.
I want to make HTML5 play nextframe after video at frame 1 END.

Thank you for reading.

 

    This topic has been closed for replies.

    2 replies

    jeffp81970431
    Participating Frequently
    November 10, 2020

    I'm having a similar issue but once the video ends I want it to jump back to frame 1. Basically, I have 4 buttons, each jumping to different frames to autoplay their specific videos. Once the video ends I want to automatically jump back to frame 1. Any help? Thanks in advance! 

    Legend
    September 30, 2019
    this.stop();
    var thisTimeline = this;
    
    // video must not be set to autoplay
    // video must not be set to loop
    
    // wait until video component is fully initialized
    stage.on("drawstart", initVideo, this, true);
    
    // add event listener to video and tell it to play
    function initVideo() {
    	$("#myMovieClip")[0].addEventListener("ended", nextFrame);
    	$("#myMovieClip")[0].play();
    }
    
    // remove event listener and continue
    function nextFrame(evt) {
    	evt.currentTarget.removeEventListener("ended", nextFrame);
    	thisTimeline.gotoAndStop(thisTimeline.currentFrame + 1);
    }
    Participant
    October 2, 2019
    it work perfectly! Thank you for your help.