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.
There has been no feature added to do this AFAIK, but Lizzie's solution above still works for me:
//mute/unmute // Use the global DS object if it exists, otherwise try require: var appState = window.DS ? DS.appState : require("helpers/appState"); appState.onToggleVolume();
Apologies for the delay in responding. Nicole has linked to an earlier part of this thread, but if you still aren't clear here is what I did.
I created a basic audio button with an OFF state (selected). I placed it on the Master Slide because I wanted it to be applicable/accessible on every slide.
I attached a trigger to it to Execute Javascript - simply copied and pasted the code above into the javascript panel that opens up. This script works as a switch. Anytime it runs it either turns on or off the audio.
I also created a variable called MUTE_AUDIO just to monitor the state of the button, whether it was selected or normal. And I set it to TOGGLE, like a switch. This is basically giving the user a visual clue as to what is happening (if they can't hear it already :) ).
You can see that the only real use of the MUTE_AUDIO variable is to have Storyline check whether the Audio Button is switched on or off as each slide begins so it can change the state of the Audio Button accordingly. You don't want the button resetting to Normal if the user had clicked the audio to be off in an earlier slide.
I hope that wasn't overkill on the explanation. If you have any further queries do let me know.
Once again, my thanks to Lizzie Angell for the code. It really helped me out on a major build.
Not sure why things have changed for you. The code Lizzie supplied (and I mention above) still works. I published a module with it last week and it behaves as it should.
//mute/unmute // Use the global DS object if it exists, otherwise try require: var appState = window.DS ? DS.appState : require("helpers/appState"); appState.onToggleVolume();
So appreciative of the 9 years of expertise that has been shared and preserved in this space!
This is almost the functionality I'm looking for, but I only need to mute select audio files (not videos), which means it cannot be tied to the audio controls already built into Storyline (i.e. keyboard commands/player controls).
Project Description: Slides and feedback layers are narrated and learners are able to turn on/off narration from a lightbox slide at any point during the course/module. Learners need to be able to use the player scrub bar to advance or rewind the narration so we're not able to trigger it using play/pause/stop.
Essentially, what we're looking to do is use JS to disable/enable the narration audio based on learners' changing preferences. Any recommendations?
Hi!, I am using Modern Player in 360 and trying to implement below JavaScript code for doing mute/unmute,
var appState = require("helpers/appState"); appState.onToggleVolume();//mute
Not getting anything with this. In other term its not running for me. Could anyone have any idea for this? OR how do I add mute/unmute functionality for in modern player.
Looking into this and wanting to do a button with narration switching between two languages and be able to disable the music audio track..
Am I asking for too much or is this something with button states that this JavaScript will work on? If it still works? Newest posts reporting it is broken.
Require is a Javascript library that doesnot work in newer browsers or might be added to the core in the newest Storyline updates. So you need to ensure not using it directly.
var appState = require("helpers/appState"); appState.onToggleVolume();//mute
Above the first code years ago. This will not work nowadays anymore. When you however comment the first line and add DS ( for some Articulate internal stuff ) before appState it works fine.
//mute/unmute // Use the global DS object if it exists, otherwise try require: var appState = window.DS ? DS.appState : require("helpers/appState"); appState.onToggleVolume();
Hey there! I followed you explanation and it works great. When I mute the audio and the audio button show it’s muted and proceed to the next slide, the audio button is still muted. However, when I go backwards, it changes back to being unmuted. Do you know why this would happen?
141 Replies
This is a crazy old post - has a feature to install a custom button that can mute audio ever been created?
Is there better javascript available yet to do this? It would really help me with a project.
There has been no feature added to do this AFAIK, but Lizzie's solution above still works for me:
//mute/unmute
// Use the global DS object if it exists, otherwise try require:
var appState = window.DS ? DS.appState : require("helpers/appState");
appState.onToggleVolume();
Hi there,
I've had success with this script.
** Volume JavaScript code
var appState = require("helpers/appState");
appState.onToggleVolume();//mute/unmute
console.log(appState.volumeToggle);
Hope this helps.
Nicole
Thank you. How did you set up your triggers?
Thank you Nicole. How did you set up your triggers? I plan to attach it to an image on the master slide.
Hello.
I no longer have access to the project - thought I did.
But, here is a link to the forum where the code and steps I used was sourced from. Hope it helps.
https://community.articulate.com/discussions/articulate-storyline/javascript-to-mute-audio?page=4
Apologies for the delay in responding. Nicole has linked to an earlier part of this thread, but if you still aren't clear here is what I did.
I created a basic audio button with an OFF state (selected). I placed it on the Master Slide because I wanted it to be applicable/accessible on every slide.
I attached a trigger to it to Execute Javascript - simply copied and pasted the code above into the javascript panel that opens up. This script works as a switch. Anytime it runs it either turns on or off the audio.
I also created a variable called MUTE_AUDIO just to monitor the state of the button, whether it was selected or normal. And I set it to TOGGLE, like a switch. This is basically giving the user a visual clue as to what is happening (if they can't hear it already :) ).
You can see that the only real use of the MUTE_AUDIO variable is to have Storyline check whether the Audio Button is switched on or off as each slide begins so it can change the state of the Audio Button accordingly. You don't want the button resetting to Normal if the user had clicked the audio to be off in an earlier slide.
I hope that wasn't overkill on the explanation. If you have any further queries do let me know.
Once again, my thanks to Lizzie Angell for the code. It really helped me out on a major build.
Thank you, this helps!
Thank You! The other code offerings here did not work for me but yours (or Lizzie's?) did! Thanks!
That's right.
It did work until the last update.
Anyone have a solution?
This post was removed by the author
Hi Amit,
Not sure why things have changed for you. The code Lizzie supplied (and I mention above) still works. I published a module with it last week and it behaves as it should.
//mute/unmute
// Use the global DS object if it exists, otherwise try require:
var appState = window.DS ? DS.appState : require("helpers/appState");
appState.onToggleVolume();
This works great!
Thank you very much! :)
This post was removed by the author
So appreciative of the 9 years of expertise that has been shared and preserved in this space!
This is almost the functionality I'm looking for, but I only need to mute select audio files (not videos), which means it cannot be tied to the audio controls already built into Storyline (i.e. keyboard commands/player controls).
Project Description: Slides and feedback layers are narrated and learners are able to turn on/off narration from a lightbox slide at any point during the course/module. Learners need to be able to use the player scrub bar to advance or rewind the narration so we're not able to trigger it using play/pause/stop.
Essentially, what we're looking to do is use JS to disable/enable the narration audio based on learners' changing preferences. Any recommendations?
Many thanks to all of you for this long and old post, it helps me a lot :)
Hi!, I am using Modern Player in 360 and trying to implement below JavaScript code for doing mute/unmute,
var appState = require("helpers/appState");
appState.onToggleVolume();//mute
Not getting anything with this. In other term its not running for me. Could anyone have any idea for this? OR how do I add mute/unmute functionality for in modern player.
Thanks,
Looking into this and wanting to do a button with narration switching between two languages and be able to disable the music audio track..
Am I asking for too much or is this something with button states that this JavaScript will work on? If it still works? Newest posts reporting it is broken.
Require is a Javascript library that doesnot work in newer browsers or might be added to the core in the newest Storyline updates. So you need to ensure not using it directly.
var appState = require("helpers/appState");
appState.onToggleVolume();//mute
Above the first code years ago. This will not work nowadays anymore.
When you however comment the first line and add DS ( for some Articulate internal stuff ) before appState it works fine.
//var appState = require("helpers/appState");
DS.appState.onToggleVolume();//mute
So in later years someone used a ternary operator ( in fact an if/then check https://www.javascripttutorial.net/javascript-ternary-operator/ ) to check for DS or require availability and this works fine still.
//mute/unmute
// Use the global DS object if it exists, otherwise try require:
var appState = window.DS ? DS.appState : require("helpers/appState");
appState.onToggleVolume();
Thank you! Seems to work in Modern Player:
DS.appState.onToggleVolume();
Hey there! I followed you explanation and it works great. When I mute the audio and the audio button show it’s muted and proceed to the next slide, the audio button is still muted. However, when I go backwards, it changes back to being unmuted. Do you know why this would happen?
Could it be that you have the slide set to “reset to initial state”?