2014-02-08 95 views
-3

我想這個代碼,但它顯示一個靜止圖像,而不是正確的視頻流。但是它顯示視頻,但只有一段時間。來自網絡攝像頭的視頻不是流媒體在iPhone /目標c

[reykjavikurtjorn loadRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://213.167.154.114/mila/_definst_/tjornin.stream/playlist.m3u8"]]]; 
[super viewDidLoad]; 

回答

0
NSURL *url = [NSURL fileURLWithPath:@"http://www.domain.com/myVideo.mp4"]; 
MPMoviePlayerViewController *mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; 

[[NSNotificationCenter defaultCenter] addObserver:self 
           selector:@selector(moviePlaybackDidFinish:) 
            name:MPMoviePlayerPlaybackDidFinishNotification 
            object:nil];  

mpvc.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; 

[self presentMoviePlayerViewControllerAnimated:mpvc]; 

和委託

- (void) moviePlayBackDidFinish:(NSNotification*)notification { 
MPMoviePlayerController *player = [notification object]; 

[[NSNotificationCenter defaultCenter] removeObserver:self 
               name:MPMoviePlayerPlaybackDidFinishNotification 
               object:player]; 

if ([player respondsToSelector:@selector(setFullscreen:animated:)]) { 
[player.view removeFromSuperview]; 
}