【问题标题】:streaming videos on iPhone在 iPhone 上流式传输视频
【发布时间】:2012-06-20 05:44:32
【问题描述】:

我想在 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];

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

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

问候
潘卡伊

【问题讨论】:

    标签: iphone ios streaming video-streaming


    【解决方案1】:

    嗨,你必须在 iphone 端做以下事情......

    -(void) 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*)通知{
    MPMoviePlayerController *moviePlayer = [通知对象];
    [[NSNotificationCenter defaultCenter] removeObserver:self
    名称:MPMoviePlayerPlaybackDidFinishNotification
    对象:电影播放器​​];

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

    }

    【讨论】:

      【解决方案2】:

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

      AVFoundation 框架要强大得多。

      【讨论】:

        猜你喜欢
        • 2012-01-09
        • 1970-01-01
        • 1970-01-01
        • 2011-05-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多