2014-02-08 87 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]; 
}