Hi Jossychina,
Having become very familiar with the subdomains mentioned in an
earlier question, sound files are allowed, but they cannot be played
all by themselves as a "hot link". They can be accessed only by HTML
pages that reside in your own subdomain.
Here is code that will enable you to play various sound files.
I have named an imaginary sound file sound.whatever and created
cut-and-paste HTML code for you to use. You will need to rename the
imaginary file, using your own, actual file name(s).
Examples:
Replace sound.whatever with your_song_filename.mid -- or
Replace sound.whatever with your_song_filename.wav -- or
Replace sound.whatever with your_song_filename.mp3 -- or
Replace sound.whatever with your_sound_filename.wav
After you've completed the page, both the HTML page and your sound
file(s) will need to be uploaded to your site.
Unless you are familiar with subdirectories and paths, place both the
HTML page(s) and the sound file(s) in the same directory/folder.
BASIC HTML CODE FOR SOUNDS
**************************
This code will:
-- Start playback automatically as soon as the visitor "enters" the
page
-- Play the sound file over and over until turned off or until
visitor goes to another page.
-- Show the standard console (player) at a size of 144 by 60 pixels.
<!---------- Begin BASIC SOUND Code --------------------------------->
<embed src="sound.whatever" width="144" height="60">
</embed>
<!---------- End BASIC SOUND Code ----------------------------------->
HTML CODE FOR A SMALLER CONSOLE
*******************************
This code will:
-- Start playback automatically as soon as the visitor "enters" the
page
-- Play the sound file over and over until turned off or until
visitor goes to another page.
-- Show the small console (player) at a size of 144 by 15 pixels.
<!---------- Begin SOUND Code - SMALL CONSOLE ---------------------->
<embed src="sound.whatever" width=144 height=15 controls=smallconsole>
</embed>
<!---------- End SOUND Code - SMALL CONSOLE ------------------------>
HTML CODE - NO CONSOLE (INVISIBLE)
**********************************
-- Start playback automatically as soon as the visitor "enters" the
page
-- Play the sound file over and over until turned off or until
visitor goes to another page.
-- No console or controls will be shown.
<!---------- Begin SOUND Code - INVISIBLE CONSOLE ------------------>
<embed src="sound.whatever" height=23 width=35 controls=none
</embed>
<!---------- End SOUND Code - INVISIBLE CONSOLE -------------------->
MORE OPTIONS
************
You may add the following attributes to the embed statement(s) singly or together.
autostart=true,false
loop=true,false,integer
volume=5 (integer between 1 and 10, default is 10)
HTML CODE FOR SOUNDS - VOLUME - AUTOPLAY - LOOPING
**************************************************
This code will:
-- Show the standard console (player) at a size of 144 by 60 pixels.
-- Start playback only when the visitor clicks on the PLAY button on
the console.
-- Play the sound file two times only, then stop.
-- Play the sound file at a volume of 5
<!---------- Begin SOUND Code --------------------------------->
<embed src="sound.whatever" width="144" height="60" loop=2
autostart=false volume=5>
</embed>
<!---------- End SOUND Code ----------------------------------->
While the code samples above offer the easiest way of adding sound to
your pages, this method is becoming outmoded. More modern code would
embed a media object into the web page. You can also set parameters
for console size, autostart, loop, and volume.
<!---------- Begin OBJECT EMBED Code -------------------------->
<object
classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">
<param name="FileName" value="sound.whatever" />
</object>
<!---------- End OBJECT EMBED Code ---------------------------->
Sound Tutorials
*********************
Playing Sounds in a Browser
http://www.w3schools.com/media/media_browsersounds.asp?output=print
Embedded Objects - HTML Controls
http://www.faqs.org/docs/htmltut/embeddedobjects/_EMBED_CONTROLS.html
Audio for the Web Tutorials (highly recommended)
http://www.fluffbucket.com/othettutorials/audio/index.htm
Google Search Terms
----------------------------------------------------------------------
embed sounds tutorials
embed audio HTML
embed audio object
If I've missed anything (specific player, or filetype you wish to
use), or something seems unclear, please ask for clarification. I'll
be glad to add to my answer, try simplify, or explain in further
detail.
---larre |
Clarification of Answer by
larre-ga
on
06 Mar 2004 09:58 PST
Hi,
I'm glad you liked the code samples. You can use them as I've written,
and import a music file, just by making one substitution.
To link to an offsite music file, all you need to do is substitute the
URL of that file you wish to play, instead of using only the file name
(sound.whatever in my code examples above).
<!---------- Begin BASIC SOUND Code --------------------------------->
<embed src="http://site.com/mysite/song.wav" width="144" height="60">
</embed>
<!---------- End BASIC SOUND Code ----------------------------------->
Change http://site.com/mysite/song.wav to match the URL (location) of
your sound file.
Be sure to check on the policies of the second web host to be sure
that they allow files stored on their servers to be hotlinked.
(Hotlink = export as a single file, rather than as part of a web page
stored on their own servers).
Good luck. Please feel free to ask for further clarification if
anything is unclear.
---l
|