Copy link to clipboard
Copied
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!
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");});
cpAPI
...Copy link to clipboard
Copied
Look at.cpCmndPause and cpCmndResume.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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");});
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi guys, thanks for the tips! I'll give it a shot.