Media Capture

Code

<input id=camera type=file accepts="image/*" capture=camera />

camera.onchange = function(e) {
  var files = e.target.files;
  if(files.length > 0  && files[0].type.indexOf("image/") == 0) {
    img.src = URL.createObjectURL(files[0]);
  }
};