最近没有在UIWebView上播放iframe播放器的youtube剪辑 [英] Recently not playing youtube clip with iframe player on UIWebView

查看:98
本文介绍了最近没有在UIWebView上播放iframe播放器的youtube剪辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iOS应用程序使用UIWebView上的youtube iframe播放器以内联模式播放任何剪辑。以下代码是使用的HTML代码。

My iOS application uses youtube iframe player on UIWebView to play any clip with inline mode. The following code is HTML code used.

<html>
<head>
     <style type="text/css">body {background-color: transparent;color: white;}</style>
</head>
 <body style="margin:0">
<iframe src="http://www.youtube.com/embed/e2w8z6mI47U?playsinline=1&rel=0&showinfo=0" width="320" height="240" frameborder="0" allowfullscreen></iframe>
</body>
 </html>

然后,它传递给 loadHTMLString 方法。

该代码在最近的日期之前运作良好。但是,我最近注意到我使用的每个剪辑都没有正常播放。显示待机视图和播放按钮,但是,虽然我按了播放按钮,但播放效果不佳。黑屏只显示。

That code had worked well until a recent date. But, I recently noticed that every clips I used aren't played normally. the standby view and play button is shown but, although I pushed the play button, it didn't play well. black screen was only shown.

我还没有找到解决问题的方法。是否有Youtube Iframe播放器的任何更改或我错过的点数?

I haven't found anything to solve the problem. Are there any changes of Youtube Iframe player or points I missed?

推荐答案

我最后通过调用<$ c $来解决问题c> [videoView setMediaPlaybackRequiresUserAction:NO] 。

我不知道为什么这个方法可以救我。猜测,有一个变化涉及在youtube上播放的请求。我可以在youtube开发者网站上找到以下更改。

I ended up solving the problem by calling [videoView setMediaPlaybackRequiresUserAction:NO].
I don't exactly know why the method could save me. At a guess, there was a change dealing with the request for playing at youtube. I could find the following changes on youtube developer site.


2014年1月28日

playinline参数控制视频是否在iOS上的HTML5播放器中以内联方式播放或全屏显示
。将值设置为1会导致
内联播放。

The playsinline parameter controls whether videos play inline or fullscreen in an HTML5 player on iOS. Setting the value to 1 causes inline playback.

选择要播放的内容部分已更新,以说明如何查找
以查找YouTube视频ID和播放列表ID使用YouTube数据API
(v3)而不是较旧的API版本。

The Selecting content to play section has been updated to explain how to find YouTube video IDs and playlist IDs using the YouTube Data API (v3) rather than the older API version.

控件参数的定义已更新,以反映
事实上,参数值仅影响Flash
播放器在IFrame嵌入中实际加载的时间。此外,对于IFrame
嵌入,参数值还确定控件何时在播放器中显示
。如果您将参数的值设置为2,那么
控制显示,并且在用户启动
视频播放后加载Flash播放器。

The controls parameter's definition has been updated to reflect the fact that the parameter value only affects the time that the Flash player actually loads in IFrame embeds. In addition, for IFrame embeds, the parameter value also determines when the controls display in the player. If you set the parameter's value to 2, then the controls display and the Flash player loads after the user initiates the video playback.

我猜上述其中一项更改可能需要额外的信息,这些信息会从客户端传递到youtube服务器以便正常播放。

I guess that one of above changes may need extra informations which are passed from a client to youtube server for playing normally.

更新:

今天,我发现没有我的解决方案,它运作良好。似乎这个问题最近得到解决。

UPDATE:
Today, I identified that it works well without my solution. It seems that the problem was fixed lately.

这篇关于最近没有在UIWebView上播放iframe播放器的youtube剪辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆