Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
886ddf53
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
886ddf53
编写于
9月 01, 2023
作者:
S
shuboxu
提交者:
Gitee
9月 01, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-media.md.
Signed-off-by:
N
shuboxu
<
xushubo1@huawei.com
>
上级
b2defeb2
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
30 addition
and
31 deletion
+30
-31
zh-cn/application-dev/reference/apis/js-apis-media.md
zh-cn/application-dev/reference/apis/js-apis-media.md
+30
-31
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-media.md
浏览文件 @
886ddf53
...
...
@@ -122,9 +122,9 @@ createAVRecorder(callback: AsyncCallback\<AVRecorder>): void
**示例:**
```
js
let
avRecorder
;
let
avRecorder
:
media
.
AVRecorder
;
media
.
createAVRecorder
((
error
,
r
ecorder
)
=>
{
media
.
createAVRecorder
((
error
:
BusinessError
,
recorder
:
media
.
AVR
ecorder
)
=>
{
if
(
recorder
!=
null
)
{
avRecorder
=
recorder
;
console
.
info
(
'
createAVRecorder success
'
);
...
...
@@ -160,16 +160,16 @@ createAVRecorder(): Promise\<AVRecorder>
**示例:**
```
js
let
avRecorder
;
let
avRecorder
:
media
.
AVRecorder
;
media
.
createAVRecorder
().
then
((
recorder
)
=>
{
media
.
createAVRecorder
().
then
((
recorder
:
media
.
AVRecorder
)
=>
{
if
(
recorder
!=
null
)
{
avRecorder
=
recorder
;
console
.
info
(
'
createAVRecorder success
'
);
}
else
{
console
.
error
(
'
createAVRecorder fail
'
);
}
}).
catch
((
error
)
=>
{
}).
catch
((
error
:
Error
)
=>
{
console
.
error
(
`createAVRecorder catchCallback, error message:
${
error
.
message
}
`
);
});
```
...
...
@@ -1768,7 +1768,7 @@ prepare(config: AVRecorderConfig, callback: AsyncCallback\<void>): void
```
js
// 配置参数以实际硬件设备支持的范围为准
let
AVRecorderProfile
=
{
let
AVRecorderProfile
:
media
.
AVRecorderProfile
=
{
audioBitrate
:
48000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
...
...
@@ -1780,7 +1780,7 @@ let AVRecorderProfile = {
videoFrameHeight
:
480
,
videoFrameRate
:
30
}
let
AVRecorderConfig
=
{
let
AVRecorderConfig
:
media
.
AVRecorderConfig
=
{
audioSourceType
:
media
.
AudioSourceType
.
AUDIO_SOURCE_TYPE_MIC
,
videoSourceType
:
media
.
VideoSourceType
.
VIDEO_SOURCE_TYPE_SURFACE_YUV
,
profile
:
AVRecorderProfile
,
...
...
@@ -1789,7 +1789,7 @@ let AVRecorderConfig = {
location
:
{
latitude
:
30
,
longitude
:
130
}
}
avRecorder
.
prepare
(
AVRecorderConfig
,
(
err
)
=>
{
avRecorder
.
prepare
(
AVRecorderConfig
,
(
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
prepare success
'
);
}
else
{
...
...
@@ -1839,7 +1839,7 @@ prepare(config: AVRecorderConfig): Promise\<void>
```
js
// 配置参数以实际硬件设备支持的范围为准
let
AVRecorderProfile
=
{
let
AVRecorderProfile
:
media
.
AVRecorderProfile
=
{
audioBitrate
:
48000
,
audioChannels
:
2
,
audioCodec
:
media
.
CodecMimeType
.
AUDIO_AAC
,
...
...
@@ -1851,7 +1851,7 @@ let AVRecorderProfile = {
videoFrameHeight
:
480
,
videoFrameRate
:
30
}
let
AVRecorderConfig
=
{
let
AVRecorderConfig
:
media
.
AVRecorderConfig
=
{
audioSourceType
:
media
.
AudioSourceType
.
AUDIO_SOURCE_TYPE_MIC
,
videoSourceType
:
media
.
VideoSourceType
.
VIDEO_SOURCE_TYPE_SURFACE_YUV
,
profile
:
AVRecorderProfile
,
...
...
@@ -1862,10 +1862,9 @@ let AVRecorderConfig = {
avRecorder
.
prepare
(
AVRecorderConfig
).
then
(()
=>
{
console
.
info
(
'
prepare success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
prepare failed and catch error is
'
+
err
.
message
);
});
```
### getInputSurface<sup>9+</sup><a name=avrecorder_getinputsurface></a>
...
...
@@ -1899,9 +1898,9 @@ getInputSurface(callback: AsyncCallback\<string>): void
**示例:**
```
js
let
surfaceID
=
null
;
// 该surfaceID用于传递给相机接口创造videoOutput
let
surfaceID
:
string
;
// 该surfaceID用于传递给相机接口创造videoOutput
avRecorder
.
getInputSurface
((
err
,
surfaceId
)
=>
{
avRecorder
.
getInputSurface
((
err
:
BusinessError
,
surfaceId
:
string
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
getInputSurface success
'
);
surfaceID
=
surfaceId
;
...
...
@@ -1943,12 +1942,12 @@ getInputSurface(): Promise\<string>
**示例:**
```
js
let
surfaceID
=
null
;
// 该surfaceID用于传递给相机接口创造videoOutput
let
surfaceID
:
string
;
// 该surfaceID用于传递给相机接口创造videoOutput
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
avRecorder
.
getInputSurface
().
then
((
surfaceId
:
string
)
=>
{
console
.
info
(
'
getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
getInputSurface failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -1982,7 +1981,7 @@ start(callback: AsyncCallback\<void>): void
**示例:**
```
js
avRecorder
.
start
((
err
)
=>
{
avRecorder
.
start
((
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
start AVRecorder success
'
);
}
else
{
...
...
@@ -2022,7 +2021,7 @@ start(): Promise\<void>
```
js
avRecorder
.
start
().
then
(()
=>
{
console
.
info
(
'
start AVRecorder success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
start AVRecorder failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -2056,7 +2055,7 @@ pause(callback: AsyncCallback\<void>): void
**示例:**
```
js
avRecorder
.
pause
((
err
)
=>
{
avRecorder
.
pause
((
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
pause AVRecorder success
'
);
}
else
{
...
...
@@ -2096,7 +2095,7 @@ pause(): Promise\<void>
```
js
avRecorder
.
pause
().
then
(()
=>
{
console
.
info
(
'
pause AVRecorder success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
pause AVRecorder failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -2130,7 +2129,7 @@ resume(callback: AsyncCallback\<void>): void
**示例:**
```
js
avRecorder
.
resume
((
err
)
=>
{
avRecorder
.
resume
((
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
resume AVRecorder success
'
);
}
else
{
...
...
@@ -2170,7 +2169,7 @@ resume(): Promise\<void>
```
js
avRecorder
.
resume
().
then
(()
=>
{
console
.
info
(
'
resume AVRecorder success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
resume AVRecorder failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -2206,7 +2205,7 @@ stop(callback: AsyncCallback\<void>): void
**示例:**
```
js
avRecorder
.
stop
((
err
)
=>
{
avRecorder
.
stop
((
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
stop AVRecorder success
'
);
}
else
{
...
...
@@ -2248,7 +2247,7 @@ stop(): Promise\<void>
```
js
avRecorder
.
stop
().
then
(()
=>
{
console
.
info
(
'
stop AVRecorder success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
stop AVRecorder failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -2281,7 +2280,7 @@ reset(callback: AsyncCallback\<void>): void
**示例:**
```
js
avRecorder
.
reset
((
err
)
=>
{
avRecorder
.
reset
((
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
reset AVRecorder success
'
);
}
else
{
...
...
@@ -2320,7 +2319,7 @@ reset(): Promise\<void>
```
js
avRecorder
.
reset
().
then
(()
=>
{
console
.
info
(
'
reset AVRecorder success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
reset AVRecorder failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -2352,7 +2351,7 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```
js
avRecorder
.
release
((
err
)
=>
{
avRecorder
.
release
((
err
:
BusinessError
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
release AVRecorder success
'
);
}
else
{
...
...
@@ -2390,7 +2389,7 @@ release(): Promise\<void>
```
js
avRecorder
.
release
().
then
(()
=>
{
console
.
info
(
'
release AVRecorder success
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
Error
)
=>
{
console
.
error
(
'
release AVRecorder failed and catch error is
'
+
err
.
message
);
});
```
...
...
@@ -2413,7 +2412,7 @@ on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeRe
**示例:**
```
js
avRecorder
.
on
(
'
stateChange
'
,
async
(
state
,
r
eason
)
=>
{
avRecorder
.
on
(
'
stateChange
'
,
async
(
state
:
media
.
AVRecorderState
,
reason
:
media
.
StateChangeR
eason
)
=>
{
console
.
info
(
'
case state has changed, new state is :
'
+
state
+
'
,and new reason is :
'
+
reason
);
});
```
...
...
@@ -2467,7 +2466,7 @@ on(type: 'error', callback: ErrorCallback): void
**示例:**
```
js
avRecorder
.
on
(
'
error
'
,
(
err
)
=>
{
avRecorder
.
on
(
'
error
'
,
(
err
:
BusinessError
)
=>
{
console
.
error
(
'
case avRecorder.on(error) called, errMessage is
'
+
err
.
message
);
});
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录