I'm trying to create a HTML5 video element that streams from the local camera with the exact size of 380 x 214 pixels. I found that the only way to do this is using mandatory
with minWidth
, minHeight
etc.
So this code works great on chrome, but not on Firefox or Microsoft Edge.
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia;
navigator.getUserMedia(
{
audio: true,
video: {
mandatory: {
minWidth: 380,
minHeight: 214,
maxWidth: 380,
maxHeight: 214
}
}
}, function (stream) {
....
});
I've been attempting various properties to the video
element, but none of them seem to change its default 4:3 aspect ratio on those browsers.
Any idea how can I resolve this ?