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
- SebastianMengayCommunity Member
Having the same problem. Getting an error "require is not defined" in the Developer Console. Any quick fix for this?
- DanShannon-73c9Community Member
I'm new to JS, but want to learn.
Can someone take me through the process of writing the script for a toggle mute/unmute button?
- NigelThorne-bb2Community Member
Hi Dan,
Almost nothing to this. Just create a button and add an Execute javascript trigger. In the javascript panel of the trigger just add DS.appState.onToggleVolume();
That's all you need to do. It will not work in preview but will once it's on a server or LMS.
Cheers,
Nigel
- DanShannon-73c9Community Member
Hi Nigel,
Putting a Storyline on the LMS is kind of a big deal in my organization.
Will it work on Review 360 or if I save the file folder to my computer?
I won't be insulted if you dumb it down.
Thanks,
Dan
- ganeshubhare-d9Community Member
Hi,
Tried the solution today and it does not work in the latest version of storyline 360
- RobynPillar-2a6Community Member
OMG this is EXACTLY what I've been searching for!!
- DiarmaidCollinsCommunity Member
Excuse me for being a bit dense there. I was overcomplicating things. I simply had to create my own variable (MuteAudio) and add that to the button and set it to toggle. That way the module is able to 'monitor' the code you've provided and adjust the state on every new slide accordingly.
- LizzieAngellCommunity Member
no worries - i think it is something we all do once we start looking at the complications of javascript!
- DiarmaidCollinsCommunity Member
Hi Lizzie. I didn't see that you had written your response hours ago!
Many thanks for your help. I am glad I was eventually able to figure it out for myself. I feel a little happier about being a little less thick! :)
- ShahabKhanCommunity Member
Hi everyone,
I use this JS but its working on 18 august 2020 STL 360 version.
var appState = require("helpers/appState");
appState.onToggleVolume();//muteAnyone have a solution for this issue.
- BettyChaboui885Community Member
Hi,
a colleague of mine helped me with this javascript :var appState = window.DS ? DS.appState : require("helpers/appState");
appState.onToggleVolume(); - SuvarnaR-47dd39Community Member
I need to custom the audio button. i have one button it will mute the audio or unmute the audio. But i dont know the javascript. so please explain me in detail. I m working on SL360.
- SuvarnaR-47dd39Community Member
Also, i want to mute the audio of video file.