【问题标题】:Phonegap, Youtube, and FancyboxPhonegap、Youtube 和 Fancybox
【发布时间】:2012-02-15 21:48:16
【问题描述】:

好的,我正在尝试使用 phonegap 制作本机应用程序。我很快发现,为了加载外部数据,如:“youtube”视频......你必须将它添加到 phonegap.plist 中的“ExternalHosts”......我已经完成了。 (所以这不是问题)。

问题是当我点击视频链接时,它会打开fancybox,然后自动打开Safari,而不是在fancybox Iframe 中加载视频???

这是一些代码,因为我知道每个人都想要它:

<ul>
<li ><a href="http://youtube.com/watch?v=x3PD49AlMlc&feature=channel_video_title" class="iframe">Video Link</a></li>
</ul>

//Fancybox calls
$(".iframe").bind('tap', function(e) {
e.preventDefault();
$.fancybox({
        'padding'       : 0,
        'autoScale'     : false,
        'transitionIn'  : 'none',
        'transitionOut' : 'none',
        'width'         : 680,
        'height'        : 495,
        'href'          : this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
        'type'          : 'iframe'
    });

});

以前有没有人尝试过这样做?这是为 iPad 设计的……我最终也会为 Android 平板电脑创建它。

感谢您的帮助!

【问题讨论】:

    标签: jquery cordova youtube fancybox


    【解决方案1】:

    好吧,在您的PhoneGap.plist 中将属性OpenAllWhitelistURLsInWebView 设置为YES。这将在 PhoneGap 应用程序本身内显示和播放视频。

    此外,您应该首先使用 iframe 代码嵌入视频。这是我们用来显示视频的。请参阅官方博客条目和http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.htmlhttps://developers.google.com/youtube/player_parameters 了解更多信息。

    【讨论】:

      猜你喜欢
      • 2017-06-22
      • 1970-01-01
      • 2023-03-09
      • 2013-01-30
      • 2013-04-04
      • 2016-08-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多