收到消息“警告:在正常条件下,_fillInQueueWithExtraSpace:..”和MPMoviePlayer旋转不工作在iPad IOS 5.1 [英] Got the message "WARNING: under normal conditions, _fillInQueueWithExtraSpace:.." and MPMoviePlayer rotation not work in iPad IOS 5.1
问题描述
这是我的第一篇文章,可能是不正确的。
所以,我要在cocos2d在iPad上旋转(5.1)
我使用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对象。
player = [self.theMovie moviePlayer];
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.
[player prepareToPlay];
这篇关于收到消息“警告:在正常条件下,_fillInQueueWithExtraSpace:..”和MPMoviePlayer旋转不工作在iPad IOS 5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!