Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
310d19e0
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看板
未验证
提交
310d19e0
编写于
9月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!10034 媒体子系统资料问题修改
Merge pull request !10034 from FULIZHONG/0927ziliao
上级
58ca7cc4
89c34737
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
41 deletion
+13
-41
zh-cn/application-dev/reference/apis/js-apis-media.md
zh-cn/application-dev/reference/apis/js-apis-media.md
+13
-41
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-media.md
浏览文件 @
310d19e0
...
...
@@ -441,7 +441,7 @@ function printfDescription(obj) {
}
}
audioPlayer
.
getTrackDescription
((
error
,
)
=>
{
audioPlayer
.
getTrackDescription
((
error
,
arrlist
)
=>
{
if
(
arrlist
!=
null
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
printfDescription
(
arrlist
[
i
]);
...
...
@@ -1794,7 +1794,7 @@ on(type: 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset'
```
js
let
audioRecorder
=
media
.
createAudioRecorder
();
// 创建一个音频录制实例
let
audioRecorderConfig
=
{
audioEncoder
:
media
.
AudioEncoder
.
AAC_LC
,
,
audioEncoder
:
media
.
AudioEncoder
.
AAC_LC
,
audioEncodeBitRate
:
22050
,
audioSampleRate
:
22050
,
numberOfChannels
:
2
,
...
...
@@ -1849,7 +1849,7 @@ on(type: 'error', callback: ErrorCallback): void
```
js
let
audioRecorderConfig
=
{
audioEncoder
:
media
.
AudioEncoder
.
AAC_LC
,
,
audioEncoder
:
media
.
AudioEncoder
.
AAC_LC
,
audioEncodeBitRate
:
22050
,
audioSampleRate
:
22050
,
numberOfChannels
:
2
,
...
...
@@ -1973,29 +1973,13 @@ let videoConfig = {
}
// asyncallback
let
videoRecorder
=
null
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
prepare
'
,
()
=>
{
videoRecorder
.
prepare
(
videoConfig
,
(
err
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
prepare success
'
);
}
else
{
console
.
info
(
'
prepare failed and error is
'
+
err
.
message
);
}
});
});
media
.
createVideoRecorder
((
err
,
recorder
)
=>
{
if
(
err
==
null
&&
recorder
!=
null
)
{
videoRecorder
=
recorder
;
console
.
info
(
'
createVideoRecorder success
'
);
eventEmitter
.
emit
(
'
prepare
'
);
// prepare事件触发
videoRecorder
.
prepare
(
videoConfig
,
(
err
)
=>
{
if
(
err
==
null
)
{
console
.
info
(
'
prepare success
'
);
}
else
{
console
.
info
(
'
createVideoRecorder
failed and error is
'
+
err
.
message
);
console
.
info
(
'
prepare
failed and error is
'
+
err
.
message
);
}
})
;
})
```
### prepare<sup>9+</sup><a name=videorecorder_prepare2></a>
...
...
@@ -2046,21 +2030,10 @@ let videoConfig = {
}
// promise
let
videoRecorder
=
null
;
media
.
createVideoRecorder
().
then
((
recorder
)
=>
{
if
(
recorder
!=
null
)
{
videoRecorder
=
recorder
;
console
.
info
(
'
createVideoRecorder success
'
);
videoRecorder
.
prepare
(
videoConfig
).
then
(()
=>
{
console
.
info
(
'
prepare success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
prepare failed and catch error is
'
+
err
.
message
);
});
}
else
{
console
.
info
(
'
createVideoRecorder failed
'
);
}
videoRecorder
.
prepare
(
videoConfig
).
then
(()
=>
{
console
.
info
(
'
prepare success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
catch err error message
is
'
+
err
.
message
);
console
.
info
(
'
prepare failed and catch error
is
'
+
err
.
message
);
});
```
...
...
@@ -2474,11 +2447,10 @@ on(type: 'error', callback: ErrorCallback): void
**示例:**
```
js
// 当获取videoRecordState接口出错时通过此订阅事件上报
videoRecorder
.
on
(
'
error
'
,
(
error
)
=>
{
// 设置'error'事件回调
console
.
info
(
`audio error called, error:
${
error
}
`
);
}
// 当获取videoRecordState接口出错时通过此订阅事件上报
});
})
```
## VideoRecordState<sup>9+</sup>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录