ios 在 UIWebView 中的网页中播放视频时出现“插件处理负载”对话框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9422507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 17:00:23  来源:igfitidea点击:

"Plugin handled load" dialog appears when playing a video within a web page within UIWebView

iphoneiosuiwebviewquicktimetypo3

提问by Gruntcakes

If I click on a link to a video within a web page being displayed by UIWebView then the video plays but a dialog pops up saying "Plugin handled load".

如果我单击 UIWebView 显示的网页中视频的链接,则视频会播放,但会弹出一个对话框,提示“插件处理负载”。

Does anybody know why this happens and how to stop it from happening?

有谁知道为什么会发生这种情况以及如何阻止它发生?

This is not a duplicate of:

这不是以下内容的重复:

Playing videos in UIWebView broken in iOS4?

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

as I am not creating a UIWebView with a zero size frame, which is described as the cause.

因为我没有创建一个零尺寸框架的 UIWebView,这被描述为原因。

(Am using iOS 5)

(我使用的是 iOS 5)

回答by Barlow Tucker

The problem would seem to be in the fact the UIWebView does not include the same user agent string as mobile safari. (See this question here).

问题似乎在于 UIWebView 不包含与移动 safari 相同的用户代理字符串。(在这里看到这个问题)。

If your video is being converted to HTML5 or MP4 as your comment above implies, you will want to change the User Agent of your UIWebView to match mobile Safari so your website knows to convert the view from flash (flash will not play on iOS). Here is an answerto how to change the User Agent on a UIWebView.

如果您的视频如上述评论所示被转换为 HTML5 或 MP4,您将需要更改 UIWebView 的用户代理以匹配移动 Safari,以便您的网站知道从 Flash 转换视图(Flash 不会在 iOS 上播放)。 这是如何更改 UIWebView 上的用户代理的答案

Note, I have not tried this approach before.

请注意,我之前没有尝试过这种方法。

回答by Mr. Berna

Apparently the TYPO3 Media Player checks the User-Agent field of the HTTP request, and supplies iOS compatible video when it finds iOS Safari. The UIWebView supplies a different user agent, which the Typo 3 Media Player doesn't recognize, so it supplies content that triggers the dialog popup.

显然,TYPO3 媒体播放器会检查 HTTP 请求的 User-Agent 字段,并在找到 iOS Safari 时提供与 iOS 兼容的视频。UIWebView 提供了一个不同的用户代理,Typo 3 Media Player 无法识别它,因此它提供了触发对话框弹出窗口的内容。

There are two options for fixing this: 1) Work with TYPO3 to fix their media player's customization for user agent functionality to recognize the user agent supplied by UIWebView as needing iOS compatible video. 2) Change the user agent reported by your instance of UIWebView to match what the TYPO3 media player expects. A quick search will find various guides on setting the user agent for a UIWebView available on the Web.

有两个选项可以解决这个问题:1) 与 TYPO3 合作修复他们的媒体播放器对用户代理功能的自定义,以将 UIWebView 提供的用户代理识别为需要 iOS 兼容视频。2) 更改您的 UIWebView 实例报告的用户代理以匹配 TYPO3 媒体播放器的期望。快速搜索将找到有关为 Web 上可用的 UIWebView 设置用户代理的各种指南。