Pausing Audio when returning to a previous slide

Hi Guys,

I've been creating a Module that has audio on every slide, there are a few slides where I need the audio to be paused when returning to them. (so if i press previous i want the audio to be mute). I've tried using variables but it doesn't seem to be working.

Any Suggestions?

Kind Regards

Gavin

13 Replies
Martin Andersen

Hi Gavin,

if I understand your question right, you want the audio to only play once when visiting and when revisiting it shall be muted.

This can be done using variables. I created a true/false variable called 'muteAudio' that as default is false. When the previous button on slide 2 is clicked, the variables changes to true and goes to the previous slide. Slide checks if the variable is true, and if it is, then the media sound is stopped/paused.

Hope this is what you are looking for.

Antony Snow

Hi Gavin,

There are a probably a few ways you can do this but the way I'd do it is as follows:

  • Create a T/F variable, call it 'Slide1Complete' (or something similar) and set the default value to FALSE - you will need to create a new variable for each slide
  • Add a trigger to your next button that adjusts 'Slide1Complete' to TRUE when the user clicks - this should be ABOVE the trigger that jumps the user to the next slide as S/L executes triggers from top to bottom, so you want to adjust the variable first before moving the user on
  • Move the audio file to a layer (this will give you more control over when it is played) and add a slide trigger to the base layer to show this layer when the timeline starts, but on condition that 'Slide1Complete' is equal to FALSE

I attach a very rough example, which I hope will help

Phil Nissley

Hi folks, I know this is an old topic but I'm trying to do the same thing and found this topic in my search. I wanted to try to use a variable as well, since I've never used them and thought it would be the best solution to doing this. I have a Table of Contents (TOC) slide that I don't want users to hear the audio for, every time they return to it.( Basically they just hear it the first time through.)

I did exactly as Martin has suggested (before even seeing this post): created a T/F variable called muteAudio with default value of False. When a user clicks a TOC link they jump to a target slide/scene. From the target, they click a "return to TOC" object, which links back to the TOC slide and sets the muteAudio variable to True. Within the TOC slide, there's a Trigger that is exactly as Martin set up. It says "stop playing the audio when the Timeline starts if muteAudio=True. For some reason, this is not working though.

I'm doing this in a very rough, proof of concept project, but the logic is the same and for some reason, the audio keeps playing upon return to that TOC slide. Any suggestions???

Ashley Terwilliger

Hi Phil,

It looks like the trigger is set up for when timeline starts - but is the user returning to the slide in a state of "resume saved state"? If so, the trigger won't execute as the user is picking up where it left off and restarting the audio from that point. 

You may want to share a few slides of your file here so that folks could take a look at what you set up to offer some additional thoughts/ideas and comments. 

Phil Nissley

Hi Ashley, thanks for the reply. You know, I suspected that might be the issue, since I've been testing it as a user who might click a link before the audio/slide timeline completes. Assuming that's my problem, how would I change my "stop media" Trigger?

I'm attaching this simple project segment with the TOC that links to two slides. There is a link back to the TOC slide on the character images in each "target" slide. (For the final project, I'll want to link to different scenes but I assume the logic shouldn't be any different.)

Thanks!

Ashley Terwilliger

Hi Phil,

Is your TOC slide 1.2?  I looked at it and saw the slide's properties were set to "automatically decide" vs. using resume save state which should stop the audio from playing again. That seems to work for me if I navigate away and then back to that slide. The other scene is the one where you set up the variables - but the first scene works normally. 

Phil Nissley

Hi Ashley,

I apologize but It was actually in Scene 2, so my TOC was slide 2.2 and I apologize for that, since it made it harder to see where my problem was. (I've taken out the other scene so the TOC is slide 1.2.)

I wasn't aware of the Slide Properties pane, which is only visible in the Story view as opposed to the individual slide view but for some reason, this is still not working for me (maybe because I'm setting the variable in two places?).

Here is what I've done. I really appreciate this, since moving forward, I'll be the "go to guy" for our e-learning initiatives.

Ashley Terwilliger

Hi Phil,

Thanks for sharing an updated copy of your course.

In regards the the slide properties pane, it's still accessible on individual slides, just in a bit of a different location. You can read about how to access it here. 

In regards to your file, it does look like you were setting the variable value after the user had already jumped to the slide, and therefore a) it was not changing at all and b) your trigger was set up to watch for the variable to change, so if it was changing on another slide than it would not ever fire the trigger on slide 1.2. I changed the trigger order and then revisiting the slide the audio does not replay. This is also based on your slide settings to "resume saved state". Which, if you were using that and the audio had already played through entirely and the user were to revisit it - the same would occur regardless of the variable - it wouldn't replay based on the slide properties. 

Phil Nissley

Wow, thanks so much Ashley! That was great and yes, I did find out about accessing slide properties from within the slide as well as in the Story View.

I kind of thought the trigger order was an issue but I thought it might be at a higher (i.e. object/button) level rather than the individual trigger level. That's great info to know.

Also, it appears that my setting the variable in the target slides (triggered by clicking on the character, which also returns the user to the TOC slide) was redundant, since the variable is first set in the TOC when the user clicks the link to the target slide (i.e. slide 1.3 or 1.4). Am I correct in this assumption?

Thanks again. This was my first foray into variables and I really wanted to use their power and elegance, rather than having to create a duplicate TOC slide that users would return to.

Regards,

Phil Nissley

Elena Linville

I realize that this is an old post, but I am having the same problem as Phil did with my project. I have a slide with different clickable objects each of which sends the user to a different slide. When they are done with that slide, the Prev button returns them to the main slide. Unfortunately, if they click on an object before the audio on the main slide ends, it just resumes playing from where it left of once they come back. I need the audio to not play at all when they come back to the main slide.

I set up all the triggers like shown in Phil's example, but it still doesn't work. 

Ashley Terwilliger

Hi Elena,

Thanks for sharing the file. Just a couple changes to get this working.

The first is your trigger order for setting the variables, it needs to appear before the trigger to go to the next slide as you'll see here: 

That way it has time to execute the variable adjustment.

Also you'll see the top trigger to stop the media is changed to when the timeline starts based on a condition of the variable being True. The "When variable changes" trigger is looking for that adjustment to occur at that moment, and since upon a revisit to the slide the variable has already changed that Stop media trigger wouldn't execute. 

Let us know if you need anything else!