Reputation:
I'm creating an audio player program in HTML and Javascript. How can I adjust the volume in my program?
Upvotes: 0
Views: 884
Reputation: 26308
I'll assume that you're relying on the browser's default plugin to play the audio files. If you're using WMP through object elements, then you could dynamically change the settings using javascript.
// get the element's DOM reference, replace to fit needs
obj = document.getElementById("player");
// set volume, 0=mute, 100=full
obj.Settings.volume = 50;
Combine that with a slider widget (i.e. jQuery UI), and that should work.
reference: http://www.mioplanet.com/rsc/embed_mediaplayer.htm
Upvotes: 0
Reputation: 72504
Changing the volumne requires access to the operating system's audio device driver or some abstraction layer.
The only way to change the volume is on Windows using ActiveX.
Upvotes: 1