我到处都在寻找如何做的方法,但是还没有找到答案. 是否可以在iPhone内联的UIWebView中播放youtube视频,即不能全屏播放? 我知道iPhone不支持Flash,但是youtube支持html5并具有h.264视频吗?那我不应该能够做到这一点吗?
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?
我已将allowInlineMediaPlayback设置为YES,但仍可以全屏播放.
I have set allowsInlineMediaPlayback to YES, but still it plays fullscreen.
推荐答案是的,您需要在UIWebView上设置属性
Yes you can, you need to set property on UIWebView
webView.allowsInlineMediaPlayback=YES;您需要在YouTube iframe嵌入代码中添加& playsinline = 1.
And you need to add &playsinline=1 to YouTube iframe embedding code.
<iframe webkit-playsinline width="200" height="200" src="www.youtube/embed/GOiIxqcbzyM?feature=player_detailpage&playsinline=1" frameborder="0"></iframe>在运行iOS 6.1.2的iPhone 4S上进行测试的过程就像一种魅力.
Tested on iPhone 4S running iOS 6.1.2 works like a charm.
更多推荐
我可以在UIWebView内联(非全屏)中播放youtube视频吗?
发布评论