PhotoCapabilities

MediaStream Image Capture APIPhotoCapabilities 인터페이스는 장착된 촬영 장치에서 사용 가능한 설정 옵션을 제공합니다. PhotoCapabilities 객체는 ImageCapture.getPhotoCapabilities()를 사용해 가져올 수 있습니다..

속성

PhotoCapabilities.redEyeReduction Read only
장치의 적목 현상 감소 기능 적용 여부를 나타내는 열거형 값을 반환합니다. 가능한 값은 "never", "always", "controllable"로, "controllable"이어야 설정 가능합니다.
PhotoCapabilities.imageHeight Read only
사용자 에이전트가 지원하는 이미지 높이를 나타내는 MediaSettingsRange 객체를 반환합니다.
PhotoCapabilities.imageWidth Read only
사용자 에이전트가 지원하는 이미지 너비를 나타내는 MediaSettingsRange 객체를 반환합니다.
PhotoCapabilities.fillLightMode Read only
사용 가능한 플래시 옵션을 담은 배열을 반환합니다. 가능한 값은 auto, off, flash입니다.

예제

다음 예제는 Chrome의 Image Capture / Photo Resolution Sample에서 가져온 코드로, getPhotoCapabilities()를 사용해 범위 입력 칸의 크기를 수정합니다. 또한 장치의 MediaStream에서 가져온 MediaStreamTrack 객체를 사용해 ImageCapture 객체를 생성하는 부분도 포함하고 있습니다.

const input = document.querySelector('input[type="range"]');

var imageCapture;

navigator.mediaDevices.getUserMedia({video: true})
.then(mediaStream => {
  document.querySelector('video').srcObject = mediaStream;

  const track = mediaStream.getVideoTracks()[0];
  imageCapture = new ImageCapture(track);

  return imageCapture.getPhotoCapabilities();
})
.then(photoCapabilities => {
  const settings = imageCapture.track.getSettings();

  input.min = photoCapabilities.imageWidth.min;
  input.max = photoCapabilities.imageWidth.max;
  input.step = photoCapabilities.imageWidth.step;

  return imageCapture.getPhotoSettings();
})
.then(photoSettings => {
  input.value = photoSettings.imageWidth;
})
.catch(error => console.log('Argh!', error.name || error));

명세

Specification Status Comment
MediaStream Image Capture
The definition of 'PotoCapabilities' in that specification.
Working Draft Initial definition.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
PhotoCapabilities
Experimental
Chrome Full support 59Edge ? Firefox ? IE ? Opera Full support 46Safari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android ? Opera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0
fillLightMode
Experimental
Chrome Full support 59Edge ? Firefox ? IE ? Opera Full support 46Safari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android ? Opera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0
imageHeight
Experimental
Chrome Full support 59Edge ? Firefox ? IE ? Opera Full support 46Safari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android ? Opera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0
imageWidth
Experimental
Chrome Full support 59Edge ? Firefox ? IE ? Opera Full support 46Safari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android ? Opera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0
redEyeReduction
Experimental
Chrome Full support 59Edge ? Firefox ? IE ? Opera Full support 46Safari ? WebView Android Full support 59Chrome Android Full support 59Firefox Android ? Opera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.