3
我在我的Mac上设置了一个达尔文流媒体服务器。 现在我需要流在我的iPhone实时使用darwing流媒体服务器进行流媒体直播
这些影片,但存在的问题是MPMoviePlayerPlaybackDidFinishNotification在播放视频时
甚至在我已经检查了服务器的正常运行 还我已经成功地打开称为网址在safari和quicktime。 只是不会被在模拟器上 我写的代码播放的视频是
NSURL *movieURL=[NSURL fileURLWithPath:@"rtsp://10.41.37.160/sample_300kbit.mov"];
// NSURL *movieURL = [NSURL URLWithString:@"rtsp://10.41.37.160/sample_300kbit.mp4"];
if (movieURL != nil)
{
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[moviePlayer.view setFrame: CGRectMake(0, 0, 320, 400)];
[moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[moviePlayer setMovieSourceType:MPMovieSourceTypeStreaming];
[self.view addSubview:moviePlayer.view];
moviePlayer.fullscreen=YES;
// moviePlayer.initialPlaybackTime = -1.0;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerScalingModeDidChangeNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endPlay:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
moviePlayer.shouldAutoplay=YES;
[moviePlayer play];
//[self reloadInputViews];
}
-(void)moviePlayBackDidFinish: (NSNotification*)notification
{
self.navigationItem.hidesBackButton = FALSE;
moviePlayer = [notification object];
[moviePlayer play];
}
-(void)endPlay: (NSNotification*)notification
{
NSLog(@"end Playing");
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerScalingModeDidChangeNotification object:moviePlayer];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];
[moviePlayer stop];
[moviePlayer release];
}
我猜你的权利。但它支持Android ,所以我猜它可能也支持在iOS上 – Nitesh