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.
Hosting via my personal website (per web publish) and on Scormcloud (via LMS publish) for testing purposes. In both cases, for the HTML5 output, the Javascript is being ignored. However, if I view the HTML5 file off my desktop, it works just fine.
Javascript is supported in HTML5, but you'll want to ensure you're using an HTML5 supported browser. I'm unable to assist with specific Javascript elements, so you may want to post the example here for others in the community to take a look at.
I have simply use storyline audio button to mute the audio. You need to publish the course with audio button option then modify the player.css to get the button up on screen.
Thanks Deepak for sharing your solution here, and although this forum discussion is a bit older I'm sure it'll still be helpful to others who come across it. I did also want to mention that you're welcome and encouraged to share any examples, or step by step instructions that may assist other users as they look to replicating your solution.
Hi, Ajay -- Thanks for reaching out here! JavaScript is not something for which we are able to offer support, but there are lots of members here in the community who are quite knowledgeable and will hopefully be able to assist with what you need!
You can also message Ajay directly using the "contact me" button on his profile to see if he's able to share any additional information with you about how to use the above code as it's not something our team can offer support for.
Hi Ajay,
Thanks for your reply.
And in this coding only work in HTML5 output.but i want my file working
both html and flash.
you have any idea about this.
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.
I can't speak to the Javascript element - but if it's not working in your LMS it may be worth testing at SCORM Cloud. It's a free standard for testing LMS content and if it works there you should reach out to your LMS team. Take a look at the directions here for how to test in SCORM Cloud.
The code is where I get lost and have to step back and let the community take over. Sorry! I'm not sure if folks are still subscribed here, as the post is a bit older - but you could always use the "contact me" button on a ELH users' profile to reach out to them directly!
141 Replies
Hosting via my personal website (per web publish) and on Scormcloud (via LMS publish) for testing purposes. In both cases, for the HTML5 output, the Javascript is being ignored. However, if I view the HTML5 file off my desktop, it works just fine.
Hi Kirby,
Javascript is supported in HTML5, but you'll want to ensure you're using an HTML5 supported browser. I'm unable to assist with specific Javascript elements, so you may want to post the example here for others in the community to take a look at.
This post was removed by the author
I have simply use storyline audio button to mute the audio. You need to publish the course with audio button option then modify the player.css to get the button up on screen.
Thanks Deepak for sharing your solution here, and although this forum discussion is a bit older I'm sure it'll still be helpful to others who come across it. I did also want to mention that you're welcome and encouraged to share any examples, or step by step instructions that may assist other users as they look to replicating your solution.
Hi Everyone,
I have used javascript code to set volume to 0 (mute audio) and set volume to 0.8 (unmute audio)
the code used is:
$('audio').each(function(){
this.volume=0; //mute audio
});
$('audio').each(function(){
this.volume=0.8; //unmute audio
});
when testing from a web server, this code is working fine in IE11, Firefox but not working in Chrome.
this code is working fine when reviewed locally in IE11, Firefox and Chrome.
Can anyone suggest me a solution for this issue?
Thanks in advance
Ajay Khatri
Hi, Ajay -- Thanks for reaching out here! JavaScript is not something for which we are able to offer support, but there are lots of members here in the community who are quite knowledgeable and will hopefully be able to assist with what you need!
Ajay have you got solution?
Hi Ravindra,
Yes I got the solution in another thread, I am posting the solution here too so you can see here.
to mute audio I have used this code and it is working fine:
if (document.location.href.indexOf('html5') < 0) {
} else {
var player = GetPlayer();
Audio.setMasterVolume(0);
$('audio').prop('volume','0');
}
to unmute audio I have used this code and it is working fine:
if (document.location.href.indexOf('html5') < 0) {
} else {
var player = GetPlayer();
Audio.setMasterVolume(0.8);
$('audio').prop('volume','0.8');
}
the condition mentioned above ensures that these commands work only in HTML5 version of the course.
Thanks for popping in to share Ajay and thanks for helping Ravindra :)
Hi Ajay,
i am new to articulate.
How to use this code?
where to use this code?
can you help me please......
thank you,
Anitha
Hi Anitha,
You can also message Ajay directly using the "contact me" button on his profile to see if he's able to share any additional information with you about how to use the above code as it's not something our team can offer support for.
Hi Ashley,
ok and thanks for your reply.
if you know the answer help me.
Hi Anitha
This code is applied to triggers on the audio on/off buttons.
on audio off/mute button, add a new trigger and select execute Javascript and paste the following code:
if (document.location.href.indexOf('html5') < 0) {
} else {
var player = GetPlayer();
Audio.setMasterVolume(0);
$('audio').prop('volume','0');
}
On audio on button,
add a new trigger and select execute Javascript and paste the following code:
if (document.location.href.indexOf('html5') < 0) {
} else {
var player = GetPlayer();
Audio.setMasterVolume(0.8);
$('audio').prop('volume','0.8');
}
please note that this code will work only in HTML 5 version of the publish course content.
and for Flash version of the published content you can use the mute toggler as explained in this thread.
give me a shout if you need any more help in Articulate Storyline.
Regards
Ajay Khatri
Hi Ajay,
Thanks for your reply.
And in this coding only work in HTML5 output.but i want my file working
both html and flash.
you have any idea about this.
Thank you,
Anitha
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
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.
This post was removed by the author
Hi Ajay,
I've used your javascript for mute audio. When I test the it local, everything works, TOP.
But in the LMS it doesn't work. Do you have an idea what this could be?
I use Storyline 360, Google Chrome 58 and the LMS Scorm 1.2
Thank you,
Heinrich
Hi Heinrich,
I can't speak to the Javascript element - but if it's not working in your LMS it may be worth testing at SCORM Cloud. It's a free standard for testing LMS content and if it works there you should reach out to your LMS team. Take a look at the directions here for how to test in SCORM Cloud.
Hi Ashley,
Thanks for the tip. I've tested it in the ScormCloud. There it does not work unfortunately.
I get the following error message in the console:
app.min.js:12 actionator::exeJavaScript - Cannot read property 'volume' of undefined
And when I try over the console:
jQuery('audio').prop('volume','0');
I get the following:
[prevObject: init(1), context: document, selector: "audio"]
context:document
length:0
prevObject:init(1)
selector:"audio"
__proto__:Object(0)
It seems, that no audio tags found.
The code is where I get lost and have to step back and let the community take over. Sorry! I'm not sure if folks are still subscribed here, as the post is a bit older - but you could always use the "contact me" button on a ELH users' profile to reach out to them directly!
not working yet. can you show me video or screenshots.
Our programmer find out, that in storyline 360 html5 output the audio is built in as part of javascript. So we have no chance to get the audio mute.
If somebody have an idea, please let us know.
Hi Mayur,
Can you tell me what is the exact problem you are facing in implementation.
Sorry I am little busy these days so couldn't reply earlier.
Ajay