Forum Discussion

SueWallis's avatar
SueWallis
Community Member
4 years ago

Restarting audio from the beginning

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

  • Hi Sue, sorry I was on a long weekend! I don't see an attachment, can you re-attach?

    Thanks

      • MaryTCollins-eb's avatar
        MaryTCollins-eb
        Community Member

        Hi Sue, 

        Unfortunately there's still no attachment, I'm wondering if it's because you are replying by email? Maybe try attaching it in the actual discussion on eLearning Heroes?

  • SueWallis's avatar
    SueWallis
    Community Member

    HI Mary

    You are an absolute star - thank you so much. I am really grateful for helping me further with this. I will implment your solution straight away.

    Thanks again

    Sue

  • I was wondering if the ability to restart audio through a trigger could be added. The workaround suggested is a great one but doesn't work for all scenarios. 

  • 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!

  • Just in case anyone finds this post via Google as I did:

    What worked for me ultimately was to do what Leslie originally suggested with putting a duplicate audio file and buttons in a separate layer, but I had to combine it with what Maria mentioned about using the Stop and Start Audio triggers.

    As a note, I'm creating a playlist where the audio is set to automatically play when the slide timeline starts, and the user has a play / pause option as well as a skip option (a forward arrow with a "jump to the next slide" trigger).

    When the user clicks the back button on the base layer, it does three things:

    • A Stop Media Audio trigger activates
    • A Jump to Start of Timeline on This Slide trigger activates
      • (this may not actually be contributing to the solution but I've got some other things on the slide I also wanted to restart when the song restarts)
    • A Show Layer 2 trigger activates

    Layer 2 has the same exact buttons and content as Base Layer, but the audio file is a duplicate (Audio1). The properties of Layer 2 are set to "Resume initial state upon return." Like the base layer, Layer 2 has an auto-play trigger for Audio1.

    When the user clicks the back button on the base layer, it does three things:

    • A Stop Media Audio1 trigger activates
    • A Hide Layer 2 trigger activates
    • A Play Media Audio trigger activates
      • (Audio is the media file on the base slide.)

    This returns the user to the base layer, where the timeline has already been reset, and because the media was stopped when Layer 2 opened, it restarts from the beginning with the play trigger.

    Because Audio1 is stopped when Layer 2 closes, the button on the base layer that reopens Layer 2 also causes the music to restart on that layer. So it creates an infinite loop of restarting the song when the user clicks the button by taking the user to either the base layer or Layer 2.

    Presumably you could also do this with videos or anything else Storyline recognizes as "media," though I haven't tested that yet.

    Hope this helps other people! Even with the lovely advice already in this post it took me a solid hour or two to figure it out yesterday.

  • Hi Katherine,

    Thanks for sharing your solution with the E-Learning Heroes community! I'm sure other developers will find this post useful!