3

フルスクリーンのhtml5ビデオを再生する必要があるPhonegapアプリを作成しています。

私の問題は、Phonegap2.1.0とiOS6では向きによって何かが変化し、フルスクリーンビデオを閉じるたびに(完了ボタンを押す)、アプリが横向きモードでロックされていても、ビデオによってアプリが縦向きモードになります。

ここではobj-cマジックを実行していません。これは、標準のhtml5ビデオタグです。

<video id="myvideo" src="goat.mp4" controls="" autobuffer=""></video>

方向の変更を強制するのはviewControllerの上にあるビデオレイヤーだと思いますが、どうすれば停止させることができますか?

どんなアイデアでも大歓迎です!前もって感謝します...

4

1 に答える 1

7

PhoneGap 2.1の場合、バグ修正を確認してください

「MainViewController.m」で次のように変更viewWillAppearします

- (void)viewWillAppear:(BOOL)animated
{
  // Set the main view to utilize the entire application frame space of the device.
  // Change this to suit your view's UI footprint needs in your application.

  UIView* rootView =[[[[UIApplication sharedApplication] keyWindow] rootViewController] view];
  CGRect webViewFrame = [[[rootView subviews] objectAtIndex:0] frame];  // first subview is the UIWebView
  if (CGRectEqualToRect(webViewFrame, CGRectZero)) { // UIWebView is sized according to its parent, here it hasn't been sized yet
      self.view.frame = [[UIScreen mainScreen] applicationFrame]; // size UIWebView's parent according to application frame, which will in turn resize the UIWebView
  }

  [super viewWillAppear:animated];
}
于 2012-10-15T16:34:41.223 に答える