Basically the question is in the title. This is about WebRTC and getUserMedia function. Similar question was here: How to keep 1:1 aspect ratio video all the time in WebRTC. But in my case I need to record a stream using MediaRecorder, just crop a video element with css is not enough. I'm a bit confused about getUserMedia constraints. There is aspectRatio parameter, but I didn't manage how to achieve required result with it. What worked for me was to define constraints in that way:
const constraints = {
audio: true,
video: {
width: { exact: 720 },
}
};
But it doesn't define max resolution automatically. Do you have any ideas how to do it in a smart way?