1

我已經在運行Flash Media Server(FMS)的Amazon AWS上設置了一個實例,該實例正在廣播Live HTTP Streaming(HLS)後面的these指令,所以我知道我正在使用適合iPhone的正確流媒體格式。試圖直播從AWS/FMS到iPhone(使用HLS)

此外,使用相同的說明,我已確認服務器已啓動並正在運行,並且我已成功設置Flash客戶端以讀取其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 documentationNSInvalidArgumentException傳遞時,一個無效的參數的方法,會發生諸如零指針其中非零對象 是必須的。任何想法的人?

+0

更多關於這個..我認識到,通過在iPad/iPhone 5.1模擬器運行此,它的工作原理..但如果我運行它在物理iPad版本4.3.3,它與上述錯誤信息崩潰(有趣的是,如果我把一個不正確的URL作爲一個字符串,然後5.1版本崩潰與完全相同的消息。 。我的假設是,我必須確保在實際播放版本<5.1)之前,流已經完全加載。我會繼續挖掘,因爲沒有人在這裏說任何事情 – abbood 2012-07-16 08:16:16

回答

0

的解決方案是簡單..基本上它是一種語法錯誤(LOL)..添加「:」 moviePlaybackComplete後

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