Setting and Applying Media Constraints Objects

When passing { audio: true, video: true } to getUserMedia(), you effectively defer to a given browser’s default settings for audio and video. And it’s quite possible that those sensible defaults are fine for your app.

But, if you know that you need, for example, videos that run at a smaller or larger size, or have reasons to adjust things like the frame rate of a video or the sample rate for audio, the MediaTrackConstraints dictionary is your friend.[95] Kind of.

If you look at the compatibility table for the different entries in the constraints dictionary,[96] you will discover that only a handful of properties—height, width, and frameRate for video, or echoCancellation for audio—are well supported ...

Get Programming WebRTC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.