)
我的客户要求我将一个简短的视频作为splahscreen阅读(例如,特别针对游戏)。我google了一下,我认为这些人使用带有StyleControl的MPMoviePlayerController到None(如果我错了,请纠正我......) 我尝试使用iPhone上的视频(通常是正确的格式......),但仍保持黑色。我的背景是红色的,我看到它出现在开头,然后它被我的视频隐藏,它仍然是黑色的,永远不会启动。 但是,我设置了我的视频帧(当时初始化了self.view),我添加了播放器以查看我的自我...简而言之,我看不出可能会出现什么问题。 这是代码(使用FullScreen控件试图查看,但我也从未见过它们。 一个想法任何机会? 大家好;)
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
MPMoviePlayerController * mMoviePlayer;
// Do any additional setup after loading the view, typically from a nib.
NSURL* mMovieURL;
NSBundle *bundle = [NSBundle mainBundle];
if (bundle)
{
NSString *moviePath = [bundle pathForResource:@"movie" ofType:@"mov"];
if (moviePath)
{
mMovieURL = [NSURL fileURLWithPath:moviePath];
}
}
NSLog(@"%@", mMovieURL);
[[UIApplication sharedApplication] setStatusBarHidden:YES];
mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:mMovieURL];
// mMoviePlayer.scalingMode = MPMovieScalingModeAspectFill;
mMoviePlayer.controlStyle = MPMovieControlStyleFullscreen;
[mMoviePlayer.view setFrame: self.view.bounds]; // player's frame must match parent's
[self.view addSubview: mMoviePlayer.view];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:mMoviePlayer];
[mMoviePlayer play];
}
答案 0 :(得分:0)
[player setFullscreen:YES];