What is it about?

The MediaStream Image Capture APi is an API for capturing images or videos from devices.
It allows multiple camera configuration, so you could control the front and back cameras of your mobile phone, for example.
The API also enables you to configure flash, red-eye reduction, image size (resolution) and more.
Support is currently minimal, to use it with all these feature you’re gonna need Chrome 59+.

Using the API to capture a camera feed

With very little code you can capture a device’s camera feed and use it as a source for a video element. For example:

As you can see, getUserMedia accepts a configuration object with audio and video. They can either have boolean values, telling the API whether you want audio and video, or, an object, if you need to specify more details of how you want the stream to be, for example: video: {width 600, height: 480}.

It’s worth to note that these options will be taken into account depending on the device capabilities. It also defaults to max resolution.

Using the API to take photos

Expanding the example above, you can use the mediaStream track to create an instance of ImageCapture, which will then let you: