WebRTC resolution limit

旧城冷巷雨未停 提交于 2019-12-01 06:01:06

You can do it by using constraints and passing those to getUserMedia as shown in the links you provided. It's possible that your webcam only supports 640x480 for video and higher resolutions for still images (this is common).

Here's another example, where you can try setting various resolutions and it will print out the corresponding constraints object: http://webrtc.googlecode.com/svn/trunk/samples/js/demos/html/constraints-and-stats.html

For example, to try to force it to 720p at 30FPS:

{
 "audio": true,
 "video": {
  "mandatory": {
   "minWidth": "1280",
   "maxWidth": "1280",
   "minHeight": "720",
   "maxHeight": "720",
   "minFrameRate": "30"
  },
  "optional": []
 }
}

Note that the current spec does not allow querying the hardware capabilities, due to concerns over privacy due to fingerprinting: http://lists.w3.org/Archives/Public/public-media-capture/2012Jan/0014.html

Note that Firefox does not yet support those constraints, though we will. We do have options for width and height in about:config (look in media.*) in the meantime.

Update

Currently Firefox supports the latest spec constraints for getUserMedia, in particular for width & height. These are considerably different than the older constraints mentioned here, and different than the somewhat newer constraints still used by Chrome (who will be moving to the spec constraints sometime soon).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!