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
- BobODonnellCommunity Member
Awesome! You have no idea how much I've tried to get this feature to work. Thanks for posting!
- NishadKulkarniCommunity Member
A life saver code.
var appState = require("helpers/appState");
appState.onToggleVolume();//muteThanks to whoever came up with this solution.
- NicoleRalph-117Community Member
Thank you very much for the code Naku
- NigelThorne-bb2Community Member
This has been working for me. Add to a javascript trigger:
DS.appState.onToggleVolume();
- SteveFlowersCommunity Member
It's likely possible in the HTML5 version to trigger audio level changes via JavaScript. Currently, in the Flash-based output, volume is controlled through the compiled player and we don't have access to any exposed functions for controlling volume / mute other than the volume control in the built-in navigation bar.
It may be possible to embed a Flash file that would provide global volume control but it wouldn't be linked to the built-in control and I'm not completely sure how reliable it would be. The problem isn't a JavaScript problem It's a Storyline player issue. It may be possible to workaround it.
I'll grab 15 minutes this afternoon and build / test one. If it works, I'll post the file and instructions for use.
- AjayKhatriCommunity Member
Hi Anitha,
Apologies for a late reply, I had been bit busy.
Yes, you need to implement 2 different approaches to control the audio in Flash and HTML5.
HTML5 - coding I have explained above.
Flash - Please read this thread completely and Implement the solution provided by Steve, it works perfectly for Flash version.
These both have to be applied together, mute toggler will work only in Flash version and the HTML5 code will work in HTML5 only.
Let me know if still you need any more help.
Regards,
Ajay Khatri
- SteveFlowersCommunity Member
Hi, Patrice -
Unfortunately, there's no built in trigger for muting / unmuting audio in Storyline. This would make a dynamite feature request. I think others would also love to see this type of feature.
- SteveFlowersCommunity Member
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.- tamaraspurrrCommunity Member
I am looking for the Javascript? downloaded the FLA and the ZIP. Working in Storyline 2 and need to mute the audio w/o pausing it in Flash and HTML 5 -- found the HTNK 5 solution but trying to get this Flash fix to work.
- SteveFlowersCommunity Member
A few folks have asked about the source for the SWF. It's a pretty simple file. Attached here.
- MK4Community Member
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
- 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.