直播视频流iphone [英] Live Video Stream iphone

查看:157
本文介绍了直播视频流iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am new to iphone and Objective-c. I want to show a live going match suppose football match to the users who use my app. What do i need for live video streaming in iphone app ?

任何有关此信息的信息都很受欢迎!

any info on this is appreciated !

谢谢

伙计们请帮助任何人以前必须这样做吗?

Guys please help anyone must have done this before ?

推荐答案

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

You only need to give the URL of the movie file and the streams will automatically be setup according to the speed of your connection.

请注意,只有那些分辨率在iPhone范围内的视频才能播放。较高分辨率的电影将在模拟器上播放,但不适用于iPhone。

Mind you, only those videos whose resolution is within iPhone's limits will get played. Higher resolution movies will get played on Simulator but will not work on iPhone.

你需要一个 MPMoviePlayerController 的对象,其余代码是这样的:

You need to have an object of MPMoviePlayerController and the rest of the code is like this:

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

这篇关于直播视频流iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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