Stop music on a slide after setting audio to play in all slides using Java


I set the audio of my course to play without restarting using some code I found on threats on this forum; now, I would like to stop the music in only one particular slide because there is a video. Is there anyway to do this? 


This is the code im using: 

//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="";"bgSong" ;
line.autoplay = true;
line.loop = true;

//but we only want to add these once!
var audio = document.getElementById('bgSong');
audio.volume = 0.1;



Thank you very much! 

1 Reply
Anderson Rumuy

I got this Javascript from Owen Holt Post

Try this, You can adjust the volume of the backsound music

using Dial + JS to get the volume control of the backsound music

var player = GetPlayer();
var level = player.GetVar("Volume")
var audio = document.getElementById('bgSong');
audio.volume = level;

the Variable is "Volume" number.