在iOS 4的今典合作,播放电影:MPMoviePlayer - 黑屏 - iOS 5的 - 没有视频播放
-(IBAction)playMovie:(id)sender
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"testbild1" ofType:@"m4v"]];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
UIView *testview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[testview addSubview:moviePlayer.view];
[self.view addSubview:testview];
//[self.view addSubview:moviePlayer.view];
//[moviePlayer setFullscreen:YES animated:YES];
}
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
//[moviePlayerController release];
}
现在,我只得到一个blackscreen。没有控制,没有。视频路径是正确的,我测试了这一点。如果我通过按钮点击添加一个白色的子视图,它就可以工作。所以这个方法被调用。
在此先感谢!
我做,我这样说是相同的(但在其他项目中)有意和完美地工作。所以我认为就是这样。感谢您的贡献。 – DAS
这不适用于我 – ios
这可以与PhoneGap一起使用吗?我不确定如何/在哪里实施使用该框架 – bafromca