For a more comprehensive guide please see these tutorials on STREAMING MEDIA FILES ON THE WEB
(Thanks to Bigsly and David Tallent for the technical explanations and to Jim Hoye for collecting all this)
First of all you need to understand that there are streaming servers and non-streaming servers. Here we have information on how to achieve "virtual streaming". In Virtual streaming the media file is really being downloaded but the player used performs buffering and thus is able to start playing before the download completes.
In order for slow connections to be able to stream media files without too many interruptions it is recommended to set the buffering in your media player to 30 seconds, to give it time to have a sufficiently large buffer to start playing from and stay ahead of the download. Obviously for high-speed connections this buffer can be much smaller (typically 5 seconds).
Also for the benefit of slow connections, you should aim at creating your media file at a small enough bit-rate commensurate with the slowest connection. Aim to please those folks who have a 28.8K modem and create your media file at about 20kbps. This way they can stream the file and still have a bit of bandwidth left over to surf the net. Or, if the 28.8 modem is really gone out with the dodo bird, cater to 56k modems by making the media file at 40kbps or so.
Players such as real Player or Real One stream of their own accord. Players like Windows Media Player or Winamp need to be told to stream.
Usually you have a link on a web site that contains the url (i.e. address) of the particular mp3 or wma file to be played. The address may point to a location on the same website (same server) or to a different server. It can also be a location on your own computer.
We tell the player (Windows Media Player for instance) that we want to stream file abc.mp3 by using a meta file, an intermediate file that simply explains to the player what to go and play. Meta files have different extensions that correspond to the type of media file played. For an mp3 file the corresponding meta file extension is m3u. For a wma file the meta file extension is wax or asx. The latter can also handle video files (such as wmv). For Real Player the meta file extension is ram (while the Real Player media files have the extension rm among others)
These 3 types of meta files are similar in nature and purpose. A meta file is a regular text file, so you will create it using a text editor such as Notepad.
http://www.my_site.com/abc.mp3
Notice this is exactly the url of the media file.
Upload this meta file to the website. For the purpose of the illustration we assume it is stored in the same directory as the corresponding media file and they are both in the root directory.
Then on the web page you will point to the meta file:
<a href="http://www.my_site.com/abc.m3u"> listen to my song abc....</a>
http://www.my_site.com/def.rm
Notice this is exactly the url of the media file.
Upload this meta file to the website. For the purpose of the illustration we assume it is stored in the same directory as the corresponding media file and they are both in the root directory.
Then on the web page you will point to the meta file:
<a href="http://www.my_site.com/def.ram"> listen to my song def....</a>
<ASX VERSION="3.0">
<Title>xyz</Title>
<ENTRY>
<REF HREF="http://www.my_site.com/xyz.wma" />
</ENTRY>
</ASX>
Notice this contains the url of the media file but also some more commands.
Upload this meta file to the web site. For the purpose of the illustration we assume it is stored in the same directory as the corresponding media file and they are both in the root directory.
Then on the web page you will point to the meta file:
<a href="http://www.my_site.com/xyz.wax"> listen to my song xyz....</a>
or
<a href="http://www.my_site.com/xyz.asx"> listen to my song xyz....</a>
So you've done all this and you still can't play that media file from your website. Chances are you won't even get any error message, it simply won't do anything. That means you still have to instruct your server how to handle the meta files. Often those definitions are there, courtesy of your web hosts, but sometimes they are not. You have to instruct the server what to do with those m3u, wax and asx files, because it doesn't necessarily know.
This is where there are 2 ways to handle this.
|
MIME-types |
extension |
|
audio/x-ms-wax |
wax |
|
audio/x-mpgurl |
m3u |
|
audio/x-pn-realaudio |
ram rm |
|
vide/x-ms-asf |
asx wvx |
AddType audio/x-ms-wma wma wax
AddType audio/x-pn-realaudio ram rm
AddType video/x-ms-asf asf asx wvx
Upload the file to your root directory in your sever. If it won't allow this file, you'll have to rename it on your pc to something.txt and upload it after which you rename it on the server as .htaccess
You should backup the original .htaccess file first by copying it to something with another name. Better yet, while experimenting, create a new sub-directory and upload the modified .htaccess file there. In case there is a problem, then you won't mess up a currently functional directory and make sure there isn't another important directory dependant (below) on your experimental directory (sub directory).
The file .htaccess actually modifies lots of information that the servers uses to handle your web site. MIME types are only some of the things it can affect, by overriding the default setting that the server uses. Be very careful what you put in this file as you can mess up very badly making your web site inaccessible to all even yourself, even through programs such as FTP.
PLAYLISTS IN META FILES
Some of the meta files discussed above allow multiple entries so as to constitute a playlist. For Windows Media Player and for Real Player simply add lines to the corresponding meta file (i.e. m3u or rm) for each of the media files in the playlist, in the same format.
For Winamp the meta file should have the extension pls and its contents must be exactly as below:
Content of metafile: [Playlist]
NumberOfEntries=1
File1=http://www.my_site.com/example.mp3
Title1=Chanson d'Amour
Length1=21
Version=2
Repeat such a grouping for each song file in the playlist but make sure the second line at the beginning reflects the correct number of entries.
NB: The pls meta files are proprietary to Winamp and few other players understand them.
Suggestions for additions, clarifications or corrections are welcome. Send me an email.
|
Search this site
©2003- Songwriter's Chat - All Rights Reserved Design: www.webado.com
|