• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Advanced Action to Wait for Object Audio before Auto Continuing

Explorer ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

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.

Views

183

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2018 Dec 19, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

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 );

window.cpAPIInterface.pause();

function checkExists()

{

     var aud = document.getElementsByTagName( "audio" );

     if ( aud.length > 0 )

     {

          clearInterval( interval );

          if ( aud[0].readyState > 3 )

          {

               window.cpAPIInterface.play();

          }

     }

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2018 Dec 20, 2018

Copy link to clipboard

Copied

LATEST

Thanks,   David! Merry Xmas.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources