Comments (3)
Hey! A few things
- I just pushed a change that makes the demo code work on mobile safari. Was missing an attribute there before. The demo code should now work on mobile safari (and Chrome on android).
- Updated the readme with an explanation of how jsQR thinks about webcams, as well as some resources. That can be viewed here if you're interested.
- Sadly, according to my research it seems like currently chrome on iOS cannot use webcams, potentially because of a video codec issue.
Sadly this would appear to mean that if you want to use iOS Chrome you're out of luck. However iOS safari works just fine (using the code from the jsQR demo), and once Google/Apple work out their differences and webcams are supported on iOS chrome things should just work.
Going to close this issue as I don't think there's much else to do here unfortunately, but please re-open if you feel differently, always happy to help.
from jsqr.
from jsqr.
im using the current version of the JS file, https://cozmo.github.io/jsQR/jsQR.js
but the iOs safari does not work for me. Strangely, when i visit your demo, things work, but I cant figure out what im doing wrong.
I have not modified most of your code, just passing in dimensions:
function InitiateQRScan() {
var video = document.createElement("video");
var canvasElement = document.getElementById("canvas");
var canvas = canvasElement.getContext("2d");
var loadingMessage = document.getElementById("loadingMessage");
var outputContainer = document.getElementById("output");
var outputMessage = document.getElementById("outputMessage");
var outputData = document.getElementById("outputData");
function drawLine(begin, end, color) {
canvas.beginPath();
canvas.moveTo(begin.x, begin.y);
canvas.lineTo(end.x, end.y);
canvas.lineWidth = 4;
canvas.strokeStyle = color;
canvas.stroke();
}
// Use facingMode: environment to attemt to get the front camera on phones
navigator.mediaDevices.getUserMedia({ video: {height:300, width:300, facingMode: "environment" } }).then(function(stream) {
video.srcObject = stream;
video.setAttribute("playsinline", true); // required to tell iOS safari we don't want fullscreen
video.play();
requestAnimationFrame(tick);
});
function tick() {
loadingMessage.innerText = "⌛ Loading video..."
if (video.readyState === video.HAVE_ENOUGH_DATA) {
loadingMessage.hidden = true;
canvasElement.hidden = false;
outputContainer.hidden = false;
canvasElement.height = video.videoHeight;
canvasElement.width = video.videoWidth;
canvas.drawImage(video, 0, 0, canvasElement.width, canvasElement.height);
var imageData = canvas.getImageData(0, 0, canvasElement.width, canvasElement.height);
var code = jsQR(imageData.data, imageData.width, imageData.height, {
inversionAttempts: "dontInvert",
});
if (code) {
drawLine(code.location.topLeftCorner, code.location.topRightCorner, "#FF3B58");
drawLine(code.location.topRightCorner, code.location.bottomRightCorner, "#FF3B58");
drawLine(code.location.bottomRightCorner, code.location.bottomLeftCorner, "#FF3B58");
drawLine(code.location.bottomLeftCorner, code.location.topLeftCorner, "#FF3B58");
outputMessage.hidden = true;
outputData.parentElement.hidden = false;
outputData.innerText = code.data;
} else {
outputMessage.hidden = false;
outputData.parentElement.hidden = true;
}
}
requestAnimationFrame(tick);
} return video; };
Please help!!
from jsqr.
Related Issues (20)
- aways wrong content for each times HOT 1
- QR Code that cannot be parsed in browser JS HOT 1
- Hello, may I ask if the QR code with lighter color can not be recognized? (请问是不能识别颜色较浅的二维码吗?) HOT 3
- How pass blob imageData rather than Url HOT 4
- This QR code cannot be recognized HOT 1
- Big QRCode cannot be parsed HOT 2
- Can't read QR code on iOS16 HOT 4
- qr on oracle
- Would you consider exposing intermediate decoding data?
- Unable to read QR code
- Would it be possible to scan barcodes?
- Error: Malformed data passed to binarizer. HOT 2
- Unable to read this Qrcode HOT 1
- This JSQR library do not work reading barcode in image. I think it has algorith issue HOT 2
- What's going on here? Why is the frame misaligned? HOT 1
- EAN-13 Format
- I discovered a QR code that cannot be recognized.
- crop qrcode error
- Cannot read transparent pixels
- Why do some images have return values? Some pictures don't
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsqr.