iPhone 上的 YouTube 视频 PhoneGap 应用程序
很抱歉再次回到这个话题,但我真的很沮丧!我阅读了我找到的所有资源,在网上搜索,但我无法对我的问题提出明确的答案。
问题描述
我正在使用phonegap 1.0 创建一个iphone 应用程序。在此应用程序中,一个选项卡专门用于来自我的 YouTube 频道的 RSS 提要,我希望我的用户能够在单击特定条目后播放这些视频。 问: 有可能吗?最好的解决方案是在应用程序内播放视频,但显示缩略图并将用户重定向到本机 youtube 应用程序也是可以接受的(即使在这种情况下,我希望当 youtube 完成播放视频时将控件返回到原始应用程序) )。
尝试过的解决方案
在网上搜索我找到了几种解决方案,人们说这些解决方案对他们有用,但没有一个对我有用!
使用“object”标签,我最终会看到白屏
<对象 id="video" width="296" height="100%" data="http://www.youtube.com/v/gDjb9RVMF4c" type="application/x-shockwave -闪光”> <参数名称=“allowfullscreen”值=“true”/>
使用“embed”标签,我最终得到一个白屏
我也尝试了“视频”标签,但据我了解,这仍然是不可能的。
>
如果我错过了已经写在某处的解决方案,我真的很抱歉,但是相信我......我在提问之前做了功课:-) 谢谢!!
I'm sorry to come back to this topic again, but i'm really frustrated!! I've read every resource i've found, googling around the web, but i couldn't come up with a definitive answer to my problem.
Problem description
I'm creating an iphone app with phonegap 1.0. In this app, one tab is dedicated to a rss feed from my youtube channel and i want my users to be able to play these videos, after clicking on a specific entry.
Question: is it possible? best solution would be to play the video inside the app, but displaying a thumbnail image and redirecting the user to native youtube app is also acceptable (even though in this case i want the control back to the original app when youtube finishes to play the video).
Tried solutions
Searching on the web I found several solutions and people say that these solutions work for them, but none of them work for me!
use an "object" tag, i end up with a white screen
<object id="video" width="296" height="100%" data="http://www.youtube.com/v/gDjb9RVMF4c" type="application/x-shockwave-flash"> <param name="allowfullscreen" value="true" /> <param name="src" value="http://www.youtube.com/v/gDjb9RVMF4c" /> </object>
using an "embed" tag, i end up with a white screen
<embed src="http://www.youtube.com/v/gDjb9RVMF4c" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="280" height="100%"></embed>
i also tried a "video" tag, but as far as i understood, this is still not possible.
I'm really sorry if i missed a solution already written somewhere, but trust me ... i did my homework before askying :-)
Thx!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是一个很好的教程,拯救了我的一天
http://eisabainyo.net/weblog/2012/01/24/embed-a-youtube-video-iframe-in-phonegap-app/
另外我发布了一些代码以供快速访问。
然后在 Phonegap.plist 中进行以下更改,
视频也将在您的模拟器上播放。
Here is a nice tutorial Which Saved my Day
http://eisabainyo.net/weblog/2012/01/24/embed-a-youtube-video-iframe-in-phonegap-app/
Also i m posting some codes For a quick Access.
Then make the following changes in Phonegap.plist
Video will play on your Simulator Also.
除了使用
您还需要在
PhoneGap.plist
中将属性OpenAllWhitelistURLsInWebView
设置为YES
。这将在 PhoneGap 应用程序本身内显示和播放视频。它是经过尝试和测试的。Apart from using
<iframe> ... </iframe>
you also need to set the propertyOpenAllWhitelistURLsInWebView
toYES
in yourPhoneGap.plist
. This would show and play the video inside the PhoneGap application itself. It is tried and tested.您可以尝试将 YouTube 视频嵌入为 iframe,我相信这是现在推荐的方法:
http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html
You could try embedding the YouTube video as an iframe, I believe that is the recommended way to do it now:
http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html
这是我最终在我的应用程序中使用的组件 。借助 YouTube iFrame API 完成。
Here is a component I've end up using in my app. Done with a help of YouTube iFrame API.