Forum Discussion
How do you pause the audio on a Storyline course when you toggle away from the screen?
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.
- EricSantos16 days agoStaff
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.
Related Content
- 10 years ago