play audio only once

Apr 11, 2016

Hello

I am trying to figure out how to play an audio file only one time - the first time the user visits the page.

I think this can be done through variables but not to sure how to set it.

I appreciate your help :)

11 Replies
Steve VE

Samantha:

Here's one quick way.

Set up a true/false variable. Something like stopAudio. Set the default value to False.

On the slide where the audio is playing, add two triggers.

Trigger 1 - The very first slide trigger in the list

Stop media "audio file name" when the timeline starts if stopAudio is equal to True

Trigger 2 - Doesn't really matter where this one goes

Set stopAudio equal to True when the timeline ends

What happens:

  1. The slide plays for the first time. Trigger 1 checks the stopAudio variable. It is set to False (the default). The audio plays.
  2. At the end of the timeline, the Trigger 2 is fired and the stopAudio variable is set to True.

The next time the slide is visited, Trigger 1 checks the stopAudio variable. It sees that it's set to True. The audio is immediately stopped.

Note that this will require a different variable for every slide (stopAudio1, stopAudio2, stopAudio3 etc.) because every piece of audio needs to be stopped on an individual basis.

One other note: This will only work if the user listens to the end. If they don't, the audio will play again when they revisit the slide. If you don't care if they listen to the whole thing, just set the stopAudio variable to True when the timeline starts. Be sure that Trigger 1 remains at the top of the list, though.

Hope this helps.

This discussion is closed. You can start a new discussion or contact Articulate Support.