How to control the system volume using javascript

Posted by Geetha on Stack Overflow See other posts from Stack Overflow or by Geetha
Published on 2010-03-09T06:09:59Z Indexed on 2010/03/09 6:21 UTC
Read the original article Hit count: 290

Hi,

I am using media player to play audio and video. I am creating own button to increase and decrease the volume of the media player. working fine too.

Problem:

Even after reaches 0% volume its audible. If the player volume increase the system volume also be increased. Is it possible. How to achieve this task.

Control:

<object id="mediaPlayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
    codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
    height="1" standby="Loading Microsoft Windows Media Player components..."
    type="application/x-oleobject" width="1">
    <param name="fileName" value="" />
    <param name="animationatStart" value="true" />
    <param name="transparentatStart" value="true" />
    <param name="autoStart" value="true" />
    <param name="showControls" value="true" />
    <param name="volume" value="70"  />
</object>

Code:

function decAudio() {
    if (document.mediaPlayer.Volume >= -1000) {
        var newVolume = document.mediaPlayer.Volume - 100;
        if (newVolume >= -1000) {
            document.mediaPlayer.Volume = document.mediaPlayer.Volume - 100;
        } else {
            document.mediaPlayer.Volume = -1000;
        }
    } 
}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about windows-media-player