Iframe youtube video in phonegap/cordova on ios

800 views Asked by At

I have read a lot of answers about this problem but I haven't found a solution.
I'm testing an hybrid app on android and iOS with phonegap and cordova.
I have insert an iframe of youtube like this:

<iframe width="100%" height="100%" src="https://www.youtube.com/embed/CODE?feature=player_embedded" frameborder="0" allowfullscreen></iframe>

On android works perfectly but on iOS I see only the space of video and not the video.
I have add the white list plugin.
In the top of the page I have add:

<meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *; img-src * data:'unsafe-inline'">

and in the config.xml:

<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />

I have tried a lot of things but none works for me.
Is it a problem of phonegap or cordova? If I create an ipa, is the problem resolved? Am I doing something wrong? Or am I forgetting something? Thank you so much

2

There are 2 answers

0
Giu On BEST ANSWER

At the end I found the solution and I hope it can help.
In the config.xml I added the string <allow-navigation href="https://www.youtube.com/embed/*"/> inside the code

<platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
</platform>

So the final result is:

<platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <allow-navigation href="https://www.youtube.com/embed/*"/>
</platform>
0
cgomez On

try

<allow-navigation href="*" />

in config.xml