title: Android Studio access webcam via WebView
body: <p>I'm trying to access and display a webcam interface in my application.<br>
  Currently I'm trying to do that using a WebView (still no success), but open to other suggestions.<br></p>
  
  <p>When I go to "<a href="http://192.168.43.74:81" rel="nofollow">http://192.168.43.74:81</a>" (the ip of the camera) on my phone's browser I get a popup asking me to insert a username and a password, I do that and log the camera successfully.<br>
  This is how I try to do that using a WebView:<br></p>
  
  <pre><code>    WebView camera = (WebView) findViewById(R.id.camera);
      camera.getSettings().setJavaScriptEnabled(true);
      camera.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
      camera.loadUrl(CAMERA_URL);
      camera.setWebViewClient(new WebViewClient());
  </code></pre>
  
  <p>When I set CAMERA_URL to google's url for example, I'm able to access google and browse the internet normally, using the webview. When I set CAMERA_URL to the webcam's IP, I get a blank page on my webview, and the following message:</p>
  
  <blockquote>
    <p><strong>Access Error: Unauthorized</strong><br>
    Access to this document requires a User ID</p>
  </blockquote>
  
  <p>This is the same message I get when I try to log in via my browser, but hit cancel instead of trying to log in. I assume I'm doing something wrong, and would appreciate some help:</p>
  
  <ul>
  <li>How do I make it work?</li>
  <li>Is there a better way to go about it than a WebView?</li>
  <li>and finally, though a somewhat different question, is there a way to automatically make the login instead of having the user type the username/password every time?</li>
  </ul>
  
  <p>I apologize if this question is trivial, or has been asked before. I was unable to find a solution by searching. Thank you!</p>