Forum Discussion
Javascript to MUTE audio?
Is it possible to MUTE audio in Storyline? I'm working on a course with a ground-up custom interface with a button that's supposed to mute/unmute - not pause/play or stop/play - the audio.
Are there any Javascript gurus out there who know if this is possible? And if so, can you provide the scripts for mute and unmute? That would SO make my day.
Dazed and confused...
Patrice
141 Replies
- ElectronKarthicCommunity Member
Glad i found this post! Steve Flowers - Thanks a ton!
- ElectronKarthicCommunity Member
M K said:
By the way, looking for a solution to implement mute/ unmute in HTML5 output. any help on the same will be greatly appreciated.
Thanks
MK
You can use a trigger to execute this javascript code on HTML5 mode,$('audio').each(function(){
this.pause();
});
This will pause all the audio which are active. You can execute this on conditional basis (say when timeline starts if variable audio = false) then call this code otherwise let the audio to play by default.
- ElectronKarthicCommunity Member
Electron Media said:
M K said:
By the way, looking for a solution to implement mute/ unmute in HTML5 output. any help on the same will be greatly appreciated.
Thanks
MK
You can use a trigger to execute this javascript code on HTML5 mode,$('audio').each(function(){
this.pause();
});
This will pause all the audio which are active. You can execute this on conditional basis (say when timeline starts if variable audio = false) then call this code otherwise let the audio to play by default.
By the way, i have accidentally pressed the suggested answer button on your reply. Could not find a way to undo it. Sorry about that! Hi Electron! Thanks for sharing and I can undo that button push
No problem!- juliewynnCommunity Member
Steve Flowers said:
OK, my friends. Here's a quick example and widget that will let you mute all audio. Note that this won't work in Preview or in HTML5 or iOS publish. It's Flash based and requires that you publish. If it doesn't work locally you may also need to add your publish folder to the Flash player security settings.
This does use JavaScript as an intermediary so that Flash can pick up variable change conditions from Storyline. Pretty straight forward. Let me know if you have any problems.
Hello,Is it possible to add the Javascript HTML5 mute toogle into this sample file as well?
Much appreciated
Julie
Hi Julie,
You may want to send Steve a private message if you need additional help with it as I'm not certain he is subscribed, but he did note that it won't work within HTML5.
- juliewynnCommunity Member
If anyone is interested, I used:
$('audio').each(function(){
this.muted=true;
});$('audio').each(function(){
this.muted=false;
});- TonyJohnsonCommunity Member
Hi Julie, thanks for this. What do you attached the code to? I got the flash version to work, but want to get the html5 version to work as well.
Tony
- KirbyWillisCommunity Member
I know this is an old post, but has anyone ever gotten the Javascript mute code to work in Chrome? It works locally, but not when hosted remotely.
Thanks Julie for sharing what you ended up using here!
- JeffSaleCommunity Member
Thanks Jeff for sharing what you found here. Have a great Friday!
Related Content
- 9 months ago