Section 31
THE ADDITIONAL INFORMATION I FOUND ABOUT NETSCAPE'S <EMBED...>
HOW TO USE: LIVEAUDIO SYNTAX WITH EMBED DESCRIPTION
LiveAudio plays audio files in WAV, AIFF, AU, and MIDI formats. Audio
controls appear according to the size specified in the WIDTH and HEIGHT
parameters in the EMBED tag. You can create an audio console with any of
the following six views.
- Console - consisting of a Play, Pause, Stop, and volume control lever.
- SmallConsole - consisting of a Play, Stop, and volume control lever (upon
invoking this view of the applet class, a sound will "autostart" by
default). This view will have smaller buttons than the standard Console
buttons.
- PlayButton - a button that starts the sound playing.
- PauseButton - a button that pauses (without unloading) the sound while it
is playing.
- StopButton - a button that ends the playing of sound and unloads it.
- VolumeLever - a lever that adjusts the volume level for playback of the
sound (and adjusts the system's volume level).
These views may be used many times on one Web page, with all the view
instances controlling one sound file, or many sound files, depending on
how the file is called in the HTML or JavaScript.
It is also important to remember that these controls can be called by
other applets to do things like control the systems' universal volume.
HTML SYNTAX
<EMBED SRC= [URL] AUTOSTART=[TRUE|FALSE] LOOP=[TRUE|FALSE|INTEGER]
STARTTIME=[MINUTES:SECONDS] ENDTIME=[MINUTES|SECONDS] VOLUME=[0-100]
WIDTH=[# PIXELS] HEIGHT=[# PIXELS] ALIGN=[TOP|BOTTOM|CENTER|BASELINE|
LEFT|RIGHT|TEXTTOP|MIDDLE|ABSMIDDLE|ABSBOTTOM] CONTROLS=[CONSOLE|
SMALL CONSOLE|PLAYBUTTON|PAUSEBUTTON|STOPBUTTON|VOLUMELEVER] HIDDEN=[TRUE]
MASTERSOUND NAME=[UNIQUE NAME TO GROUP CONTROLS TOGETHER SO THAT THEY
CONTROL ONE SOUND]...>
- SRC=[URL] - The URL of the source sound file.
- AUTOSTART=[TRUE|FALSE] - Setting the value to TRUE allows the sound, music,
or voice to begin playing automatically when the Web page is loaded. The
default is FALSE.
- LOOP=[TRUE|FALSE|INTEGER] - Setting the value to TRUE allows the sound to
play continuously until the stop button is clicked on the console or the
user goes to another page. If an INTEGER value is used, the sound repeats
the number of times indicated by the integer.
- STARTTIME=[MINUTES:SECONDS] - Use STARTTIME to designate where in the sound
file you would like playback to begin. If you want to begin the sound at
30 seconds, you would set the value to 00:30 (implemented only on Windows
95, NT, and Macintosh).
- ENDTIME=[MINUTES:SECONDS] - Use ENDTIME to designate where in the sound
file you would like playback to end. If you want to stop the sound at
1.5 minutes, you would set the value to 01:30 (implemented only on
Windows 95, NT, and Macintosh).
- VOLUME=[0-100] - This value must be a number between 0 and 100 to represent
0 to 100 percent. This attribute sets the volume for the sound that is
playing [unless the MASTERVOLUME (see NAME attribute below) is used, then
this value sets the sound for the entire system]. The default volume
level is the current system volume.
- WIDTH=[# PIXELS] - This attribute is used to display the width of the
console or console element. For the CONSOLE and SMALLCONSOLE, the default
is WIDTH=144. For the VOLUMELEVER, the default is WIDTH=74. For a button,
the default is WIDTH=37.
- HEIGHT=[# PIXELS] - This attribute is used to display the height of the
console. For the CONSOLE, the default is HEIGHT=60. For the SMALLCONSOLE,
the default is HEIGHT=15. For the VOLUMELEVER, the default is HEIGHT=20.
For a button, the default is HEIGHT=22.
- ALIGN=[TOP|BOTTOM|CENTER|BASELINE|LEFT|RIGHT|TEXTTOP|MIDDLE|ABSMIDDLE|
ABSBOTTOM] - This attribute tells Netscape Navigator how you want to
align text as it flows around the consoles. It acts similarly to the
IMG tag.
- CONTROLS=[CONSOLE|SMALLCONSOLE|PLAYBUTTON|PAUSEBUTTON|STOPBUTTON|
VOLUMELEVER] - This attribute defines which control a content creator
wishes to use. The default for this field is CONSOLE.
- HIDDEN=[TRUE] - The value for this attribute should be TRUE, or it should
not be included in the EMBED tag. If it is specified as TRUE, no controls
will load and the sound will act as a background sound.
- MASTERSOUND - This value must be used when grouping sounds together in a
NAME group. This attribute takes no value (it must merely be present in
the EMBED tag), but tells LiveAudio which file is a genuine sound file
and allows it to ignore any stub files. Stub files have a minimum length
necessary to activate LiveAudio.
- NAME=[UNIQUE NAME TO GROUP CONTROLS TOGETHER SO THEY CONTROL ONE SOUND]
- This attribute sets a unique ID for a group of CONTROLS elements, so
they all act on the same sound as it plays. For example, if a content
creator wishes to have one sound controlled by two embedded objects (a
PLAYBUTTON and a STOPBUTTON), they must use this attribute to group the
CONTROLS together. In this case, the MASTERSOUND tag is necessary to flag
LiveAudio and let it know which of the two EMBED tags actually has the
sound file you wish to control. LiveAudio ignores any EMBED(s) with no
MASTERSOUND tag.
If you want one VOLUMELEVER to control multiple NAMEs (or the system
volume), create an EMBED using the VOLUMELEVER CONTROL. Then set NAME to
MASTERVOLUME.
JAVASCRIPT FUNCTIONS
LiveAudio includes the ability to defer loading a sound file until the Play
button is pushed. This enables a Web page designer to comfortably embed
several sounds on one page, without worrying about page load time.
To implement this feature, the Web designer must create a file like the
following:
<SCRIPT LANGUAGE=SoundScript>
OnPlay(http://YourURL/YourSound.aif);
</SCRIPT>
This file should be saved and named as a sound file (such as script1.aif).
When the Play button is pushed, the URL you defined for the OnPlay function
is loaded.
EXAMPLES OF LIVEAUDIO USES
To play a sound as a background sound for a Web page:
<EMBED SRC="mysound.aif" HIDDEN=TRUE>
To have several CONTROLS controlling one sound file:
<EMBED SRC="mysound.aif" HEIGHT=22 WIDTH=37 CONTROLS=PLAYBUTTON
NAME="MyConsole" MASTERSOUND>
<EMBED SRC="stub1.aif" HEIGHT=22 WIDTH=37 CONTROLS=PAUSEBUTTON
NAME="MyConsole">
<EMBED SRC="stub2.aif" HEIGHT=22 WIDTH=37 CONTROLS=STOPBUTTON
NAME="MyConsole">
<EMBED SRC="stub3.aif" HEIGHT=20 WIDTH=74 CONTROLS=VOLUMELEVER
NAME="MyConsole">
To use a SMALLCONSOLE:
<EMBED SRC="mysound.aif" HEIGHT=15 WIDTH=144 MASTERSOUND
CONTROLS=SMALLCONSOLE>
LIVECONNECT
LiveAudio is LiveConnect enabled. The following functions will work in
JavaScript to control a loaded LiveAudio plug-in:
Controlling functions (all Boolean):
play('TRUE/FALSE or int','URL of sound')
stop()
pause()
start_time(int seconds)
end_time(int seconds)
setvol(int percent)
fade_to(int to_percent)
fade_from_to(int from_percent,int to_percent)
start_at_beginning() = Override a start_time()
stop_at_end() = Override an end_time()
State indicators (all Boolean, except *, which is an int):
IsReady() = Returns TRUE if the plug-in instance has completed loading
IsPlaying() = Returns TRUE if the sound is currently playing
IsPaused() = Returns TRUE if the sound is currently paused
GetVolume() = Returns the current volume as a percentage*
[Previous Section]
[Table of Contents]
[Addendum]
[Milt's Micro Digest Home Page]
The names Microsoft, Internet Explorer, Netscape, and others used in this document
are Trademarks, or Registered Trademarks of the companies represented.
E-mail questions, comments, or suggestions to: miltst@hotmail.com

(This page was last modified on: Monday, February 08, 1999)