Back to the Chat Room Portal 

HOW TO STREAM YOUR MEDIA FILES ON THE WEB

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.

  1. The meta file abc.m3u corresponding to the media file abc.mp3 should contain the following information:
  2. 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>

     

  3. The meta file def.ram corresponding to the media file def.rm should contain the following information:
  4. 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>

     

  5. The meta file xyz.wax (also xyz.asx) corresponding to the media file xyz.wma should contain the following information:

<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.

  1. If you have access to the control panel (cpanel) on your website (webmasters will know what that is), then you may also have the means to define the MIME file associations.
    In the MIME utility you enter the following information (unless it's already there):
  2. MIME-types

    extension

    audio/x-ms-wax

    wax

    audio/x-mpgurl

    m3u

    audio/x-pn-realaudio

    ram rm

    vide/x-ms-asf

    asx wvx

     

  3. The following is for the more experienced webmasters only:

    If you cannot fix the MIME associations in the control panel, there may be a file named .htaccess in which you can define all the file associations. This is pretty tricky and many web host may not allow you to either modify this file or create it. You can "fool" a web host into allowing you to modify/create this file by naming it something else such as .htaccess.txt or even something completely different for the purpose of uploading it. Afterwards you have to rename it again to .htaccess (notice the period in the beginning of the file name)

    If this file already exists on your website (usually in the root directory, or the highest level to which you have access, but also at lower levels), it may be invisible to the FTP program you use. You'll have to use the '_a' specification on the server side, in a spot not identified by anything at all except as a blank space that allows typing (at least this is how it appears in Ws-ftp). This may enable seeing the file if it exists.

    Download the .htaccess file to you pc and create it or modify it (so that it show those lines) as follows using Notepad:


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: iconwww.webado.com