Copy link to clipboard
Copied
I added in a web object that holds a simulation recording (through a URL). The web object is hidden to the slide and is shown through an advanced action once a user clicks a button. Does anyone know how to communicate with the html in the web object (the player) in order to disable the audio from playing after I hide the web object?
Copy link to clipboard
Copied
Hey Matt,
Interesting question. Is your simulation and OAM file or is it a video?
Cheers
Steve
Copy link to clipboard
Copied
Hi Steve,
The simulation is a published package from Captivate (index.html). I am calling on it through a server.
-Matt
Copy link to clipboard
Copied
Thanks Matt,
So technically, you want to communicate between two projects. The one you have and the one you are calling an "animation" on your server. Is that correct?
If it is, then I believe what you want to do is technically possible, but above my "knowledge-grade" I will leave it for others to advise.
Cheers
Steve
Copy link to clipboard
Copied
The easiest way to do this is to set a variable in the parent Captivate file or if you are using a specific button, add a listener in the child Captivate file to listen for the button click and pause the audio. To use the variable, create a variable stopAudio = 0; When you hide to WO set the stopAudio = 1;
Either way you will need listeners in the child Captivate file.
Listen for the button:
window.parent.document.getElementById( 'you button name' ).addEventListener( 'click', function () { stopAudio()});
function stopAudio()
{
//do your magic to stop the audio here
}
or listen for the value of the variable to change:
window.parent.window.cpAPIEventEmitter.addEventListener( 'CPAPI_VARIABLEVALUECHANGED', function ()
{
stopAudio()}, 'stopAudio'
);