Skip to main content
chrismay_at_delta6226261
Inspiring
April 5, 2018
Answered

Make Captivate play again after pausing - with Javascript

  • April 5, 2018
  • 2 replies
  • 1303 views

I hope I am missing something simple. I have 2 buttons: play_nav and pause_nav. Play_nav is hidden. Both buttons, when clicked call the same javascript function. The function hides the calling button and shows the other. The function is supposed to pause or play the movie.

But...

I can only get the movie to pause, nothing I do will make the movie play again. Below is my code, you can see all the commented out parts are different ways I have tried to make the player start again, but nothing seems to work.

I am using Captivate 2017 on a Mac.

Any ideas would be a great help!

function PLaD_pausePlay(theButton){

    if(theButton=="pause"){

        console.log("**** pause button clicked ****");

        cp.show("play_nav");

        cp.hide("pause_nav");

        cp.movie.pause(cp.ReasonForPause.PLAYBAR_ACTION);

    }else{

        console.log("**** play button clicked  ****");

        // cpCmndPause = false;

        //cp.movie.paused=false;

        //window.cpCmndResume=1; 

        //cpAPIInterface.setVariableValue("cpCmndResume",1);

        // cp.actionChoiceContinueMovie();

        //window.cpAPIInterface.play();

        //cp.playPause(cp.ReasonForPlay.PLAYBAR_ACTION);

        cp.movie.play(cp.ReasonForPlay.PLAYBAR_ACTION);

        cp.hide("play_nav");

        cp.show("pause_nav");

    }

This topic has been closed for replies.
Correct answer sabre123

Make sure you select the, "continue playing the project" check box for your Play button.

You can then just use:

cp.movie.play();

2 replies

sabre123
sabre123Correct answer
Participating Frequently
April 5, 2018

Make sure you select the, "continue playing the project" check box for your Play button.

You can then just use:

cp.movie.play();

chrismay_at_delta6226261
Inspiring
April 6, 2018

Well, poop. That solved it. That is rather counter-intuitive, if I am explicitly calling cp.movie.play(); it ought to play.

With "continue playing the project" check box checked, you don't even need to call cp.movie.play(); The movie will continue to play because of the checked box.

I think I will file a bug report.

Thanks!

sabre123
Participating Frequently
April 6, 2018

I was thinking exactly the same thing after posting this. I didn't test whether the "Continue playing...." was the only trigger it needed to fire.

Lilybiri
Legend
April 5, 2018

I always use advanced actions and a multistate button to toggle but if you want JS, what is wrong with:

window.cpAPIInterface.play();

window.cpAPIInterface.pause();