Restarting audio from the beginning

Feb 19, 2021

Hi

I have some audio that starts when the user presses a 'start audio' button.

I have added a 'pause' button. If the user pauses the audio, and then presses the 'start audio' again, the audio continues from where it was at when it was paused.

I want to add a 'restart audio' button that will start the audio from the beginning but I can't work out how to do it. If I add a trigger to play audio when you press the 'restart audio' button, it just plays where the audio was last up to rather than starting it again from the beginning.

Any ideas would be most welcome

Thanks

Sue

27 Replies
Leslie McKerchie

Hi Sue,

The idea that Mary shared may be just what you are looking for. I'd recommend using a layer to accomplish your goal:

  • The object/trigger for the audio can open the layer that includes the audio tied to the timeline of the layer.
  • The trigger to 'pause' the audio can close the layer.
  • Set layer properties to 'Reset to initial state' so that audio replays.

I've attached a brief example.

Sue Wallis

HI Mary

Thanks so much for looking at this for me and I am so sorry it has taken me so long to reply.

I'm really sorry but I just can't get my head around this.

What I want to be able to do and I am sorry if I am being a bit slow about this.

I want the learner to be able to:

- play audio by pressing a button

- pause the audio and then continue listening from where they left off 9say if they got interrrupted while they were listening)

- replay the audio from the beginning if they wanted to listen to it again

Does your solution work for this and if so if you could show me how I would be really grateful.

Thanks

Sue

Mary T. Collins

Hi Sue, 

I've attached a sample of how I would set this up. There may be others out there that have different ideas but here's one for you to start with anyway! Here are the steps I took: 

  1. I added a Play/Pause button and a Restart button
  2. I added a True/False variable called AudioOn
  3. I added audio to both the base layer and to a layer called Restart audio.
  4. I added a trigger to Toggle the AudioOn variable when someone presses the Play/Pause button, so if it is True it will switch it to False and if it is False it will switch it to true (I also added some states and triggers to change the appearance of the play/pause button just for effect!)
  5. I added a trigger to play the audio when someone clicks the pause/play button if AudioOn is false (the default is set to false) 
  6. And I added another variable to pause the audio when someone clicks the pause/play button if AudioOn is true

That takes care of the play and pause functionality. For the restart one: 

7. I added a trigger to the restart button to jump to the Restart audio layer when the user clicks this. Here the audio will play automatically as soon as the layer starts. 

8. The play/pause button from the base layer will still function here

9. I added a second restart button to the restart audio layer that will restart the timeline on this layer, just in case the user clicks the restart button a second time. 

I know it seems like a lot of steps but once you set it up once you should be able to copy/paste it to other slides with just a few adjustments. 

Hope this helps!

Sue Wallis

HI Mary and Lesley

Thank you both for your help with this.

I have copied the slide into one of my stories so I can copy the triggers. However, when I did this the icons are not showing in the round buttons. Do you have any idea why this might be the case? I have checked the arrange tab and sent the button to the back but this didn't resolve it.

Any ideas cvery welcome!

Thanks again

Sue

Sue Wallis

I am mysified. if I copy the buttons in to a cnew story, they are fine.

If I copy them into my existing stories, the button is not visible. I can see it in the timeline and i can see the different states in the states tab and all the triggers are there. But you can't see the icon.

Sorry to be such a pain, but i would so love a solution to the pause issue and I really love your icons.

Thanks

Sue

 

Sue Wallis

Mary

You have been so helpful so hope you don't mind me asking one more thing. I want to resize your lovely buttons but when I do, it only resizes the circle not the icon in the middle. I can't seem grab the icon to resize that too. Again, do you have any ideas why that may be so? 

Thanks and sorry to be such a pain!

Sue

Mary T. Collins

No problem Sue and rest assured you're not a pain! The icons are actually added to the States for the buttons (I set the buttons up this way so that I could use triggers to change their appearance). So to edit the icons you will need to select the button/circle, go to States > Edit States and there you should find what you need. 

Sue Wallis

HI Mary

I hope you had a lovely Easter break.

I have implemented your restart audio solution to great effect and used your lovely buttons so thank you so much.

I just had one outstanding question if you wouldn't mind. I have attached a slide to demonstrate the issue.

If you press the restart button, the audio restarts (from the restart layer) but if the learner presses the pause button it restarts the original audio (on the base layer) so there are then two audios playing. Similarly, if you press restart while the first audio is playing, you get two.

In the real world, it is likely that someone would only press the restart button once the audio is paused. But I suppose it is not unreasonable for someone to press the pause button on the restarted audio and need it to pause/unpause the audio on the restart layer and not the base layer.

Did you manage to follow that?

Thanks as ever for your really invaluable help.

All the best

Sue

Sue Wallis

07718 993099
sue@thinkouts.com
www.thinkouts.com

[cid:387363bf-7d60-4381-92f1-2a7dc037decd]

Mary T. Collins

Hi Sue, 

I haven't been able to replicate the issue of two audios playing at the same time but what I did find was that if you paused on base layer, then hit restart, then hit pause, it started playing the audio from the base layer rather than the restart layer. To fix this I followed these steps: 

  • Added a pause/play button to the restart layer and hid the one from the base layer
  • Set the initial state to Normal
  • Changed the triggers for this button to refer to the audio on the restart layer
  • Add a trigger to the restart button to return to 0sec on this layer when user clicks restart again
  • Add a trigger to play the audio automatically when timeline reaches 0.25secs

I hope this covers all bases!

Maria Costa-Stienstra

Hi, Kenneth.

The trigger "Play audio" will restart the audio after it completes or is stopped. So if your design allows, you could add a replay button with the following triggers:

  • Stop audio when the user clicks the replay_button
  • Play audio when the user clicks the replay_button

Here's an example:

Windows 10 (1) 2022-02-24 at 3.45.42 PM

Let me know if that helps!