While setting the video resolution,


{ video: { resolution: { width: myFixedWidth, height: myFixedHeight } } }


And the returning results appears not be the same as the requested width and height, it's due to issues fixing width and height for cross-browsers due to each implementations that differs in some ways.


Tested Environments:

  • Opera 34
  • Chrome 47
  • Safari 9 (plugin ver 0.8.862)
  • Firefox 43


Based off similar issues faced with stackoverflow developers as noted in here.


MediaStreamConstraints as of 10-December-2015,


var constraints = { audio: false, video: {

  mandatory: {

    height: { min: width - 100, ideal: width, max: width + 100 },

    width: { min: height - 100, ideal: height, max: height + 100 }

  }

};


Results:

  • Opera 34: Throws NavigatorUserMediaError
  • Chrome 47: Throws NavigatorUserMediaError
  • Firefox 43: Does not resize the stream as the fixed requested size
  • Safari 9 (plugin ver 0.8.862): Appears a black stream without any errors thrown.


MediaStreamConstraints from webrtchacks in 23-Oct-2013 *,


var constraints = { audio: false, video: {

  mandatory: {

    minWidth: width,

    minHeight: height,

    maxWidth: width,

    maxHeight: height

  }

};


Results:

  • Opera 34: Throws NavigatorUserMediaError
  • Chrome 47: Throws NavigatorUserMediaError
  • Firefox 43: Does not resize the stream as the fixed requested size
  • Safari 9 (plugin ver 0.8.862): Does not resize the stream as the fixed requested size


*We currently do not have the link to the old w3c draft for mediastreams and capture api, but this is the closest to the outlook to the previous getUserMedia MediaConstraints API implementation draft spec.



So what did we do?

In conclusion, we decided to use maxHeight and maxWidth only instead because minWidth and minHeight wasn't working as well.


We will continue to update as the specs grow and implementation starts to change, however, for safe compatibility until the browsers start having a fixed width height constraints and to prevent from black stream or errors, we configured the constraints to only handle the maximum width and height of the video stream.


In regards to IE, it should reflect the same result as safari because of the same plugin webRTC implementation.