H5 call the local camera to take pictures and how to get the original pictures.

webcam.js has been implemented by someone. Calling navigator.getUserMedia in H5 has been implemented, but the picture drawn with canvas is distorted. Is there any way to directly get the photos taken by the computer"s own camera

?

call camera: navigator.mediaDevices.getUserMedia
Photo: context.drawImage (video, 0,0,480,320);
transfer base64: var img_base64 = canvas.toDataURL ("image/jpeg", 0.5);


I have this content you can come to my home page to see


navigator.getUserMedia
https://developer.mozilla.org.

write widht= "3840" height= "2160"
context.drawImage (video, 0,01920) to canvas on html;
change it to
context.drawImage (video, 0,0,3840);

put two places

{
    video: true
}
Change

to

{
    "video": {width: 3840, height: 2160}
},    
< hr >

there is another solution

<input type="file" capture="camera" accept="image/*"/>
< hr >

if you compress
https://developer.mozilla.org.
type pass' image/jpeg'" and then set the appropriate encoderOptions value, or modify the canvas size in the previous code

  • About h5 Wake up app

    I am waking up app with url scheme. the requirement is that if app exists, open app, does not exist, ios jumps to appstore, Android jumps to google play. var nowTime = new Date().valueOf(); setTimeout(function() { var launchTime = new Da...

Menu