LearningAPI has moved to a new blog!

The learningapi blog has moved to a new URL. These posts will remain here, but all new content has moved to learningAPI.com: Digital Media, Streaming Video & Educational Technology. You may also subscrdibe to the RSS feed for the new learningAPI.com blog.

December 03, 2003

HTTP is more like streaming than it used to be!

I recently recieved this note from a reader of streamingmedia.com. It relates to my artlcle earlier this year, Streaming vs. Downloading Video: Understanding The Differences:

Recently my company blocked the access to Real server,
however i can still stream music from http: stream
sites such as www.undergroundhouse.net

I was wondering how it is possible? The music streams
just like RTSP streams, i can fast forward and play
the end of a mix almost instantly. Is there any trick
to do this or it is just a HTTP stream?

I checked out the site metioned here, and it is serving audio using HTTP from an Apache 1.3 web server. Indeed, I could advance an hour into the 32kbps audio file with almost instantaneous seek time.  I started up my HTTP packet sniffer, loaded up an audio file, and then slid the RealPlayer's position slider ahead to near the end.  A new HTTP request was sent to the Web server by RealPlayer.  A look at the contents of that header revealed the secret:

GET /ugh/patrick_promo.rm HTTP/1.1
Range:bytes=9914094-

HTTP 1.1 supports the Range parameter, which allows a specific byte range of the file to be requested.  The Web server responds with the requested data in a "206 - Partial Content" message.  It won't work with any Web server, but will with many.  The W3C's docs on HTTP 1.1 say the following:

A server MAY ignore the Range header. However, HTTP/1.1 origin servers and intermediate caches ought to support byte ranges when possible, since Range supports efficient recovery from partially failed transfers, and supports efficient partial retrieval of large entities.

This does remove one of the clear advantages of true streaming over http streaming.  It is clearly possible to seek ahead in a audio or video file streamed from a Web server.  You do need to use a .ram metafile for this to work.  If you link directly to the .rm file in your web page, then the browser will download the file and pass it whole to the RealPlayer (which now has no communication with the server).  If you use a .ram file, then the RealPlayer makes its own connection to the server to get the media file, and that enables it to make Range requests as needed. 

For those who are interested, the full http headers from the transaction appear in the extended entry under the "continue reading" link. 

Captured using the EffeTech HTTP Sniffer 3.5

Initial Request:
GET /ugh/patrick_promo.rm HTTP/1.1
Accept: */*
User-Agent: RMA/1.0 (compatible; RealMedia)
Icy-MetaData: 1
Bandwidth: 10485800
ClientID: WinNT_5.0_6.0.11.868_RealPlayer_RN10PRM_en_686
GUID: 00000000-0000-0000-0000-000000000000
Language: en, *
RegionData: 02163
SupportsMaximumASMBandwidth: 1
Connection: Keep-Alive
Host: samples.deepconnections.com
Accept-Language: en, *
Accept-Encoding: gzip

Initial Response:
HTTP/1.1 200 OK
Date:
Wed, 03 Dec 2003 18:33:03 GMT
Server:
Apache/1.3.28 (Unix) mod_ssl/2.8.15 OpenSSL/0.9.7c PHP/4.3.3
Last-Modified:
Thu, 20 Nov 2003 18:21:40 GMT
ETag:
"3e18523-e8ecde-3fbd0634"
Accept-Ranges:
bytes
Content-Length:
15264990
Keep-Alive:
timeout=5, max=100
Connection:
Keep-Alive
Content-Type:
audio/x-pn-realaudio

Seek Request:
GET /ugh/patrick_promo.rm HTTP/1.1
Accept: */*
User-Agent: RMA/1.0 (compatible; RealMedia)
Icy-MetaData: 1
Bandwidth: 10485800
ClientID: WinNT_5.0_6.0.11.868_RealPlayer_RN10PRM_en_686
GUID: 00000000-0000-0000-0000-000000000000
Language: en, *
RegionData: 02163
SupportsMaximumASMBandwidth: 1
Connection: Keep-Alive
Host: samples.deepconnections.com
Accept-Language: en, *
Accept-Encoding: gzip
Range:bytes=9914094-

Seek Response:
HTTP/1.1 206 Partial Content
Date: Wed, 03 Dec 2003 18:33:11 GMT
Server: Apache/1.3.28 (Unix) mod_ssl/2.8.15 OpenSSL/0.9.7c PHP/4.3.3
Last-Modified: Thu, 20 Nov 2003 18:21:40 GMT
ETag: "3e18523-e8ecde-3fbd0634"
Accept-Ranges: bytes
Content-Length: 5350896
Content-Range: bytes 9914094-15264989/15264990
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: audio/x-pn-realaudio


TrackBack URL for this entry:
http://www.learningapi.com/cgi-bin/mt-tb.cgi/41

Listed below are links to weblogs that reference 'HTTP is more like streaming than it used to be!' from learningAPI.com: Media and Learning Technology - Larry Bouthillier.