Commit 79ce1aef authored by dani2612's avatar dani2612

Modificato il main.js

reso funzionante lo script, reinstaziando l' oggetto e facendo lo stop
di tutte le tracks 
consiglio di cambiare libreria poichè presenta numerosi bug
parent 697534c7
......@@ -8,7 +8,8 @@ $(function () {
return;
}
$("input#id_id")[0].value = result;
$("#qr-scan").modal("hide");
$("#qr-scan").modal("toggle");
};
$("#cameraProcess").click(function(e) {
......@@ -30,16 +31,30 @@ $(function () {
}
var video = document.querySelector("video");
var reset = document.querySelector("#reset");
var stop = document.querySelector('#stop');
// prepare a canvas element that will receive the image to decode, sets
// the callback for the result and then prepares the videoElement to
// send its source to the decoder.
qr.decodeFromCamera(video, resultHandler);
qr.decodeFromCamera(video, resultHandler,true);
// attach some event handlers to reset and stop whenever we want.
reset.onclick = function () {
qr.decodeFromCamera(video, resultHandler);
for (var i = 0; i < qr.stream.getTracks().length; i++){
qr.stream.getTracks()[i].stop();
}
qr = new QCodeDecoder();
qr.decodeFromCamera(video, resultHandler,true);
};
}).on("hide.bs.modal", function() {
qr.stop();
for (var i = 0; i < qr.stream.getTracks().length; i++){
qr.stream.getTracks()[i].stop();
}
qr = new QCodeDecoder();
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment