我刚刚更新到 IOS 6,现在当我运行我的应用程序时,MPMoviePlayerControler 会错误地显示视频。该应用程序是横向的,但是当视频以纵向显示时。我创建了新的 .h 和 .m 文件,它们是 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];
这个对吗?
我需要做什么才能正确显示?