I am using Captivate 2019.
There is an interaction where the user selects many objects on the screen. Each object has a shared action to "Show __," "Play Audio __," and "Assign Variable __ to 1." There is then a Conditional action, if "All variables are 1" then "Continue."
I want the slide to automatically proceed to the next because it's a continuation of the interaction. (Otherwise, I'd simply "Show" a button, which works fine enough. It just doesn't make sense for the user to click Next when it's the same interaction).
But when I click the last object on the screen (note this can be in any order), the Conditional activates and the slide continues to the next, without waiting to play the corresponding audio.
How can I get the program to "wait for audio to complete" before activating the conditional continue?
Edit: Right now I am working around the problem by setting a variable to the length of the audio, manually typing in the seconds, which is not entirely ideal. Looking for a better way if possible! Thanks.
There is very little control possible for audio clips started with 'Play Audio', unless you wait for a JS expert who will probably have a solution?
I could imagine some solutions without JS, but you'd better wait for those experts.
Copy link to clipboard
I've used this code for video, it should work for audio also. The only caveat is that there be more than on audio object it finds, which could be fixed utilizing a loop, which doesn't work too well in the JS window. So try executing this in the JS window in the slide onEnter action:
interval = setInterval( checkExists, 100 );
var aud = document.getElementsByTagName( "audio" );
if ( aud.length > 0 )
clearInterval( interval );
if ( aud.readyState > 3 )
Thanks, David! Merry Xmas.