I am developing a system in laravel and I am trying to implement a QR code reader in a modal, the problem is that I do not load the webcam in the modal, I am using html5-qrcode.min.js to decode the qr and upload the webcam, I've tried it on a separate page and the code works, I hope and you can help me, thanks.
HTML code:
<div class="modal fade" id="webcam" role="dialog">
<div class="modal-dialog">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Leer QR</h4>
</div>
<div class="modal-body">
<div class="center" id="reader" style="width:300px;height:250px;"></div>
<textarea id="read" class=""></textarea>
<button type="submit" class="btn btn-primary">Buscar</button>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
JS:
$(document).ready(function(){
$('#reader').html5_qrcode(function(data){
$('#read').html(data);
},
function(error){
$('#read_error').html(error);
}, function(videoError){
alert('No hay camara');
}
);
});