提交 6fee9609 authored 作者: 羊富学's avatar 羊富学

安卓视频流校验二维码图

上级 82523cfb
......@@ -47,24 +47,28 @@ Page({
// 实时帧渲染到canvas
await wx.canvasPutImageData({
canvasId: 'myCanvas',
x:-frame.width / 4,
y:-frame.height / 3,
x:0,
y:0,
width: frame.width,
height: frame.height,
data: new Uint8ClampedArray(frame.data),
})
const fileData = await wx.canvasToTempFilePath({
canvasId: 'myCanvas',
x: 0,
y: 0,
width: frame.width,
height: frame.height,
x: frame.width / 4,
y: frame.height / 4,
width: frame.width / 2,
height: frame.height / 3,
quality: 'high',
fileType: 'jpg',
destWidth: frame.width / 2,
destHeight: frame.height / 3,
})
const base = fileSystem.readFileSync(fileData.tempFilePath, 'base64')
// console.log('qr_result',flag,5555,base);
const qr_result = await that.handleCodeAnalysis(base)
console.log('qr_result',flag,5555,qr_result.data.codeinfo);
console.log('qr_result',flag,5555,qr_result.data);
// 前端校验取消
// const data = new Uint8ClampedArray(frame.data);
// // const nData = data.slice(data.length / 4, data.length / 4 * 3)
......
<!--pages/beiyinmei/beiyinmei.wxml-->
<view wx:if="{{!showPage}}" style="height: 100vh;width: 100vw;position: relative;z-index: 99;">
<!-- <image src="{{src}}" mode="widthFix" style="position: absolute;top: 0px;left: 0px;z-index: 9999;"/> -->
<camera device-position="back" frame-size="high" flash="on" style="width: 100%; height: 100%;" mode="normal">
<view class="prompt">
<image src="/assets/imgs/拍照框.png" style="width: 25%;" mode="widthFix" />
......@@ -24,5 +25,5 @@
</view>
<view style="visibility: hidden;position: fixed;top: 99999px;left: 0px;">
<canvas canvas-id="myCanvas" id="myCanvas" style="width:500px;height:500px;" />
<canvas canvas-id="myCanvas" id="myCanvas" style="width:{{width}}px;height:{{height}}px;" />
</view>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论