Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline youtube video doesn't work in cordova application on iOS

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 to 1 in the youtube iframe API

  • I put <preference name="AllowInlineMediaPlayback" value="true"/> in my config.xml

  • Then I set AllowsInlineMediaPlayback to true in the plist in Xcode

  • I 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...

like image 219
Elindorath Avatar asked Sep 29 '22 14:09

Elindorath


2 Answers

There 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"

like image 59
Patrice Tardif Avatar answered Oct 02 '22 15:10

Patrice Tardif


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>
like image 43
Richen Yadav Avatar answered Oct 02 '22 16:10

Richen Yadav