IPhone H.264 version

On the 7th of March 2008 the BBC launched an iPhone compatible version of their web-based iPlayer service. Visitors to the BBC's iPlayer site using an iPhone would be presented with a slightly tweaked interface, but, crucially, where visitors to the site using a desktop web browser saw an embedded Flash Player using the RTMP protocol, iPhone users would see an embedded Quicktime player streaming H.264 video (referred to by iPlayer as MP4) over a normal HTTP protocol. This is the current method used by download scripts.

Overview of video request process
Note: As of the 10th December 2010, this process no longer works as the connection to the stream download is negotiated over TLS requiring a client certificate found only in iOS versions 3 and above. This also means older Apple devices not running updated version of iOS are prevented from using the service.

The process for requesting the H.264 video is as follows:


 * 1) Video page is requested and a "BBC-UID" cookie is set, containing the URL-encoded User-Agent string of the browser.
 * 2) Find the version_PID for the episode from http://www.bbc.co.uk/iplayer/playlist/{PID}. This is found in the form 
 * 3) Request http://www.bbc.co.uk/mediaselector/3/auth/iplayer_streaming_http_mp4/{PID}?{RAND} where {PID} is the programme's version_PID and {RAND} is a random number, although the random number is apparently unused by the service (so in practice the suffix ?{RAND} should be omitted). This URL (and all subsequent requests) must have:
 * 4) The Quicktime User-Agent header: "Apple iPhone v1.1.1 CoreMedia v1.0.0.3A110a"
 * 5) The BBC-UID cookie
 * 6) A "Range" header of "0-1"
 * 7) "Accept" header of "*/*"
 * 8) The video URL then 302 redirects to a much more complex URL. Save that URL.
 * 9) Then request that URL with "Range" of "bytes=0-1" to get the "Content-Range" header back, containing the full byte length of the video.
 * 10) Step through the video length, using the "Range" header, from zero (or from the existing size of a partially downloaded file), in steps of under 70MB, until the download is finished, appending to a file with a .mp4 extension.

The finished file should be a playable, unencrypted video.

Alternative Method
Follow the above steps replacing steps 3 and 4 as follows:

3. In your browser's Address line, type http://www.bbc.co.uk/mediaselector/4/mtis/stream/{version PID} where {version PID} (a.k.a. the identifier) is the 8-digit character string in identifier={version PID}.

4. In the XML page that opens, find the section (a.k.a. "media element") containing the attribute service="iplayer_streaming_http_mp4", then find the href attribute of the connection sub-element. This is the URL. For example:  <connection priority="2" kind="securesis" server="http://download.iplayer.bbc.co.uk/" identifier="iplayer_streaming_http_mp4/5421531205075963289" authString="iVXZx55%2FTNMmb1BzHh0nO6835iCiAPOU6K2ofDUx9limC26%2Bqowh8666zL5G9U7neJxvdfGgSRuU%0A%2F86r%2BxAGs4sbRmkZclq9%2F9h%2B3brWmr6fsuKhi4DosbXOUg59b%2FGGNBdQKl0%3D%0A" href="http://download.iplayer.bbc.co.uk/iplayer_streaming_http_mp4/5421531205075963289.mp4?token=iVXZx55%2FTNMmb1BzHh0nO6835iCiAPOU6K2ofDUx9limC26%2Bqowh8666zL5G9U7neJxvdfGgSRuU%0A%2F86r%2BxAGs4sbRmkZclq9%2F9h%2B3brWmr6fsuKhi4DosbXOUg59b%2FGGNBdQKl0%3D%0A&pid=b00pm1h6" />

Example HTTP headers sent by an iPhone session
This is then followed by a redirect response and the client creates another request to the actual media location:

Timeline of BBC updates to iPhone interface
This seems to have stabilised and the current method of requesting video is at the top of the page.

View the page history for this section if you want to see all the fun hoops the BBC made us jump through for a while.