IE11下进行拍照代码,不走后台,前端将拍照后的数据通过canvas画布进行获取,目的是为了后续再准备活体检测时,每100ms进行拍照对后台服务器造成压力

This commit is contained in:
袁帅
2022-10-18 15:00:33 +08:00
parent 47c996265a
commit 4965600636
3 changed files with 910 additions and 16 deletions

View File

@ -288,12 +288,14 @@ const Index: React.FC<{}> = () => {
//RgbToBase64
const RgbToBase64 = async (image: any) => {
setSubmitLoading(true);
await rgbToBase64({ image }).then(res => {
const _blob = base64ToBlob('data:image/jpg;base64,' + res.data);
hanleFaceSubmit(_blob, null);
}).catch(e => {
setSubmitLoading(false);
});
// await rgbToBase64({ image }).then(res => {
// const _blob = base64ToBlob('data:image/jpg;base64,' + res.data);
// hanleFaceSubmit(_blob, null);
// }).catch(e => {
// setSubmitLoading(false);
// });
console.log(1, image);
hanleFaceSubmit(base64ToBlob(image), null);
}
//是https或者是本地