从URL中播放MPMoviePlayerController中的视频?
问题描述:
我想在MPMovieplayer的帮助下从一个Url播放视频,该视频将它加载到Quicktime播放器中,而我希望视频仅在我的应用程序中播放(无背景模式)?我怎么能做到这一点?将在UIWebview而不是MPMoviePlayer工作播放视频? 另外,当QuickTime播放器只加载音频播放,并没有视频显示?我使用以下代码从URL中播放MPMoviePlayerController中的视频?
NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];
MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:movie];
[self presentMoviePlayerViewControllerAnimated:movie];
答
必须添加movie.view
到视图
答
幅= [[UIWebView中的alloc] initWithFrame:方法CGRectMake(0,0,320,480)];
NSString *urlAddress = @"HTTP://";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[web loadRequest:requestObj];