@@ -3873,20 +3873,29 @@ QRCodeDecoder.prototype._captureToCanvas = function () {
38733873 clearTimeout ( this . tmrCapture ) ;
38743874 }
38753875
3876- if ( ! this . videoDimensions && this . videoElem . videoWidth && this . videoElem . videoHeight ) {
3876+ if ( ! this . videoDimensions &&
3877+ this . videoElem . videoWidth &&
3878+ this . videoElem . videoHeight ) {
3879+
38773880 this . videoDimensions = {
38783881 w : this . videoElem . videoWidth ,
38793882 h : this . videoElem . videoHeight
38803883 } ;
3881- this . prepareCanvas ( this . canvasElem , this . videoDimensions . w , this . videoDimensions . h ) ;
3884+
3885+ this . prepareCanvas ( this . canvasElem ,
3886+ this . videoDimensions . w ,
3887+ this . videoDimensions . h ) ;
38823888 }
38833889
38843890 if ( this . videoDimensions ) {
38853891 var gCtx = this . canvasElem . getContext ( "2d" ) ;
3886- gCtx . clearRect ( 0 , 0 , this . videoElem . videoWidth , this . videoElem . videoHeight ) ;
3892+ gCtx . clearRect ( 0 , 0 , this . videoElem . videoWidth ,
3893+ this . videoElem . videoHeight ) ;
38873894
38883895 try {
3889- gCtx . drawImage ( this . videoElem , 0 , 0 , this . videoDimensions . w , this . videoDimensions . h ) ;
3896+ gCtx . drawImage ( this . videoElem , 0 , 0 ,
3897+ this . videoDimensions . w ,
3898+ this . videoDimensions . h ) ;
38903899 qrcode . decode ( ) ;
38913900 return ;
38923901 }
@@ -3927,7 +3936,7 @@ QRCodeDecoder.prototype.isCanvasSupported = function () {
39273936 */
39283937QRCodeDecoder . prototype . prepareVideo = function ( videoElem , errcb ) {
39293938 var scope = this ;
3930-
3939+
39313940 this . stop ( ) ;
39323941
39333942 navigator . getUserMedia = navigator . getUserMedia ||
@@ -3949,10 +3958,11 @@ QRCodeDecoder.prototype.prepareVideo = function(videoElem, errcb) {
39493958 console . log ( 'Couldn\'t get video from camera' ) ;
39503959 }
39513960} ;
3952-
3953- /**
3954- + * Releases a video stream that was being captured by prepareToVideo
3955- + */
3961+
3962+ /**
3963+ * Releases a video stream that was being
3964+ * captured by prepareToVideo
3965+ */
39563966QRCodeDecoder . prototype . stop = function ( ) {
39573967 if ( this . stream ) {
39583968 this . stream . stop ( ) ;
@@ -3968,12 +3978,13 @@ QRCodeDecoder.prototype.stop = function() {
39683978/**
39693979 * Sets the sourceId for the camera to use.
39703980 *
3971- * The sourceId can be found using the getVideoSources
3972- * function on a browser that supports it (currently
3973- * only Chrome).
3974- *
3975- * @param {String } sourceId The id of the video
3976- * source you want to use (or false to use the current default)
3981+ * The sourceId can be found using the
3982+ * getVideoSources function on a browser that
3983+ * supports it (currently only Chrome).
3984+ *
3985+ * @param {String } sourceId The id of the
3986+ * video source you want to use (or false to use
3987+ * the current default)
39773988 */
39783989QRCodeDecoder . prototype . setSourceId = function ( sourceId ) {
39793990 if ( sourceId ) {
@@ -3996,7 +4007,8 @@ QRCodeDecoder.prototype.setDecoderCallback = function (cb) {
39964007} ;
39974008
39984009/**
3999- * Gets a list of all available video sources on the device
4010+ * Gets a list of all available video sources on
4011+ * the device
40004012 */
40014013QRCodeDecoder . prototype . getVideoSources = function ( cb ) {
40024014 var sources = [ ] ;
0 commit comments