Forum Discussion
JamesWHenry
3 years agoCommunity Member
Articulate Storyline 360- Music across specific slides - how to stop it?
Hi all.
I know there have been a couple of threads on this topic. The ones I see are more than a couple of years old, from what I can tell, so I am hoping to get a 2022 perspective if possible. I ...
Jürgen_Schoene_
3 years agoCommunity Member
you don't need two trigger
initialize and play audio
if(document.getElementById('bgSong') === null){
var audioFileName = "Jeopardy 3 Minute music Mixdown JHenry.mp3";
var audioVolume = 0.05;
var audioNode = document.createElement("audio");
audioNode.id = "bgSong";
audioNode.type = "audio/mp3";
audioNode.src = "story_content/audio_files/" + audioFileName;
audioNode.volume = audioVolume;
audioNode.loop = false;
audioNode.autoplay = true;
document.body.appendChild(audioNode);
var audio = document.getElementById('bgSong');
audio.play();
}
i have reorganized the script a bit - so it should be more readable
stop audio
if(document.getElementById('bgSong') !== null){
var audio = document.getElementById('bgSong');
audio.pause();
audio.currentTime = 0;
}
pause audio
if(document.getElementById('bgSong') !== null){
var audio = document.getElementById('bgSong');
audio.pause();
}
play audio
if(document.getElementById('bgSong') !== null){
var audio = document.getElementById('bgSong');
audio.play();
}
Related Content
- 11 months ago
- 8 months ago