title: Play youtube/vimeo video embedded in HTML in Android WebView
body: <p>Hey So I'm trying to play youtube/vimeo videos embedded in HTML inside of a <code>webview</code>. </p>
  
  <p>The typlical HTML will look like this:</p>
  
  <pre><code>&lt;p&gt;Here's some text from a server&lt;/p&gt;
  &lt;p&gt;This text goes inside of a webview&lt;/p&gt;
  &lt;p&gt;Sometimes there are iframe's with vimeo videos embedded in the HTML text like this:&lt;/p&gt;
  
  &lt;iframe src="//player.vimeo.com/video/12345?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;
  
  &lt;p&gt;Sometimes there are iframe's with youtube videos embedded in the HTML text like this:&lt;/p&gt;
  
  &lt;p&gt;&lt;iframe width="640" height="360" src="//www.youtube.com/embed/-NwibJy9-Cg?feature=player_detailpage" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt;
  </code></pre>
  
  <p>But no video plays, and no thumbnail for the video is shown either.</p>
  
  <p>I've looked at many different StackOverflow posts on this subject but have not found any luck with them.</p>
  
  <p>Here's my code to set up the webview:</p>
  
  <pre><code>public class ReaderFragment extends Fragment {
  
  private TextView mTitleTextView, mDateTextView;
  private WebView mContentWebView;
  private StoryItem mStory;
  
  @Override
  public View onCreateView(LayoutInflater inflater,
                           final ViewGroup container, Bundle savedInstanceState) {
  
      View v = inflater.inflate(R.layout.fragment_reader, container, false);
  
      mTitleTextView = (TextView) v
              .findViewById(R.id.fragment_reader_story_title);
      mTitleTextView.setText(mStory.getTitle());
  
      mDateTextView = (TextView) v
              .findViewById(R.id.fragment_reader_story_date);
      mDateTextView.setText(mStory.getAuthor());
  
      mContentWebView = (WebView) v
              .findViewById(R.id.fragment_reader_story_content);
  
      mContentWebView.setWebChromeClient(new WebChromeClient());
      mContentWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
      mContentWebView.getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
      mContentWebView.setWebViewClient(new WebViewClient());
      mContentWebView.setBackgroundColor(0x00000000);
      mContentWebView.getSettings().setBuiltInZoomControls(true);
      mContentWebView.getSettings().setJavaScriptEnabled(true);
      mContentWebView.getSettings().setLoadWithOverviewMode(true);
      mContentWebView.getSettings().setUseWideViewPort(true);
  
      //I load the webview with the entire HTML content from the server, including text, and
      //sometime &lt;iframe&gt; videos, I'd like to successfully embed these videos!
      mContentWebView.loadDataWithBaseURL(null, mStory.getUnparsedContent(),
              "text/html; charset=utf-8", "UTF-8", null);
  
      return v;
  }
  </code></pre>
  
  <p>How can I display these inline <code>&lt;iframe</code>> videos within my <code>WebView</code>?</p>