volume property

Sets or gets the volume of the media file.

Syntax

JScript
val = object.volume

Property values

Type: Variant

the volume of the media file, relative to its parent element. The value specified in val is converted to a Variant of type Floating-point number. Valid values range from 0 to 100.

Remarks

You can control the volume of all elements in a time container, such as a par element or a seq element, by setting the volume property on the time container element. To control the volume of all the media on the page, set the volume of the body element.

The volume is relative to its parent element; therefore, if the volume of the parent element is set to 50, and the volume of the child element is set to 50, the effective volume of the child element is 25.

When you use Microsoft DirectMusic, the volume property is implemented as a global property of the DirectMusic player; it is not specific to any individual segment. Because of this, the lowest segment element in the page controls the volume level of all of the segment elements. In the following example, the volume level of oSegment1 is zero because the lowest segment element (oSegment2) has its VOLUME attribute set to zero.

<!-- The effective volume of this element is zero even though it is set to
100. This is because the lowest segment element is set to zero.-->
<t:AUDIO VOLUME="100" ID=oSegment1 PLAYER=dmusic SRC="sample.sgt"/>
<t:AUDIO VOLUME="0" ID=oSegment2 PLAYER=dmusic SRC="sample2.sgt"/>

Examples

The following example allows you to select the volume of the sound effect, or turn off the volume entirely.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/volume_mute.htm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<HEAD>
<TITLE>volume / mute Property</TITLE>
<?IMPORT namespace="t" implementation="#default#time2">

<STYLE>
    .time{ behavior: url(#default#time2);}
</STYLE>
</HEAD>

<BODY>

<t:media id="m1" begin="indefinite;"
    src="/workshop/samples/author/behaviors/media/shuttle3.wmv"
    onmediacomplete="Timer2.beginElement();" fill="remove"/>

<BR><BR>
<BUTTON id="b0" onclick="m1.beginElement();">Start</BUTTON>
<BUTTON id="b3" onclick="m1.endElement();">Stop</BUTTON>
<BR><BR>

<B>Volume control:</B>&nbsp;
<input type="radio" name="i1" onpropertychange="m1.mute='true';">Mute
<input type="radio" name="i1"
    onpropertychange="m1.mute='false';m1.volume=25;">25% Volume
<input type="radio" name="i1"
    onpropertychange="m1.mute='false';m1.volume=50;" checked>50% Volume
<input type="radio" name="i1"
    onpropertychange="m1.mute='false';m1.volume=75;">75% Volume
<input type="radio" name="i1"
    onpropertychange="m1.mute='false';m1.volume=100;">100% Volume

</BODY>
</HTML>

See also

animation

audio

img

media

par

ref

seq

time2

video

Reference

mute

Conceptual

Introduction to HTML+TIME