Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Engaged ,
Jul 24, 2017 Jul 24, 2017

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!

326
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jul 24, 2017 Jul 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");});

cpAPI

...
Translate
Community Expert ,
Jul 24, 2017 Jul 24, 2017

Look at.cpCmndPause and cpCmndResume.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 24, 2017 Jul 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 24, 2017 Jul 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");});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 25, 2017 Jul 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 25, 2017 Jul 25, 2017
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources