Since Apple's iOS 11 webRTC
and getUserMedia
introduction, I'm able to get the camera's input to the <video>
element, but can't use conventional methods to set its dimensions (height
and width
).
This works:
var constraints = {
audio: false,
video: { facingMode: 'user' }
};
navigator.mediaDevices.getUserMedia(constraints).then(
function success(stream) {
video.srcObject = stream;
}
);
This doesn't work (only on iOS), and no image is shown:
var constraints = {
audio: false,
video: { facingMode: 'user', width: 306, height: 180 }
};
navigator.mediaDevices.getUserMedia(constraints).then(
function success(stream) {
video.srcObject = stream;
}
);
The error message from catch
:
Invalid constraint
Failed attempts: setting mandatory
, ideal
, minHeight
etc.
Is this a bug? Are there any known alternatives?