Html “webkit-playsinline”视频标签属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17090906/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"webkit-playsinline" video tag attribute
提问by tim peterson
The <video>
tag attribute webkit-playsinline
supposedly prevents the default go to fullscreen behavior of HTML5 videos.
该<video>
标签属性webkit-playsinline
理应阻止默认进入的HTML5视频全屏行为。
I added this attribute to my video tag and checked mobile safari and chrome on iOS6 iPhone and it doesn't work. The video still goes fullscreen. This is similar to others' experiences as described on SO two years ago.
我将此属性添加到我的视频标签并检查了 iOS6 iPhone 上的移动 Safari 和 chrome,但它不起作用。视频仍然全屏显示。这与两年前在 SO 上描述的其他人的经历相似。
What mobile browsers as of today, June 13th, 2013 does this attribute webkit-playsinline
work?
截至今天,即 2013 年 6 月 13 日,哪些移动浏览器可以使用此属性webkit-playsinline
?
回答by fregante
Apple has finally enabled the playsinline
attribute on iOS 10, so this will work:
Apple 终于playsinline
在 iOS 10 上启用了该属性,所以这将起作用:
<video src="file.mp4" playsinline>
I wrote a polyfill called iphone-inline-videothat adds the same behavior to iOS 8 and 9.
我写了一个名为iphone-inline-video的 polyfill ,它为 iOS 8 和 9 添加了相同的行为。
回答by blacktooth
The webkit-playsinline
attribute works for HTML5 video on iOS4+ but only when you save the webpage to your home screen as a webapp. If you are using mobile Safari it will always open fullscreen.
该webkit-playsinline
属性适用于 iOS4+ 上的 HTML5 视频,但仅当您将网页作为 web 应用程序保存到主屏幕时才有效。如果您使用的是移动版 Safari,它将始终全屏打开。
Theres a small blurb about its support here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
这里有一个关于它的支持的小简介:http: //developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html
I've also seen on recent versions of Android that inline video playback does work within its native browser.
我还在最新版本的 Android 上看到,内联视频播放确实可以在其本机浏览器中运行。
回答by moloko
Looks like this might finally get implemented properly in iOS 10
回答by Shanaka Nuwan
This worked for me. I tried to use playsinline
inside of video tag. But it didn't work so I tried to set attribute from jQuery
这对我有用。我试图playsinline
在视频标签内使用。但它没有用,所以我尝试从jQuery
$('#you video tag id').attr('playsinline','');