簡體   English   中英

嘗試從AWS / FMS實時流式傳輸到iPhone(使用HLS)

[英]trying to live stream from AWS/FMS to iphone (using HLS)

我已經在運行Flash Media Server(FMS)的Amazon AWS上設置了一個實例,該實例正在按照以下說明廣播Live HTTP Streaming(HLS),因此我知道我正在使用適用於iPhone的正確流格式進行處理。

此外,按照相同的說明,我已經確認服務器已啟動並且正在運行,並且我已經成功設置了Flash客戶端以讀取其HDS流(用於Flash設備的HTTP動態流)。

我編寫了以下iphone客戶端代碼來播放流(從教程中盜用,使其可以與本地視頻文件一起使用。也對我有用):

@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 文檔傳遞時,一個無效的參數的方法,例如在需要非零對象一個零指針NSInvalidArgumentException發生。 大家有什么想法嗎?

解決方法很簡單..基本上是語法錯誤(lol)..在moviePlaybackComplete之后添加':'

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM