问题描述
在下面的代码中,我将最大图像宽度设置为 640。我将 blob 转换为 base64 字符串,然后将其发送到服务器。在服务器上,我得到了原始宽度的图像,即 1280。看起来约束没有应用于捕获的图像。如何强制返回的图像 blob 大小为 640?
function takepicture(mediaStream) {
imageCapture = new ImageCapture(mediaStream.getVideoTracks()[0]);
imgCapture = imageCapture.takePhoto({ imageWidth : 640}).then(function(blob) {
reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = function() {
base64data = reader.result.split(',')[1];
// base64data is uploaded to server
}
}).catch(function(error) {
console.log('error: ',error);
});
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)