0

비디오를 재생하는 어플리케이션이 있습니다. 이 iOS7에 큰 좋은 작업이었다하지만 지금은 iOS8의에서은 내가 그것을 회전 할 필요가있다 ios 8로 회전하면 MPMediaPlayer가 작아집니다.

self.player = [[MPMoviePlayerController alloc] initWithContentURL:self.videoFileToDisplay]; 
[self.player play]; 

[self.view setBackgroundColor:[UIColor redColor]]; 
[self.player.view setBackgroundColor:[UIColor greenColor]]; 
UIView *playerView = self.player.view; 

[self.view addSubview:playerView]; 
playerView.translatesAutoresizingMaskIntoConstraints = NO; 
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[playerView]|" 
                    options:0 
                    metrics:nil 
                    views:NSDictionaryOfVariableBindings(playerView)]]; 
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[playerView]|" 
                    options:0 
                    metrics:nil 

는 또한 수평 또는 수직 비디오에 따라 분류됩니다

- (void)adoptVideoToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation withDuration:(NSTimeInterval)duration 
{ 

    CGFloat horizontalVideoAngle = 0; 
    CGFloat verticalVideoAngle = 0; 

    switch (toInterfaceOrientation) { 
     case UIDeviceOrientationLandscapeLeft: 
      horizontalVideoAngle = 0; 
      verticalVideoAngle = M_PI_2; 
      break; 
     case UIDeviceOrientationLandscapeRight: 
      horizontalVideoAngle = 0; 
      verticalVideoAngle = -M_PI_2; 
      break; 
     case UIDeviceOrientationPortraitUpsideDown: 
      verticalVideoAngle = 0; 
      horizontalVideoAngle = M_PI_2; 
      break; 
     case UIDeviceOrientationPortrait: 
      verticalVideoAngle = 0; 
      horizontalVideoAngle = -M_PI_2; 
      break; 
     default: 
      return; 
    } 

    CGFloat angle = [self isHorizontalVideo] ? horizontalVideoAngle : verticalVideoAngle; 
    self.player.view.transform = CGAffineTransformMakeRotation(angle); 
} 

그것은 모든 방향에서 좋은 초상화를 제외하고. 스크린 샷

portrait LandscapeRight UpsideDown LandscapeLeft

iOS8의 세로 방향에 어떤 문제에도 상하 반전 좋은 여기입니다입니까?

PS 레드 뷰는 지금은 전용 콘텐츠를 회전 볼 프레임에 영향을주지 않습니다 애플이 iOS8의에서 회전을 변경 같은

답변

0

이 보이는 MediaPlayer를의 슈퍼 뷰의 배경입니다. 그래서 추가 스케일 변환을 추가했습니다.

관련 문제