2015-10-08 2 views

Répondre

0

Utilisez WebChromeClient(), ceci est un exemple de base:

WebView videoView = (WebView)findViewById(R.id.webView); 
    videoView.getSettings().setJavaScriptEnabled(true); //Enable Js execution! 
    videoView.setWebChromeClient(new WebChromeClient()); 
    videoView.loadUrl("http://www.jorgesys.com/myVideoDemo.html"); 

code html de myVideoDemo.html:

<html> 
    <head> 
     <meta content="width=device-width; height=device-height;" name="viewport"> 
     <title>Jorgesys Video Demo</title> 
     <link href="resource://gre/res/TopLevelVideoDocument.css" rel="stylesheet"> 
     <link href="chrome://global/skin/media/TopLevelVideoDocument.css" rel="stylesheet"> 
    </head> 
    <body> 
     <video id="video" autobuffer controls="controls" autoplay="true" width="300" height="250"> 
      <source src="http://broken-links.com/tests/media/BigBuck.m4v"> 

     </video> 
    </body>  
    <script> 
      var video = document.getElementById('video'); 
      video.addEventListener('click',function(){ 
       video.play(); 
       },false); 
    </script> 
</html>