Monday, August 27, 2007

JAVA > Script > LiveAudio


<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript>

function playSound() {
document.firstSound.play(false);
}

function pauseSound() {
document.firstSound.pause();
}

function stopSound() {
document.firstSound.stop();
}

function volup() {
currentVolume = document.firstSound.GetVolume();
newVolume = ( currentVolume + 10 ) ;
if ( document.firstSound.GetVolume() == 100 ) {
alert("Volume is already at maximum");
}
if ( newVolume < 90 ) {
document.firstSound.setvol(newVolume) ;
} else {
if ( ( newVolume <= 100 ) && ( newVolume > 90 ) ) {
document.firstSound.setvol(100) ;
}
}
}

function voldown() {
currentVolume = document.firstSound.GetVolume();
newVolume = ( currentVolume - 10 ) ;
if ( document.firstSound.GetVolume() == 0 ) {
alert("Volume is already at minimum");
}
if ( newVolume > 10 ) {
document.firstSound.setvol(newVolume) ;
} else {
if ( ( newVolume >= 0 ) && ( newVolume < 10 ) ) {
document.firstSound.setvol(0) ;
}
}
}

</SCRIPT>
</HEAD>
<BODY>
<EMBED SRC="sound1.wav" HIDDEN=TRUE AUTOSTART=FALSE NAME="firstSound" MASTERSOUND>
<P><A HREF="javascript:playSound()">Play the sound now!</A></P>
<P><A HREF="javascript:pauseSound()">Pause the sound now!</A></P>
<P><A HREF="javascript:stopSound()">Stop the sound now!</A></P>
<P><A HREF="javascript:volup()">Increment the Volume!</A></P>
<P><A HREF="javascript:voldown()">Decrement the Volume!</A></P>
</BODY>
</HTML>

No comments: