diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
| commit | a065e04d529da1d847b5062a12c46d916408bf32 (patch) | |
| tree | fe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/zh-cn/web/api/cameracontrol | |
| parent | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff) | |
| download | translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2 translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip | |
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/zh-cn/web/api/cameracontrol')
| -rw-r--r-- | files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html | 64 | ||||
| -rw-r--r-- | files/zh-cn/web/api/cameracontrol/index.html | 88 |
2 files changed, 0 insertions, 152 deletions
diff --git a/files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html b/files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html deleted file mode 100644 index be1756631d..0000000000 --- a/files/zh-cn/web/api/cameracontrol/getpreviewstream/index.html +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: CameraControl.getPreviewStream -slug: Web/API/CameraControl/getPreviewStream -translation_of: Archive/B2G_OS/API/CameraControl/getPreviewStream ---- -<p>{{APIRef("Camera API")}}{{ non-standard_header() }}</p> - -<h2 id="概述">概述</h2> - -<p>该方法用来根据指定的配置,从摄像头获取到一个{{domxref("MediaStream")}}数据流,你可以从该数据流中捕获到静态的照片.</p> - -<div class="note"> -<p><strong>注:使用该方法获取到的数据流仅能用来捕获静态的照片</strong>.如果你想录制视频,那么必须使用{{domxref("CameraControl.getPreviewStreamVideoMode()")}}方法来代替.</p> -</div> - -<h2 id="语法">语法</h2> - -<pre>CameraControl.getPreviewStream(options, onsuccess[, onerror]);</pre> - -<h3 id="参数">参数</h3> - -<dl> - <dt><code>options</code></dt> - <dd>一个包含有两个属性<code>width</code>和<code>height的对象</code>.该对象可以通过{{domxref("CameraCapabilities")}}<code>.previewSizes属性获取到.</code></dd> - <dt><code>onsuccess</code></dt> - <dd>一个回调函数,会被传入一个参数,这个参数是一个{{domxref("MediaStream")}}数据流对象,可以使用该数据流对象捕获静态的图像.</dd> - <dt><code>onerror</code> {{optional_inline()}}</dt> - <dd>一个回调函数,会被传入一个参数,这个参数是一个表示错误原因的字符串.如果在尝试获取<code>MediaStream</code>数据流对象时发生了错误,则会调用该函数.</dd> -</dl> - -<h2 id="示例">示例</h2> - -<p>这个例子演示了如何通过使用{{domxref("MediaStream")}}数据流对象来从摄像头捕获并播放静态的图片.</p> - -<pre class="brush: js">var display = document.getElementsByTagName('video')[0]; -var options = { - camera: navigator.mozCameras.getListOfCameras()[0] -}; - -function onStreamReady( stream ) { - display.mozSrcObject = stream; - display.play(); -} - -function onAccessCamera( camera ) { - var size = camera.capabilities.previewSizes[0]; - - camera.getPreviewStream(size, onStreamReady); -}; - -navigator.mozCameras.getCamera(options, onAccessCamera) -</pre> - -<h2 id="Specification" name="Specification">规范</h2> - -<p>不属于任何规范.当<a class="external" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html" rel="external" title="http://dev.w3.org/2011/webrtc/editor/getusermedia.html">WebRTC Capture and Stream API</a>实现时,该方法应该会被删除.</p> - -<h2 id="相关链接">相关链接</h2> - -<ul> - <li>{{domxref("CameraControl")}}</li> - <li>{{domxref("MediaStream")}}</li> - <li>The <code>mozSrcObject</code> property on {{domxref("HTMLMediaElement")}}</li> -</ul> diff --git a/files/zh-cn/web/api/cameracontrol/index.html b/files/zh-cn/web/api/cameracontrol/index.html deleted file mode 100644 index 3be97dac90..0000000000 --- a/files/zh-cn/web/api/cameracontrol/index.html +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: CameraControl -slug: Web/API/CameraControl -translation_of: Archive/B2G_OS/API/CameraControl ---- -<p>{{APIRef("Camera API")}}</p> - -<p>{{ non-standard_header() }}</p> - -<p><span class="seoSummary">When you use the {{domxref("CameraManager.getCamera()")}} method to get a reference to a camera, you specify a callback function to be invoked on success. That function receives as a parameter a <code>CameraControl</code> object. You can use its methods and properties to manage and make use of the camera.</span></p> - -<h2 id="Properties">Properties</h2> - -<dl> - <dt>{{domxref("CameraControl.capabilities")}} {{readonlyinline}}</dt> - <dd>A {{domxref("CameraCapabilities")}} object indicating all the capabilities for the given camera.</dd> - <dt>{{domxref("CameraControl.effect")}}</dt> - <dd>A string defining the effect to be used by the camera (<code>none</code> by default). Its value must be one of the values available in {{domxref("CameraCapabilities.effects")}}.</dd> - <dt>{{domxref("CameraControl.exposureCompensation")}} {{readonlyinline}}</dt> - <dd>A value used to compensate the camera exposure. This attribute is read-only; to change the exposure, you need to call the {{domxref("CameraControl.setExposureCompensation()")}} method.</dd> - <dt>{{domxref("CameraControl.flashMode")}}</dt> - <dd>A string that defines how the flash, if any, is to be used; this is <code>auto</code> by default if the device has a flash, <code>none</code> otherwise. When set, its value must be chosen from the list of options specified by {{domxref("CameraCapabilities.flashModes")}}<code>.</code></dd> - <dt>{{domxref("CameraControl.focalLength")}} {{readonlyinline}}</dt> - <dd>A number that express the camera's focal length in millimeters.</dd> - <dt>{{domxref("CameraControl.focusAreas")}}</dt> - <dd>An <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array" title="/en-US/docs/JavaScript/Reference/Global_Objects/Array"><code>Array</code></a> of one or more objects that define where the camera will perform auto-focusing.</dd> - <dt>{{domxref("CameraControl.focusDistanceFar")}} {{readonlyinline}}</dt> - <dd>This value is a distance in meter used with {{domxref("CameraControl.focusDistanceNear")}} to defined the image's depth of field. The value for this property may be <code><a href="/en-US/docs/JavaScript/Reference/Global_Objects/Infinity" title="/en-US/docs/JavaScript/Reference/Global_Objects/Infinity">Infinity</a></code>.</dd> - <dt>{{domxref("CameraControl.focusDistanceNear")}} {{readonlyinline}}</dt> - <dd>This value is a distance in meter used with {{domxref("CameraControl.focusDistanceFar")}} to defined the image's depth of field.</dd> - <dt>{{domxref("CameraControl.focusDistanceOptimum")}} {{readonlyinline}}</dt> - <dd>This value is a distance in meter where the subject will appear sharpest.</dd> - <dt>{{domxref("CameraControl.focusMode")}}</dt> - <dd>A string that defines which kind of focus mode the camera should use (<code>auto</code> or <code>fixed</code> by default). Its value must be chosen from {{domxref("CameraCapabilities.focusModes")}}.</dd> - <dt>{{domxref("CameraControl.meteringAreas")}}</dt> - <dd>An <a href="/en-US/docs/JavaScript/Reference/Global_Objects/Array" title="/en-US/docs/JavaScript/Reference/Global_Objects/Array"><code>Array</code></a> of one or more objects that define where the camera will perform auto-focusing.</dd> - <dt>{{domxref("CameraControl.onShutter")}}</dt> - <dd>A handler for the camera's "shutter" event, to trigger a shutter sound and/or a visual shutter indicator.</dd> - <dt>{{domxref("CameraControl.onClosed")}}</dt> - <dd>A handler called when a new <code>CameraControl</code> object in the same app takes over the camera.</dd> - <dt>{{domxref("CameraControl.onRecorderStateChange")}}</dt> - <dd>A function to call when the recorder changes state, either because the recording process encountered an error, or because one of the recording limits (see {{domxref("CameraControl.startRecording()")}}) was reached.</dd> - <dt>{{domxref("CameraControl.sceneMode")}}</dt> - <dd>A string that defines which scene mode the camera is to use (<code>auto</code> by default). Its value must be chosen from {{domxref("CameraCapabilities.sceneModes")}}.</dd> - <dt>{{domxref("CameraControl.whiteBalanceMode")}}</dt> - <dd>A string that defines which white balance mode the camera is to use (<code>auto</code> by default). Its value must be chosen from {{domxref("CameraCapabilities.whiteBalanceModes")}}.</dd> - <dt>{{domxref("CameraControl.zoom")}}</dt> - <dd>A number that defines which kind of zoom factor mode the camera is to use (1 by default). Its value must be chosen from {{domxref("CameraCapabilities.zoomRatios")}}.</dd> -</dl> - -<h2 id="Methods">Methods</h2> - -<dl> - <dt>{{ domxref("CameraControl.autoFocus()") }}</dt> - <dd>Tells the camera to attempt to focus the image.</dd> - <dt>{{ domxref("CameraControl.getPreviewStream()") }}</dt> - <dd>Gets a video stream from the camera; you can use this in an arbitrary context.</dd> - <dt>{{ domxref("CameraControl.getPreviewStreamVideoMode()") }}</dt> - <dd>Gets a video stream from the camera based on a specific video mode.</dd> - <dt>{{ domxref("CameraControl.release()") }}</dt> - <dd>Releases the camera so that other applications can use it.</dd> - <dt>{{ domxref("CameraControl.resumePreview()") }}</dt> - <dd>Resumes the preview video stream after it's been paused by a call to {{domxref("CameraControl.takePicture()")}}.</dd> - <dt>{{ domxref("CameraControl.setExposureCompensation()") }}</dt> - <dd>Lets you specify the exposure compensation factor.</dd> - <dt>{{ domxref("CameraControl.startRecording()") }}</dt> - <dd>Lets you start recording a video stream.</dd> - <dt>{{ domxref("CameraControl.stopRecording()") }}</dt> - <dd>Lets you stop recording a video stream.</dd> - <dt>{{ domxref("CameraControl.takePicture()") }}</dt> - <dd>Lets you capture a single image, receiving it as a {{domxref("Blob")}}.</dd> -</dl> - -<h2 id="Specification" name="Specification">Specification</h2> - -<p>{{page("/en-US/docs/Web/API/Navigator.MozCameras","Specification")}}</p> - -<h2 id="Permissions">Permissions</h2> - -<p>{{page("/en-US/docs/Web/API/Navigator.MozCameras","Permissions")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{ domxref("CameraManager") }}</li> - <li>{{ domxref("CameraCapabilities") }}</li> - <li>{{ domxref("navigator.mozCamera") }}</li> -</ul> |
