Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
33458342
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
33458342
编写于
6月 15, 2022
作者:
O
openharmony_ci
提交者:
Gitee
6月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5234 fixed some issur for pr5163
Merge pull request !5234 from 蒋旻洋/master
上级
f84e39f1
5978b9af
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
170 addition
and
23 deletion
+170
-23
en/application-dev/reference/apis/js-apis-camera.md
en/application-dev/reference/apis/js-apis-camera.md
+170
-23
未找到文件。
en/application-dev/reference/apis/js-apis-camera.md
浏览文件 @
33458342
...
@@ -175,6 +175,17 @@ cameraManager.getCameras().then((cameraArray) => {
...
@@ -175,6 +175,17 @@ cameraManager.getCameras().then((cameraArray) => {
})
})
```
```
### Size
Size parameters. This interface used to get supported size for Preview + Photo + Video.
**System capability**
: SystemCapability.Multimedia.Camera.Core
| Name | Default Value | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ----------------------------------- |
| height | number | Yes | Desired height of the Preview + Photo + Video. |
| width | number | Yes | Desired width of the Preview + Photo + Video.|
### createCameraInput
### createCameraInput
createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput
\>
): void
createCameraInput(cameraId: string, callback: AsyncCallback<CameraInput
\>
): void
...
@@ -249,7 +260,7 @@ Creates a **CameraInput** instance with the specified camera position and camera
...
@@ -249,7 +260,7 @@ Creates a **CameraInput** instance with the specified camera position and camera
**Example**
**Example**
```
```
cameraManager.createCameraInput(camera
Position, cameraType
, (err, cameraInput) => {
cameraManager.createCameraInput(camera
.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED
, (err, cameraInput) => {
if (err) {
if (err) {
console.error('Failed to create the CameraInput instance. ${err.message}');
console.error('Failed to create the CameraInput instance. ${err.message}');
return;
return;
...
@@ -282,7 +293,7 @@ Creates a **CameraInput** instance with the specified camera position and camera
...
@@ -282,7 +293,7 @@ Creates a **CameraInput** instance with the specified camera position and camera
**Example**
**Example**
```
```
cameraManager.createCameraInput(camera
Position, cameraType
).then((cameraInput) => {
cameraManager.createCameraInput(camera
.CameraPosition.CAMERA_POSITION_BACK, camera.CameraType.CAMERA_TYPE_UNSPECIFIED
).then((cameraInput) => {
console.log('Promise returned with the CameraInput instance.');
console.log('Promise returned with the CameraInput instance.');
})
})
```
```
...
@@ -305,7 +316,11 @@ Listens for camera status changes. This API uses a callback to return the camera
...
@@ -305,7 +316,11 @@ Listens for camera status changes. This API uses a callback to return the camera
**Example**
**Example**
```
```
cameraManager.on('cameraStatus', (cameraStatusInfo) => {
cameraManager.on('cameraStatus', (err, cameraStatusInfo) => {
if (err) {
console.error('Failed to get cameraStatus callback. ${err.message}');
return;
}
console.log('camera : ' + cameraStatusInfo.camera.cameraId);
console.log('camera : ' + cameraStatusInfo.camera.cameraId);
console.log('status: ' + cameraStatusInfo.status);
console.log('status: ' + cameraStatusInfo.status);
})
})
...
@@ -327,14 +342,14 @@ After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera
...
@@ -327,14 +342,14 @@ After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera
**Example**
**Example**
```
```
async
function
getCameraInfo
()
{
async
function
getCameraInfo
(
"cameraId"
)
{
var
cameraManager
=
await
camera
.
getCameraManager
();
var
cameraManager
=
await
camera
.
getCameraManager
();
var
cameras
=
await
cameraManager
.
getCameras
();
var
cameras
=
await
cameraManager
.
getCameras
();
var
cameraObj
=
cameras
[
0
];
var
cameraObj
=
cameras
[
0
];
var
cameraId
=
cameraObj
.
cameraId
;
var
cameraId
=
cameraObj
.
cameraId
;
var
cameraPosition
=
cameraObj
.
cameraPosition
;
var
cameraPosition
=
cameraObj
.
cameraPosition
;
var
cameraType
=
cameraObj
.
cameraType
;
var
cameraType
=
cameraObj
.
cameraType
;
var
c
ameraId
=
cameraObj
.
connectionType
;
var
c
onnectionType
=
cameraObj
.
connectionType
;
}
}
```
```
...
@@ -470,7 +485,7 @@ Checks whether a specified flash mode is supported. This API uses an asynchronou
...
@@ -470,7 +485,7 @@ Checks whether a specified flash mode is supported. This API uses an asynchronou
**Example**
**Example**
```
```
cameraInput.isFlashModeSupported(
flashMode
, (err, status) => {
cameraInput.isFlashModeSupported(
camera.FlashMode.FLASH_MODE_AUTO
, (err, status) => {
if (err) {
if (err) {
console.error('Failed to check whether the flash mode is supported. ${err.message}');
console.error('Failed to check whether the flash mode is supported. ${err.message}');
return;
return;
...
@@ -502,7 +517,7 @@ Checks whether a specified flash mode is supported. This API uses a promise to r
...
@@ -502,7 +517,7 @@ Checks whether a specified flash mode is supported. This API uses a promise to r
**Example**
**Example**
```
```
cameraInput.isFlashModeSupported(
flashMode
).then((status) => {
cameraInput.isFlashModeSupported(
camera.FlashMode.FLASH_MODE_AUTO
).then((status) => {
console.log('Promise returned with flash mode support status.' + status);
console.log('Promise returned with flash mode support status.' + status);
})
})
```
```
...
@@ -530,7 +545,7 @@ Before setting the parameters, do the following checks:
...
@@ -530,7 +545,7 @@ Before setting the parameters, do the following checks:
**Example**
**Example**
```
```
cameraInput.setFlashMode(
flashMode
, (err) => {
cameraInput.setFlashMode(
camera.FlashMode.FLASH_MODE_AUTO
, (err) => {
if (err) {
if (err) {
console.error('Failed to set the flash mode ${err.message}');
console.error('Failed to set the flash mode ${err.message}');
return;
return;
...
@@ -567,7 +582,7 @@ Before setting the parameters, do the following checks:
...
@@ -567,7 +582,7 @@ Before setting the parameters, do the following checks:
**Example**
**Example**
```
```
cameraInput.setFlashMode(
flashMode
).then(() => {
cameraInput.setFlashMode(
camera.FlashMode.FLASH_MODE_AUTO
).then(() => {
console.log('Promise returned with the successful execution of setFlashMode.');
console.log('Promise returned with the successful execution of setFlashMode.');
})
})
```
```
...
@@ -638,7 +653,7 @@ Checks whether a specified focus mode is supported. This API uses an asynchronou
...
@@ -638,7 +653,7 @@ Checks whether a specified focus mode is supported. This API uses an asynchronou
**Example**
**Example**
```
```
cameraInput.isFocusModeSupported(
afMode
, (err, status) => {
cameraInput.isFocusModeSupported(
camera.FocusMode.FOCUS_MODE_AUTO
, (err, status) => {
if (err) {
if (err) {
console.error('Failed to check whether the focus mode is supported. ${err.message}');
console.error('Failed to check whether the focus mode is supported. ${err.message}');
return;
return;
...
@@ -670,7 +685,7 @@ Checks whether a specified focus mode is supported. This API uses a promise to r
...
@@ -670,7 +685,7 @@ Checks whether a specified focus mode is supported. This API uses a promise to r
**Example**
**Example**
```
```
cameraInput.isFocusModeSupported(
afMode
).then((status) => {
cameraInput.isFocusModeSupported(
camera.FocusMode.FOCUS_MODE_AUTO
).then((status) => {
console.log('Promise returned with focus mode support status.' + status);
console.log('Promise returned with focus mode support status.' + status);
})
})
```
```
...
@@ -695,7 +710,7 @@ Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupporte
...
@@ -695,7 +710,7 @@ Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupporte
**Example**
**Example**
```
```
cameraInput.setFocusMode(
afMode
, (err) => {
cameraInput.setFocusMode(
camera.FocusMode.FOCUS_MODE_AUTO
, (err) => {
if (err) {
if (err) {
console.error('Failed to set the focus mode ${err.message}');
console.error('Failed to set the focus mode ${err.message}');
return;
return;
...
@@ -729,7 +744,7 @@ Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupporte
...
@@ -729,7 +744,7 @@ Before setting the focus mode, use **[isFocusModeSupported](#isfocusmodesupporte
**Example**
**Example**
```
```
cameraInput.setFocusMode(
afMode
).then(() => {
cameraInput.setFocusMode(
camera.FocusMode.FOCUS_MODE_AUTO
).then(() => {
console.log('Promise returned with the successful execution of setFocusMode.');
console.log('Promise returned with the successful execution of setFocusMode.');
})
})
```
```
...
@@ -848,7 +863,7 @@ Sets a zoom ratio. This API uses an asynchronous callback to return the result.
...
@@ -848,7 +863,7 @@ Sets a zoom ratio. This API uses an asynchronous callback to return the result.
**Example**
**Example**
```
```
cameraInput.setZoomRatio(
zoomRatio
, (err) => {
cameraInput.setZoomRatio(
1
, (err) => {
if (err) {
if (err) {
console.error('Failed to set the zoom ratio value ${err.message}');
console.error('Failed to set the zoom ratio value ${err.message}');
return;
return;
...
@@ -880,7 +895,7 @@ Sets a zoom ratio. This API uses a promise to return the result.
...
@@ -880,7 +895,7 @@ Sets a zoom ratio. This API uses a promise to return the result.
**Example**
**Example**
```
```
cameraInput.setZoomRatio(
zoomRatio
).then(() => {
cameraInput.setZoomRatio(
1
).then(() => {
console.log('Promise returned with the successful execution of setZoomRatio.');
console.log('Promise returned with the successful execution of setZoomRatio.');
})
})
```
```
...
@@ -950,7 +965,7 @@ Releases this **CameraInput** instance. This API uses an asynchronous callback t
...
@@ -950,7 +965,7 @@ Releases this **CameraInput** instance. This API uses an asynchronous callback t
**Example**
**Example**
```
```
camera.release((err) => {
camera
Input
.release((err) => {
if (err) {
if (err) {
console.error('Failed to release the CameraInput instance ${err.message}');
console.error('Failed to release the CameraInput instance ${err.message}');
return;
return;
...
@@ -1027,6 +1042,27 @@ cameraInput.on('error', (cameraInputError) => {
...
@@ -1027,6 +1042,27 @@ cameraInput.on('error', (cameraInputError) => {
})
})
```
```
## CameraInputErrorCode
Enumerates the CameraInput error code.
**System capability**
: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| ERROR_UNKNOWN | -1 | Unknown error.|
## CameraInputError
Camera input error object which extends
**Error**
interface.
**System capability**
: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| code |
[
CameraInputErrorCode
](
#camerainputerrorcode
)
| Used to get error code in CameraInput on('error') callback|
## FlashMode
## FlashMode
...
@@ -1836,6 +1872,28 @@ captureSession.on('error', (captureSessionError) => {
...
@@ -1836,6 +1872,28 @@ captureSession.on('error', (captureSessionError) => {
})
})
```
```
## CaptureSessionErrorCode
Enumerates the CaptureSession error code.
**System capability**
: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| ERROR_UNKNOWN | -1 | Unknown error.|
## CaptureSessionError
Capture session error object which extends
**Error**
interface.
**System capability**
: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| code |
[
CaptureSessionErrorCode
](
#capturesessionerrorcode
)
| Used to get error code in CaptureSession on('error') callback.|
## camera.createPreviewOutput
## camera.createPreviewOutput
createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput
\>
): void
createPreviewOutput(surfaceId: string, callback: AsyncCallback<PreviewOutput
\>
): void
...
@@ -1854,7 +1912,7 @@ Creates a **PreviewOutput** instance. This API uses an asynchronous callback to
...
@@ -1854,7 +1912,7 @@ Creates a **PreviewOutput** instance. This API uses an asynchronous callback to
**Example**
**Example**
```
```
camera.createPreviewOutput((
surfaceId
), (err, previewOutput) => {
camera.createPreviewOutput((
"surfaceId"
), (err, previewOutput) => {
if (err) {
if (err) {
console.error('Failed to create the PreviewOutput instance. ${err.message}');
console.error('Failed to create the PreviewOutput instance. ${err.message}');
return;
return;
...
@@ -1886,7 +1944,7 @@ Creates a **PreviewOutput** instance. This API uses a promise to return the inst
...
@@ -1886,7 +1944,7 @@ Creates a **PreviewOutput** instance. This API uses a promise to return the inst
**Example**
**Example**
```
```
camera.createPreviewOutput(
surfaceId
).then((previewOutput) => {
camera.createPreviewOutput(
"surfaceId"
).then((previewOutput) => {
console.log('Promise returned with the PreviewOutput instance');
console.log('Promise returned with the PreviewOutput instance');
})
})
```
```
...
@@ -2013,6 +2071,28 @@ previewOutput.on('error', (previewOutputError) => {
...
@@ -2013,6 +2071,28 @@ previewOutput.on('error', (previewOutputError) => {
})
})
```
```
## PreviewOutputErrorCode
Enumerates the PreviewOutput error code.
**System capability**
: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| ERROR_UNKNOWN | -1 | Unknown error.|
## PreviewOutputError
Preview output error object which extends
**Error**
interface.
**System capability**
: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| code |
[
PreviewOutputErrorCode
](
#previewoutputerrorcode
)
| Used to get error code in PreviewOutput on('error') callback.|
## camera.createPhotoOutput
## camera.createPhotoOutput
createPhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput
\>
): void
createPhotoOutput(surfaceId: string, callback: AsyncCallback<PhotoOutput
\>
): void
...
@@ -2031,7 +2111,7 @@ Creates a **PhotoOutput** instance. This API uses an asynchronous callback to re
...
@@ -2031,7 +2111,7 @@ Creates a **PhotoOutput** instance. This API uses an asynchronous callback to re
**Example**
**Example**
```
```
camera.createPhotoOutput((
surfaceId
), (err, photoOutput) => {
camera.createPhotoOutput((
"surfaceId"
), (err, photoOutput) => {
if (err) {
if (err) {
console.error('Failed to create the PhotoOutput instance. ${err.message}');
console.error('Failed to create the PhotoOutput instance. ${err.message}');
return;
return;
...
@@ -2063,7 +2143,7 @@ Creates a **PhotoOutput** instance. This API uses a promise to return the instan
...
@@ -2063,7 +2143,7 @@ Creates a **PhotoOutput** instance. This API uses a promise to return the instan
**Example**
**Example**
```
```
camera.createPhotoOutput(
surfaceId
).then((photoOutput) => {
camera.createPhotoOutput(
"surfaceId"
).then((photoOutput) => {
console.log('Promise returned with PhotoOutput instance');
console.log('Promise returned with PhotoOutput instance');
})
})
```
```
...
@@ -2260,7 +2340,7 @@ Listens for photo capture start events. This API uses a callback to return the e
...
@@ -2260,7 +2340,7 @@ Listens for photo capture start events. This API uses a callback to return the e
**Example**
**Example**
```
```
photoOutput.on('captureStart', (captureId) => {
photoOutput.on('captureStart', (
err,
captureId) => {
console.log('photo capture stated, captureId : ' + captureId);
console.log('photo capture stated, captureId : ' + captureId);
})
})
```
```
...
@@ -2336,6 +2416,50 @@ photoOutput.on('error', (photoOutputError) => {
...
@@ -2336,6 +2416,50 @@ photoOutput.on('error', (photoOutputError) => {
})
})
```
```
### FrameShutterInfo
Frame shutter callback info which provides
**captureId**
&
**timestamp**
parameteres & indicates the frame shutter event.
**Parameteres**
| Name | Type | Mandatory| Description |
| :------- | :------------------------------- | :--- | :---------------------------------------- |
| captureId | number | Yes | Capture id.|
| timestamp | number | Yes | Timestamp for frame.
### CaptureEndInfo
Capture end info which provides
**captureId**
&
**frameCount**
parameteres & indicates the photo capture end event.
**Parameteres**
| Name | Type | Mandatory| Description |
| :------- | :------------------------------- | :--- | :---------------------------------------- |
| captureId | number | Yes | Capture id.|
| frameCount | number | Yes | Frame count.
## PhotoOutputErrorCode
Enumerates the PhotoOutput error code.
**System capability**
: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| ERROR_UNKNOWN | -1 | Unknown error.|
## PhotoOutputError
Photo output error object which extends
**Error**
interface.
**System capability**
: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| code |
[
PhotoOutputErrorCode
](
#photooutputerrorcode
)
| Used to get error code in PhotoOutput on('error') callback.|
## camera.createVideoOutput
## camera.createVideoOutput
createVideoOutput(surfaceId: string, callback: AsyncCallback<VideoOutput
\>
): void
createVideoOutput(surfaceId: string, callback: AsyncCallback<VideoOutput
\>
): void
...
@@ -2354,7 +2478,7 @@ Creates a **VideoOutput** instance. This API uses an asynchronous callback to re
...
@@ -2354,7 +2478,7 @@ Creates a **VideoOutput** instance. This API uses an asynchronous callback to re
**Example**
**Example**
```
```
camera.createVideoOutput((
surfaceId
), (err, videoOutput) => {
camera.createVideoOutput((
"surfaceId"
), (err, videoOutput) => {
if (err) {
if (err) {
console.error('Failed to create the VideoOutput instance. ${err.message}');
console.error('Failed to create the VideoOutput instance. ${err.message}');
return;
return;
...
@@ -2386,7 +2510,8 @@ Creates a **VideoOutput** instance. This API uses a promise to return the instan
...
@@ -2386,7 +2510,8 @@ Creates a **VideoOutput** instance. This API uses a promise to return the instan
**Example**
**Example**
```
```
camera.createVideoOutput(surfaceId).then((videoOutput) => {
camera.createVideoOutput("surfaceId"
).then((videoOutput) => {
console.log('Promise returned with the VideoOutput instance');
console.log('Promise returned with the VideoOutput instance');
})
})
```
```
...
@@ -2609,3 +2734,25 @@ videoOutput.on('error', (VideoOutputError) => {
...
@@ -2609,3 +2734,25 @@ videoOutput.on('error', (VideoOutputError) => {
console.log('Video output error code: ' + VideoOutputError.code);
console.log('Video output error code: ' + VideoOutputError.code);
})
})
```
```
## VideoOutputErrorCode
Enumerates the VideoOutput error code.
**System capability**
: SystemCapability.Multimedia.Camera.Core
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| ERROR_UNKNOWN | -1 | Unknown error.|
## VideoOutputError
Photo output error object which extends
**Error**
interface.
**System capability**
: SystemCapability.Multimedia.Camera.Core
**Parameters**
| Name | Default Value| Description |
| ---------------------- | ------ | ------------ |
| code |
[
VideoOutputErrorCode
](
#videooutputerrorcode
)
| Used to get error code in VideoOutput on('error') callback.|
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录