feat: 刷赞添加图片识别二维码功能

This commit is contained in:
539943419 committed 2025-01-21 19:14:40 +08:00
1 parent f3af29f04c
commit f8fba79d55
4 files changed
+169 -32

No files matched your search

+12 -11
View File
@@ -42,18 +42,17 @@ const handleVideoTrack = (track: MediaStreamTrack) => {
let errCount = 0
// @ts-ignore
const imageCapture = new ImageCapture(track)
timer = setInterval(() => {
timer = setInterval(async () => {
try {
imageCapture.grabFrame().then((videoFrame: VideoFrame) => {
const data = getQRData(videoFrame)
if (data &&!scannerResult.has(data)) {
console.log(data)
scannerResult.add(data)
result.push(data)
emit('onResult', data)
}
videoFrame.close()
})
const videoFrame = await imageCapture.grabFrame()
const data = getQRData(videoFrame)
if (data && !scannerResult.has(data)) {
console.log(data)
scannerResult.add(data)
result.push(data)
emit('onResult', data)
}
videoFrame.close()
} catch (e) {
errCount++
if (errCount > 10) {
@@ -96,6 +95,8 @@ onBeforeUnmount(() => {
video {
height: inherit;
width: inherit;
max-height: inherit;
max-width: inherit;
object-fit: contain;
}
}