i'm trying to embed youtube video into my iphone application. I'm using UIWebView and loading embed code from youtube as html string. So i have a layout with basic html markup and i'm placing there this code.
<embed id="yt" src="http://www.youtube.com/watch?v=L9szn1QQfas&fs=0" type="application/x-shockwave-flash" width="%width%" height="%height%"></embed>
The problem is the video always opens in the fullscreen mode. I've changed my webview property allowsInlineMediaPlayback to YES _webview.allowsInlineMediaPlayback = YES;
but it doesn't works too. Is there a way to play videos from youtube without fullscreen?
I'm also tried to embed like this
<iframe title="YouTube video player" id="videoframe" width="%width%" height="%height%" src="http://www.youtube.com/embed/L9szn1QQfas?rel=0" frameborder="0"></iframe>
and this
<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/L9szn1QQfas" width="%width%" height="%height%">
<param name="movie" value="http://www.youtube.com/v/L9szn1QQfas" />
<param name="quality" value="high" />
<param name="allowFullScreen" value="false" />
<embed id="yt" src="http://www.youtube.com/v/L9szn1QQfas" type="application/x-shockwave-flash" width="%width%" height="%height%"></embed>
</object>
Thanks.
Best Answer
As far as I'm aware, inline media playback is only supported on iPad, not iPhone. This would be due to size limitations with the screens.
Edit:
I setup a test project, with a
UIWebView
and the code:I ran the same exact code on both an iPhone and an iPad, both running iOS 4.2.1.
The results were that the iPhone would only play the video in fullscreen mode, regardless of setting the inline media playback to
YES
and the iPad played the video inline. Here's a picture: