Forum Discussion
Java script for MUTE/UNMUTE audio in Storyline 3
Hello All,
Is it possible to MUTE/UNMUTE audio in Storyline 3 (HTML5 output)? I'm working on a course with a custom interface with a button that's supposed to mute/unmute - not pause/play or stop/play - the audio.
In the previous version of the storyline (Storyline 2), I am using javascript code to set the volume to 0 (mute audio) and set the volume to 0.8 (unmute audio). But now in storyline 3, the code was not working.
Please have a look on to the code which I used in Storyline 2:
"
Audio off button:
if (document.location.href.indexOf('html5') < 0) {
} else {
var player = GetPlayer();
Audio.setMasterVolume(0);
$('audio').prop('volume','0');
}
Audio on button :
if (document.location.href.indexOf('html5') < 0) {
} else {
var player = GetPlayer();
Audio.setMasterVolume(0.8);
$('audio').prop('volume','0.8');
}
"
It seems that in storyline 3 function is not working.
Has anyone an idea how audio is played in Storyline3? And how to mute/unmute audio like in Storyline 2?
Thanks
Akash
- RenGomezStaff
Hi Akash,
Are you using jQuery with your JavaScript? To improve security for our customers, we removed jQuery from Storyline 360. You can still use it to write custom JavaScript. You'll just need to reference the jQuery library directly. Hope this helps!
- DorisDenggCommunity Member
Thanks a lot, Sheetal! I have used Vishal's code, but now it doesn't work anymore. Your solution came just in time!!
- BronwynLohanCommunity Member
That's awesome. I was looking for this feature and the code works perfectly. Thanks guys.
- SethMerriam-55bCommunity Member
I can't seem to get this to work. is it browser specific or something?
- norkao-alcocerCommunity Member
Amazing! Thank you Sheetal.
I wanted to add the option to learners so that I can get rid of the Player controls and gain that space on the page.
Trying to replace each function on the Player one by one and mute/unmute (although everyone have the option on their computers), seems an important one that I, as a user, appreciate when I have.
I first created a toggle action on the mute button and then added the conditions separately for mute/ unmute with the provided codes.
Also, I made states for the button so that it changes icon for mute unmute and put all the triggers on the slide master. Have tested and it works perfectly weather I'm playing audio or video in any give slide!
Whoop whoop!