CreateFromWebCam aspect ratio to 16:9

I have problem changing aspect ratio from 4:3 (640:480) to 16:9 (1920:1080). Setting maxWidth, minWidth, maxHeight, minHeight, doesn’t seem to change anything. I need this resolution, so camera will take bigger part of the screen on phones, without distorting image.

Docs: VideoTexture | Babylon.js Documentation


are you trying to change the native resolution of the camera? I am not sure it is possible.

The playground seems to be working for me, so I am not sure how to try and reproduce it.

Yes, I am trying to change resolution of the camera.

You can pass an exact resolution (instead of min/max):

Fullscreen Video Aspect Ratio | Babylon.js Playground (

Thanks, that worked!
It would be really nice if you add all parameters to documentation :slight_smile:

CreateFromWebCamAsync(scene: Scene, constraints: { deviceId: string; maxHeight: number; maxWidth: number; minHeight: number; minWidth: number }

1 Like

Aren’t they here already?

Unless I’m missing something?

I don’t see height , width facingMode and maybe some other parameters WebRTC camera is capable of using. I only see min/max-height/width and id,…

Oh, I think those are the & MediaTrackConstraints bit :slight_smile: MediaTrackConstraints - Web APIs | MDN (


yeah, we actually don’t need our def, just the media track contraints