Skip to main content
Inspiring
July 24, 2017
Answered

Is there a Captivate system variable that tells me if the project is playing?

  • July 24, 2017
  • 3 replies
  • 415 views

Hello,

Is there a Captivate system variable that tells me if the project is playing or not?  There are a number of Javascript functions I would like to write, but in order for them to work, I need to find out if the project is currently playing or paused..

Thanks for any help!

This topic has been closed for replies.
Correct answer Gaanf

I know of no way to detect if the movie is currently playing or not (without any events occuring), but you can listen for the events to pause or resume it and then e.g. update a user variable whenever that happens (or call any other function for that matter).

Create a user variable v_isPlaying with a default value of 1 and run the following javascript on slide enter:

cpAPIEventEmitter.addEventListener("CPAPI_MOVIEPAUSE", function(){window.cpAPIInterface.setVariableValue("v_isPlaying","0");});

cpAPIEventEmitter.addEventListener("CPAPI_MOVIERESUME", function(){window.cpAPIInterface.setVariableValue("v_isPlaying","1");});

3 replies

papaintegrator
Inspiring
July 25, 2017

You can use the method suggested by Gaanf.

For more details on how Event Emitter can be used to detected various movie (project) events please refer to : https://helpx.adobe.com/captivate/using/common-js-interface.html

Inspiring
July 25, 2017

Hi guys, thanks for the tips!  I'll give it a shot.

GaanfCorrect answer
Inspiring
July 24, 2017

I know of no way to detect if the movie is currently playing or not (without any events occuring), but you can listen for the events to pause or resume it and then e.g. update a user variable whenever that happens (or call any other function for that matter).

Create a user variable v_isPlaying with a default value of 1 and run the following javascript on slide enter:

cpAPIEventEmitter.addEventListener("CPAPI_MOVIEPAUSE", function(){window.cpAPIInterface.setVariableValue("v_isPlaying","0");});

cpAPIEventEmitter.addEventListener("CPAPI_MOVIERESUME", function(){window.cpAPIInterface.setVariableValue("v_isPlaying","1");});

Lilybiri
Legend
July 24, 2017

Look at.cpCmndPause and cpCmndResume.

Inspiring
July 24, 2017

I understand those to be functions you call to pause and resume the project, respectively.  I am looking for a "read only" function I can call to see if the project is already playing or paused.