Video not playing on android webview
        Posted  
        
            by 
                rand
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by rand
        
        
        
        Published on 2012-10-27T10:19:45Z
        Indexed on 
            2012/10/27
            11:01 UTC
        
        
        Read the original article
        Hit count: 293
        
I am working with an Android and PhoneGap application and am using the HTML5 video tag to play videos on my web page. When I play the video is not visible and video is not playing itself. How can I play a HTML5 video on Android?
Code for the same given below
<!DOCTYPE HTML>
<html>
    <head>
    <script type="text/javascript" charset="utf-8" src="cordova-1.8.1.js"></script>
        <meta http-equiv="content-type" content="text/html; charset=">
        <title></title>
    </head>
    <body >
        <video id="video" autobuffer height="240" width="360" onclick="this.play();>
<source src="test.mp4">
<source src="test.mp4" type="video/webm">
<source src="test.mp4" type="video/ogg">
</video>
        <div id="msg"></div>
<script type="text/javascript">
</script>
    </body>
</html>
and the activity class onCreate method-->>
public void onCreate(Bundle savedInstanceState) {            
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final WebView webView = (WebView) findViewById(R.id.webview);
        WebSettings webSettings = webView.getSettings();
        webSettings.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS); 
        webView.getSettings().setJavaScriptEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        webSettings.setPluginState(PluginState.ON);
        webView.getSettings().setPluginsEnabled(true);
        webSettings.setAllowFileAccess(true);
        webView.loadUrl("file:///android_asset/www/html5videoEvents.html");      
}
© Stack Overflow or respective owner