【问题标题】:trying to live stream from AWS/FMS to iphone (using HLS)尝试从 AWS/FMS 直播到 iphone(使用 HLS)
【发布时间】:2012-07-13 15:18:21
【问题描述】:

我在 Amazon AWS 上设置了一个运行 Flash Media Server (FMS) 的实例,该实例按照 these 的说明广播 Live HTTP Streaming (HLS),所以我知道我正在使用适用于 iPhone 的正确流格式进行流式传输.

此外,使用相同的说明,我已确认服务器已启动并正在运行,并且我已成功设置闪存客户端以读取其 HDS 流(用于闪存设备的 HTTP 动态流)。

我编写了这个 iphone 客户端代码来播放流(从 tutorial 窃取,使其可以与本地视频文件一起使用.. 这对我也有用):

@implementation BigBuckBunnyViewController

-(IBAction)playMovie:(id)sender
{
    NSURL *streamURL = [NSURL URLWithString:@"http://dstvrton8xbej.cloudfront.net/hls-live/livepkgr/_definst_/liveevent/livestream.m3u8"];
    MPMoviePlayerController *moviePlayerContoller = [[MPMoviePlayerController alloc] initWithContentURL:streamURL];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlaybackComplete) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayerContoller];

    [self.view addSubview:moviePlayerContoller.view];
    moviePlayerContoller.fullscreen = YES;
    [moviePlayerContoller play];

}

- (void)moviePlaybackComplete: (NSNotification *)notification
{
    MPMoviePlayerController *moviePlayerController = [notification object];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification
                                                  object:moviePlayerController];

    [moviePlayerController.view removeFromSuperview];
    [moviePlayerController release];

}

但是当我将代码编译到我的 ipad 上时,我收到了这个错误消息:

2012-07-13 17:45:20.513 BigBuckBunny[3714:607] -[BigBuckBunnyViewController moviePlaybackComplete]: unrecognized selector sent to instance 0x21050080
2012-07-13 17:45:20.524 BigBuckBunny[3714:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BigBuckBunnyViewController moviePlaybackComplete]: unrecognized selector sent to instance 0x21050080'        

来自 Mac documentation NSInvalidArgumentException 当您将无效参数传递给方法时发生,例如需要非 nil 对象的 nil 指针。大家有什么想法吗?

【问题讨论】:

  • 更多关于这个.. 我意识到通过在 iPad/iPhone 5.1 模拟器上运行它,它可以工作.. 但如果我在物理 iPad 版本 4.3.3 上运行它,它会因上述原因而崩溃错误消息(有趣的是,如果我将不正确的 URL 作为字符串,那么 5.1 版本会崩溃并显示完全相同的消息。我的假设是,我必须先确保流已完全加载,然后才能在版本

标签: iphone amazon-web-services http-live-streaming flash-media-server


【解决方案1】:

解决方案很简单..基本上是语法错误(lol)..在moviePlaybackComplete之后添加':'

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(moviePlaybackComplete:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification   
                                           object:moviePlayerContoller];

【讨论】:

    猜你喜欢
    • 2012-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-24
    • 2018-11-17
    • 1970-01-01
    • 2012-01-22
    相关资源
    最近更新 更多