javascript - html5 视频标签无法使用 cordova 2.9.0 和 jquery1.9.0 在 phonegap android 中播放 .mp4 视频?

标签 javascript android jquery jquery-mobile cordova

我正在尝试播放已添加到我的项目路径中的本地视频文件:ASSETS/WWW/VIDEOS/xyz.mp4 现在使用标签但收到警报: errror on playing video

我在 HTML 中添加了代码:

<!DOCTYPE html>
   <html>
    <head>
    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <body>
    <div data-role="page" data-theme="a" class="my-page" id="video">
                <video id="video_player" src="#" controls="controls"></video>
           </div>
    </body>
</html>
**in js:**


 $(document).on('pagebeforeshow',"#video", function () {
            xyz = document.getElementById('video_player');
            alert("values xyz:" + xyz);
            xyz.src = data[curYear].video.url;
           alert("xyz after src:" +  xyz.src);
            xyz.play();
            });

image of 1st alert

 image of 2nd alert

最佳答案

试试这个..

<video class="video" poster="/assets/video/posters/example.jpg" controls width="768" height="432" preload="none">
    <source src="/assets/video/example.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
    <source src="/assets/video/example.ogv" type='video/ogg; codecs="theora, vorbis"' />
</video>

关于javascript - html5 视频标签无法使用 cordova 2.9.0 和 jquery1.9.0 在 phonegap android 中播放 .mp4 视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18997200/

相关文章:

javascript - 如何根据选择输入使用javascript更改页面内容?

java - 将外部库导入到 eclipse - Android

C# MVC 通过 JQuery AJAX 发送对象

javascript - 在博客文章中显示代码

javascript - Django的简单文件浏览器

java - 在 Android 上使用 Google App Engine 的先决条件是什么?

java - 如何在 Android 中制作一个点击后结束的介绍屏幕?

javascript - 左边框颜色在 javascript 中不起作用

javascript - 触发器上的故障/跳跃/崩溃 SmoothScroll+ScrollMagic+GSAP

javascript - 如何防止表单提交时刷新时重新提交表单