Get Aspect Ratio for video

75 views
Skip to first unread message

man...@phonon.in

unread,
Dec 8, 2014, 3:06:26 AM12/8/14
to eas...@googlegroups.com
Is there any way in easyrtc to know what is video aspect ration supported / video stream has ?
Any specific set of video dimensions in easyrtc ( having 4:3 or 16:9 as aspect ratio) supported ?
I am looking at setting correct video dimensions as per aspect ratio supported based on resolution of video camera.

Eric Davies

unread,
Dec 8, 2014, 10:53:34 AM12/8/14
to eas...@googlegroups.com
You can set  easyrtc._presetMediaConstraints

There are two options you can follow:
   1) replace  easyrtc.getUserMediaConstraints with your own code that returns the media constraints object expected by getUserMedia. In your own code, after you include easyrtc.js, just have a block of code that reads
          easyrtc.getUserMediaConstraints = function() {
                   return { audio: your_audio_constraints, 
                                video: your_video_constraints };
           };
   2) set easyrtc._presetMediaConstraints to the media constraints object, and it will be passed to getUserMedia. Note: this field has to be set each time you try to get a media object.

You can see see the structure of the media constraints object if you go to http://googlechrome.github.io/webrtc/samples/web/content/manual-test/constraints/


Eric Davies

unread,
Dec 8, 2014, 10:54:55 AM12/8/14
to eas...@googlegroups.com
There is no way with webrtc that I'm aware to determine what aspect ratios are supported natively by your camera. 

man...@phonon.in

unread,
Dec 9, 2014, 7:44:08 AM12/9/14
to eas...@googlegroups.com
Thanks Eric.
Reply all
Reply to author
Forward
0 new messages