onCameraFrame返回arrayBuffer使用canvasPutImageData报错?
context.onCameraFrame((frame) => {
try {
if (!this.data.flag) {
return;
}
wx.canvasPutImageData({
canvasId: ‘myCanvas’,
x: 0,
y: 0,
width: frame.width,
heihgt: frame.height,
data: new Uint8ClampedArray(frame.data),
success(res) {
wx.showModal({
title: ‘获取图片’,
content: ‘’ + res,
})
},
fail(err){
wx.showModal({
title: ‘获取图片失败’,
content: ‘’ + err.errMsg,
})
}
});
}catch(err){
}
});
报错信息:canvasPutImageData:fail canvas is empty