Forum Discussion
Background Music Demo
Thanks Jane!
So firstly, the location variable goes back too far, the current one is:
"C:\Users\Jane\Documents\My Articulate Projects\test background music - Storyline output\story_content\WebObjects"
and all you need for that variable is: story_content\WebObjects\6VUFHlYBLQO
The last bit, the 6VUFHlYBLQO part, can be found in the WebObjects folder after you publish your storyline file. If you ever add any additional songs or change the song that you included in the course you will need to find that folder again and update the variable with the new random string of numbers and letters.
Secondly, the trigger setting the song to start playing is missing. In your case, since it is just a single song, I would just lump that trigger into the same javascript trigger you already have to make it easier.
Use this trigger:
//load the scripts dynamically into the head of the document
function add_line() {
var line = document.createElement("audio");
var head=document.getElementsByTagName('body')[0];
line.type = "audio/mp3";
line.src="";
line.id="bgSong" ;
line.autoplay = true;
line.loop = true;
head.appendChild(line);
}
//but we only want to add these once!
if(document.getElementById('bgSong')==null){
add_line();
var audio = document.getElementById('bgSong');
audio.volume = 1.0;
}
var player = GetPlayer();
this.Location= player.GetVar("location");
var audio = document.getElementById('bgSong');
audio.src=Location+"SONGNAMEHERE.mp3";
audio.load();
audio.play();
and replace "SONGNAMEHERE.mp3" with the real name of the song. The bold part of the script is the new part and you can add it to your trigger. This should get your music starting when the timeline starts.
Let me know if you run into any more issues! I hope this helps :)
- JaneJordan110 years agoCommunity Member
Wow thank you so much for your help Jackson I will try that out asap - cheers and much appreciate your time
Sent from my iPhone