camera-5.0: Upload 3 frames
This commit is contained in:
parent
cd8d3527c7
commit
4cbb643740
@ -147,6 +147,8 @@ function handle_frame() {
|
||||
setTimeout(handle_frame, 20);
|
||||
}
|
||||
|
||||
image_data_urls = [];
|
||||
|
||||
function do_handle_frame() {
|
||||
if (busy) return;
|
||||
const canvas = document.getElementById("original");
|
||||
@ -174,7 +176,13 @@ function do_handle_frame() {
|
||||
}
|
||||
if (done_checking_auto_torch && is_valid_pattern && res.ok) {
|
||||
var data_url = canvas.toDataURL("image/jpeg", 1.0);
|
||||
submit_image(res.qrcode, res.angle, data_url);
|
||||
image_data_urls.push(data_url);
|
||||
if (image_data_urls.length >= 3) {
|
||||
submit_image(image_data_urls, res.qrcode, res.angle);
|
||||
image_data_urls = [];
|
||||
} else {
|
||||
pending_hint = make_hint_text(res);
|
||||
}
|
||||
} else {
|
||||
pending_hint = make_hint_text(res);
|
||||
}
|
||||
@ -235,7 +243,7 @@ function hide_spinner() {
|
||||
add_class_by_query('.verifyspin', 'hidden');
|
||||
}
|
||||
|
||||
async function submit_image(qrcode, angle, image_data_url) {
|
||||
async function submit_image(qrcode, angle, image_data_urls) {
|
||||
busy = true;
|
||||
var begin = Date.now();
|
||||
show_spinner();
|
||||
@ -253,7 +261,7 @@ async function submit_image(qrcode, angle, image_data_url) {
|
||||
qrcode,
|
||||
angle,
|
||||
phonemodel,
|
||||
image_data_url,
|
||||
image_data_urls,
|
||||
log: debug_logs.join("\n"),
|
||||
};
|
||||
var r = await fetch("https://themblem.com/api/v1/qr-verify/", {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user