views:

2784

answers:

5

How can I stream video data from the network and play it on an iPhone?

+7  A: 

First, are you developing a Web app optimized for iPhone or a native application ?

In the first case, your only option is to transcode your video files to Quicktime H.264 (m4v or mp4 extension). You can use Quicktime Pro (use the export menu) or VLC (as a free alternative). Then simply add a hyperlink to the video file on your HTTP server. Make sure it presents the right content-type and stuff (read Safari Web Content Guide for iPhone OS: Configuring Your Server). That'll work for web and native apps (in a native app you would use the MPMoviePlayerController view). So can "stream" (technically called progressive download of a Quicktime movie file).

If you're talking about streaming live content (i.e. content that you produce live or transcode a live feed) there is currently no official way of doing it (as of iPhone OS 2.2). iPhone OS does not support RTSP/RTP streaming. A number of native iPhone applications (such as UStream.tv and Orb Live) have created their custom live streaming solution (most of them transfer a delayed streams with many seconds of latency over HTTP then somehow decode it on the phone using FFmpeg or other libraries).

François P.
Since ffmpeg is LGPL licensed, it cannot be used in iPhone applications that aren't also GPL or LGPL. Keep that in mind when writing your app :)
rpetrich
A: 

Are you trying to stream video in your app or just streaming on your iPhone? For streaming video through an app, use the MPMoviePlayerController and pass the URL of your video to it. The MPMoviePlayerController will itself stream the video and play it for you.

lostInTransit
A: 

If you're looking for a server based solution (with a very affordable Amazon EC2 option), be sure to check out Wowza at http://www.wowzamedia.com/advanced.php

It streams directly to iPhone/iPod Touch without a custom app.

note: I'm not affiliated with them at all... just a fan/customer.

edit: Just noticed how old this question was. :)

DavidB
A: 

good tutorial on how to stream video:

http://buildmobilesoftware.com/2010/08/09/how-to-stream-videos-on-the-iphone-or-ipad/

Sheehan Alam