I\'m trying to get highest video resolution as possible through JS navigator.getUserMedia
. I know about constraints, but don\'t know how to choose right in my c
Use:
var constraints = {
video: {
width: { ideal: 4096 },
height: { ideal: 2160 }
}
};
This will make the browser use the maximum resolution available, up to 4K. Works in Chrome 63, Edge 41 and Firefox 58.
Citing MDN regarding the use of ideal:
An ideal value, when used, has gravity, which means that the browser will try to find the setting (and camera, if you have more than one), with the smallest fitness distance from the ideal values given.