title: IP Camera - Streaming video with the basic authentication on Chrome
body: <p>I have an Amcrest IP Camera. I would like to stream video to my web page.
  Its url is <code>rtsp://mycamera.com:5554/stream</code></p>
  
  <p>In order to get the stream of the camera, the camera has a following API  <code>http://mycamera.com/video.mjpg</code> </p>
  
  <p>It requires the basic authentication to work.</p>
  
  <p>By formatting the URL and putting it into the image tag like below, I can make it work on Firefox, Safari</p>
  
  <pre><code>&lt;img src="http://username:password@mycamera.com/video.mjpg" /&gt;
  </code></pre>
  
  <p>However, Chrome (v.40 on mine) does not allow this kind of URL, the browser will promt the user password form to be filled, or simply refuses the request. Setting header Authorization: "Basic encode64(username, password)" in the script does not help, the URL always return 401 error (Unauthorized)</p>
  
  <p>Sometimes, it raises the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS" rel="nofollow">CORS</a> error. If my website is running with HTTPS, the HTTP API call will get blocked by the browser.</p>