我可以在UIWebView内联(非全屏)中播放youtube视频吗?

编程入门 行业动态 更新时间:2024-10-24 20:18:25
本文介绍了我可以在UIWebView内联(非全屏)中播放youtube视频吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我到处都在寻找如何做的方法,但是还没有找到答案. 是否可以在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视频吗?

本文发布于:2023-07-11 12:23:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1094049.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内联   全屏   视频   UIWebView   youtube

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!