Biblioteca.co.cr main page - Página principal de la Bibliteca Virtual

 

Playing Shoutcast or Icecast Streams in QuickTime

QuickTime 6 allows you to play current Shoutcast or Icecast streams that use MP3 compression. This section discusses the various features of Shoutcast and Icecast streams, as well as what you need to know in order to deliver these streams in real-time over a network. If you are a content author, multimedia producer, or Webmaster, you should read this section.

In this section:

Background
Shoutcast and Icecast in QuickTime
Opening Icecast or Shoutcast URLs
Playing Icecast or Shoutcast Streams in QuickTime Player
Playing Icecast or Shoutcast Streams in the QuickTime Browser Plug-in
Playing Icecast or Shoutcast Streams Using the QuickTime API

Background

Shoutcast and Icecast use a modified form of http to deliver MP3 audio in real-time over a network. This is a popular and inexpensive way to deliver radio over the Internet. It is especially popular with small broadcasters, as it does not require the server to have a registered domain name, just an IP address. It can deliver a live stream or a playlist of recordings. On a Macintosh, you can tune into hundreds of these streams by clicking the radio tower button in iTunes. There are also several Shoutcast players for Windows, such as WinAmp.


Shoutcast and Icecast in QuickTime

QuickTime 4 introduced support for playing Shoutcast and Icecast streams from QuickTime Player, the QuickTime browser plug-in, and QuickTime applications programs. Support for .pls playlists was added as part of QuickTime 5. These features were never fully documented, however, and recent changes to the Shoutcast/Icecast protocol make current streams unplayable by these earlier versions of QuickTime.

There are three ways to open an Icecast or Shoutcast stream using QuickTime:

  1. Use QuickTime Player to open a URL or a playlist.

  2. Embed the URL of a stream or playlist in a Web page.

  3. Open a URL or playlist from your application.


Opening Icecast or Shoutcast URLs

Whether you are using QuickTime Player, the QuickTime browser plug-in, or application code, you need to understand how QuickTime handles Icecast and Shoutcast URLs.

The URL of a typical Icecast or Shoutcast stream takes the form:

http://Server[/path] [/file]:port

or

http://Server/path/file.pls

Note: The port number is commonly in the 8000-8999 range, but it can be any port number designated by the server.

Many Shoutcast and Icecast servers do not have their own domain names. Consequently, the URL is commonly in the form:

http://nnn.nnn.nnn.nnn:XXXX

where nnn.nnn.nnn.nnn is the IP address of the server, and XXXX is the port number.

If the URL ends in a .pls filename, you can open the stream using QuickTime just as you would for any non-movie file that QuickTime can play (such as an .aiff file, for example).

If the URL does not end in a .pls filename, you must change the protocol from http:// to icy:// for QuickTime to recognize it as an Icecast or Shoutcast stream.

For example, to access

http://ItsReggae.com:8004 

tell QuickTime to open

icy://ItsReggae.com:8004

whereas to access

http://www.ItsReggae.com/listen.pls

just use the unmodified URL.

As an alternative to changing URLs to icy:// protocol, you can create a local .pls playlist that lists one or more stream URLs. These URLs do not need to be changed from http:// to icy://. The fact that they reside in a .pls file tells QuickTime all it needs to know.

Playlists take the format:

[playlist]
numberofentries=<n>
File1=<uri>
Title1=<title>
Length1=<length or -1>
File2=<uri>
Title2=<title>
Length2=<length or -1>
...

The Title field is optional.

The Length field is either the length of the recording in seconds or -1 (unspecified or live stream).

For example, for a single live stream, the .pls file might look like this:

[playlist]
NumberOfEntries=1
File1=http://itsreggae.com:8004/
length=-1

Playing Icecast or Shoutcast Streams in QuickTime Player

Use the Open URL menu command to open a stream directly. Be sure to change the URL protocol from http:// to icy:// as described previously.

You can open a .pls file from QuickTime player using the Open menu command, the Open URL menu command, or by dragging and dropping.


Playing Icecast or Shoutcast Streams in the QuickTime Browser Plug-in

The QuickTime plug-in is not normally registered to handle the icy:// protocol or .pls file type. To direct a Shoutcast or Icecast stream to the QuickTime plug-in, you must use the QTSRC parameter in your EMBED tag. The SRC parameter should point to a file that QuickTime is always registered for, such as a .qtif (QuickTime image) or .mov (QuickTime movie). This file is downloaded by the browser, so it should be small, but it is not displayed by QuickTime. QuickTime knows by the QTSRC parameter that you want to play something else.

Note: The OBJECT tag calls for the QuickTime plug-in explicitly, so the QTSRC parameter is not required. You may want to include it, however, so that your EMBED and OBJECT tags have the same parameters, or this may simply occur if you use an automated tool that creates OBJECT tags from your EMBED tags.

Here is an example of the HTML you would use to play a Shoutcast or Icecast stream from a Web page using the QuickTime browser plug-in, assuming the URL of the stream is "http://itsreggae.com:8004/"

 

 

 

 

<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" 
CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab"
WIDTH="320" HEIGHT="16" >

<PARAM NAME="src" VALUE="icy://itsreggae.com:8004" >
<PARAM NAME="autoplay" VALUE="true" >

<EMBED PLUGINSPAGE="http://www.apple.com/quicktime/download/"
SRC="UNeedQT.qtif" TYPE="image/x-quicktime"
WIDTH="320" HEIGHT="16"
QTSRC="icy://itsreggae.com:8004"
AUTOPLAY="true" >
</EMBED>
</OBJECT>

As described previously, you must substitute the icy:// protocol identifier for the http:// protocol in the URL of a Shoutcast or Icecast stream.

No such substitution is required for (or inside) .pls files, but you must still use the EMBED’s SRC parameter to direct the browser to a QuickTime file, and the QTSRC parameter to pass the actual file to QuickTime. The HTML is essentially identical to the example just shown, substituting

http://www.ItsReggae.com/listen.pls

for

icy://itsreggae.com:8004

Playing Icecast or Shoutcast Streams Using the QuickTime API

You can open an Icecast or Shoutcast stream, or a .pls playlist file, from within QuickTime applications. The simplest method is to use NewMovieFromFile or NewMovieFromDataRef to create a playable movie from the file or stream. In the case of a .pls file, the data reference might be a file alias or a URL. In the case of a stream, the data reference will normally be a URL.

Again, as described previously, you must substitute "icy://" for "http://" in the URL of a stream. Do this only for streams, not for .pls files.

This creates a movie with a streaming track. Play it as you would any streaming movie.

 

 

 

















 

 

© 2003, 2004 INTERDESA. Copyright notice.

El contenido de este sitio es administrado por medio de WebEver
Content management of this site with WebEver
Diseño y hospedaje por INTERDESA

The Editors recommend...

 

Biblioteca.co.cr main page - Página principal de la Bibliteca Virtual Downloads - Bajar shareware, freeware, aplicaciones, updates, actualizaciones Geeks, nerds and freaks forum at novasitios.com Contáctenos