实时视频流iphone(Live Video Stream iphone)

2019-07-20 01:10发布

我是新iphone和Objective-C。 我想说明的现场去比赛设足球比赛谁用我的应用程序的用户。 我需要为现场视频中的iPhone应用程序流是什么?

有这方面的信息表示赞赏!

谢谢

伙计们,请帮助任何人必须有这样做过?

Answer 1:

你只需要给电影文件的URL和流将根据您的连接速度自动进行设置。

你要知道,只有那些视频分辨率为内iPhone的限制将得到发挥。 更高分辨率的电影将获得出场的模拟器,但不会在iPhone上运行。

你需要有一个对象MPMoviePlayerController和代码的其余部分是这样的:

-(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];
}


Answer 2:

假设你已经有问题的足球比赛视频的权利,你需要一个编码器,将编码的视频直播,在飞行到正确的格式(MP4,H263等)。 玩这些iPhone的方法是有一个动态播放列表,将通过看视频直播的大块发挥出来。



Answer 3:

继承人到谈论现场直播一个文档的引用,可能会帮上你http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html



文章来源: Live Video Stream iphone