Search code examples
webrtcwebapiscreen-recordingget-display-mediavideoquality

how can I set a HD screen recording using getDisplayMedia api?


I have created a screen recorder application using getDisplayMedia() API but the output video quality is not good, is there any way to configure the output video quality to get HD resolution video?

I got a similar kind of question -> https://groups.google.com/g/discuss-webrtc/c/-KC3xg4MEp4 but solution is not available

var constraints = {
  audio: false,
  video: {
    width: { ideal: 720, max: 1920 },
    height: { ideal: 1024, max: 1080 }
  }
}
video_stream = await navigator.mediaDevices.getDisplayMedia(constraints);

Solution

  • I got the answer, in order to set the good resolution just update the constraint and the output video quality will be better.

    var constraints = {
      audio: false,
      video: {
        width: { ideal: 1920, max: 1920 },
        height: { ideal: 1080, max: 1080 }
      }
    }