Skip to main content
oktommy
Participant
October 19, 2016
Question

Captivate 8 and Javascript Play common interface function

  • October 19, 2016
  • 2 replies
  • 1159 views

I have a weird issue.  I have a slide that prompts for input with a submit button.

The button calls a very simple javascript that checks if the field is blank.  If it is it puts up an alert box explaining the issue and pauses the movie, so the user has a chance to put something in the box before it continues playing.  If it isn't blank it stores the data in a variable and should then continue the movie.

window.cpAPIInterface.pause(); works fine

window.cpAPIInterface.play(); doesn't do anything.

So now the movie pauses at the slide and I can't seem to get it moving again.  If I use

windows.cpAPIInterface.next(); it will skip to the next slide as expected but it stays paused.

I thought maybe it was my scripting since i'm no javascript expert so i created another button and the only line of script is the common interface play command and it also does nothing when pressed.

For reference my goal is using HTML5 output.

For testing I also previewed in standard flash output in which case the play button works, but the none of the functions from the original box and button work.  I'm sure I could accomplish this without javascript but my project requires several instances of similar functions and it will make it a lot easier if I can just call the function each time.  Haven't used Captivate for a few versions so wasn't sure if there was some large javascript changes.

    This topic has been closed for replies.

    2 replies

    David Burnham HBA
    Inspiring
    April 6, 2018

    No according to the Captivate Reference materials, these commands should work but having tried to work with it for a while with no success and little documentation from Adobe - Well interpret that as you will!

    getVariableValueReturns the value of the given variable name.-window.cpAPIInterface.
    getVariableValue
    ("cpQuizInfoStudentID");
    setVariableValueSets the value of the given variable name with the given value.variableName:Stringwindow.cpAPIInterface.
    setVariableValue
    ("cpQuizInfoStudentID",
    "John");
    playPlays the movie. window.cpAPIInterface.
    play();
    pausePauses the movie. window.cpAPIInterface.
    pause();
    stopStops the movie. window.cpAPIInterface.
    stop();
    rewindRewinds and plays the movie. window.cpAPIInterface.
    rewind();
    nextSeeks the movie to the next slide. window.cpAPIInterface.
    next();
    previousSeeks the movie to the previous slide. window.cpAPIInterface.
    previous();
    fastForwardIncreases the movie speed to 2x, then 4x and then back to normal on consecutive calls. window.cpAPIInterface.
    fastForward();
    getPlaySpeedReturns the movie playback speed in Frames per second (fps). window.cpAPIInterface.
    getPlaySpeed();
    getDurationInFramesReturns the total number of frames in the movie. window.cpAPIInterface.
    getDurationInFrames();
    getDurationInSecondsReturns the total duration of the movie in seconds. window.cpAPIInterface.
    getDurationInSeconds();
    getVolumeReturns the volume of the movie in percentage. window.cpAPIInterface.
    getVolume();
    setVolumeSets the volume of the movie.volume:Number (range : 0 - 1)window.cpAPIInterface.
    setVolume(0.7);
    navigateToTimeSeeks to a particular time (milliseconds) in the movie.timeInMilliseconds:Numberwindow.cpAPIInterface.
    navigateToTime(3000);
    canNavigateToTimeReturns a boolean value showing whether you can seek to a particular time in the movie or not.timeInMilliseconds:Numberwindow.cpAPIInterface.
    canNavigateToTime(3000);
    getCurrentFrameReturns the current frame of the movie. window.cpAPIInterface.
    getCurrentFrame();
    getCurrentSlideIndexReturns the current slide index of the movie. window.cpAPIInterface.
    getCurrentSlideIndex();
    getEventEmitterReturns the handle to the cpAPIEventEmitter object. window.cpAPIInterface.
    getEventEmitter();
    Lilybiri
    Legend
    April 6, 2018

    I have used some of those commands with success. Which ones did you try?

    chrismay_at_delta6226261
    Inspiring
    April 9, 2018

    This thread answered my question.

    Make Captivate play again after pausing - with Javascript

    Which basically restates what the OP says, that the "Continue Playing Project" check box has to be checked. And when its checked, you don't need any script to play the movie, Captivate will do that for you.

    TLCMediaDesign
    Inspiring
    October 19, 2016

    I use the pause the same as you but use: window.cpCmndResume = 1; to play the movie again. I must have encountered the same issue as you some time ago, I don't remember. I have the same basic script file I use for all of our courses and they all use the resume command. I do check if at the end of the slide before issuing the command though.

    oktommy
    oktommyAuthor
    Participant
    October 20, 2016

    Thanks for the assistance.  This also did not work.  In fact I have now figured out that pause also does not work.  It always pauses on load since there is a text entry box.  From there its behavior is following the "Continue playing the project" option.  If it's checked it continues regardless of what I do, and if it's unchecked it stays pauses and won't continue.

    It's processing all of my other script.  Alert boxes show up, or if I set a variable in a text caption it changes accordingly, but its like it's ignoring any play controls.

    I've tried window.cpAPIInterface.pause()/play()

    I've tried window.cpCmndResume = 1

    I've tried cp.setvariable("rdcmndResume","1")

    Nothing seems to be working.  Guess maybe I should try and get it working with internal captivate controls but since I plan to take everything collected and dump it into a google sheet I really need to figure out why javascript is not playing along nicely.

    chrismay_at_delta6226261
    Inspiring
    April 5, 2018

    Did you ever get this working? I am having the same issue.

    Thanks!