Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. ImageCapture
  4. ImageCapture()

ImageCapture: ImageCapture() constructor

TheImageCapture() constructorcreates a newImageCapture object.

Syntax

js
new ImageCapture(videoTrack)

Parameters

videoTrack

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

Return value

A newImageCapture object which can be used to capture still frames fromthe specified video track.

Exceptions

NotSupportedErrorDOMException

Thrown if thevideoTrack parameter'skind property is notvideo.

Examples

The following example shows how to use a call toMediaDevices.getUserMedia() to retrieve theMediaStreamTrack needed by theImageCapture() 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

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp