2

I tried to get 1:1 aspect ratio video in WebRTC.

But when I use this setting, I still get a 4:3 aspect ratio video.

constraints = {
  audio: true,
  video: { width: 240, height: 240 }
};

Check this jsfiddle.

How can I do it correctly? Thanks

Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267

1 Answers1

1

I found the solution. After adding latest adapter.js (version 1.0.7) as external resources, it works perfect now.

The codes no need change, still same

constraints = {
  audio: true,
  video: { width: 240, height: 240 }
};

The working jsfiddle is here.

Hope this helps people who has similar problems.

Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
  • This answer won't work in all browsers. See [this answer](http://stackoverflow.com/a/36962250/918910). – jib May 01 '16 at 02:50
  • If you're interested why this didn't work before, it's quite simply because constraints are not fully implemented yet, they work in javascript, some work in the native API's. Even the ones that work have a list to choose from instead of allowing arbitrary numbers. It seems like your new version of adapter.js fixed some of the issues with constraints you were running into ;) – Kevin May 10 '16 at 08:06