Calling the phone camera in the MUI frame to take a photo can directly use the HTML5 of the soundtrack;
Here is the HTML code
<video id= "video" width= "640" height= "480" autoplay></video> <!--This is the screen that is rendered after the camera is called-->< Button id= "Snap" >snap photo</button> <!--camera button--><canvas id= "Canvas" width= "640" height= "480" ></canvas><!--This line is displayed on the page after taking the picture--
Here's the JavaScript code
var Avideo=document.getelementbyid (' video '); var acanvas=document.getelementbyid (' canvas '); var ctx= Acanvas.getcontext (' 2d '); Navigator.getusermedia = Navigator.getusermedia | | Navigator.webkitgetusermedia | | Navigator.mozgetusermedia | | navigator.msgetusermedia;//Gets the Media object (this refers to the camera) Navigator.getusermedia ({video:true}, Gotstream, nostream);// Parameter 1 Gets the user open permission, the parameter two successfully opened after the call, and pass a video stream object, parameter three open failed call, pass error message function Gotstream (stream) {video.src = Url.createobjecturl ( stream); video.onerror = function () { stream.stop ();}; stream.onended = Nostream;video.onloadedmetadata = function () { alert (' Camera opened successfully! ‘);};} function Nostream (err) { alert (err); } The button simulates the picture by drawing the captured picture onto the canvas document.getElementById ("Snap"). AddEventListener ("click", Function () {Ctx.drawimage ( Avideo, 0, 0, 640, 480);//will get the video drawn on the canvas});
Use HTML5 drawing technology to call the camera to take pictures;