我正在构建一个需要播放全屏html5视频的Phonegap应用。
我的问题是,随着Phonegap 2.1.0和iOS 6改变了方向,每次我关闭全屏视频(按完成按钮),视频强制我的应用程序处于纵向模式,即使应用程序被锁定在横向模式。
我这里没有做任何对象魔法,它是一个标准的html5视频标签。
<video id="myvideo" src="goat.mp4" controls="" autobuffer=""></video>
我认为它是我的viewController顶部的视频图层,它会强制更改方向,但是如何让它停止?
任何想法都将不胜感激!提前谢谢......
答案 0 :(得分:7)
对于PhoneGap 2.1,请查看bug fix
在“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];
}