I came up with a solution to pause the background audio for a single slide, and it could potentially be used to end the background audio at the end of the last slide in a module. Not sure about fade out, but you could stop it.
Accessibility controls need to be enabled in the player for this to work.
If you do not want to actually show the accessibility controls:
On the first slide of the course, execute javascript when timeline starts.
var link = document.getElementById('settings');
link.style.display = 'none';
link.style.visibility = 'hidden';
On the slide that you want to turn the background music off, execute javascript when timeline starts.
var thisVariable = GetPlayer().GetVar("musicOn");
if (thisVariable == 1) {
document.getElementById("backgroundAudio-switch").click();
GetPlayer().SetVar("musicOn",0);
}
On the slide before and after the "turn it off" slide, execute javascript when timeline starts
var thisVariable = GetPlayer().GetVar("musicOn");
if (thisVariable == 0) {
document.getElementById("backgroundAudio-switch").click();
GetPlayer().SetVar("musicOn",1);
}
(this is different than the one above. Copy it very carefully.)
Create a new number variable in the project, name it musicOn
. Default value 1.
The problem is the background music doesn't pause when the user clicks pause on the playbar. For example, let's say the learner wants to pause the audio to answer a phone call. When they select Pause on the player the in-slide audio pauses, but the background audio does not. It seems like that scenario would be a more common use case than one in which a developer would want to turn off/pause the background audio for a single slide.