0

I want to display video of IP camera in android application. For this I am using a webview. In the navigator of my smartphone I can see and control the web camera but in the webview video is always black and controls don't work.

This is the source code of my activity :

public class MainActivity extends Activity {

    private WebView webView;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_main);

        webView = (WebView) findViewById(R.id.vision);
        webView.setWebChromeClient(new WebChromeClient());
        webView.setWebViewClient(new myWebViewClient());
        webView.setHttpAuthUsernamePassword("http://192.168.1.2/", null, "admin", null);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setPluginState(PluginState.ON);
        webView.loadUrl("http://192.168.1.2/");

    }
    public class myWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }   
}

I got this error in the log ![enter image description here][1] web console uncaught reference error resolution is not defined.

David Duponchel
  • 3,959
  • 3
  • 28
  • 36
Kolombo90
  • 51
  • 1
  • 8

1 Answers1

0

If you are trying to play a HTML5 video (from your IP camera) in a WebView, this previous answer from another question might help you:

WebView and HTML5 <video>

Community
  • 1
  • 1
Joseph Lam
  • 5,289
  • 3
  • 14
  • 13