I can't find explanation on this. From what I read it seems that Safari 11 is working with getUserMedia APIs, from iOs 11. So I don't understand what is wrong in this code (and my goal is to acquire a QR code in livestream, but blocked here):
Controller
function BarcodeReaderQRCtrl($scope) {
/* widget controller */
var c = this;
var constraints = { audio: true, video: { width: 640, height: 480 } };
c.startMedia = function() {
navigator.mediaDevices
.getUserMedia(constraints)
.then(function(mediaStream) {
var video = document.getElementById('idvideo');
video.srcObject = mediaStream;
video.onloadedmetadata = function(e) {
video.play();
};
})
.catch(function(err) {
console.log(err.name + ': ' + err.message);
});
};
}
HTML
<div>
<a class="btn btn-default" href="#" role="button" ng-click="c.startMedia()">Start</a>
<div>
<video id="idvideo"></video>
</div>
</div>
Any suggestions?