Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
092101b5
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看板
提交
092101b5
编写于
10月 14, 2022
作者:
J
jiangminyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed d.ts.
Signed-off-by:
N
jiangminyang
<
jiangminyang@huawei.com
>
上级
7e09b86e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
204 addition
and
200 deletion
+204
-200
zh-cn/application-dev/reference/apis/js-apis-camera.md
zh-cn/application-dev/reference/apis/js-apis-camera.md
+204
-200
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-camera.md
浏览文件 @
092101b5
...
@@ -250,7 +250,7 @@ cameraManager.getSupportedMetadataObjectType((err, metadataobject) => {
...
@@ -250,7 +250,7 @@ cameraManager.getSupportedMetadataObjectType((err, metadataobject) => {
### getSupportedMetadataObjectType
### getSupportedMetadataObjectType
getSupportedMetadataObjectType(): Promise<
CameraOutputCapability
\>
getSupportedMetadataObjectType(): Promise
<
Array
<
MetadataObjectType
>
\>
查询相机设备支持的元能力信息,通过Promise获取结果。
查询相机设备支持的元能力信息,通过Promise获取结果。
...
@@ -543,7 +543,7 @@ cameraManager.createPhotoOutput(profile, surfaceId, (err, photooutput) => {
...
@@ -543,7 +543,7 @@ cameraManager.createPhotoOutput(profile, surfaceId, (err, photooutput) => {
### createPhotoOutput
### createPhotoOutput
createPhotoOutput(profile: Profile, surfaceId: string): Promise<P
review
Output
\>
createPhotoOutput(profile: Profile, surfaceId: string): Promise<P
hoto
Output
\>
创建拍照输出对象,通过Promise获取结果。
创建拍照输出对象,通过Promise获取结果。
...
@@ -655,7 +655,7 @@ cameraManager.createMetadataOutput((err, metadataoutput) => {
...
@@ -655,7 +655,7 @@ cameraManager.createMetadataOutput((err, metadataoutput) => {
### createMetadataOutput
### createMetadataOutput
createMetadataOutput(): Promise
<MetadataOutput>
createMetadataOutput(): Promise<MetadataOutput
\
>
创建metadata流输出对象,通过Promise获取结果。
创建metadata流输出对象,通过Promise获取结果。
...
@@ -751,37 +751,6 @@ cameraManager.on('cameraStatus', (err, cameraStatusInfo) => {
...
@@ -751,37 +751,6 @@ cameraManager.on('cameraStatus', (err, cameraStatusInfo) => {
})
})
```
```
### on('cameraMute')
on(type: 'cameraMute', callback: AsyncCallback<boolean
\>
): void
监听相机禁用的状态变化,通过注册回调函数获取相机的状态变化。
此接口为系统接口。
**需要权限:**
ohos.permission.CAMERA
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------- | ---- | ------------------------------- |
| type | string | 是 | 监听事件,固定为'cameraMute',即相机状禁用态变化事件。 |
| callback | AsyncCallback<boolean
\>
| 是 | 回调函数,用于获取相机是否禁用。 |
**示例:**
```
js
cameraManager
.
on
(
'
cameraMute
'
,
(
err
,
status
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get cameraMute callback.
${
err
.
message
}
`
);
return
;
}
console
.
log
(
`status:
${
status
}
`
);
})
```
## CameraStatusInfo
## CameraStatusInfo
相机管理器回调返回的接口实例,表示相机状态信息。
相机管理器回调返回的接口实例,表示相机状态信息。
...
@@ -1264,61 +1233,6 @@ captureSession.commitConfig().then(() => {
...
@@ -1264,61 +1233,6 @@ captureSession.commitConfig().then(() => {
})
})
```
```
### canAddInput
canAddInput(cameraInput: CameraInput, callback: AsyncCallback<boolean
\>
): void
判断是否可以添加
[
CameraInput
](
#camerainput
)
到会话中,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ------------------------ |
| cameraInput |
[
CameraInput
](
#camerainput
)
| 是 | 需要添加的CameraInput实例。 |
| callback | AsyncCallback<boolean
\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
```
js
captureSession
.
canAddInput
(
cameraInput
,
(
err
,
status
)
=>
{
if
(
err
)
{
console
.
error
(
`Can not add cameraInput.
${
err
.
message
}
`
);
return
;
}
console
.
log
(
'
Callback returned with cameraInput can added.
'
);
})
```
### canAddInput
canAddInput(cameraInput: CameraInput): Promise<boolean
\>
判断是否可以添加
[
CameraInput
](
#camerainput
)
到会话中,通过注Promise获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ----------- | --------------------------- | ---- | ------------------------ |
| cameraInput |
[
CameraInput
](
#camerainput
)
| 是 | 需要添加的CameraInput实例。 |
**返回值:**
| 类型 | 说明 |
| -------------- | -------------------------- |
| Promise<boolean
\>
| 使用Promise的方式获取结果。 |
**示例:**
```
js
captureSession
.
canAddInput
(
cameraInput
).
then
(()
=>
{
console
.
log
(
'
Promise returned with cameraInput can added.
'
);
})
```
### addInput
### addInput
addInput
\(
cameraInput: CameraInput, callback: AsyncCallback<void
\>\)
: void
addInput
\(
cameraInput: CameraInput, callback: AsyncCallback<void
\>\)
: void
...
@@ -1429,63 +1343,6 @@ captureSession.removeInput(cameraInput).then(() => {
...
@@ -1429,63 +1343,6 @@ captureSession.removeInput(cameraInput).then(() => {
})
})
```
```
### canAddOutput
canAddOutput(cameraOutput: CameraOutput, callback: AsyncCallback<boolean
\>\)
: void
查询是否可以添加
[
CameraOutput
](
#cameraoutput
)
到会话中,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ------------- | ------------------------------- | ---- | ------------------------- |
| cameraOutput |
[
CameraOutput
](
#cameraoutput
)
| 是 | 需要添加的CameraOutput实例。 |
| callback | AsyncCallback<boolean
\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
```
js
captureSession
.
canAddOutput
(
cameraOutput
,
(
err
,
status
)
=>
{
if
(
err
)
{
console
.
error
(
`Can not add cameraOutput.
${
err
.
message
}
`
);
return
;
}
console
.
log
(
'
Callback returned with cameraOutput can added.
'
);
})
```
### canAddOutput
canAddOutput(cameraOutput: CameraOutput): Promise<boolean
\>
查询是否可以添加
[
CameraOutput
](
#cameraoutput
)
到会话中,通过Promise获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ------------- | ------------------------------- | ---- | ------------------------- |
| cameraOutput |
[
CameraOutput
](
#cameraoutput
)
| 是 | 需要添加的CameraOutput实例。 |
**返回值:**
| 类型 | 说明 |
| -------------- | --------------------------- |
| Promise<boolean
\>
| 使用Promise的方式获取结果。 |
**示例:**
```
js
captureSession
.
canAddOutput
(
cameraOutput
).
then
(()
=>
{
console
.
log
(
'
Promise returned with cameraOutput can added.
'
);
})
```
### addOutput
### addOutput
addOutput
\(
cameraOutput: CameraOutput, callback: AsyncCallback<void
\>\)
: void
addOutput
\(
cameraOutput: CameraOutput, callback: AsyncCallback<void
\>\)
: void
...
@@ -2206,110 +2063,99 @@ cameraInput.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED).then(() =>
...
@@ -2206,110 +2063,99 @@ cameraInput.setExposureMode(camera.ExposureMode.EXPOSURE_MODE_LOCKED).then(() =>
})
})
```
```
### get
Metering
Point
### get
Exposure
Point
get
Metering
Point(callback: AsyncCallback<Point
\>
): void
get
Exposure
Point(callback: AsyncCallback<Point
\>
): void
查询曝光区域中心点,通过注册回调函数获取结果。(该接口目前为预留)
获取曝光中心点,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
**参数:**
| 名称
| 类型 | 必填 | 说明
|
| 名称
| 类型 | 必填 | 说明
|
| -------- | -------------------------------| ---- | -----------------------
-
|
| -------- | -------------------------------| ---- | ----------------------- |
| callback | AsyncCallback<
[
Point
](
#point
)
\>
| 是 | 回调函数,用于获取当前曝光点
。 |
| callback | AsyncCallback<
Point
\>
| 是 | 回调函数,用于获取设置结果
。 |
**示例:**
**示例:**
```
js
```
js
cameraInput
.
get
MeteringPoint
((
err
,
exposurePoint
)
=>
{
cameraInput
.
get
ExposurePoint
((
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
`Failed to get the
current exposure point
${
err
.
message
}
`
);
console
.
log
(
`Failed to get the
exposurePoint mode
${
err
.
message
}
`
);
return
;
return
;
}
}
console
.
log
(
`Callback returned with current exposure point:
${
exposurePoint
}
`
);
console
.
log
(
'
Callback returned with the successful execution of getExposurePoint
'
);
})
})
```
```
### get
Metering
Point
### get
Exposure
Point
get
Metering
Point(): Promise<Point
\>
get
Exposure
Point(): Promise<Point
\>
查询曝光区域中心点,通过Promise获取结果。(该接口目前为预留)
获取曝光中心点,通过Promise获取结果。。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**返回值:**
**返回值:**
| 名称
| 说明
|
| 名称
| 说明
|
| -----------------
-------- |-
---------------------------- |
| -----------------
|
---------------------------- |
| Promise<
[
Point
](
#point
)
\>
| 使用Promise的方式获取当前曝光点
。 |
| Promise<
Point
\>
| 使用Promise的方式获取设置结果
。 |
**示例:**
**示例:**
```
js
```
js
cameraInput
.
get
MeteringPoint
().
then
((
exposurePoint
)
=>
{
cameraInput
.
get
ExposurePoint
().
then
((
)
=>
{
console
.
log
(
`Promise returned with current exposure point :
${
exposurePoint
}
`
);
console
.
log
(
'
Promise returned with the successful execution of getExposurePoint.
'
);
})
})
```
```
### set
Metering
Point
### set
Exposure
Point
set
MeteringPoint(point: Point, callback: AsyncCallback<point
\>
): void
set
ExposurePoint(exposurePoint: Point, callback: AsyncCallback<void
\>
): void
设置曝光区域中心点,通过注册回调函数获取结果。(该接口目前为预留)
获取曝光中心点,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| ------------- | -------------------------------| ---- | ------------------- |
| -------- | -------------------------------| ---- | ----------------------- |
| exposurePoint |
[
Point
](
#point
)
| 是 | 曝光点。 |
| callback | AsyncCallback<void
\>
| 是 | 回调函数,用于获取设置结果。 |
| callback | AsyncCallback<void
\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
**示例:**
```
js
```
js
const
Point1
=
{
x
:
1
,
y
:
1
};
cameraInput
.
setExposurePoint
(
point
,
(
err
)
=>
{
cameraInput
.
setMeteringPoint
(
Point1
,(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
`Failed to set the exposure
point
${
err
.
message
}
`
);
console
.
log
(
`Failed to set the exposure
Point mode
${
err
.
message
}
`
);
return
;
return
;
}
}
console
.
log
(
'
Callback returned with the successful execution of set
Metering
Point
'
);
console
.
log
(
'
Callback returned with the successful execution of set
Exposure
Point
'
);
})
})
```
```
### set
Metering
Point
### set
Exposure
Point
set
MeteringPoint(p
oint: Point): Promise<void
\>
set
ExposurePoint(exposureP
oint: Point): Promise<void
\>
设置曝光区域中心点,通过Promise获取结果。(该接口目前为预留)
获取曝光中心点,通过Promise获取结果。。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| ------------- | -------------------------------| ---- | ------------------- |
| exposurePoint |
[
Point
](
#point
)
| 是 | 曝光点。 |
**返回值:**
**返回值:**
| 名称 | 说明 |
| 名称 | 说明
|
| ----------------- |------------------------ |
| ----------------- |------------------------
----
|
| Promise<void
\>
| 使用Promise的方式
返回
结果。 |
| Promise<void
\>
| 使用Promise的方式
获取设置
结果。 |
**示例:**
**示例:**
```
js
```
js
const
Point2
=
{
x
:
2
,
y
:
2
};
cameraInput
.
setExposurePoint
(
point
).
then
(()
=>
{
console
.
log
(
'
Promise returned with the successful execution of setExposurePoint.
'
);
cameraInput
.
setMeteringPoint
(
Point2
).
then
(()
=>
{
console
.
log
(
'
Promise returned with the successful execution of setMeteringPoint
'
);
})
})
```
```
...
@@ -3711,6 +3557,61 @@ captureSession.isMirrorSupported().then((isSupported) => {
...
@@ -3711,6 +3557,61 @@ captureSession.isMirrorSupported().then((isSupported) => {
})
})
```
```
### setMirror
setMirror(mirror: boolean, callback: AsyncCallback<void
\>
): void
设置镜像,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------------- |
| mirror | boolean | 是 | 是否设置镜像。 |
| callback | AsyncCallback<void
\>
| 是 | 回调函数。 |
**示例:**
```
js
captureSession
.
setMirror
(
true
,
(
err
,
isSupported
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to set mirror
${
err
.
message
}
`
);
return
;
}
console
.
log
(
'
Callback returned with the successful execution of setMirror.
'
);
})
```
### setMirror
setMirror(mirror: boolean): Promise<void
\>
设置镜像,通过Promise获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | -------------------------- |
| mirror | boolean | 是 | 是否设置镜像。 |
**返回值:**
| 类型 | 说明 |
| ----------------- | ------------------------------------------- |
| Promise<void
\>
| 使用Promise的方式获取结果,返回是否设置镜像 。 |
**示例:**
```
js
captureSession
.
setMirror
(
true
).
then
((
isSupported
)
=>
{
console
.
log
(
`Promise returned with setMirror:
${
isSupported
}
`
);
})
```
### on('captureStart')
### on('captureStart')
on(type: 'captureStart', callback: AsyncCallback<number
\>
): void
on(type: 'captureStart', callback: AsyncCallback<number
\>
): void
...
@@ -3953,7 +3854,7 @@ videoOutput.stop().then(() => {
...
@@ -3953,7 +3854,7 @@ videoOutput.stop().then(() => {
### getFrameRateRange
### getFrameRateRange
getFrameRateRange(callback: AsyncCallback
<Array
<
number
>
\>
): void
getFrameRateRange(callback: AsyncCallback<Array<number
\
>\>
): void
获取帧率范围,通过注册回调函数获取结果。
获取帧率范围,通过注册回调函数获取结果。
...
@@ -3963,7 +3864,7 @@ getFrameRateRange(callback: AsyncCallback<Array<number>\>): void
...
@@ -3963,7 +3864,7 @@ getFrameRateRange(callback: AsyncCallback<Array<number>\>): void
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ |
| -------- | -------------------- | ---- | ------------------------ |
| callback | AsyncCallback
<Array
<
number
>
\>
| 是 | 回调函数,用于获取结果。 |
| callback | AsyncCallback<Array<number
\
>\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
**示例:**
...
@@ -3979,7 +3880,7 @@ videoOutput.getFrameRateRange((err) => {
...
@@ -3979,7 +3880,7 @@ videoOutput.getFrameRateRange((err) => {
### getFrameRateRange
### getFrameRateRange
getFrameRateRange(): Promise
<Array
<
number
>
\>
getFrameRateRange(): Promise
<Array
\
<
number
>
\>
获取帧率范围,通过Promise获取结果。
获取帧率范围,通过Promise获取结果。
...
@@ -4001,7 +3902,7 @@ videoOutput.getFrameRateRange().then(() => {
...
@@ -4001,7 +3902,7 @@ videoOutput.getFrameRateRange().then(() => {
### setFrameRateRange
### setFrameRateRange
setFrameRateRange(minFrameRate: number, maxFrameRate: number, callback: AsyncCallback
<Array
<
number
>
\>
): void
setFrameRateRange(minFrameRate: number, maxFrameRate: number, callback: AsyncCallback<Array<number
\
>\>
): void
获取帧率范围,通过注册回调函数获取结果。
获取帧率范围,通过注册回调函数获取结果。
...
@@ -4013,7 +3914,7 @@ setFrameRateRange(minFrameRate: number, maxFrameRate: number, callback: AsyncCal
...
@@ -4013,7 +3914,7 @@ setFrameRateRange(minFrameRate: number, maxFrameRate: number, callback: AsyncCal
| ------------ | ----------------------------- | ---- | ------------------- |
| ------------ | ----------------------------- | ---- | ------------------- |
| minFrameRate | number | 是 | 最小帧率。 |
| minFrameRate | number | 是 | 最小帧率。 |
| maxFrameRate | number | 是 | 最大帧率。 |
| maxFrameRate | number | 是 | 最大帧率。 |
| callback | AsyncCallback
<Array
<
number
>
\>
| 是 | 回调函数,用于获取结果。 |
| callback | AsyncCallback<Array<number
\
>\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
**示例:**
...
@@ -4029,7 +3930,7 @@ videoOutput.setFrameRateRange(minFrameRate, maxFrameRate,(err) => {
...
@@ -4029,7 +3930,7 @@ videoOutput.setFrameRateRange(minFrameRate, maxFrameRate,(err) => {
### setFrameRateRange
### setFrameRateRange
setFrameRateRange(minFrameRate: number, maxFrameRate: number): Promise
<Array
<
number
>
\>
setFrameRateRange(minFrameRate: number, maxFrameRate: number): Promise<Array<number
\
>\>
获取帧率范围,通过Promise获取结果。
获取帧率范围,通过Promise获取结果。
...
@@ -4046,7 +3947,7 @@ setFrameRateRange(minFrameRate: number, maxFrameRate: number): Promise<Array<num
...
@@ -4046,7 +3947,7 @@ setFrameRateRange(minFrameRate: number, maxFrameRate: number): Promise<Array<num
| 类型 | 说明 |
| 类型 | 说明 |
| -------------- | ----------------------- |
| -------------- | ----------------------- |
| Promise
<Array
<
number
>
\>
| 使用Promise的方式获取结果。 |
| Promise<Array<number
\
>\>
| 使用Promise的方式获取结果。 |
**示例:**
**示例:**
...
@@ -4154,7 +4055,7 @@ videoOutput.on('error', (VideoOutputError) => {
...
@@ -4154,7 +4055,7 @@ videoOutput.on('error', (VideoOutputError) => {
| 名称 | 值 | 说明 |
| 名称 | 值 | 说明 |
| ------------------------- | ---- | ----------------- |
| ------------------------- | ---- | ----------------- |
| FACE
_DETECTION
| 0 | metadata对象类型。 |
| FACE
| 0 | metadata对象类型。 |
## Rect
## Rect
...
@@ -4325,6 +4226,109 @@ metadata的人脸对象。继承[MetadataObject](#metadataobject)
...
@@ -4325,6 +4226,109 @@ metadata的人脸对象。继承[MetadataObject](#metadataobject)
metadata流。继承
[
CameraOutput
](
#cameraoutput
)
metadata流。继承
[
CameraOutput
](
#cameraoutput
)
### getSupportedMetadataObjectTypes
getSupportedMetadataObjectTypes(callback: AsyncCallback<Array<MetadataObjectType
\>\>
): void
获取支持的metadata对象类型,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ------------------- |
| callback | AsyncCallback<Array<
[
MetadataObjectType
](
#metadataobjecttype
)
\>\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
```
js
metadataOutput
.
getSupportedMetadataObjectTypes
(
metadataobjecttype
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get supportedMetadataObjectTypes.
${
err
.
message
}
`
);
return
;
}
console
.
log
(
'
Callback returned with getSupportedMetadataObjectTypes started.
'
);
})
```
### getSupportedMetadataObjectTypes
getSupportedMetadataObjectTypes(): Promise<Array<MetadataObjectType
\>\>
获取支持的metadata对象类型,通过Promise获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------------------ | ------------------------ |
| Promise<<Array<
[
MetadataObjectType
](
#metadataobjecttype
)
\>
| 使用Promise的方式获取结果。 |
**示例:**
```
js
metadataOutput
.
getSupportedMetadataObjectTypes
(
metadataobjecttype
).
then
(()
=>
{
console
.
log
(
'
Callback returned with getSupportedMetadataObjectTypes started.
'
);
})
```
### setCapturingMetadataObjectTypes
setCapturingMetadataObjectTypes(metadataObjectTypes: Array<MetadataObjectType
\>
, callback: AsyncCallback<void
\>
): void
设置的metadata类型,通过注册回调函数获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ------------------- |
| metadataObjectTypes | Array<
[
MetadataObjectType
](
#metadataobjecttype
)
\>
| 是 | 回调函数,用于获取结果。 |
| callback | AsyncCallback<void
\>
| 是 | 回调函数,用于获取结果。 |
**示例:**
```
js
metadataOutput
.
setCapturingMetadataObjectTypes
(
metadataobjecttype
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to set capturingMetadataObjectTypes.
${
err
.
message
}
`
);
return
;
}
console
.
log
(
'
Callback returned with setCapturingMetadataObjectTypes started.
'
);
})
```
### setCapturingMetadataObjectTypes
setCapturingMetadataObjectTypes(metadataObjectTypes: Array<MetadataObjectType
\>
): Promise<void
\>
设置的metadata类型,通过Promise获取结果。
**系统能力:**
SystemCapability.Multimedia.Camera.Core
**参数:**
| 名称 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | ------------------- |
| metadataObjectTypes | Array<
[
MetadataObjectType
](
#metadataobjecttype
)
\>
| 是 | 回调函数,用于获取结果。 |
**返回值:**
| 类型 | 说明 |
| ---------------------- | ------------------------ |
| Promise<void
\>
| 使用Promise的方式获取结果。 |
**示例:**
```
js
metadataOutput
.
setCapturingMetadataObjectTypes
(
metadataobjecttype
).
then
(()
=>
{
console
.
log
(
'
Callback returned with setCapturingMetadataObjectTypes started.
'
);
})
```
### start
### start
start(callback: AsyncCallback<void
\>
): void
start(callback: AsyncCallback<void
\>
): void
...
@@ -4446,7 +4450,7 @@ metadataOutput.on('metadataObjectsAvailable', (metadataObject) => {
...
@@ -4446,7 +4450,7 @@ metadataOutput.on('metadataObjectsAvailable', (metadataObject) => {
### on('error')
### on('error')
on(t
u
ype: 'error', callback: ErrorCallback<MetadataOutputError
\>
): void
on(type: 'error', callback: ErrorCallback<MetadataOutputError
\>
): void
监听metadata流的错误,通过注册回调函数获取结果。
监听metadata流的错误,通过注册回调函数获取结果。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录