2012-06-18 183 views
0

我想在iPhone中傳輸來自ftp的大型視頻。該視頻的大小超過500 MB。我從來沒有做過流式傳輸,所以不知道它。我已經檢查過來自Apple的直播流指南,但它沒有提供任何有關iPhone編碼的幫助。有人能幫助我在iPhone編碼中究竟做些什麼嗎?到目前爲止,我做了以下事情:在iPhone上流式傳輸視頻

MPMoviePlayerViewController *mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"http://www.defencecourse.com/digital-reproductions/yellow-belt.mp4"]]; 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification 
              object:nil]; 
mpvc.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; 

[self presentMoviePlayerViewControllerAnimated:mpvc]; 
[mpvc release]; 

這種編碼是否足以播放流媒體視頻?

我有一個人爲我準備視頻,我應該怎麼問他如何處理服務器上的視頻?我應該問他只是分開服務器或其他東西的視頻? 有人可以建議我最好的轉發方式嗎?

問候
潘卡

回答

0

檢查這些教程AVFoundation Tutorials,並宣讀了蘋果的AVFoundation框架編程指南here

AVFoundation框架是更強大。

0

嗨你必須做以下的iphone側事情......

- (無效){btnClose_clicked

[appDelegate.navShowController dismissModalViewControllerAnimated:YES]; 

} - (IBAction爲)btnPlay_clicked {

// NSString *urlStr = [[NSBundle mainBundle] pathForResource:@"3idiots.mov" ofType:nil]; 
// NSURL *url =[NSURL fileURLWithPath:urlStr]; 
NSURL *url = [[NSURL alloc] initWithString:[self.DiscAnsDetail objectForKey:@"product_video"]]; 
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; 

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

if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) { 
    // Use the new 3.2 style API 
    moviePlayer.controlStyle = MPMovieControlStyleDefault; 
    moviePlayer.shouldAutoplay = YES; 
    [self.view addSubview:moviePlayer.view]; 
    [moviePlayer setFullscreen:YES animated:YES]; 
} else { 
    // Use the old 2.0 style API 
    moviePlayer.movieControlMode = MPMovieControlModeHidden; 
    [moviePlayer play]; 
} 

} - (void)moviePlayBackDidFinish:(NSNotification *)notification {
MPMoviePlayerController * moviePlayer = [通知對象];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];

// If the moviePlayer.view was added to the view, it needs to be removed 
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) { 
    [moviePlayer.view removeFromSuperview]; 
} 

[moviePlayer release]; 

}