Embedding ASF Files

(Updated April 13th 2004 for compiling to achieve use with Windows Media 9)


Folks have mailed me asking questions about "How do you make ASF files and how do you embed them in your web pages". Hopefully, I can help by putting down a step-by-step guide to how I make ASF files using Microsoft Windows Media Encoder and then how I embed them into my web pages.

Please see Tutorial 4 to learn how to create ASF files. Tutorial 4

An interesting sideline of this creativity and employing the lessons learned from embedding code in the HTML of web pages is that one can then embed sounds into stationery emails. Personally I stick to using MIDI files but it can be done!!

 

FOR STATIONERY - Put these lines right after your <BACKGROUND> tag in your stationery script; if the 'object' to start the asf comes after a lot of text, it may not start automatically when you open the stationery, people may have to scroll down before the code is activated. There are a few different types of displays that are currently being used.

FOR WEBPAGES - Put these lines just before the <BODY> tag so that the graphics and text on your page will load first, before the ASF does. Some people like to include an on/off switch for webpages - to allow people the choice of listening to the asf or not. (See the Push Button or the Small Display codes to see what you can do).

Within the Bearz Cave I make use of the No Display and a variation to embed the various tracks throughout the Cave.

Here is the basic code that 'runs' ASF files in both stationery and within a web page. This code will display a 'mini-console' with buttons and controls so that you can listen and play-back the sounds you hear. Click on any of the code displays to see a popup text display you can copy to your computer.

 

STANDARD DISPLAY

<OBJECT id=player height=64 width=160 classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6></OBJECT>
<script>
player.uiMode="mini"
player.settings.autoStart=true
player.settings.playCount=99
player.settings.volume=100
player.URL=""website sound file location""
</script>

 

I've highlighted various PARAM names and values you can change that impact on the display or the quality of the embedded sound - volume, repeat, rewind etceteras. You're welcome to test these out and see what the effects are . . . . . . . .

Volume is a figure starting at Zero rising to -1000 in loudness.

Probably the most common mistake is to misdirect the Filename PARAM. You must make sure you put in the full path as a web address where you keep the ASF file.

 

You can make all sorts of variations of coding by just playing with the param values. You can combine your favourite parameters and create the ultimate player for your personal use. Just remember when you are changing the parameters that -1 denotes TRUE and 0 denotes FALSE. Also try to remember your viewers - if you are sending ASF links to people on slow modems or to people who have to pay for the amount of bytes they download, it's better to choose scripts that are not 'auto play'.

 

The following sets of codes display or do not display and can be used to suit your own purposes. The brief description of what they do is given under each codelet. Click on the codelet to see the code in text form for copying purposes . . . . . . .

 

NO DISPLAY

<OBJECT id=player height=64 width=160 classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6></OBJECT>
<script>
player.uiMode="mini"
player.settings.autoStart=true
player.settings.playCount=99
player.settings.volume=100
player.URL=""website sound file location""
</script>

 

No Display - This coding uses NetShow Player. There is no display when the ASF finally loads and is playing. As it is buffering, there is a logo that is displayed

 

SMALL DISPLAY

<OBJECT id=player height=64 width=160 classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6></OBJECT>
<script>
player.uiMode="mini"
player.settings.autoStart=true
player.settings.playCount=99
player.settings.volume=100
player.URL=""website sound file location""
</script>

 

Small Display - This seems to be the smallest display possible with WMP without things becoming too messed up.

 

COMMON DISPLAY

<OBJECT id=player height=184 width=160 classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6></OBJECT>
<script>
player.uiMode="mini"
player.settings.autoStart=true
player.settings.playCount=99
player.settings.volume=100
player.URL=""website sound file location""
</script>

 

Common Display - This is the most common display used.

 

PUSH BUTTON DISPLAY

<OBJECT id=player height=64 width=240 classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6></OBJECT>
<script>
player.uiMode="full"
player.settings.autoStart=true
player.settings.playCount=99
player.settings.volume=100
player.URL=""website sound file location""
</script>

 

Push Button to Play - This is a console display which has a button that you can push to begin playing the song.

 

You can make all sorts of variations of coding by just playing with the param values. You can combine your favourite parameters and create the ultimate player for your personal use. Just remember when you are changing the parameters that -1 denotes TRUE and 0 denotes FALSE. Also try to remember your viewers - if you are sending ASF links to people on slow modems or to people who have to pay for the amount of bytes they download, it's better to choose scripts that are not 'auto play'.

 

Do please visit the Bearz Jukebox

The Bearz Jukebox

 

Site Copyright 1999 - 2007