在 iOS4 中损坏的 UIWebView 中播放视频?

Playing videos in UIWebView broken in iOS4?(在 iOS4 中损坏的 UIWebView 中播放视频?)

本文介绍了在 iOS4 中损坏的 UIWebView 中播放视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从 SDK 2.0 版开始工作的应用程序,我在其中创建和添加 UIWebView,然后加载 .mov 的 URL 以播放电影.从 4.0 beta 的早期版本到 4.0 GM,这已经停止工作.当我现在加载电影时,出现以下错误::插件处理加载"并且电影永远不会显示.

I have an app that's worked since version 2.0 of the SDK where I create and add a UIWebView and then load the URL of an .mov to play a movie. Ever since the early version of the 4.0 beta up until the 4.0 GM this has stopped working. When I load a movie now I get the following error: :Plug-in handled load" and the movie never displays.

这是一个已知问题吗?我在 4.0 中做错了吗?

Is this a known issue? Am I doing something wrong in 4.0?

推荐答案

我想通了.这似乎是 iOS4 不向后兼容使用init"而不是initWithFrame"创建的 UIWebView 的问题.在 2.0 - 3.1.3 中,您只能在 UIWebview 中将视频显示为全屏.我认为这就是为什么调用init"并不重要——电影播放器​​会启动并全屏显示.但是,在 3.2 及更高版本中,您现在可以在 UIWebView 中内联视频,因此您必须调用 initWithFrame 并为其提供类似 [[UIScreen mainScreen] bounds] 的内容,以便有一个可见的视图.不太确定这是否是牛市,但似乎是这样.

I figured this out. It appears to be an issue with iOS4 not being backward compatible with a UIWebView created with 'init' rather than 'initWithFrame'. In 2.0 - 3.1.3, you could only show video in a UIWebview as full screen. I think this is why it didn't matter if you called 'init' -- the movie player would kick in and go fullscreen. However, in 3.2 and higher you can now inline video in a UIWebView so you have to call initWithFrame and give it something like [[UIScreen mainScreen] bounds] so there's a visible view. Not quite sure if this is bull or not but seems to be the case.

这篇关于在 iOS4 中损坏的 UIWebView 中播放视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 iOS4 中损坏的 UIWebView 中播放视频?

基础教程推荐