Fix QR code scanning in Safari (inc. iOS).
This commit is contained in:
parent
ffb12f7a3b
commit
d43d2a4c5f
|
|
@ -111,19 +111,21 @@ var checkinApp = new Vue({
|
|||
qrcode.callback = this.QrCheckin;
|
||||
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
||||
|
||||
navigator.getUserMedia({video: true, audio: false}, function (stream) {
|
||||
navigator.getUserMedia({
|
||||
video: {
|
||||
facingMode: 'environment'
|
||||
},
|
||||
audio: false
|
||||
}, function (stream) {
|
||||
|
||||
that.stream = stream;
|
||||
console.log(stream);
|
||||
|
||||
if (that.videoElement.mozSrcObject !== undefined) { // works on firefox now
|
||||
that.videoElement.mozSrcObject = stream;
|
||||
} else if(window.URL) { // and chrome, but must use https
|
||||
var objectURL = window.URL.createObjectURL(stream);
|
||||
that.videoElement.src = objectURL || stream;
|
||||
that.videoElement.srcObject = stream;
|
||||
};
|
||||
|
||||
that.videoElement.play();
|
||||
|
||||
}, function () { /* error*/
|
||||
alert(lang("checkin_init_error"));
|
||||
});
|
||||
|
|
@ -170,4 +172,3 @@ var checkinApp = new Vue({
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
<a @click="closeScanner" class="closeScanner" href="javascript:void(0);">
|
||||
<i class="ico-close"></i>
|
||||
</a>
|
||||
<video id="scannerVideo" autoplay></video>
|
||||
<video id="scannerVideo" playsinline autoplay></video>
|
||||
|
||||
<div class="scannerButtons">
|
||||
<a @click="initScanner" v-show="!isScanning" href="javascript:void(0);">
|
||||
|
|
|
|||
Loading…
Reference in New Issue