【问题标题】:Iframe video on Android Hybrid App with Phonegap带有 Phonegap 的 Android Hybrid App 上的 iframe 视频
【发布时间】:2014-10-03 18:46:10
【问题描述】:

我在我的 index.html 文件中嵌入了一个 youtube 视频。

<iframe id="video" width="640" height="360" src="//www.youtube.com/embed/xxxxxxxxx?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
  • 我通过 cmd 使用 Cordova Phonegap 创建了应用程序,如下所示:

     cordova create hello com.example.hello HelloWorld
    
  • 替换了我在app文件夹中的html、css、js文件。

  • 新增安卓平台:

     cordova platform add android
    
  • 打开 Eclipse,导入应用并运行。

  • 我将 .apk 放在平板电脑上,一切正常,但视频无法播放。

    我收到错误“网页不可用”而不是视频。

我该如何解决这个问题?

【问题讨论】:

    标签: android cordova iframe video


    【解决方案1】:

    您可能应该将 youtube 列入白名单。

    http://cordova.apache.org/docs/en/3.6.0/guide_appdev_whitelist_index.md.html

    <access origin="http://*.youtube.com" />
    

    【讨论】:

      【解决方案2】:

      解决了。

      我只是在 src 属性的链接中添加了 http:

      <iframe id="video" width="640" height="360" src="HTTP://www.youtube.com/embed/xxxxxxxxx?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-02-08
        • 1970-01-01
        • 2012-06-22
        • 1970-01-01
        • 2016-03-06
        • 1970-01-01
        • 2013-01-26
        • 2018-08-24
        相关资源
        最近更新 更多