在IOS设备上内联显示YouTube视频 [英] Display youtube video inline on IOS devices

查看:105
本文介绍了在IOS设备上内联显示YouTube视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用YouTube iframe api'playsinline'参数,但尝试使用youtube Iframe api'playsinline'参数,但尝试构建一个小型网络应用程序,该应用程序需要在某些文本后面播放YouTube视频。 它不会工作,并在全屏IPHONE上显示视频。



有什么建议?



p>




UPDATE



由于IOS 10出来了html5视频标签内联属性在Safari上支持,YouTube视频可以内嵌播放,
,因此@David Anderton的答案被标记为正确。

https://developer.apple .com / library / content / releasenotes / General / WhatsNewInSafari / Articles / Safari_10_0.html#// apple_ref / doc / uid / TP40014305-CH11-DontLinkElementID_12

希望它有帮助

解决案

添加 playsinline = 1 paramerer到嵌入URL。根据需要添加& ; 如果唯一的参数,& 与其他params连接。



示例:

 < iframe 
src =https://www.youtube.com / v / VIDEO_ID playsinline = 1\" >?;
< / iframe>

来自 YouTube iFrame Player API b
$ b


此参数控制视频在HTML5播放器上以内联或全屏播放iOS版。有效值为:
0:此值导致全屏播放。这是目前的默认值,但默认值可能会更改。
1:此值会导致使用allowInlineMediaPlayback属性设置为TRUE创建的UIWebView的内联回放。



I am trying to build a small web app which requires playing a youtube video behind some text.

I tried using the youtube Iframe api 'playsinline' parameter, but it won't work and display videos in fullscreen on IPhones.

Any suggestions?

Thanks.


UPDATE

Since IOS 10 came out html5 video tag inline attribute is supported on safari and youtube videos can be played inline, and thus @David Anderton answer is marked correct.

https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_10_0.html#//apple_ref/doc/uid/TP40014305-CH11-DontLinkElementID_12

Hope it helps

解决方案

Add playsinline=1 paramerer to the embed url. Add ? or & before as appropriate; ? if the only paramerter, & to concatenate with other params.

Example:

<iframe
  src="https://www.youtube.com/v/VIDEO_ID?playsinline=1">
</iframe>

From YouTube iFrame Player API:

This parameter controls whether videos play inline or fullscreen in an HTML5 player on iOS. Valid values are: 0: This value causes fullscreen playback. This is currently the default value, though the default is subject to change. 1: This value causes inline playback for UIWebViews created with the allowsInlineMediaPlayback property set to TRUE.

这篇关于在IOS设备上内联显示YouTube视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆