1

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

我在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();
            });

第一次警报的图像

第二次警报的图像

4

1 回答 1

1

尝试这个..

<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>
于 2013-09-25T06:02:51.050 回答