打开网络视频:
-(void)openmovie
{
MPMoviePlayerViewController *movie = [[MPMoviePlayerViewControlleralloc]initWithContentURL:[NSURLURLWithString:@视频网络地址]];
[movie.moviePlayer prepareToPlay];
[self presentMoviePlayerViewControllerAnimated:movie];
[movie.moviePlayersetControlStyle:MPMovieControlStyleFullscreen];
[movie.viewsetBackgroundColor:[UIColorclearColor]];
[movie.view setFrame:self.view.bounds];
//回调方法
[[NSNotificationCenterdefaultCenter]addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:movie.moviePlayer];
}
-(void)movieFinishedCallback:(NSNotification*)notify{
// 视频播放完或者在presentMoviePlayerViewControllerAnimated下的Done按钮被点击响应的通知。
MPMoviePlayerController* theMovie = [notifyobject];
[[NSNotificationCenterdefaultCenter]removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
[selfdismissMoviePlayerViewControllerAnimated];
}
//- (void) movieFinishedCallback:(NSNotification*) aNotification {
//
// MPMoviePlayerController *player = [aNotificationobject];
//
// [[NSNotificationCenter defaultCenter] removeObserver:selfname:MPMoviePlayerPlaybackDidFinishNotificationobject:player];
//
// [playerstop];
//
// [player.viewremoveFromSuperview];
//
//
//
//}