onCameraFrame返回arrayBuffer使用canvasPutImageData报错?
demo.js
Page({
onReady: function () {
const cameraCtx = wx.createCameraContext()
const cameraCfl = cameraCtx.onCameraFrame(res => {
const data = new Uint8ClampedArray(res.data);
wx.canvasPutImageData({
x: 0,
y: 0,
width: 300,
height: 150,
data,
success: res => {
console.log('绘制成功:', res)
},
fail: res => {
console.log('绘制失败:', res)
},
complete: res => {
console.log(res)
}
})
})
cameraCfl.start()
}
})
demo.wxml
demo.wxss
page{
height: 100%;
}
.container {
height: 100%;
}
1 回复
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),并详细描述下复现的流程。