I have looked everywhere on how to do this and haven't found an answer yet. Is it possible to play a youtube video in a UIWebView on an iPhone inline, i.e. not fullscreen? I know that the iPhone doesn't support flash, but youtube supports html5 and has h.264 videos doesn't it? shouldn't I be able to do this then?
I have set allowsInlineMediaPlayback to YES, but still it plays fullscreen.
Yes you can, you need to set property on UIWebView
webView.allowsInlineMediaPlayback=YES;
And you need to add &playsinline=1 to YouTube iframe embedding code.
<iframe webkit-playsinline width="200" height="200" src="https://www.youtube.com/embed/GOiIxqcbzyM?feature=player_detailpage&playsinline=1" frameborder="0"></iframe>
Tested on iPhone 4S running iOS 6.1.2 works like a charm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With