home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeWeb Design in a NutshellSearch this book

24.4. Streaming Audio

Once upon a time, the only way to play audio from a web page was to link to it and wait for it to download to the hard drive so it could be played. With this method, once the file finishes downloading, the browser either launches an external player or uses a plug-in to play the audio.[15]

[15]Some common Macintosh external players include QuickTime and iTunes. MediaPlayer is a common player on the Windows operating system. Internet Explorer Versions 3 and higher can play many audio file formats natively. Netscape Navigator 3.0 and 4.0 uses the LiveAudio plug-in to play most audio files. The QuickTime player is available for both platforms and as a plug-in to both browsers.

Downloaded audio has a few distinct disadvantages. First, because the file needs to download to the hard disk in its entirety before it can begin playing, users may be faced with a very long wait before they hear any sound. In addition, because the audio file is copied to the hard drive, it is more difficult for artists and publishers to limit distribution and protect copyrights.

Although it is still possible and common to deliver static audio files in this manner, it is far more effective to use one of several streaming media technologies. Streaming media (be it audio or video) begins playing almost immediately after the request is made, and continues playing as the audio data is being transferred. Streaming audio technology was developed to address the problem of unacceptable download times. It can even be used to broadcast live programs, such as concerts or baseball games.

The following are some advantages to streaming audio:

  • Audio begins playing soon after the stream begins.

  • Using new technologies and formats, sound quality doesn't need to be as severely sacrificed.

  • Artists and publishers can better control distribution and protect copyright because the user never gets a copy of the audio file.

Consider also these disadvantages:

  • The potentially high cost of server software may be prohibitive.

  • Some formats require a dedicated or preconfigured server, which may be problematic with some hosting services.

  • Sound quality and stream may be adversely affected by low speed or inconsistent Internet connections.

24.4.1. Streaming File Formats

It used to be that if you wanted audio to stream, you had to use RealAudio technology. Not so anymore. As it became obvious that streaming was the best way to deliver sound to the Web, we've seen the development of a number of compteting proprietary technologies, as well as solutions for streaming standard file formats such as MP3 and QuickTime. The following formats have streaming functionality:

RealNetwork's RealMedia (and RealAudio)

Apple's QuickTime

Microsoft's Windows Media (Netshow)

Streaming MP3s (using a streaming MP3 server like SHOUTcast)

Macromedia Flash and Shockwave

Liquid Audio

Beatnik's Rich Music Format (RMF)

These file formats are discussed in more detail later in this chapter.

24.4.2. Server Software and Protocols

True streaming relies on special server software that permits the uninterrupted flow of data. The information in the song is broken up into little "packets" and sent out in order over the lines. These packets are then reassembled on the user's end. The audio player collects a number of packets before playback begins (a process called buffering) to increase the likelihood of smooth playback.

Streaming media takes advantage of either UDP (User Datagram Protocol), RTSP (RealTime Streaming Protocol), or RTP (RealTime Transfer Protocol) for the transmission of data. What makes these protocols effective at streaming is that if a packet of information is dropped or missing, the data transmission continues on without it. This is in contrast to traditional HTTP, the traditional protocol of the Web, which stops and tries to resend lost packets, potentially halting the stream.

UDP was the first protocol used for streaming media because of its improvements over HTTP. The newer RTSP is more efficent than UDP. RTSP is a two-way streaming protocol, allowing the user to send messages back to the server (such as rewinding the tape). By contrast, RTP (used by Apple QuickTime) is a one-way stream (similar to HTTP in this regard), only the file never downloads completely to the user's hard drive as it does in HTTP or FTP transfers.

Commercial streaming server software, such as RealServer, can handle thousands of simultaneous streams. It provides robust administrative tools and offers advanced functions such as bandwidth negotiation (where the proper bit rate version is delivered based on the connection speed). The software and hardware to set up a dedicated streaming server can be quite costly. On top of that, RealNetworks charges licensing fees based on number of streams.

24.4.3. Pseudo-Streaming

Some media formats are designed to begin playing before they've completely downloaded, producing a streaming effect even when the files are served from an HTTP server. This is known as pseudo-streaming or HTTP-streaming.

The advantage to pseudo-streaming is that it requires no special (and costly!) server software. You just put the files on your server as you would a GIF or JPEG. This is a good solution for broadcasting relatively short audio tracks to just a few simultaneous listeners.

There are a number of key limitations to serving streaming media from a web server. It can not handle heavy server loads and multiple simultaneous connections. You also sacrifice the advanced administration tools and bandwidth negotiation (users have to choose the appropriate file for themselves). This method also makes it impossible to do live broadcasts since the whole file needs to be available for download.

With the proper player on the user's end, RealMedia, QuickTime, MP3, Flash, and Shockwave files will pseudo-stream from an HTTP server.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.