在 iOS4 中 UIWebView 播放视频损坏?
我有一个从 SDK 2.0 版开始运行的应用程序,我在其中创建并添加 UIWebView,然后加载 .mov 的 URL 来播放电影。从 4.0 beta 的早期版本到 4.0 GM,此功能已停止工作。当我现在加载电影时,出现以下错误::插件处理加载”并且电影永远不会显示。
这是一个已知问题吗?我在 4.0 中做错了什么吗?
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.
Is this a known issue? Am I doing something wrong in 4.0?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
至少在PhoneGap的ChildBrowser中,didFailLoadWithError方法处理并显示此消息。只需不显示错误,问题就解决了,但在这种特定情况下,在返回应用程序之前需要按两个“完成”按钮。
At least in PhoneGap's ChildBrowser, the didFailLoadWithError method handles and displays this message. Simply don't display the error, problem solved, but in this specific case there are two 'done' buttons to press before you get back to the application.
简单地忽略它即可。这样做没有什么害处。
Simply just ignore it. No harm in doing so.
我在播放视频剪辑时遇到“该影片无法播放”的情况。
刚使用录音机时出现这种情况。而当播放器刚刚使用时,不会发生这种情况。
然后,在录音机完成后,我将音频会话类别设置为 kAudioSessionCategory_AmbientSound。
我这样做之后这个问题就解决了。
I got a situation of "this movie could not be played" when playing a video clip.
This happened when recorder was just used. And this would NOT happen when player was just used.
Then I set audio session category to kAudioSessionCategory_AmbientSound after recorder finished.
This problem was solved after I did that.
我明白了这一点。这似乎是 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.