Forum Discussion

RobShattuck's avatar
RobShattuck
Community Member
1 year ago

How do you pause the audio on a Storyline course when you toggle away from the screen?

I can't figure out how to pause the audio on a course when it's playing and you toggle away from that screen.

6 Replies

  • CraigHadden's avatar
    CraigHadden
    Community Member

    If the other app window (that you toggle to) entirely covers the browser window where the course is playing, then for me the audio stops automatically. So maybe the workaround is to ensure that's the case – such as by using maximised windows.

    If the other app doesn't entirely cover the browser window, then I'm not sure Storyline would have any way of telling that the focus has moved somewhere else.

  • Hi RobShattuck

    When toggling to another application or window, it is expected behavior for the slide audio to continue to play

    • Do you want the audio to pause when you toggle to another element or layer within your slide or to another window entirely? It would be helpful to know more about your setup and what you're looking to accomplish.
    • Have you modified any player settings or slide properties on your end? 
    • Where are you experiencing this? I'm curious if it is browser-specific and if testing another browser would be helpful! 

    We'd be happy to take a closer look at your .story file in this thread or privately in a support case to suggest further recommendations!

    Looking forward to hearing from you!

  • RobShattuck's avatar
    RobShattuck
    Community Member

    It appears to be working correctly when it's published in Reach.  When previewing in SL and Review, it continued playing in the background when we toggle to a new window (Outlook, a different tab in Edge, etc.).  If we continue to have an issue, I'll open a support case.  Thanks for the response.

    • LucianaPiazza's avatar
      LucianaPiazza
      Staff

      Hello RobShattuck

      Thanks so much for the update! It sounds like you are experiencing expected behavior when previewing and in Review 360. 

      Happy to help with any further questions in this thread or privately in a support case.

      Have a great afternoon! 

  • MartinKoester's avatar
    MartinKoester
    Community Member

    Just in case you were referring to the background audio track(s):

    They do not pause / mute for me as well, when the broser (tab) loses focus; in Review but also offine or in the LMS.

    I think they should though, and I see no benefit in the background audio continuing when you are in a different browser tab or in a different application. 
    I think there should be a setting in the background audio options for this.

    What worked for me as a workaround is a combination of a variable, a javascript and two triggers:

    Variable:
    "BrowserHidden"; True / False (the name is arbitrary, so is the trigger type; it would work with 0/1 as well)


    Javascript (triggering at the start of timeline, on each base layer on each slide; might work using the master, I did not test that):

    (function () {
      if (window.__storylineVisibilityListenerAdded) return;
      window.__storylineVisibilityListenerAdded = true;

      var player = GetPlayer();

      function updateVisibilityState() {
        var hidden = document.hidden || document.visibilityState === "hidden";
        player.SetVar("BrowserHidden", hidden);
      }

      document.addEventListener("visibilitychange", updateVisibilityState, false);
      window.addEventListener("blur", updateVisibilityState, false);
      window.addEventListener("focus", updateVisibilityState, false);

      // Set initial state
      updateVisibilityState();
    })();

    Trigger (Screenshot is german, sorry for that):


    "BG" is the name of my background audio playlist.
    So you have one trigger pausing the audio when the variable changes from "false" to "correct", and one trigger playing the audio when it changes the other way around. 
    Both triggers need to be on every base layer of every slide in the course.


    • EricSantos's avatar
      EricSantos
      Staff

      Hi MartinKoester​,

      Thanks for sharing your workaround, that’s really helpful.

      You’re right that this is expected behavior today, but I can see how having an option to pause or mute background audio when the course loses focus would be useful.

      I’ve shared your feedback with our product team.