admin管理员组文章数量:1401673
I develop a mobile application with cordova, and I really need to be able to play inline youtube video.
I tried to resolve it for a while:
I set the attribute
playsinline
to1
in the youtube iframe APII put
<preference name="AllowInlineMediaPlayback" value="true"/>
in my config.xmlThen I set
AllowsInlineMediaPlayback
totrue
in the plist in XcodeI even try to put webkit-playsinline directly on the iframe
The results are weird. When I play my video the first time, it goes fullscreen. So I inspect my HTML via the remote developer tools to check if the attribute is well set. It is! I do as I would edit it, I leave it without modification, and the magic happen: my video plays inline!
Obviously, I can't ask my users to do this trick.
Someone have an idea to solve this out?
It's kind of an emergency issue...
I develop a mobile application with cordova, and I really need to be able to play inline youtube video.
I tried to resolve it for a while:
I set the attribute
playsinline
to1
in the youtube iframe APII put
<preference name="AllowInlineMediaPlayback" value="true"/>
in my config.xmlThen I set
AllowsInlineMediaPlayback
totrue
in the plist in XcodeI even try to put webkit-playsinline directly on the iframe
The results are weird. When I play my video the first time, it goes fullscreen. So I inspect my HTML via the remote developer tools to check if the attribute is well set. It is! I do as I would edit it, I leave it without modification, and the magic happen: my video plays inline!
Obviously, I can't ask my users to do this trick.
Someone have an idea to solve this out?
It's kind of an emergency issue...
Share Improve this question asked Oct 16, 2014 at 14:54 ElindorathElindorath 911 silver badge5 bronze badges 1- This worked for me: stackoverflow./questions/34002561/… – Danny Connell Commented Nov 30, 2015 at 23:30
4 Answers
Reset to default 3There are several conf files in the folder cordova, the one that worked in my case with IOS is /Staging/config.xml Try to add to this conf file: preference name = "AllowsInlineMediaPlayback" value = "true"
More specifically you can add this in preference as @Patrice Tadrif mentioned in above answer in Cordova config.xml
<platform name="ios">
<preference name="AllowsInlineMediaPlayback" value="true">
</platform>
The name="AllowsInlineMediaPlayback" is not correct. The actual cordova preference name is "AllowInlineMediaPlayback" (note the missing 's' from 'Allows'). So the config.xml entry should look like this instead: atrice Tadrif mentioned in above answer in Cordova config.xml
<platform name="ios">
<preference name="AllowInlineMediaPlayback" value="true">
</platform>
Also, in the html <video>
tag, don't forget to pass the playsinline
attribute.
This is how I've found about this problem: https://medium./thecreative-cat/allowinlinemediaplayback-is-not-allowsinlinemediaplayback-1a9123fdf88c
For me, it was just a case of using the correct preference name, you were missing the "s" from "Allows". So it should be:
<preference name="AllowsInlineMediaPlayback" value="true">
本文标签: javascriptInline youtube video doesn39t work in cordova application on iOSStack Overflow
版权声明:本文标题:javascript - Inline youtube video doesn't work in cordova application on iOS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744317672a2600342.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论