Play/Pause with multiple audio files

I have tabs each with it's own audio file that plays when tab is clicked. I want a Pause/Play button on page that will pause all events/audio when clicked and then pick up where left off when click again. Any suggestions? I already have stops on all other audio if you are on a certain tab.

Discussion (2)

The pause button is easy: Add actions to "Pause" each audio.

For the play button you need to know which audio has been playing, i.e. which tab is opened.

Create a variable called "currentTab". Initial value = 0 (if no tab is opened when the page is loaded) = 1 (if the first tab is opened when the page is loaded).

Add an action to each tab button.

On: Click

Action: Modify variable

Target: currentTab

Type: Set equal to

Value: 1 (for the first tab), 2 (for the second), ...

Add actions to the Play for each audio / tab:

On: Click

Action: Play

Target: audio_1

Condition: Only if "currentTab" Equal to "1"

Change the target and the value in the condition for each audio.

Tim

Hi Tim,

Thanks again for your solution. It really helped our course have the functionality it needed.

Karen

Discussions have been disabled for this post