How do I stream video and play it?

2019-01-18 06:54发布

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

3条回答
【Aperson】
2楼-- · 2019-01-18 07:20

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.

查看更多
来,给爷笑一个
3楼-- · 2019-01-18 07:24

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. :)

查看更多
干净又极端
4楼-- · 2019-01-18 07:41

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).

查看更多
登录 后发表回答