如何播放视频使用html5视频播放器在Android phonegap? [英] how to play video using html5 videoplayer in android phonegap?

查看:119
本文介绍了如何播放视频使用html5视频播放器在Android phonegap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在android phonegap创建应用程序。我想使用html5视频播放器播放视频。
我的代码是:

 <!DOCTYPE html& 
< html>
< head>
< title> Video.js | HTML5视频播放器< / title>
< link href =http://vjs.zencdn.net/c/video-js.css =stylesheettype =text / css>
< script src =http://vjs.zencdn.net/c/video.js>< / script>
< / head>
< body>
< video id =example_video_1class =video-js vjs-default-skincontrols preload =nonewidth =640height =264poster =http:// video-js .zencoder.com / oceans-clip.pngdata-setup ={}>
< source src =http://video-js.zencoder.com/oceans-clip.mp4type ='video / mp4'/>
< source src =http://video-js.zencoder.com/oceans-clip.webmtype ='video / webm'/>
< source src =http://video-js.zencoder.com/oceans-clip.ogvtype ='video / ogg'/>
< / video>
< / body>
< / html>

此代码显示视频播放器。。点击播放按钮时视频没有播放。 p>

请引导我。
。提前感谢。

解决方案

Android在播放视频时遇到问题,通常只能通过添加



例如:

  function play(){
var video = document.getElementById('video');
video.addEventListener('click',function(){
video.play();
},false);
}

你可能需要调整这个代码, p>

I have created application in android phonegap.I want to play video using html5 video player. My code is:

<!DOCTYPE html>
    <html>
        <head>
          <title>Video.js | HTML5 Video Player</title>
          <link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet" type="text/css">
          <script src="http://vjs.zencdn.net/c/video.js"></script>
        </head>
        <body>
          <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="http://video-js.zencoder.com/oceans-clip.png" data-setup="{}">
            <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4' />
            <source src="http://video-js.zencoder.com/oceans-clip.webm" type='video/webm' />
            <source src="http://video-js.zencoder.com/oceans-clip.ogv" type='video/ogg' />
          </video>
        </body>
    </html> 

This code show the videoplayer .but video is not playing while clicking play button.what's wrong?

please guide me. thanks in advance.

解决方案

Android has issues with playing video and can often only be triggered via JavaScript by adding a click event handler to the video element and playing the video once that is activated.

For example:

function play() {
   var video = document.getElementById('video');
   video.addEventListener('click',function(){
      video.play();
   },false);
}

You will probably need to adapt this code to work with yours though.

这篇关于如何播放视频使用html5视频播放器在Android phonegap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆