Forum Discussion
Background Music Demo
I made a demo featuring background music that goes through the whole course (doesn't change from slide to slide). The user can chose from four songs to listen to and can adjust the volume, and the song continues playing through every slide and loops when it completes. I've also added instructions on how to make this work to the module.
I don't know whether someone else has already posted something like this (I couldn't find anything), but hey if so here's one more!
-------
I've put together a second demo that shows a different way to do this. This second version performs the same actions as the first one, but without needing to edit the output files every time you publish! It saves a lot of headaches when you need to edit something in the course because now you don't have to drop the music files into the output folder and you dont have to edit the html file every time you publish!
I've also attached the second version .story file. Its called Background_Music_Version_2.story.
If anyone needs help getting either versions of this to work I'm more than happy to assist :)
- AlexandriaLairdCommunity Member
This information has be extremely helpful! I was able to add the background music to multiple courses. However, for one of my courses the music is way too loud and is blocking out the other media within the course. Is there a way to reduce the volume of the background music so it automatically plays softer, without having to add a volume control?
- AaronBussey-bf7Community Member
This rocks Jackson - Thanks for sharing!
- BridgetVarnedoeCommunity Member
Thank you so much for this information!
It was extremely helpful. I LOVE this community!
- ChristiePollickCommunity Member
Hi, Daniel -- Thanks for reaching out, and it looks like it's been a little while since Jackson replied here in the discussion, so if you'd like to reach him directly, you are welcome to use the 'Contact Me' link on his profile page.
- AnikNeogiCommunity Member
Hi Jackson, I just have one mp3 file that I would like to play in a loop starting from a certain slide. Here are some screenshots of what I did.
But, when publishing to Moodle, I am getting this error.
I tried testing it on Articulate Tempshare, but also got an error.
Obviously, I am doing something wrong somewhere, so any help from you or other members who have had success using this approach will be greatly appreciated.
I also have another question. What should I do if I want the audio to stop playing after a certain slide? Is there another JS command I could use. In essence, it's a small file so I need it to loop on a number of slides but I would like it to stop once a particular slide is reached.
Many thanks in advance.
Anik
Hi Anik,
I can't speak to the Moodle error, but when uploading to Tempshare you'll need to have publish for web. If you'd like to try the content in another LMS environment you could look at using SCORM Cloud which is an industry standard for testing LMS content. You could take a look at the article here for some directions on how to test this out.
I'll defer to the community in regards to the additional JS set up as it's not something that staff can offer support for.
- AnikNeogiCommunity Member
Thanks for the tips Ashley! I will try SCORM Cloud then.
I am hoping someone will have the answer to my JS queries, and point out what I am doing wrong.
Cheers,
Anik
- charlenenealeCommunity Member
Hi Anik,
I'm not sure if you have already tried this JS, it was posted here previously and works brilliantly:
It is possible to stop the music and resume it while the video is playing. If you execute this javascript trigger it will mute the music:
var audio = document.getElementById('bgSong');
audio.volume = 0.0;and to resume the music:
var audio = document.getElementById('bgSong');
audio.volume = 1.0;Good luck with your project,
Charlene
Thanks, Charlene, for popping in and lending a hand! :D
- AnikNeogiCommunity Member
Hi Charlene,
Thanks a lot. That looks like a neat trick! I will try that.
Regards,
Anik
- DietmarGrasböckCommunity Member
Thanks to Jackson and as well all others for sharing this wonderful post :)
I needed to play an intro song at the first few slides which later stops at a certain slide. So I removed the
loop
in the HTML5 <audio> tag.<audio src="song.mp3" id="bgSong" preload="auto" autoplay></audio>
And, as I dont liked the abrupt ending of the song, I made a smooth fade-out with a javascript trigger:
var sound = document.getElementById('bgSong');
var fadeAudio = setInterval(function () {
// Only fade if not at zero already
if (sound.volume != 0.0) {
sound.volume -= 0.1;
}
// When volume at zero stop all the intervalling
if (sound.volume === 0.0) {
clearInterval(fadeAudio);
}
}, 400);This works fine for me, but - to be honest - there is one thing, that bothers me. The Volume slider in the Storyline player has no influence to the <audio> song.
My question: Is there a way to forward the current level of the volume slider into other javascript variables?
I am grateful for any advice!
Regards,
Dietmar