youtube视频iphone iphonegap应用程序 [英] youtube videos on iphone phonegap app
问题描述
很抱歉再次回到这个主题,但我真的很失望!我已经阅读了我找到的每一个资源,在网上搜索,但我无法得出一个确定的答案我的问题。
问题描述
我正在使用phonegap 1.0创建一个iphone应用程序。在这个应用程序,一个选项卡专用于我的YouTube频道的RSS提要,我希望我的用户能够播放这些视频后,点击一个特定的条目。
问题:是可能吗?最好的解决方案是在应用程序中播放视频,但显示缩略图和重定向用户到本机YouTube应用程序也是可以接受的(即使在这种情况下,我想控制回原来的应用程序,当YouTube完成播放视频)。
尝试的解决方案
在网上搜索我发现了几个解决方案,人们说这些解决方案适合他们
-
使用对象标签,我最终以白色屏幕
p>
< object id =videowidth =296height =100%data =http: youtube.com/v/gDjb9RVMF4ctype =application / x-shockwave-flash>
< param name =allowfullscreenvalue =true/>
< param name =srcvalue =http://www.youtube.com/v/gDjb9RVMF4c/>
< / object>
-
< embed src =http://www.youtube.com/v/gDjb9RVMF4ctype =application / x-shockwave-flash allowscriptaccess =alwaysallowfullscreen =truewidth =280height =100%>< / embed>
-
我也试过了一个视频标签,但据我所知,仍然不可能。
如果我错过了某处已写的解决方案,在我问我之前做过我的家庭作业:-)
Thx !!
日
http://eisabainyo.net/weblog/2012/01/24/embed-a-youtube-video-iframe-in-phonegap-app/
也可以发布一些代码快速访问。
< html&
< head>
< title> YouTube视频< / title>
< meta name =viewportcontent =width = device-width; initial-scale = 1.0; maximum-scale = 1.0; user-scalable = 0; />
< meta name =apple-mobile-web-app-capablecontent =yes/>
< meta name =apple-mobile-web-app-status-bar-stylecontent =black/>
< script src =phonegap-1.2.0.js>< / script>
< / head>
< body>
< iframe width =560height =315src =http://www.youtube.com/embed/9HDeEbJyNK8frameborder =0allowfullscreen>< / iframe>
< / body>
< / html>
然后在Phonegap.plist中进行以下更改
MediaPlaybackRequiresUserAction:NO
AllowInlineMediaPlayback:YES
OpenAllWhitelistURLsInWebView:YES
ExternalHosts
* .youtube.com
* .ytimg .com
视频将在您的模拟器上播放。
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!!
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.
<html>
<head>
<title>YouTube video</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<script src="phonegap-1.2.0.js"></script>
</head>
<body>
<iframe width="560" height="315" src="http://www.youtube.com/embed/9HDeEbJyNK8" frameborder="0" allowfullscreen></iframe>
</body>
</html>
Then make the following changes in Phonegap.plist
MediaPlaybackRequiresUserAction: NO
AllowInlineMediaPlayback: YES
OpenAllWhitelistURLsInWebView: YES
ExternalHosts
*.youtube.com
*.ytimg.com
Video will play on your Simulator Also.
这篇关于youtube视频iphone iphonegap应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!