aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/imagecapture/getphotocapabilities/index.html
blob: 9ee855a96d1d7fe57a803d69748f305ad76d576e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: ImageCapture.getPhotoCapabilities()
slug: Web/API/ImageCapture/getPhotoCapabilities
tags:
  - API
  - Experimental
  - ImageCapture
  - MediaStream Image Capture API
  - Method
  - Reference
translation_of: Web/API/ImageCapture/getPhotoCapabilities
---
<div>{{APIRef("MediaStream Image")}}</div>

<p><span class="seoSummary">{{domxref("ImageCapture")}} 인터페이스의 <strong><code>getPhotoCapabilities()</code></strong> 메서드는 사용 가능한 설정 옵션을 담은 {{domxref("PhotoCapabilities")}} 객체로 이행하는 {{jsxref("Promise")}}를 반환합니다.</span></p>

<h2 id="구문">구문</h2>

<pre class="syntaxbox">const <em>capabilitiesPromise</em> = <em>imageCaptureObj</em>.getPhotoCapabilities()</pre>

<h3 id="반환_값"><span style='font-family: x-locale-heading-primary,zillaslab,Palatino,"Palatino Linotype",x-locale-heading-secondary,serif; font-size: 1.375rem;'>반환 값</span></h3>

<p>{{domxref("PhotoCapabilities")}} 객체로 이행하는 {{jsxref("Promise")}}.</p>

<h2 id="예제">예제</h2>

<p>다음 예제는 <a href="https://googlechrome.github.io/samples/image-capture/photo-resolution.html">Chrome의 Image Capture / Photo Resolution Sample</a>에서 가져온 코드로, <code>getPhotoCapabilities()</code>를 사용해 범위 입력 칸의 크기를 수정합니다. 또한 장치의 {{domxref("MediaStream")}}에서 가져온 {{domxref("MediaStreamTrack")}} 객체를 사용해 {{domxref("ImageCapture")}} 객체를 생성하는 부분도 포함하고 있습니다.</p>

<pre class="brush: js">const input = document.querySelector('input[type="range"]');

var imageCapture;

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

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

  return imageCapture.getPhotoCapabilities();
})
.then(photoCapabilities =&gt; {
  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 =&gt; {
  input.value = photoSettings.imageWidth;
})
.catch(error =&gt; console.log('Argh!', error.name || error));</pre>

<h2 id="명세">명세</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('MediaStream Image','#dom-imagecapture-getphotocapabilities','getPhotoCapabilities()')}}</td>
   <td>{{Spec2('MediaStream Image')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>

<div>


<p>{{Compat("api.ImageCapture.getPhotoCapabilities")}}</p>
</div>