首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >直播视频流iphone

直播视频流iphone
EN

Stack Overflow用户
提问于 2009-09-29 10:05:01
回答 3查看 9.3K关注 0票数 2

我是iphone和Objective-c的新手。我想向使用我的应用程序的用户展示一场实况转播比赛,假设是足球比赛。iphone应用程序中的直播视频流需要什么?

任何关于这方面的信息都将不胜感激!

谢谢

伙计们,请帮帮我,有没有人以前做过这个?

EN

回答 3

Stack Overflow用户

发布于 2009-09-29 14:07:31

您只需提供电影文件的URL,流将根据您的连接速度自动设置。

请注意,只有分辨率在iPhone限制范围内的视频才会被播放。较高分辨率的影片将在模拟器上播放,但不能在iPhone上播放。

您需要有一个MPMoviePlayerController对象,其余代码如下所示:

代码语言:javascript
复制
-(void) play {

NSURL *movieURL = [NSURL URLWithString:@"http://movies.apple.com/media/us/mac/getamac/2009/apple-mvp-biohazard_suit-us-20090419_480x272.mov"];


if (movieURL != nil) {
    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

    moviePlayer.initialPlaybackTime = -1.0;

    // Register to receive a notification when the movie has finished playing. 
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:) 
                                                 name:MPMoviePlayerScalingModeDidChangeNotification 
                                               object:moviePlayer];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(endPlay:) 
                                                 name:MPMoviePlayerPlaybackDidFinishNotification 
                                               object:moviePlayer];

    moviePlayer.scalingMode = MPMovieScalingModeAspectFit; 
    moviePlayer.movieControlMode = MPMovieControlModeDefault;
    moviePlayer.backgroundColor = [UIColor blackColor];

    [moviePlayer play];
 }
}

-(void)moviePlayBackDidFinish: (NSNotification*)notification
{
self.navigationItem.hidesBackButton = FALSE;
moviePlayer = [notification object];
[moviePlayer play];
}

-(void)endPlay: (NSNotification*)notification
{
NSLog(@"end Playing");

self.navigationItem.hidesBackButton = FALSE;
//[[UIApplication sharedApplication] endIgnoringInteractionEvents];
[actview stopAnimating];

[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerScalingModeDidChangeNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];

[moviePlayer stop];
[moviePlayer release];
}
票数 3
EN

Stack Overflow用户

发布于 2009-09-29 13:30:09

这里有一个关于直播的参考文档,可能会对你有所帮助,http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html

票数 1
EN

Stack Overflow用户

发布于 2009-09-29 18:24:30

假设你有视频权利的足球比赛,你需要一个编码器,将现场视频编码,在飞行到正确的格式(mp4,h263等)。播放这些视频的iPhone方法是有一个动态播放列表,它将通过实时视频的块来播放它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1491641

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档