text: !function(e){function t(e){for(var t=0;t!==e.length;++t){var o=e[t];"video"===o.kind&&a.push(o.id)}}var a=[];"undefined"==typeof MediaStreamTrack||"undefined"==typeof MediaStreamTrack.getSources?console.log("This browser does not support MediaStreamTrack.\n\nTry Chrome."):MediaStreamTrack.getSources(t),jQuery.fn.extend({html5_qrcode:function(t,o,r,i){return this.each(function(){var n=e(this);e.data(n[0],"qrcodeSuccess",t),e.data(n[0],"qrcodeError",o),e.data(n[0],"videoError",r),"undefined"!=typeof i&&"undefined"!=typeof a[i]?e.data(n[0],"sourceId",i):e.data(n[0],"sourceId",0),"undefined"!=typeof a[n.data("sourceId")]&&e.data(n[0],"cameraId",a[n.data("sourceId")]);var d=n.height(),c=n.width();null==d&&(d=250),null==c&&(c=300);var s,u=e('<video width="'+c+'px" height="'+d+'px"></video>').appendTo(n),h=e('<canvas id="qr-canvas" width="'+(c-2)+'px" height="'+(d-2)+'px" style="display:none;"></canvas>').appendTo(n),f=u[0],l=h[0],m=l.getContext("2d"),v=function(){if(s){m.drawImage(f,0,0,307,250);try{qrcode.decode()}catch(t){o(t,s)}e.data(n[0],"timeout",setTimeout(v,500))}else e.data(n[0],"timeout",setTimeout(v,500))};window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var g=function(t){f.src=window.URL&&window.URL.createObjectURL(t)||t,s=t,e.data(n[0],"stream",t),f.play(),e.data(n[0],"timeout",setTimeout(v,1e3))};if(navigator.getUserMedia){var p={video:!0};"undefined"!=typeof n.data("cameraId")&&(p={video:{optional:[{sourceId:n.data("cameraId")}]}}),navigator.getUserMedia(p,g,function(e){"function"==typeof r?r(e,s):console.log("Error callback is undefined or not a function.")})}else console.log("Native web camera streaming (getUserMedia) not supported in this browser.");qrcode.callback=function(e){"function"==typeof t?t(e,s):console.log("Success callback is undefined or not a function.")}})},html5_qrcode_stop:function(){return this.each(function(){e(this).data("stream").getVideoTracks().forEach(function(e){e.stop()}),e(this).children("video").remove(),e(this).children("canvas").remove(),clearTimeout(e(this).data("timeout"))})},html5_qrcode_changeCamera:function(){return this.each(function(){e(this).html5_qrcode_stop(),e(this).html5_qrcode(e(this).data("qrcodeSuccess"),e(this).data("qrcodeError"),e(this).data("videoError"),(e(this).data("sourceId")+1)%a.length)})},html5_qrcode_cameraCount:function(){return a.length}})}(jQuery);