vue-qrcode-reader
Advanced tools
Comparing version 0.8.2 to 0.8.3
{ | ||
"name": "vue-qrcode-reader", | ||
"description": "A Vue.js component, accessing the device camera and allowing users to read QR-Codes, within the browser", | ||
"version": "0.8.2", | ||
"version": "0.8.3", | ||
"author": { | ||
@@ -87,4 +87,4 @@ "name": "Niklas Gruhn", | ||
"lodash": "^4.17.4", | ||
"webrtc-adapter": "^6.0.2" | ||
"webrtc-adapter": "^6.2.1" | ||
} | ||
} |
@@ -77,5 +77,5 @@ # vue-qrcode-reader | ||
By default detected QR codes are visually highlighted. A transparent canvas overlays the camera stream. When a QR code is detected, its location is painted to the canvas. You can enable/disable this feature by passing `true`/`false` via the `track` prop. | ||
By default detected QR codes are visually highlighted. A transparent canvas overlays the camera stream. When a QR code is detected, its location is painted to the canvas. You can enable/disable this feature by passing `true`/`false` via the `track` prop. If tracking is disabled the camera stream is scanned much less frequently. So if you encounter performance problems on your target device, this might help. | ||
You can also pass a function to customize the way the location is painted. This function is called to produce each frame. It receives the location object as the first argument and a `CanvasRenderingContext2D` instance as the second argument. | ||
You can also pass a function with `track` to customize the way the location is painted. This function is called to produce each frame. It receives the location object as the first argument and a `CanvasRenderingContext2D` instance as the second argument. | ||
@@ -103,3 +103,3 @@ :point_right: Avoid access to reactive properties in this function (like stuff in `data`, `computed` or your Vuex store). The function is called several times a second and might cause memory leaks. If you want to be save don't access `this` at all. | ||
ctx.beginPath() | ||
ctx.moveTo(topLeftCorner.x, topRightCorner.y) | ||
ctx.moveTo(topLeftCorner.x, topLeftCorner.y) | ||
ctx.lineTo(bottomLeftCorner.x, bottomLeftCorner.y) | ||
@@ -158,4 +158,5 @@ ctx.lineTo(bottomRightCorner.x, bottomRightCorner.y) | ||
facingMode: { ideal: 'environment' }, // use rear camera if available | ||
width: { min: 360, ideal: 1280, max: 1920 }, // constrain video width resolution | ||
height: { min: 240, ideal: 720, max: 1080 } // constrain video height resolution | ||
width: { min: 360, ideal: 680, max: 1920 }, // constrain video width resolution | ||
height: { min: 240, ideal: 480, max: 1080 }, // constrain video height resolution | ||
frameRate: { min: 10, ideal: 25 } | ||
} | ||
@@ -162,0 +163,0 @@ } |
@@ -30,24 +30,31 @@ import 'webrtc-adapter' | ||
shouldContinue, | ||
scanInterval = 16, // milliseconds | ||
minDelay, | ||
} = options | ||
const recur = (contentBefore, locationBefore) => { | ||
return () => { | ||
const imageData = camera.captureFrame() | ||
const { content, location } = scan(imageData) | ||
let contentBefore = null | ||
let locationBefore = null | ||
let lastScanned = performance.now() | ||
if (content !== null && content !== contentBefore) { | ||
decodeHandler(content) | ||
} | ||
const processFrame = () => { | ||
if (shouldContinue()) { | ||
window.requestAnimationFrame(processFrame) | ||
if (location !== locationBefore) { | ||
locateHandler(location) | ||
} | ||
const timeNow = performance.now() | ||
if (shouldContinue()) { | ||
window.setTimeout(() => { | ||
window.requestAnimationFrame( | ||
recur(content || contentBefore, location) | ||
) | ||
}, scanInterval) | ||
if (timeNow - lastScanned >= minDelay) { | ||
lastScanned = timeNow | ||
const imageData = camera.captureFrame() | ||
const { content, location } = scan(imageData) | ||
if (content !== null && content !== contentBefore) { | ||
decodeHandler(content) | ||
} | ||
if (location !== locationBefore) { | ||
locateHandler(location) | ||
} | ||
contentBefore = content || contentBefore | ||
locationBefore = location | ||
} | ||
@@ -57,3 +64,3 @@ } | ||
window.requestAnimationFrame(recur(null, null)) | ||
processFrame() | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43
295
561777
892
2
5
Updatedwebrtc-adapter@^6.2.1