Skip to main content
Participant
March 23, 2018
Answered

Code for stop button that will stop the video and go to the beginning of the video in Animate CC

  • March 23, 2018
  • 2 replies
  • 1558 views

I am looking for how to code (code snippet) a stop button for a video inside of HTML5 Canvas.  I want the button to stop the video and go to the beginning of the video but not play the video.  Here is my code (actions) so far:  Thanks in advance.

this.playBtn.dyn.text = "play";

this.pauseBtn.dyn.text = "pause";

this.stopBtn.dyn.text = "stop";

this.playBtn.addEventListener("click", fl_MouseClickHandler_4.bind(this));

function fl_MouseClickHandler_4()

{

     $("#myVideo")[0].play();

}

this.pauseBtn.addEventListener("click", fl_MouseClickHandler_5.bind(this));

function fl_MouseClickHandler_5()

{

     $("#myVideo")[0].pause();

}

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

    One possible solution would be to pause the video and set its current time to 0.

    function onStopVideo(e)

    {

         $("#video0")[0].pause();

         $("#video0")[0].currentTime = 0;

    }

    2 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    April 2, 2018

    Hi.

    One possible solution would be to pause the video and set its current time to 0.

    function onStopVideo(e)

    {

         $("#video0")[0].pause();

         $("#video0")[0].currentTime = 0;

    }

    Preran
    Legend
    April 2, 2018

    Because no one has answered this one so far, have a look at this article for insights Adobe ActionScript 3.0 * Controlling movie clip playback