Using Embedded Sounds and LiveAudioSeptember 20, 1996
NOTE: This example will work only in Netscape 3.0 (beta 6 or later), and only if you have the LiveAudio plug-in installed. You'll also need a computer with sound capability (such as a PC with sound card) to try the example.
Using the <EMBED> TagTo use a sound in your web page with LiveAudio, use the <EMBED> tag to embed the sound. LiveAudio works with the common sound formats (.wav, .au, .aif). The <EMBED> tag for a sound can include the following attributes:
- SRC is the URL of the sound file.
- NAME is a name to be used for the sound file's sound object.
- AUTOSTART can be either TRUE or FALSE; if true, the sound starts playing when the page finishes loading.
- LOOP is a Boolean value that indicates whether the sound repeats after it finishes playing. You can also specify an integer value to loop a certain number of times.
- STARTTIME and ENDTIME are the indexes within the sound file where playback will start and stop; these are in minutes and seconds; for example, 0:30 is 30 seconds from the start of the sound.
- VOLUME is the relative volume of the sound, ranging from 0 to 100.
- CONTROLS specifies the type of control, if any, displayed for the sound. The values include CONSOLE, a complete console, SMALLCONSOLE, a smaller version, and individual buttons: PLAYBUTTON, PAUSEBUTTON, STOPBUTTON, and VOLUMELEVER.
- MASTERSOUND must be used to specify that the sound file is a real sound file; LiveAudio allows "stub" files that refer to other files to be used instead.
In addition, you can use the following methods, which return a value:
- play() starts playing the sound. You can specify a loop value, similar to the LOOP attribute values, followed by an optional URL for the sound if the original URL is not used.
- stop() stops the sound if it is currently playing.
- pause() pauses the sound at the current position. You can use the play() method, or the pause() method again, to continue the playback.
- start_time() and end_time() allow you to override the start and end times. Specify the value in seconds.
- start_at_beginning() and stop_at_end() reset the start and stop times to the begging and end of the sound file.
- setvol() sets the sound's volume, from 0 to 100 percent.
- fade_to() sets the volume, but fades from the current value.
- fade_from_to() allows you to specify two values, and fades from one to the other.
- IsReady() returns TRUE if the sound is loaded and ready to play.
- IsPlaying() returns TRUE if the sound is currently playing.
- IsPaused() returns TRUE if the sound is currently paused.
- GetVolume() returns the current volume.
michael moncur ... [email protected]