From d7bb052c5ccbac06d29f80d532f5024d7f9573b4 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Peeters Date: Sat, 14 Feb 2015 16:39:34 +0100 Subject: [PATCH] Added checks to avoid 404 error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a check to avoid a 404 error which happened if the user didn’t automatically accept webcam access. The `src` attribute of the `video` tag was set to `undefined`, which led to a 404 error on the URL `http://domain.tld/path_with_scanner/undefined`. It is now just set to an empty string. --- dist/quagga.js | 2 +- src/input_stream.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/quagga.js b/dist/quagga.js index 65aab97..d51693e 100644 --- a/dist/quagga.js +++ b/dist/quagga.js @@ -1409,7 +1409,7 @@ define('input_stream',["image_loader"], function(ImageLoader) { that.setInputStream = function(config) { _config = config; - video.src = config.src; + video.src = (typeof config.src !== 'undefined') ? config.src : ''; }; that.ended = function() { diff --git a/src/input_stream.js b/src/input_stream.js index 3df624a..19d7079 100644 --- a/src/input_stream.js +++ b/src/input_stream.js @@ -29,7 +29,7 @@ define(["image_loader"], function(ImageLoader) { that.setInputStream = function(config) { _config = config; - video.src = config.src; + video.src = (typeof config.src !== 'undefined') ? config.src : ''; }; that.ended = function() {