Forum Discussion
how to create a sound volume button
Hi,
I want to know how to create a control volume button without using the default player.
Thankyou
- MaiAbdelsalamCommunity Member
This worked for me if anyone needs it
create excute javascript
DS.appState.setVolume(1);//play sound
DS.appState.setVolume(0); //mute
Happy first post, Marco!
Great call to reach out to the community for help on designing this. They're a wonderful resource, and I'm excited to see the possibilities!
For now, here are two related posts that could help:
- MathNotermans-9Community Member
This custom audioVolume slider works. Uses this code to set the audio.
var allAudios = document.getElementsByTagName("audio");
if (allAudios[0].volume >= 0) {
for (var a = 0; a < allAudios.length; a++) {
allAudios[a].volume = _volume;
}
}
- EricPERONCommunity Member
Hello Katie,
This is my first post too :-)
i'm looking for the the same thing as Marco. I've tested your first solution. Does it work anymore ?
The tutorial say's to replace a file named "app.min.js" who doesn't exist when i publish their storyLine sample.
Otherwise on Chrome, the sample generates a javaScript error (see attachment)
i saw this post who says this file doesn't exist anymore in Storyline.
Can you confirm this ?
is there a replacement solution ?Thank's for your answer
Eric
P.S. : i don't publish in Scorm mode
- MathNotermans-9Community Member
In the browser this command works in your console...
DS.appState.setVolume(0.2);
I couldnot figure out (yet) how to make that work in Storyline as trigger... - EricPERONCommunity Member
Hello Math,
Thank you for your example. It works fine !
i try to do something with it - MatthewBarto687Community Member
If you are comfortable with editing code in the exported files, you can also do the following...
Search the ds-slides.min.js file for parseBlocks,i=DS,r=i._,s=i.utils (this file is minified, so make sure no spaces in the search term. Then look just before for var e= and insert _c=DS.appState; before the var keyword. So for example you will see this (the numbers in parenthesis may vary) var e=f(50),n=f(16).parseBlocks,i=DS,r=i._,s=i.utils and you will change it to _c=DS.appState;var e=f(50),n=f(16).parseBlocks,i=DS,r=i._,s=i.utils
You can then adjust the volume from within Storyline using a javascript trigger and calling _c.setVolume(number from 0 to 1).