Stuck with customizing volume controls and its placement on the Articulate Storyline 2 player.

Aug 03, 2016

Our client wants to have a fully customized player in Articulate Storyline 2. So far I have been successful. However, I am stuck with customizing volume controls and its placement on the player.

Can anyone help me with this issue?

12 Replies
Ajay Khatri

Hello Godwin

I modified the code a little bit as and it works:

var player = GetPlayer();
Audio.setMasterVolume(0); // to mute

and 

var player = GetPlayer();
Audio.setMasterVolume(0.8); // to unmute

I tried your code for HTML5 only and it works but there is a limitation for browsers.

This code works fine in Chrome and doesn't work in Firefox and IE11, any idea how can I get is work in IE11 and Firefox?

Thanks in advance

Ajay Khatri

Godwin Vinny Carole

Hi Ajay,

If you see my example in the link Volume control for both HTLM5 and Flash the slider actually reduces, increases and even mutes currently playing audio itself.

The 'volumeCount' is a slider variable which returns a numeric value based on the user's interaction with the slider.  

var player = GetPlayer();
Audio.setMasterVolume(volumeCount); // this is code we write in storyline

and 

var player = GetPlayer();
Audio.setMasterVolume(0.8); // in runtime 'volumeCount' changes to a number. Which is exactly the same as your code.

So the code is meant to manipulate currently playing audio volume.

I guess you are trying to achieve the same functionality with out the slider. By just toggling volume on and off button.

If so, add the code below as a trigger to "Execute JavaScript when timeline starts"

var player = GetPlayer();
setInterval(function(){
var volumeCount = player.GetVar('volumeCount')
Audio.setMasterVolume(volumeCount);},10);

Then, give a tigger on mute button as 'Adjust variable "volumeCount" to 0' // to mute it.

and a tigger on unmute button as 'Adjust variable "volumeCount" to 1' // to unmute it.

Hope this helps you out.

Good luck.

 

Ajay Khatri

Thanks for Replying Godwin,

The code is working fine, the issue now is that in IE11 and Firefox this code is not muting the current audio which is playing. The current audio which is playing is muted if we pause and play the audio again. rest all audio clips are muted or unmuted automatically as per the code.

Kind regards,

Ajay Khatri

Godwin Vinny Carole

Hello again Ajay,

First of all thank you for bring this issue to my notice. I have created a new example which has a button that toggles between mute and unmute to find out if I could replicate the same issue you were facing with the current playing audio. And boom, I found it.

And I've fixed it.

Please add the following line of code to your current code and it must work fine now.

$('audio').prop('volume','0') // to mute 


$('audio').prop('volume','0.8') // to unmute

Hope this new example will help you out.

Thank and Regards,
Godwin VC.

 

Ajay Khatri

Hello Godwin,

Thanks for the update and its working fine now.

You are a hero of JavaScript, I must say.

While I was testing the slider version with this code, the slider is not working in Firefox 48.0.1 (latest update), do you have any idea about it? The issue is that the moment I click on the slider button it resets the variable to 0 as the initial value of variable was 1 and stops dragging.

Thanks

Kind regards

Ajay Khatri

Godwin Vinny Carole

Thank You Ajay,

I have seen the issues of firefox and tested the slider in a blank project without any code. 

Slider was not responding in all the latest versions of firefox. Looks like storyline's HTML5 code is not working as expected on latest version of firefox.

As the slider is a storyline default option, there is nothing we do but wait for storyline team to fix it.

This discussion is closed. You can start a new discussion or contact Articulate Support.