Javascript to MUTE audio?

Aug 09, 2012

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
Steve Flowers

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.

Steve Flowers

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.

steve cc

Super Hero - Steve Flowers:  thank you for the solution.  

I'm wondering: do you have the Flash source file?  Also, I'm wondering since it is using Javascript, if it can't be modified to operate as a custom scripted trigger, so that it doesn't relay on a external SWF?  I'm not a javascript writer so I'm somewhat at a loss to take this any further.  We're often doing a build-once/run-twice approach, so having a solution for only flash is limiting.  

Thanks for your (additional) thoughts and help.  

Steve Flowers

Happy to post the FLA once I find it Since there aren't any JavaScript > Storyline Player commands to modify the volume of the player, this was the only way to accomplish it so far. This uses native ActionScript commands to modify the volume globally. The JavaScript was put in place to round trip between Storyline and Flash. Since the SDK and API for the SL player hasn't been revealed, it wasn't possible to communicate between the two SWF's directly. 

I'd love to see some JavaScript commands to modify states in the player. Things like:

JumpToSlide(ID);

MutePlayer();

Pause();

Play();

These would be super handy. Join me in submitting a feature request:)

Allison LaMotte

Hello everyone!

I was super excited to find this post because I was having the exact same issue. The only problem is that I discovered that now that I have added the togglemute widget to my project, the restart buttons no longer work. I confirmed that it is in fact the widget that makes them not work anymore, since when I deleted it they worked once again.

My restart buttons are "home made" from images with "hover" and "down" states, and a "jump to" trigger leading the to current slide. This is the only solution I have found for a custom restart button, as the only available "restart" trigger is "restart course" and not "restart slide."

Are any of you having this same problem? I have not been able to find a solution yet, so if you have any ideas they would be much appreciated!

Thanks,

Allison