ImageCapture: ImageCapture() constructor

The ImageCapture() constructor creates a new ImageCapture object.

Syntax

js
new ImageCapture(videoTrack)

Parameters

videoTrack

A MediaStreamTrack from which the still images will be taken. This can be any source, such as an incoming stream of a video conference, a playing movie, or the stream from a webcam.

Return value

A new ImageCapture object which can be used to capture still frames from the specified video track.

Exceptions

NotSupportedError DOMException

Thrown if the videoTrack parameter's kind property is not video.

Examples

The following example shows how to use a call to MediaDevices.getUserMedia() to retrieve the MediaStreamTrack needed by the ImageCapture() constructor.

js
navigator.mediaDevices
  .getUserMedia({ video: true })
  .then((mediaStream) => {
    document.querySelector("video").srcObject = mediaStream;
    const track = mediaStream.getVideoTracks()[0];
    imageCapture = new ImageCapture(track);
  })
  .catch((error) => console.error(error));

Specifications

Specification
MediaStream Image Capture
# dom-imagecapture-imagecapture

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() 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

Legend

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

Full support
Full support
No support
No support
User must explicitly enable this feature.