The question I and many others have about the iPhone is:
Can we make it play live video?
I'm not talking about prerecorded video (that's doable, and really easy, ooTunes does that already, along with tons of other apps, including the youtube app). Also, I'm talking about this in the context of an officially released app in the app store, built using the iPhone SDK. The problem has already been solved using the jailbreak toolchain, but doesn't work for official apps because of 3 and 5 below, and 4 below is still very applicable.
I'd be ecstatic if someone would prove me wrong on any of this... so put in your comments, please!
So, nothing's impossible, but it's extraordinarily difficult for the following reasons:
- There is nothing built in to the iPhone to handle true rtsp streaming
- The only formats available to be played on the built in video player are .mov, x264 or mpeg4 all of which require a frame index in the moov atom at the beginning in order to be played as they're downloaded. Unfortunately, for a live stream such information is simply not available until the encoding is finished.
- Should you desire to build your own video player, the SDK doesn't give access to the private frameworks that apple uses for video decoding or the raw framebuffer that a player would need to have fast display. There are workarounds (that are suboptimal) but no one can show source thanks to the developer NDA that is still in effect. (technically this comment is probably out of line, though I've gleaned it from reading/searching the web, NOT from the sdk).
- Without proper hardware optimized methods, you're going to be a battery hog, and probably limited in resolution.
- Now, imagining that all of the above is somehow overcome (which I am sure it has been by some)... now the question is: "Will apple accept your app into the store?" It is against the terms of most (if not all) service provider's agreements to stream live anything (and video isn't going to be low bandwidth).
So, the options are:
- Figure out a way to encode live video with predictable metadata (fixed frame boundaries and packet sizes)
- Write your own video player from scratch to decode whatever type of stream you want (remember 3, 4 and 5 above)
- File feature enhancements and otherwise petition Apple in hopes that they'll add support for RTSP or change their SDK to allow for this.
- Encode in short snippets and try to play them back to back seamlessly, with no breaks... this way you almost have live video (delayed by the amount of time to encode and start playing a single snippet).
- Give up on it?
So for ooTunes, I've learned the hard way all of the above. My latest efforts have been in porting the ogg theora video codec. I've gotten as far as decoding, but can't yet display fast enough due to 3 and 4 above. It's questionable due to 5 whether it's even worth anyone's efforts.
Hope that helps someone, and I also hope that someone can prove me wrong on some of the negative stuff above.