Watching Vimeo videos in UIWebView on iOS

依然范特西╮ 提交于 2020-01-16 05:37:11

问题


I have an app with a UIWebView that I'm trying to view Vimeo videos in. If i hard link it to www.vimeo.com, the vimeo home page and the list of videos loads, however, when clicked only sound plays. If i hop into mobile safari and go to www.vimeo.com, it all looks the same, but the video plays in full screen mode here. I am trying to have my UIWebView act the same way. What am I missing? I have checked this across multiple devices and versions of iOS all with the same results.

Thanks

UPDATE: It actually loads the video BEHIND the view in full screen. Is there any way i can access that full screen video view and bring it to the front?

Heres a bit of code where it's loading. Nothing special though. It's about 3 views in on a navigation controller.

urlString =[NSMutableString stringWithFormat:@"http://www.youtube.com"]
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[[self webView]setDelegate:self];
[webView loadRequest:requestObj];

UPDATED FIX

I found that if i add self.view.window.rootviewcontroller.view as a subview of the existing view before pushing the new view controller, all works great. Thanks, Eric for the help

[self.view addSubview:self.view.window.rootViewController.view];
[myNavController pushViewController:urlView animated:YES];
[urlView release];

回答1:


I had a similar problem, and discovered that the fullscreen video is added as a view to the window's rootViewController, which was not the view controller that contained the UIWebView. After setting window.rootViewController the video opened on top of the UIWebView as expected.



来源:https://stackoverflow.com/questions/11085455/watching-vimeo-videos-in-uiwebview-on-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!