title: Showing html5 Video on Android Webview. Video getting black while playing
body: <p>Showing Video on Android Webview. Video getting black while playing and sound occurred but video screen getting black. I am working on android 15+ versions. what is needed to play this?..some device will be working fine..</p>
  
  <p>Xml Code:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.example.gowsample.MainActivity" &gt;
  &lt;WebView
      android:id="@+id/webView1"
     android:layout_width="match_parent"
       android:layout_height="wrap_content"
  
     /&gt;
  
  &lt;TextView
      android:id="@+id/sam"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignLeft="@+id/webView1"
      android:layout_below="@+id/webView1"
      android:layout_marginTop="36dp"
      android:text="@string/hello_world" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainActivity Code:</p>
  
  <pre><code>package com.example.gowsample;
  import android.annotation.SuppressLint;
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.webkit.WebView;
  
  
  public class MainActivity extends Activity {
   private WebView mWebview ;
  
  @SuppressLint({ "NewApi", "SetJavaScriptEnabled" }) @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      mWebview  = (WebView)findViewById(R.id.webView1);
      mWebview.getSettings().setMediaPlaybackRequiresUserGesture(false);
      mWebview.getSettings().setJavaScriptEnabled(true);
  
  
  
  
     String myvar = "";
  
     String head = "&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;meta name=\"viewport\" content=\"width=device-width, user-scalable=yes\" /&gt;&lt;/head&gt;";
  
     String summary = "&lt;style&gt;table{ height:100%;}td.height{height:100%;}&lt;/style&gt;&lt;table width=100% height=100%&gt; &lt;tr&gt;&lt;td class=\"height\" style=\"text-align: center; vertical-align: middle;\"&gt;&lt;video id='my-video' controls autoplay style=\"width: 350px; height: 250px;vertical-align: middle;\"&gt;&lt;source src='http://techslides.com/demos/sample-videos/small.mp4' type='video/mp4' /&gt;&lt;/video&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
  
    String html = head + "&lt;body&gt;"+summary+"&lt;/body&gt;&lt;/html&gt;";
    mWebview.loadData(html, "text/html", null);  
    }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
      if (id == R.id.action_settings) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  }
  </code></pre>