Forum Discussion
Javascript to MUTE audio?
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
You say it won't work in "preview", which I take to mean the specific Preview mode available from the Slide interface.
So, here's what I need to know.
Will it work in any of the other ways that one would use to "preview", such as Review 360 or Web?
In some ways, either of these preview options could be considered a server, in a sense.
I tried both ways, though, and neither worked at all.
This is where providing a more thorough explanation would probably save time in the long run.
As I've said, putting an eLearning on a server or LMS is actually a pretty big deal in my organization and I'd like to be able to test its functionality before I do that.
Thanks again.
Dan
- NishadKulkarni6 years agoCommunity Member
Hello,
As far as I know none of the javascripts in general works in preview. You have to publish the course either locally, review360 or LMS. Any javascript will work in published versions.
Again JS does not work in preview.
Hope that helps.
- DanShannon-73c96 years agoCommunity Member
I tried publishing locally and on Review 360 using Nigel's instructions.
Didn't work.
If you've been able to get the JS to work, could you please provide a procedure?
Thanks,
Dan
- LizzieAngell6 years agoCommunity Member
try this one - it is definitely working for us in the latest SL - there is some issues with older browsers and the audio on off working - we think this one covers it:
//mute/unmute
// Use the global DS object if it exists, otherwise try require:
var appState = window.DS ? DS.appState : require("helpers/appState");
appState.onToggleVolume();
Related Content
- 10 months ago