我是iphone和Objective-c的新手。 我想展示一個即將到來的比賽,假設足球比賽給使用我的應用程序的用戶。 在iPhone應用程序中,我需要什麼實時視頻流?實時視頻流iphone
任何有關此信息的讚賞!
謝謝
夥計們請幫助任何人都必須這樣做過嗎?
我是iphone和Objective-c的新手。 我想展示一個即將到來的比賽,假設足球比賽給使用我的應用程序的用戶。 在iPhone應用程序中,我需要什麼實時視頻流?實時視頻流iphone
任何有關此信息的讚賞!
謝謝
夥計們請幫助任何人都必須這樣做過嗎?
假設您有足夠的視頻權限來參加有關足球比賽,您需要一個編碼器,它可以將實時視頻編碼爲正確的格式(mp4,h263等)。 iPhone的播放方法是製作一個動態播放列表,它將查看實時視頻的大塊以播放它。
你只需要給電影文件的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];
}
謝謝您的回答! iPhone的動態播放列表的任何例子與源代碼? – 2009-09-29 11:37:21