diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/browser.js b/browser.js index 5e55caa..262a30d 100644 --- a/browser.js +++ b/browser.js @@ -3,8 +3,9 @@ var qrDecode = require('./src/QRDecode'); var decodeByDom = function (dom) { var canvas = document.createElement("canvas") var ctx = canvas.getContext('2d') - canvas.width = dom.width; - canvas.height = dom.height; + var isVideo = dom.tagName == 'VIDEO' + canvas.width = isVideo ? dom.videoWidth : dom.width; + canvas.height = isVideo ? dom.videoHeight : dom.height; ctx.drawImage(dom, 0, 0, canvas.width, canvas.height); var data = ctx.getImageData(0, 0, canvas.width, canvas.height); return qrDecode(data) diff --git a/demo/index.html b/demo/index.html index 7721c29..f5d777f 100644 --- a/demo/index.html +++ b/demo/index.html @@ -1,14 +1,97 @@ +