MediaStream Image Capture API

The MediaStream Image Capture API is an API for capturing images or videos from a photographic device. In addition to capturing data, it also allows you to retrieve information about device capabilities such as image size, red-eye reduction and whether or not there is a flash and what they are currently set to. Conversely, the API allows the capabilities to be configured within the constraints what the device allows.

MediaStream image capture concepts and usage

The process of retrieving an image or video stream happens as described below. The example code is adapted from Chrome's Image Capture examples.

First, get a reference to a device by calling MediaDevices.getUserMedia(). The example below says give me whatever video device is available, though the getUserMedia() method allows more specific capabilities to be requested. This method returns a Promise that resolves with a MediaStream object.

js
navigator.mediaDevices.getUserMedia({ video: true }).then((mediaStream) => {
  // Do something with the stream.
});

Next, isolate the visual part of the media stream. Do this by calling MediaStream.getVideoTracks(). This returns an array of MediaStreamTrack objects. The code below assumes that the first item in the MediaStreamTrack array is the one to use. You can use the properties of the MediaStreamTrack objects to select the one you need.

js
const track = mediaStream.getVideoTracks()[0];

At this point, you might want to configure the device capabilities before capturing an image. You can do this by calling applyConstraints() on the track object before doing anything else.

js
let zoom = document.querySelector("#zoom");
const capabilities = track.getCapabilities();
// Check whether zoom is supported or not.
if (!capabilities.zoom) {
  return;
}
track.applyConstraints({ advanced: [{ zoom: zoom.value }] });

Finally, pass the MediaStreamTrack object to the ImageCapture() constructor. Though a MediaStream holds several types of tracks and provides multiple methods for retrieving them, the ImageCapture constructor will throw a DOMException of type NotSupportedError if MediaStreamTrack.kind is not "video".

js
let imageCapture = new ImageCapture(track);

Interfaces

ImageCapture

An interface for capturing images from a photographic device referenced through a valid MediaStreamTrack.

Specifications

Specification
MediaStream Image Capture
# imagecaptureapi

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
ImageCapture
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox 35 (Release date: 2015-01-13)
disabled
disabled From version 35 users must explicitly set the dom.imagecapture.enabled preference to true. To change preferences in Firefox, visit about:config.
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
ImageCapture() constructor
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox 35 (Release date: 2015-01-13)
disabled
disabled From version 35 users must explicitly set the dom.imagecapture.enabled preference to true. To change preferences in Firefox, visit about:config.
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
getPhotoCapabilities
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
getPhotoSettings
Chrome – Full support
Chrome 61 (Release date: 2017-09-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Full support
Chrome Android 61 (Release date: 2017-09-05)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 8 (Release date: 2018-07-18)
footnote Full support
WebView Android – Full support
WebView Android 61 (Release date: 2017-09-05)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
grabFrame
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
takePhoto
Chrome – Partial support
Chrome 59 – 59 (Release date: 2017-06-05)
footnote Partial support
footnote photoSettings parameter not supported.
Chrome – Full support
Chrome 60 (Release date: 2017-07-25)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox 35 (Release date: 2015-01-13)
disabled
disabled From version 35 users must explicitly set the dom.imagecapture.enabled preference to true. To change preferences in Firefox, visit about:config.
Opera – Partial support
Opera 46 – 46 (Release date: 2017-06-22)
footnote Partial support
footnote photoSettings parameter not supported.
Opera – Full support
Opera 47 (Release date: 2017-08-09)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Partial support
Chrome Android 59 – 59 (Release date: 2017-06-06)
footnote Partial support
footnote photoSettings parameter not supported.
Chrome Android – Full support
Chrome Android 60 (Release date: 2017-08-01)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Partial support
Opera Android 43 – 43 (Release date: 2017-09-27)
footnote Partial support
footnote photoSettings parameter not supported.
Opera Android – Full support
Opera Android 44 (Release date: 2017-12-11)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Partial support
Samsung Internet 7 – 7.4 (Release date: 2018-03-16)
footnote Partial support
footnote photoSettings parameter not supported.
Samsung Internet – Full support
Samsung Internet 8 (Release date: 2018-07-18)
footnote Full support
WebView Android – Partial support
WebView Android 59 – 59 (Release date: 2017-06-06)
footnote Partial support
footnote photoSettings parameter not supported.
WebView Android – Full support
WebView Android 60 (Release date: 2017-08-01)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
track
Chrome – Full support
Chrome 59 (Release date: 2017-06-05)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox 35 (Release date: 2015-01-13)
altname , disabled
altname Alternate name: videoStreamTrack
disabled From version 35 users must explicitly set the dom.imagecapture.enabled preference to true. To change preferences in Firefox, visit about:config.
Opera – Full support
Opera 46 (Release date: 2017-06-22)
footnote Full support
Safari – Full support
Safari 18.4 (Release date: 2025-03-31)
footnote Full support
Chrome Android – Full support
Chrome Android 59 (Release date: 2017-06-06)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18.4 (Release date: 2025-03-31)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 59 (Release date: 2017-06-06)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18.4 (Release date: 2025-03-31)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
User must explicitly enable this feature.
Uses a non-standard name
Has more compatibility info.

See also