New YouTube iframe code not displaying video on iPhone

We have added a new YouTube iframe code to our news site. The problem is that the video is not displayed on the iPhone.

Here is my page and code:

<iframe width="620" height="390" src="http://www.youtube.com/v/A2V1WTF8tp4?hl=en&fs=1&autoplay=0&hd=1" frameborder="0" allowfullscreen="true"></iframe>

How can I get a YouTube video on an iPhone?

+3
source share
4 answers

Maybe the video url might be a problem. The integrated video code is as follows

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
</iframe>

Note that the URL uses embed instead of v.

+6
source

Perhaps the problem is that YouTube is based on Flash, so the implementation of iframe will not work on an iPhone that does not support Flash. Try something like this:

<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/A2V1WTF8tp4?hl=en&fs=1&autoplay=0&hd=1" width="620" height="3900">
<param name="movie" value="http://www.youtube.com/v/A2V1WTF8tp4" />
<param name="quality" value="high" />
<param name="allowFullScreen" value="true" />
<!-- Fallback content -->
<a href="http://www.youtube.com/watch?v=A2V1WTF8tp4">
<img src="http://img.youtube.com/vi/A2V1WTF8tp4/0.jpg" width="620" height="390" alt="Staff Gathers for Multicultural Springfest" />
</a>
</object>

: http://learningtheworld.eu/2009/youtube-embed/

+2

UIWebView , :

( init:)

NSString* url = [NSString stringWithFormat: @"http://www.youtube.com/embed/A2V1WTF8tp4"];

CGRect theFrame = CGRectMake(0, 0, 400, 300);

NSString* embedHTML = [NSString stringWithFormat: @"<iframe width=%i height=%i src=%@ frameborder=10 allowfullscreen></iframe>", theFrame.size.width, theFrame.size.height, url];

[self loadHTMLString: embedHTML baseURL: nil]; // this method is part of UIWebView.

Just make sure your “watch video” is added as a peep at what belongs to it.

0
source

putting this in config.xml worked for me:  <allow-navigation href="*://*youtube.com" />

0
source

All Articles