ios phonegap/cordova 中的 iframe youtube 视频
Iframe youtube video in phonegap/cordova on ios
我已经阅读了很多关于这个问题的答案,但我还没有找到解决方案。
我正在 android 和 iOS 上测试 混合应用程序 phonegap 和 cordova.
我已经像这样插入了一个 iframe 的 youtube:
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/CODE?feature=player_embedded" frameborder="0" allowfullscreen></iframe>
在 android 上完美运行,但在 iOS 上我只能看到视频的 space 而不是视频。
我添加了白名单插件。
在页面顶部我添加了:
<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'">
并且在 config.xml:
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
我尝试了很多方法,但 none 对我有用。
是phonegap还是cordova的问题?如果我创建一个 ipa,问题是否解决了?难道我做错了什么?还是我忘记了什么?
非常感谢
尝试
<allow-navigation href="*" />
在config.xml
最后我找到了解决办法,希望对你有帮助。
在 config.xml 我在代码
中添加了字符串 <allow-navigation href="https://www.youtube.com/embed/*"/>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
所以最后的结果是:
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<allow-navigation href="https://www.youtube.com/embed/*"/>
</platform>
我已经阅读了很多关于这个问题的答案,但我还没有找到解决方案。
我正在 android 和 iOS 上测试 混合应用程序 phonegap 和 cordova.
我已经像这样插入了一个 iframe 的 youtube:
<iframe width="100%" height="100%" src="https://www.youtube.com/embed/CODE?feature=player_embedded" frameborder="0" allowfullscreen></iframe>
在 android 上完美运行,但在 iOS 上我只能看到视频的 space 而不是视频。
我添加了白名单插件。
在页面顶部我添加了:
<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'">
并且在 config.xml:
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
我尝试了很多方法,但 none 对我有用。
是phonegap还是cordova的问题?如果我创建一个 ipa,问题是否解决了?难道我做错了什么?还是我忘记了什么?
非常感谢
尝试
<allow-navigation href="*" />
在config.xml
最后我找到了解决办法,希望对你有帮助。
在 config.xml 我在代码
<allow-navigation href="https://www.youtube.com/embed/*"/>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
所以最后的结果是:
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<allow-navigation href="https://www.youtube.com/embed/*"/>
</platform>