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;
}
}
}
if the audio is still audible once
document.mediaPlayer.Volumeis set to0, why don’t you setdocument.mediaPlayer.Settings.mute = true?also are you sure that
document.mediaPlayer.Settings.Volumeisn’t the correct reference instead ofdocument.mediaPlayer.Volume? it looks like you’re trying to access the parameter/property value directly instead of going through the mediaplayer’s javascript (or jscript) interface.here’s some general reference for you of the “most important” parameters supported by Windows Media Player 7 and later:
obj = document.getElementById("mediaPlayer");CodeParametersor default valueDescriptionobj.Settings.autoStarttrueobj.Settings.baseURLClosedCaption.captioningID0obj.Controls.currentMarker0obj.Controls.currentPosition0obj.Settings.defaultFrameobj.enableContextMenutrueobj.enabledfalseobj.fullScreenfalseobj.Settings.invokeURLstrueobj.Settings.mutefalseobj.Settings.PlayCount1obj.Settings.rate1.00.5 equates to half the normal playback speed, 2 equates to twice.
obj.stretchToFitfalseobj.uiModefullPossible values: invisible, none, mini, full.
obj.URLYou can specify a local filename or a URL.
obj.Settings.volumeobj.Settings.balancefalseobj.windowlessVideofalseWhen windowlessVideo is set to true, the Player control renders video directly in the client area, so you can apply special effects or layer the video with text.
Supported by Windows Media Player for Windows XP or later.