2011-12-09 4 views
0

私はios5でビデオを再生しています。私のアプリケーションはランドスケープモードをサポートしています。 WebviewまたはMPMoviePlayerControllerで再生しても、アプリケーションでフルスクリーンでビデオを再生しているときに、向きを横にロックしたいiosでビデオまたはMPMoviePlayerControllerを再生しているときにWebViewでロックする方向

私はMPMoviePlayerControllerのサブクラスを作成して- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientationを実装しましたが、これはcozという名前ではないと思われますので、このメソッドはUIViewControllerで利用できます。

動画プレーヤーの向きをロックするのを手伝ってください。

EDIT 3:ここでは は私のコードです:

- (void)showTransferedVideo:(NSNotification*)notification { 

viewFileDisplay = [[UIView alloc] initWithFrame:self.view.frame]; 
[viewFileDisplay setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.70]]; 

NSString *imagePath = [((MobileJabberAppDelegate*)[[UIApplication sharedApplication] delegate]).strFilePath stringByAppendingPathComponent: 
         [NSString stringWithFormat:@"%@", [notification object]]]; 

NSURL *url = [NSURL fileURLWithPath:imagePath]; 
UIWebView *objWebView = [[UIWebView alloc] initWithFrame:CGRectMake(212, 152, 600, 400)]; 
NSURLRequest *req = [NSURLRequest requestWithURL:url]; 
[objWebView loadRequest:req]; 
[viewFileDisplay addSubview:objWebView]; 
[self.view addSubview:viewFileDisplay]; 

} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    return(interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight); 
} 

問題は、iOS 5とするとき、私はフルスクリーンでビデオを再生中にのみ発生します。私は、あなたがそのような風景にUIWebViewを使用してから取得するプレーヤーをロックすることができるとは思わない

おかげ

+0

別のView Controllerでwebview/Movieプレーヤーを作成する必要があります。なぜあなたはBOOLを実装しないのですか?shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation? –

+0

私はすでにこれを行っていますが、webviewはquicktimeプレーヤーでビデオを再生します。 QuickTimePlayerを制御できますか? –

+0

コードを投稿できますか? –

答えて

0

をフルスクリーンの向きをロックします。 MPMoviePlayerViewControllerのサブクラスを作成し、横向きのみをサポートするようにあなたのクラスにあるようにshouldAutorotateToInterfaceOrientation:を実装することをお勧めします。それを使ってビデオを再生します。

+0

MPMoviePlayerContrrollerサブクラスは 'shouldAutorotateToInterfaceOrieantation:'を呼び出さないでください。私もこれを試しました。 –

+3

'MPMoviePlayerViewController' *ではなく、' MPMoviePlayerController'です。その違いに注意してください - あなたはビューコントローラをサブクラス化する必要があり、プレーヤ自体はサブクラス化する必要はありません。 – mattjgalloway

関連する問題