views:

129

answers:

2

I'm creating an audio player program in HTML and Javascript. How can I adjust the volume in my program?

+1  A: 

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.

DR
A: 

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

thezachperson31