Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c814dcaa
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,发现更多精彩内容 >>
提交
c814dcaa
编写于
2月 08, 2022
作者:
B
bird_j
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modyfied bugs
Signed-off-by:
N
bird_j
<
jianghongpeng@huawei.com
>
上级
3fb6c598
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
44 addition
and
81 deletion
+44
-81
zh-cn/application-dev/media/audio-recorder.md
zh-cn/application-dev/media/audio-recorder.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-media.md
zh-cn/application-dev/reference/apis/js-apis-media.md
+42
-79
未找到文件。
zh-cn/application-dev/media/audio-recorder.md
浏览文件 @
c814dcaa
...
...
@@ -39,7 +39,7 @@
包含流程:创建实例,设置录制参数,录制音频,暂停录制,恢复录制,停止录制,释放资源等流程。
```
js
fun
fun
ction
SetCallBack
(
audioRecorder
)
{
function
SetCallBack
(
audioRecorder
)
{
audioRecorder
.
on
(
'
prepare
'
,
()
=>
{
// 设置'prepare'事件回调
console
.
log
(
'
prepare success
'
);
// 录制界面可切换至已准备好,可点击录制按钮进行录制
...
...
@@ -87,7 +87,7 @@ let audioRecorderConfig = {
uri
:
'
file:///data/accounts/account_0/appdata/appdata/recorder/test.m4a
'
,
// 文件需先由调用者创建,并给予适当的权限
location
:
{
latitude
:
30
,
longitude
:
130
},
}
audioRecorder
.
prepare
(
audioRecorderConfig
)
audioRecorder
.
prepare
(
audioRecorderConfig
)
;
// 4.开始录制
audioRecorder
.
start
();
// 需等待'prepare'事件回调完成后,才可调用start进行录制,触发'start'事件回调
// 5.暂停录制
...
...
zh-cn/application-dev/reference/apis/js-apis-media.md
浏览文件 @
c814dcaa
...
...
@@ -1078,18 +1078,12 @@ getInputSurface(callback: AsyncCallback\<string>): void;
```
js
// asyncallback
let
surfaceId
=
null
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
getInputSurface
'
,
()
=>
{
videoRecorder
.
getInputSurface
((
err
,
surfaceId
)
=>
{
videoRecorder
.
getInputSurface
((
err
,
surfaceId
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
getInputSurface success
'
);
}
else
{
console
.
info
(
'
getInputSurface failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
@@ -1113,7 +1107,6 @@ getInputSurface(): Promise\<string>;
```
js
// promise
let
surfaceId
=
null
;
await
videoRecorder
.
getInputSurface
().
then
((
surface
)
=>
{
console
.
info
(
'
getInputSurface success
'
);
surfaceId
=
surface
;
...
...
@@ -1142,17 +1135,12 @@ start(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
start
'
,
()
=>
{
videoRecorder
.
start
((
err
)
=>
{
videoRecorder
.
start
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
start videorecorder success
'
);
}
else
{
console
.
info
(
'
start videorecorder failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
@@ -1201,17 +1189,12 @@ pause(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
pause
'
,
()
=>
{
videoRecorder
.
pause
((
err
)
=>
{
videoRecorder
.
pause
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
pause videorecorder success
'
);
}
else
{
console
.
info
(
'
pause videorecorder failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
@@ -1258,17 +1241,12 @@ resume(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
resume
'
,
()
=>
{
videoRecorder
.
resume
((
err
)
=>
{
videoRecorder
.
resume
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
resume videorecorder success
'
);
}
else
{
console
.
info
(
'
resume videorecorder failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
@@ -1315,17 +1293,12 @@ stop(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
stop
'
,
()
=>
{
videoRecorder
.
stop
((
err
)
=>
{
videoRecorder
.
stop
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
stop videorecorder success
'
);
}
else
{
console
.
info
(
'
stop videorecorder failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
@@ -1372,17 +1345,12 @@ release(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
release
'
,
()
=>
{
videoRecorder
.
release
((
err
)
=>
{
videoRecorder
.
release
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
release videorecorder success
'
);
}
else
{
console
.
info
(
'
release videorecorder failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
@@ -1429,17 +1397,12 @@ reset(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
eventEmitter
.
on
(
'
reset
'
,
()
=>
{
videoRecorder
.
reset
((
err
)
=>
{
videoRecorder
.
reset
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
reset videorecorder success
'
);
}
else
{
console
.
info
(
'
reset videorecorder failed and error is
'
+
err
.
message
);
}
});
});
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录