来自网络摄像头的视频无法在 iPhone/Objective c 中流式传输



我正在尝试此代码,但它显示的是静止图像,而不是正确的视频流。但是,它会显示视频,但仅显示一段时间。

[reykjavikurtjorn loadRequest:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://213.167.154.114/mila/_definst_/tjornin.stream/playlist.m3u8"]]];
[super viewDidLoad];
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];
}

最新更新