did try html5 video capturing image camera on mobile , have problem blurry image? try on samsung phone image sharp, , on lg g4 image blurry (android browser , chrome on both mobile phones). has experience or can explain solution? can phones has these problems?
there snippet of code use:
function startcamera(newsource) { if (newsource) { var constraints = { audio: false, video: { optional: [ { sourceid: newsource }, ] } }; addvideoandcanvas(); navigator.getusermedia(constraints, onmediasuccess, onmediaerror); } } function addvideoandcanvas() { self.video = $('<video muted autoplay>'); self.canvas = $('<canvas id="qr-canvas" class="hide">'); $('.modal-body .video-container', self.root).append(self.video).append(self.canvas); } function onmediasuccess(stream) { self.stream = stream; self.video[0].src = (window.url && window.url.createobjecturl(stream)) || stream; self.video[0].onloadeddata = function () { self.canvas[0].height = self.video[0].videoheight; self.canvas[0].width = self.video[0].videowidth; scan(); } } function onmediaerror(error) { } function scan() { if (self.stream) { try { var ctx = self.canvas[0].getcontext('2d'); ctx.drawimage(self.video[0], 0, 0); } catch (e) { settimeout(scan, 20); } } else { settimeout(scan, 20); } }
probably waiting on folowing spec: https://w3c.github.io/mediacapture-image/index.html#focusmode
Comments
Post a Comment