2013-01-15 160 views
0

我剛剛更新到IOS 6,現在當我運行我的應用程序MPMoviePlayerControler錯誤地顯示視頻。該應用程序是風景,但是當視頻以縱向顯示時。我創建了新的.h和.m文件,它是MPMoviePlayerController的子文件。這裏是我的兩個文件IOS 6 MPMoviePlayerController旋轉問題

.H

#import <Foundation/Foundation.h> 
#import "cocos2d.h" 
#import <MediaPlayer/MediaPlayer.h> 

@interface TrashPackPlayer : MPMoviePlayerController 

@end 

.M

#import "TrashPackPlayer.h" 

@implementation TrashPackPlayer 

-(id)init{ 
    [super init]; 
    return self; 
} 

- (BOOL)shouldAutorotate 
{ 
    return YES; 
} 

- (NSInteger)supportedInterfaceOrientations 
{ 
    return UIInterfaceOrientationMaskLandscape; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
{ 
    return UIInterfaceOrientationIsLandscape(toInterfaceOrientation); 
} 

@end 

我創建了媒體播放器這樣的:

player = [[TrashPackPlayer alloc] initWithContentURL:videoURL]; 
    player.view.frame = CGRectMake(0, 0, sharedInfo.screenSize.width, sharedInfo.screenSize.height); 
    player.controlStyle = MPMovieControlStyleFullscreen; 
    player.scalingMode = MPMovieScalingModeAspectFit; 
    [player play]; 

    [[[CCDirector sharedDirector] openGLView] addSubview:player.view]; 

這是正確的嗎?

我需要做些什麼才能正確顯示此顯示?

回答