0

我想在 iPhone 中从 ftp 流式传输大型视频。视频大小超过 500 MB。我从来没有做过流媒体,所以不知道。我查看了 Apple 的实时流媒体指南,但它没有提供有关 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];

这种编码是否足以播放流媒体视频?

我有一个为我准备视频的人,我应该让他对服务器上的视频做什么?我应该问他只是在服务器上分割视频还是其他什么?有人可以建议我最好的转发方式吗?

问候
潘卡伊

4

2 回答 2

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

}

于 2012-06-18T09:43:19.213 回答
0

查看这些教程AVFoundation Tutorials并在此处阅读 Apple 的 AVFoundation Framework 编程指南

AVFoundation 框架要强大得多。

于 2012-06-18T09:19:42.027 回答