Skip to main content
Known Participant
February 9, 2022
Answered

Toggle - Continue Playing the Project Issues

  • February 9, 2022
  • 2 replies
  • 867 views

Hello,

I am using Captivate 2019 v. 11.5.5.553. I have a project that uses a custom button set that includes CC, audio mute/unmute, replay (slide), play/pause, back, and next. The button set works great EXCEPT for the toggles (CC, play/pause, TOC). To be clear, the toggles work, but on stakeholder review, I received several comments that clicking the toggle buttons causes the timeline to continue whenever the timeline is at a pause point, so the pauses are bypassed (i.e., if there is an interaction where the learner has to click on something to continue or at the end of the slide, when the learner should have to click the next button). My initial thought was "Well, don't do that." but that won't fly.

I've read through the bulk of the posts on using toggle commands but have not seen one that quite fits my issue. It seems there are only two options - Continue Playing the Project checked or unchecked. Unchecking this is fine for the TOC because I have the Hide TOC action on enter for all slides but this is not acceptable for the CC and play/pause buttons. As part of the solution, I removed the play/pause but one of the stakeholders wants it back.

Am I missing something? Is there a solution?
As always, thanks to this helpful community.

This topic has been closed for replies.
Correct answer TLCMediaDesign

For the play button to work correctly, do the following.

 

Create a variable in Captivate called "endSlide"

 

Execute this JS on slideEnter ( usually in an advancd action) of the first slide in the project:

 

window.cpAPIEventEmitter.addEventListener( 'CPAPI_SLIDEENTER', enterSlide, false );

var slideData;

function enterSlide( e )
{
slideData = e.Data;
window.endSlide = false;
window.cpAPIEventEmitter.addEventListener( 'CPAPI_VARIABLEVALUECHANGED', slideTimer, 'cpInfoCurrentFrame' );
}

function slideTimer()
{
if ( window.cpInfoCurrentFrame > slideData.to - 5 )
{
window.endSlide = true;
window.cpAPIEventEmitter.removeEventListener( 'CPAPI_VARIABLEVALUECHANGED', slideTimer, 'cpInfoCurrentFrame' );
}
}

 

Then use the endSlide variable in your play button action, yu'll need to flip your condition to be

 

if

cpCmndPause = 1

and endSlide = 0

 

change state

continue

 

else

change state

pause

 

2 replies

B_P_HAuthor
Known Participant
February 9, 2022

TLCMediaDesign helped me sort my issue with the CC and TOC buttons. Here's my scripting for my Play/Pause button. It's a two-state button (pause and play) that toggles the button state images and pauses and plays the timeline. It's functioning as it's supposed to but the unwanted result is that when toggling from pause to play, it continues the timeline if the timeline is already paused, either for an interaction or at the end of the slide.

TLCMediaDesign
TLCMediaDesignCorrect answer
Inspiring
February 9, 2022

For the play button to work correctly, do the following.

 

Create a variable in Captivate called "endSlide"

 

Execute this JS on slideEnter ( usually in an advancd action) of the first slide in the project:

 

window.cpAPIEventEmitter.addEventListener( 'CPAPI_SLIDEENTER', enterSlide, false );

var slideData;

function enterSlide( e )
{
slideData = e.Data;
window.endSlide = false;
window.cpAPIEventEmitter.addEventListener( 'CPAPI_VARIABLEVALUECHANGED', slideTimer, 'cpInfoCurrentFrame' );
}

function slideTimer()
{
if ( window.cpInfoCurrentFrame > slideData.to - 5 )
{
window.endSlide = true;
window.cpAPIEventEmitter.removeEventListener( 'CPAPI_VARIABLEVALUECHANGED', slideTimer, 'cpInfoCurrentFrame' );
}
}

 

Then use the endSlide variable in your play button action, yu'll need to flip your condition to be

 

if

cpCmndPause = 1

and endSlide = 0

 

change state

continue

 

else

change state

pause

 

B_P_HAuthor
Known Participant
February 23, 2022

Thanks again @TLCMediaDesign  - this works perfectly. The only thing I wasn't sure about was the Select Window drop down. I used Current Window. The only other thing I had to do was add a line to my default slide on enter script to change the button state to normal because if you click that button it will still change the state - but it doesn't advance, which is what I needed.

Inspiring
February 9, 2022

Have you tried to add 'Pause' to the end of the advanced actions script for the problomatic buttons? I assume your custom button set has advanced actions. 

B_P_HAuthor
Known Participant
February 9, 2022

The CC and TOC use On Success: Toggle, Variable: cpCmndCC and cpCmndTOCVisible respectively.

The Play/Pause (which I removed long ago) does have a pause because that's how it works. The problem is, when paused at a timeline pause point, when you toggle it to play, it bypasses the pause.

Thanks for your reply.

TLCMediaDesign
Inspiring
February 9, 2022

You won't have that issue if you put you actions in Advanced Actions or make sure you don't have the continue playing project selected for a simple action.