如何嵌入YouTube视频上使用的PhoneGap的Android [英] How To Embed Youtube Video on Android using Phonegap
问题描述
所以,我一直在尝试嵌入YouTube视频里使用新的YouTube API的iframe我PhoneGap的Android应用程序。
嵌入自己的工作和YouTube的弹出窗口与preVIEW图片和中心播放按钮。
问题是,当我按一下按钮,开始流式视频中嵌入不播放视频 - 只需加载在preVIEW画面,所以没有任何
。
所使用的code是下面是否有帮助。
So I've been trying to embed Youtube videos inside my phonegap Android app using the new youtube iframe API.
The embed itself working and a youtube window pops in with the preview picture and the play button in the centre.
The problem is when I click the button to start streaming the video the embed doesn't play the video - just loads the preview picture in and does nothing.
The code used is below if it helps.
<iframe title="YouTube video player"
class="youtube-player" type="text/html" width="320" height="194"
src="http://www.youtube.com/embed/xxxxxxxx" frameborder="0"></iframe>
我从任何读条,如果使用iphone只是改变phonegap.plist这个
i read from any article that if using iphone just change setting on phonegap.plist this
MediaPlaybackRequiresUserAction: NO
AllowInlineMediaPlayback: YES
OpenAllWhitelistURLsInWebView: YES
ExternalHosts
*.youtube.com
*.ytimg.com
如何在Android的...?
how about in android...?
推荐答案
我有同样的问题。在我的情况(PhoneGap的2.9 +安卓4.2),问题的minSdkVersion在AndroidManifest.xml中。
I had the same problem. In my case (Phonegap 2.9 + Android 4.2) the problem was minSdkVersion in AndroidManifest.xml.
<uses-sdk android:minSdkVersion="14" />
当我试图将它设置低于14就不再显示视频流像你的情况(在preVIEW还是OK)
When I tried to set it lower than '14' it ceased to display video stream like in your case (the preview was still ok)
更新:
..但如果添加了启用硬件加速在AndroidManifest.xml中,一切工作正常甚至较低版本的Android
.. but if you add enable hardware acceleration in AndroidManifest.xml, everything works fine even with lower versions of Android
android:hardwareAccelerated="true"
一切都详细解释了这个<一href="http://stackoverflow.com/questions/5383364/flash-video-not-displaying-in-webview-for-android-3-0-1/5439573#5439573">post
这篇关于如何嵌入YouTube视频上使用的PhoneGap的Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!