Skip to main content
ruthg84
Known Participant
April 22, 2016
Answered

Play/Stop Audio Clip with one button

  • April 22, 2016
  • 1 reply
  • 5390 views

I am having a lot of trouble figuring out how to use advanced actions to toggle an audio button on and off. I have read several blogs and posts on the forum but it is still baffling me!

I want to create a button that can be clicked once to play audio, clicked a second time to pause it, and clicked a third time to restart the audio (in the same place it left off).

Can anyone help with a really clear walk through of how to use the advanced actions to create this? There only seem to be bits and pieces of the puzzle in the posts and blogs I have found so far!

I have started with a smart shape which has a fill image of a speaker:

I was using simple actions to have this trigger the audio but then there is now way to pause and restart it as far as I can see without using advanced actions. Apologies if this has already been answered but I cannot find any post that has an exact walk through of the process.

Thanks!

Ruth

This topic has been closed for replies.
Correct answer Lilybiri

OMG That is something totally different from the title of your thread which says literally 'Toggle Audio Narration On/Off'. That title is not correct at all for what you ask here. You want a button to Play/stop an audio clip. I will your title that way (using my moderator's power

If you want an audio file to play when a button is clicked you use the command

  Play Audio

If you want to stop it you use the command

Stop Triggered Audio.

If you want to use the same button to play/stop a specific audio clip, you need to create a similar action as I explained in th Toggle buttons article, but not use the system variable cpCmndMute, but a user variable. It has almost the same signification as the variable v_visib that I used to show/hide images. Will label this audio variable v_audio, with a default value of 0. The conditional action will then be:

IF v_audio is equal to 0

   Play Audio ....           indicate the audio clip
    Toggle v_audio

ELSE

   Stop Triggered audio
    Toggle v_audio

I didn't add state changes here, can be done the same way as described in the article.

1 reply

Lilybiri
Legend
April 22, 2016

What is the problem with my articles? Keep it simple in that case, just don't change the look of the button when it has been toggled.

Use a simple action:

Toggle cpCmndMute

Be sure to uncheck the option Continue Playing Project.

ruthg84
ruthg84Author
Known Participant
April 22, 2016

Hi Lily,

Your article was great: 1 action = 5 Toggle Buttons - Captivate blog

However, it seemed that this toggle audio action is more tailored for using slide narration. I don't want to narration to play automatically with the option of muting it. I want the audio to be linked to the button, so that it only plays if the user clicks the button. I couldn't seem to work out how to do that from the blog.

I will try your advice about using the simple toggle action. I'm just not sure about where the audio file goes!

Best,

Ruth

Lilybiri
LilybiriCorrect answer
Legend
April 22, 2016

OMG That is something totally different from the title of your thread which says literally 'Toggle Audio Narration On/Off'. That title is not correct at all for what you ask here. You want a button to Play/stop an audio clip. I will your title that way (using my moderator's power

If you want an audio file to play when a button is clicked you use the command

  Play Audio

If you want to stop it you use the command

Stop Triggered Audio.

If you want to use the same button to play/stop a specific audio clip, you need to create a similar action as I explained in th Toggle buttons article, but not use the system variable cpCmndMute, but a user variable. It has almost the same signification as the variable v_visib that I used to show/hide images. Will label this audio variable v_audio, with a default value of 0. The conditional action will then be:

IF v_audio is equal to 0

   Play Audio ....           indicate the audio clip
    Toggle v_audio

ELSE

   Stop Triggered audio
    Toggle v_audio

I didn't add state changes here, can be done the same way as described in the article.