最近没有在UIWebView上播放iframe播放器的youtube剪辑

时间:2022-03-17 18:57:39

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

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

<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>

Then, it is passed to loadHTMLString method.

然后,它传递给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.

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

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

我还没有找到解决问题的方法。是否有Youtube Iframe球员的任何变化或我错过的分数?

1 个解决方案

#1


7  

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.

我最后通过调用[videoView setMediaPlaybackRequiresUserAction:NO]来解决问题。我不知道为什么这个方法可以救我。猜测,有一个变化涉及在youtube上播放的请求。我可以在youtube开发者网站上找到以下更改。

January 28, 2014

2014年1月28日

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

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

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.

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

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.

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

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

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

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

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

#1


7  

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.

我最后通过调用[videoView setMediaPlaybackRequiresUserAction:NO]来解决问题。我不知道为什么这个方法可以救我。猜测,有一个变化涉及在youtube上播放的请求。我可以在youtube开发者网站上找到以下更改。

January 28, 2014

2014年1月28日

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

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

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.

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

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.

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

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

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

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

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