WEBADO Webhosting

We'll Help You Get Your Own Place on the Web

Webhosting and Design in Canada - Webado
Webhosting and design in Canada - WEBADO, Web-Ah-Do, Web-I-Do see www.webado.com

STREAMING MEDIA FILES ON THE WEB

More FAQ ...

Introduction

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" also known as "pseudo 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.

Top

Preparing Media Files for the Web

Before worrying about streaming or not streaming (i.e. simply downloading) media files, those media files have to be in web-ready format .

This subject is dealt with in more detail in the tutorial on Web-Ready Media Files. Considerations such as media formats to use, conversions between various file types, bitrates, etc. are discussed.

Top

Meta Files, a.k.a. Playlists

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. M3U Meta-File for MP3 Audio Files

    The meta file abc.m3u corresponding to the media file abc.mp3 should contain the following information:

    http://www.example.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.example.com/abc.m3u"> listen to my song abc....</a>

    Top

  2. RAM Meta-File for Real Media Files

    The meta file def.ram corresponding to the media file def.rm should contain the following information:

    http://www.example.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.example.com/def.ram"> listen to my song def....</a>

    Top

  3. QTL - Special Meta-File for Quicktime Movie Files (.mov)

    A .qtl file is a Quicktime Media Link - basically a shortcut. It allows embedding a Quicktime player to play an .mov file in a variety of browsers, more readily than using the .mov file directly which, depending on the browser, may cause problems.

    The file sample.qtl is nothing more than a simple xml file with the following structure:

      
     <?xml version="1.0"?>
     <?quicktime type="application/x-quicktime-media-link"?>
     <embed src="sample.mov" /> 
    

    When you want to play the video sample.mov through the Quicktime player embedded on a web page, you will in fact use the corresponding sample.qtl file.

    You may need to add the MIME type for qtl on your server, in addition to the mov type.

  4. ASX (and WAX and WVX) Meta-File for All Windows Media Files

    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.example.com/xyz.wma" />
          </ENTRY> 
          </ASX> 
    

    Notice this contains the url of the media file xyz.wma 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.example.com/xyz.wax"> listen to my song xyz....</a>

    or

    <a href="http://www.example.com/xyz.asx"> listen to my song xyz....</a>

    Note also that these asx-based meta files can be used for other media type that Windows Media Player is capable of playing as well, like mp3, mpg, mid.

    The meta file extension for a Windows Media video playable through WMP is .wvx or .asx . It is structured the same way as given above.

    Available elements for Windows Media Player meta files (applies to WMP version at least up to 10):

    For complete instructions on Windows Media meta files and all the elements available, please see The MSDN Windows Media Metafile Elements Reference. The above links are liable to change often, as has been my experience, and it's becoming increasingly difficult to keep them current. Hopefully proper redirections are in place.

    Top

  5. The SMIL Meta-File for Multi-Media

    The SMIL meta file , suffixed .smi or .smil, is a special type of file. Not technically speaking a meta file, but the purpose is similar. It's a much more powerful interface meant to provide a varied experience combining many types of media in one web application.

    SMIL (pronounced smile) stands for Synchronized Multimedia Integration Language. It is a markup language (like HTML or XHTML) and is designed to be easy to learn and deploy on Web sites. SMIL was created specifically to solve the problems of coordinating the display of a variety of media (multimedia) on Web sites. By using a single time line for all of the media on a page their display can be properly time coordinated and synchronized.

    For now I'll say it is very often associated with Real Media files in lieu of or in addition to the RAM meta-file or sometimes MID files. In fact it appears to be the file type that Real Player first tries to access when asked to download and play one of the file types it is capable of playing. Since you will most often see it in relation to Real Media files though, so I will only explain a simple layout of a .smil file in that context:

     <smil>
     <head>
     <!-- Presentation attributes. -->
     <meta name="author" content="www.example.com" />
     <meta name="title" content="my media file" />
     <meta name="copyright" content="© 2004" />
     </head>
     <body>
     <audio src="http://www.example.com/my-music/my-song-1.rm" />
     <video src="http://www.example.com/my-music/my-video-1.rm" />
         ..
         ..
     </body>
     </smil>
    

    The portion appearing in the <head> .... </head> section is basically descriptive. The portion appearing in the <body> ... </body> section is what gives the names of the media files that will be played. All this may also have advanced instructions which I will not explain here at this time.

    More detailed information on SMIL is available at: Real Networks.

    Top

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 ram) 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.example.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.

Top

MIME Types for Media Files

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.

The MIME type defines a method used by Web browsers to associate files of a certain type with helper applications that display files of that type.

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):

    MIME-types extension
    audio/x-ms-wax wax
    audio/x-mpgurl m3u
    audio/x-pn-realaudio ram rm
    video/x-ms-asf asx wvx
    video/quicktime mov
    application/x-quicktimeplayer qtl

    Top

  2. The following is for the more experienced webmasters only (applies to a server using Apache):

    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 your pc and create it or modify it (so that it shows 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
    AddType video/quicktime mov
    AddType application/x-quicktimeplayer qtl

    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 server 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, except through programs such as FTP.

Embedding Media...

Web-Ready Media ..

More FAQ ...

 

Top

Is my on-line support useful?

If you'd like to make a donation to let me continue to offer online help, I will gratefully accept it.

 
0.02  seconds run time

Modified on: 2014-02-07