Skip to main content
Participant
January 27, 2016
Answered

Adding logic to an audio file to only play 1 time.

  • January 27, 2016
  • 2 replies
  • 305 views

I have a slide  that the user will return to multiple times. It contains an audio file that I would like to only play the first time that the user views that slide. How do I do that? I have Captivate 9.

This topic has been closed for replies.
Correct answer Lilybiri

That makes it easier. Delete the slide audio, first find it in the Library, because you'll use a command to launch it only the first time.

Create a user variable v_visit with a default value of 0.

Create this conditional advanced (or shared) action:

IF v_visit is equal to 0

        Play Audio  ....        add the audio clip from the Library

        Assign v_visit with 1

        Continue

ELSE

        Continue

Oops, forgot last step: trigger this action by the On Enter event of the slide.

If you want to use this on multiple slides, you'll have to reset the variable to 0, maybe using the Next button on the slide? Don't use the On Exit event, unless you are sure that the last frame of the slide will be reached. That is not the case if you have a Next button that has the action 'Go to Next Slide'

Rick's work flow was the only possible in former versions, before the command Play Audio appeared. I talked about it:

Audio Objects: Control them! - Captivate blog

2 replies

Captiv8r
Legend
January 27, 2016

I would add an object such as a transparent Text Caption. Attach the audio to that. Then hide the object after the first slide visit. You would use a variable in an advanced action that would be triggered on Slide Enter to track whether the slide has been visited and check the variable to see if the caption needs to be hidden.

Cheers... Rick

Lilybiri
Legend
January 27, 2016

There are several possibilities. First I have to know if you need CC? Because that limits audio to slide audio.

Participant
January 27, 2016

No, I will not need closed captioning.

Lilybiri
LilybiriCorrect answer
Legend
January 27, 2016

That makes it easier. Delete the slide audio, first find it in the Library, because you'll use a command to launch it only the first time.

Create a user variable v_visit with a default value of 0.

Create this conditional advanced (or shared) action:

IF v_visit is equal to 0

        Play Audio  ....        add the audio clip from the Library

        Assign v_visit with 1

        Continue

ELSE

        Continue

Oops, forgot last step: trigger this action by the On Enter event of the slide.

If you want to use this on multiple slides, you'll have to reset the variable to 0, maybe using the Next button on the slide? Don't use the On Exit event, unless you are sure that the last frame of the slide will be reached. That is not the case if you have a Next button that has the action 'Go to Next Slide'

Rick's work flow was the only possible in former versions, before the command Play Audio appeared. I talked about it:

Audio Objects: Control them! - Captivate blog