收到消息“警告:正常情况下,_fillInQueueWithExtraSpace:..”并且 MPMoviePlayer 旋转在 iPad IOS 5.1 中不起作用

2023-12-23

这是我的第一篇文章,可能看起来不正确。 所以,我必须在 iPad (5.1) 上的 cocos2d 中进行旋转 我针对每个方向使用 2 个不同的视频。 我有两个问题:

  1. 该应用程序以纵向模式启动,并正常播放视频。我调用(播放)视频 5-10 次,视频结束后我旋转模拟器。视图旋转,但是当我调用(播放)视频时 - 它显示白屏和下一条消息:

    “警告:在正常情况下,不应重新输入 _fillInQueueWithExtraSpace:ignoreExistingItems:。”

    然后,如果我再次旋转屏幕(几次) - 并以横向模式播放 - 它可以很好地播放视频。反之亦然。当我从横向模式开始时

  2. 视图旋转问题。 当我将视图旋转到左/右横向(从纵向)时 - 无法向后旋转视图。所以我只能顺时针或逆时针旋转。如何修复它?


-(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;
}

创建玩家对象后添加这行代码。 播放器 = [self.theMovie moviePlayer]; 播放器.controlStyle = MPMovieControlStyleNone;

iOS 6.0以下版本需要此功能。可能会有帮助。

[玩家准备开始游戏];

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

收到消息“警告:正常情况下,_fillInQueueWithExtraSpace:..”并且 MPMoviePlayer 旋转在 iPad IOS 5.1 中不起作用 的相关文章

随机推荐