用嵌入式视频编写iPhone应用程序 [英] writing an iPhone application with embedded video

查看:186
本文介绍了用嵌入式视频编写iPhone应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究iPhone应用程序的视频流,我可能不得不在不久的将来写这篇文章。该应用程序除了流视频之外还做了很多,但视频方面是我没有经验的部分。

I am researching video streaming for an iPhone application that I may have to write in the near future. The application does a whole lot other than stream video, but video aspect is the part that I have no experience with.

任何人都知道有关编写流视频应用程序的任何好文章?

Anyone know of any good articles on writing streaming video apps?

谷歌似乎用我所寻求的所有东西淹没了我。

Google seems to inundate me with links that have everything not to do what I seek.

谢谢,

m

推荐答案

Apple提供有关媒体框架的良好文档i ntheir docs。

Apple provide good documentation on the media framework i ntheir docs.

搜索MPMoviePlayerController。以下示例代码从URL播放影片。 (免责声明,此代码取自Apple)。

Search for MPMoviePlayerController. The following sample code plays a movie from a URL. (disclaimer, this code lifted from Apple).

-(void)playMovieAtURL:(NSURL*)theURL 

{
    MPMoviePlayerController* theMovie=[[MPMoviePlayerController alloc] initWithContentURL:theURL]; 
    theMovie.scalingMode=MPMovieScalingModeAspectFill; 
    theMovie.userCanShowTransportControls=NO;

    // Register for the playback finished notification. 

    [[NSNotificationCenter defaultCenter] addObserver:self 
                                            selector:@selector(myMovieFinishedCallback:) 
                                                name:MPMoviePlayerPlaybackDidFinishNotification 
                                              object:theMovie]; 

    // Movie playback is asynchronous, so this method returns immediately. 
    [theMovie play]; 
} 

// When the movie is done,release the controller. 
-(void)myMovieFinishedCallback:(NSNotification*)aNotification 
{
    MPMoviePlayerController* theMovie=[aNotification object]; 
    [[NSNotificationCenter defaultCenter] removeObserver:self 
                                                    name:MPMoviePlayerPlaybackDidFinishNotification 
                                                  object:theMovie]; 

    // Release the movie instance created in playMovieAtURL
    [theMovie release]; 
}

这篇关于用嵌入式视频编写iPhone应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆