Copy link to clipboard
Copied
I'm displaying a "Stop Audio" button to stop any triggered audio clips on a slide. It's easy to make it hide itself when clicked, but I'd love to also hide it whenever the audio ended.
Anybody know how a JavaScripty way to add a listener to the triggered sound object? (I'll live if it's not possible.) Thnx!
Are you on Captivate 9? There could be a possibility using the new 'Delay Next actions by... ' command, but you'll have to check the duration of each audio clip. The delay time, which will be that audio clip duration, can be put into a variable which makes it more flexible. That command will be functional for both SWF and HTML output. Beware: I love the CpExtra widget, it is a 'must have' for each CP-developer that wants to go beyond the basic features of Captivate.
@Rod I thought CpExtra for end
...Copy link to clipboard
Copied
The CpExtra widget makes this possible (and very easy), but it's only for HTML5 output.
Copy link to clipboard
Copied
Are you on Captivate 9? There could be a possibility using the new 'Delay Next actions by... ' command, but you'll have to check the duration of each audio clip. The delay time, which will be that audio clip duration, can be put into a variable which makes it more flexible. That command will be functional for both SWF and HTML output. Beware: I love the CpExtra widget, it is a 'must have' for each CP-developer that wants to go beyond the basic features of Captivate.
@Rod I thought CpExtra for end of audio event will only work with audio attached to objects or slide, not with audio triggered by an advanced action? Has this been changed?
Copy link to clipboard
Copied
Well, I didn't use CpExtra (we are just about to upgrade to C9 and haven't explored that yet) but you gave me the answer by suggesting putting the duration in a variable. I already had a function to insert "alternative" CC text associated with the triggered audio into the default CC box. I've just extended it to include a timer that "clicks" the "Stop Audio" button (which hides itself, which is what I was after). Thanks!
window.aTimeout;
function createAltCC(cc, t) {
window.clearTimeout(window.aTimeout);
var ccTxt = $('#ccText').find('p')[0];//link to default CC text element
if(!$(ccTxt).hasClass('hideCPel')) {
$(ccTxt).addClass('hideCPel');
}
$('#altCCtxt').remove();//remove previous CCs
var altCCtxt=document.createElement('p');
$('#ccText').prepend(altCCtxt);
altCCtxt.id='altCCtxt';
altCCtxt.innerHTML=cc;
if(t) {
var i=0;
window.setTimeout(audioPopTimer, 1800);
}
function audioPopTimer() {
if(t>i) {
i+=1;
window.aTimeout=window.setTimeout(audioPopTimer, 1000);
} else {
//'clicks' the stop audio button
window.cp.runJavascript(cp.model.data.btn_stopAudioPops.oca);
}//end if
};//end audioPopTimer
};//end createAltCC
The button that triggers the audio executes this code (in addition to some other actions):
CCtxt='This is the CC text for my triggered audio clip, which is 18 seconds in duration.';
createAltCC(CCtxt, 18);
*that CSS class hideCPel has to be added to the course with the styles, display:none !important; opacity: 0;