Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recently not playing youtube clip with iframe player on UIWebView

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>

Then, it is passed to loadHTMLString method.

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?

like image 414
Kyokook Hwang Avatar asked Feb 28 '14 08:02

Kyokook Hwang


1 Answers

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.

January 28, 2014

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

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.

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.

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.

like image 157
Kyokook Hwang Avatar answered Sep 28 '22 07:09

Kyokook Hwang