【问题标题】:Video is not playing in intel xdk视频无法在英特尔 xdk 中播放
【发布时间】:2016-05-06 16:36:52
【问题描述】:

我正在通过使用 intel xdk 和 jquery mobile 为 UI 开发混合应用程序,我试图在我的 intel xdk 项目中播放视频但它没有播放,我指的是这个示例 http://qnimate.com/playing-videos-in-intel-xdk-app/ 如果我点击播放按钮什么都不会即使我在我的项目中添加了播放器插件也会发生

我正在使用此代码

<!DOCTYPE html>
<html>
<head>
    <title>Video Player</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <style>
        @-ms-viewport { width: 100vw ; zoom: 100% ; }                          
        @viewport { width: 100vw ; zoom: 100% ; }
        @-ms-viewport { user-zoom: fixed ; }                                    
        @viewport { user-zoom: fixed ; }
    </style>

    <script src="lib/ft/fastclick.js"></script>
    <link rel="stylesheet" href="css/app.css">
</head>
<body>

    <button onclick="playVideo();">Play Video</button>

    <script src="intelxdk.js"></script>        
    <script src="cordova.js"></script>          
    <script src="xhr.js"></script>              

    <script src="js/app.js"></script>
    <script src="js/init-app.js"></script>
    <script src="js/init-dev.js"></script>

    <script>
        function playVideo()
        {
            //this function launches default video player and plays the video.mp4 file.
            intel.xdk.player.playPodcast("http://labs.qnimate.com/video.mp4");
        }

        document.addEventListener("intel.xdk.player.podcast.start", function(){
            //started playing video
            alert("start");

        }, false);

        document.addEventListener("intel.xdk.player.podcast.stop", function(){
            //video finished or player closed
            alert("stop");
        }, false);

        document.addEventListener("intel.xdk.player.podcast.error", function(){
            //error occured therefore video cannot be played
            alert("error");
        }, false);

        document.addEventListener("intel.xdk.player.podcast.busy", function(){
            //another video is already being played
            alert("busy");
        }, false);    
    </script>
</body>
</html>  

你能帮我解决什么问题吗?

【问题讨论】:

  • 您是否在项目中包含必要的插件?
  • @xmnboy 我在我的项目中添加了播放器插件,我们还需要包含什么?
  • 我做了一个调试跟踪,它似乎正在进入插件并调用正确的东西,但我无法快速调试本机代码。我的猜测是插件可能有问题。我请负责的工程师看看。

标签: javascript intel-xdk


【解决方案1】:

playPodcast() 函数仅在遗留容器中受支持,该容器将被淘汰。这些 API 的 Cordova 版本不包含该方法,因此它实际上不再可用。

【讨论】:

  • 那么cordova版怎么播放视频呢?
  • 搜索“play video cordova phonegap”以获得各种选项,包括&lt;video&gt; 标签和几个视频播放器插件。如果您选择使用&lt;video&gt; 标签,我强烈建议您使用Crosswalk 并使用Debug 选项卡进行测试,因为它使用Crosswalk。使用原生 Android webview 将无法正常工作。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多