これは私の最初の投稿です。正しくないように見えるかもしれません。 iPad(5.1)のcocos2dでローテーションを作成しました それぞれの向きに2つの異なる動画を使用しています。「警告:標準状態で、_fillInQueueWithExtraSpace:..」というメッセージが表示され、MPMoviePlayerの回転がiPad IOS 5.1で動作しません。
アプリはポートレートモードで起動し、正常に動画が再生されます。 とがあり、私は2つの問題があります。私はビデオを呼び出す(再生)5〜10回、ビデオが終了すると私はシミュレータを回転させる。ビューが回転しますが、私が呼び出したときに(遊び)ビデオ - それは白い画面と次のメッセージを示しています。
「警告:通常の条件下では、_fillInQueueWithExtraSpace:ignoreExistingItemsは:再入力するべきではありません。」
次に、画面をもう一度(数回)回転させて、横向きモードで再生すると、ビデオがうまく再生されます。 また、その逆もあります。ランドスケープモードから開始するとき
ビュー回転問題を表示します。 ビューを左右の風景に(肖像画から)回転すると、ビューを後方に回転させることはできません。時計回りまたは反時計回りにしか回転できません。それを修正するには?
-(id) init {
pathToVideoP = [[NSBundle mainBundle] pathForResource:@"video_portrait" ofType:@"mp4"];
pathToVideoL = [[NSBundle mainBundle] pathForResource:@"video_landscape" ofType:@"mp4"];
theMovieP = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:pathToVideoP]];
theMovieL = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:pathToVideoL]];
}
-(void) playVideoButtonClicked {
movieButton.visible = FALSE;
if (sharedManager.isPortrait){
theMovie = theMovieP;
} else {
theMovie = theMovieL;
}
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:[theMovie moviePlayer]];
CGSize size = [[CCDirector sharedDirector] winSize];
[[[CCDirector sharedDirector] openGLView] addSubview:theMovie.view];
player = [self.theMovie moviePlayer];
player.controlStyle = MPMovieControlStyleNone;
[theMovie moviePlayer].view.backgroundColor = [UIColor whiteColor];
theMovie.view.frame = CGRectMake(0, 0, size.width, size.height);
if (sharedManager.isPortrait) {
CGAffineTransform transform = player.view.transform;
player.view.transform = transform;
}
else if (sharedManager.changeOrientation)
{
CGAffineTransform transform = player.view.transform;
transform = CGAffineTransformRotate(transform, (-M_PI/2));
player.view.transform = transform;
}
sharedManager.changeOrientation = NO;
player.backgroundView.backgroundColor = [UIColor whiteColor];
theMovie.view.backgroundColor = [UIColor whiteColor];
player.view.userInteractionEnabled = NO;
player.scalingMode = MPMovieScalingModeNone;
[player play];
}
-(void) moviePreloadDidFinish:(id)sender {
}
-(void) movieFinishedCallback:(NSNotification*) aNotification {
theMovie = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:theMovie];
[player stop];
[theMovie.view removeFromSuperview];
movieButton.visible = TRUE;
}