Youtube video is not loaded in webview in android

Viewed 438

I want to display youtube URL in a web view. But it is not loading into the web view.

Here is my code.

     WebView web_view = (WebView) findViewById(R.id.web_view);

    web_view.setWebViewClient(new WebViewClient());
    web_view.getSettings().setJavaScriptEnabled(true);
    web_view.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    web_view.getSettings().setPluginState(WebSettings.PluginState.ON);
    web_view.getSettings().setMediaPlaybackRequiresUserGesture(false);
    web_view.setWebChromeClient(new WebChromeClient());

    web_view.loadUrl("https://www.youtube.com/watch?v=s8n16rns-iM");

the video is not loaded into the web view.It is showing error: [INFO: CONSOLE(16)] "The key "target-densitydpi" is not supported.", source: https://m.youtube.com/watch?v=s8n16rns-iM

2 Answers
Related