这是我的第一篇文章,可能看起来不正确.所以,我必须在 iPad (5.1) 上的 cocos2d 中进行旋转我对每个方向使用 2 个不同的视频.我有两个问题:
It's my first post, and may be it may seem incorrect. So, I've to make rotation in cocos2d on iPad (5.1) I use 2 different videos to each orientation. And there I have 2 problems:
应用程序以纵向模式启动,并正常播放视频.我调用(播放)视频 5-10 次,当视频完成时,我旋转模拟器.视图旋转,但是当我调用(播放)视频时 - 它显示白屏和下一条消息:
The app starts in portrait mode, and plays video normally. I call (play) the video 5-10 times, when video finishs I rotate simulator. The view rotates, BUT when I call (play) video - it shows white screen and the next message:
警告:在正常情况下,_fillInQueueWithExtraSpace:ignoreExistingItems: 不应重新输入."
"WARNING: under normal conditions, _fillInQueueWithExtraSpace:ignoreExistingItems: should not be re-entered."
然后,如果我再次(多次)旋转屏幕 - 并以横向模式播放 - 它可以很好地播放视频.反之亦然.当我从横向模式开始时
Then If I rotate screen again (several times) - and play it in landscape mode - it plays video well. Also vice versa. When I start from landscape mode
视图旋转问题.当我将视图旋转到左/右横向(从纵向)时 - 无法向后旋转视图.所以我只能顺时针或逆时针旋转.如何解决?
The View rotating problem. When I rotate view to the left/right landscape (from portrait) - can't rotate view backward. So I can rotate only in clockwise or counter clockwise. How to fix it?
<小时>
-(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;
}
在创建播放器对象后添加这行代码.player = [self.theMovie 电影播放器];player.controlStyle = MPMovieControlStyleNone;
Add this line of code After creating Player Object. player = [self.theMovie moviePlayer]; player.controlStyle = MPMovieControlStyleNone;
在 iOS 6.0 以下版本是必需的.可能会有所帮助.
It's necessary in below version of iOS 6.0. May be it's helpful.
[播放器准备播放];
这篇关于收到消息“警告:在正常情况下,_fillInQueueWithExtraSpace:.."和 MPMoviePlayer 旋转在 iPad IOS 5.1 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!