视频解散后的定位问题:Cordova 2.1.0 + iOS 6

cas*_*r60 3 video html5 orientation-changes cordova ios6

我正在构建一个需要播放全屏html5视频的Phonegap应用.

我的问题是,随着Phonegap 2.1.0和iOS 6改变了方向,每次我关闭全屏视频(按完成按钮),视频强制我的应用程序处于纵向模式,即使应用程序被锁定在横向模式.

我这里没有做任何对象魔法,它是一个标准的html5视频标签.

<video id="myvideo" src="goat.mp4" controls="" autobuffer=""></video>
Run Code Online (Sandbox Code Playgroud)

我假设它是我的viewController顶部的视频层,它强制改变方向,但是如何让它停止?

任何想法将不胜感激!提前致谢...

小智 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];
}
Run Code Online (Sandbox Code Playgroud)