Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
9069f3c4
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,发现更多精彩内容 >>
提交
9069f3c4
编写于
8月 29, 2022
作者:
B
bmeangel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update docs
Signed-off-by:
N
bmeangel
<
wangjiangying@huawei.com
>
上级
5b1b3b32
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
27 addition
and
40 deletion
+27
-40
zh-cn/application-dev/reference/apis/js-apis-media.md
zh-cn/application-dev/reference/apis/js-apis-media.md
+27
-40
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-media.md
浏览文件 @
9069f3c4
...
...
@@ -64,7 +64,7 @@ media.createVideoPlayer((error, video) => {
videoPlayer
=
video
;
console
.
info
(
'
video createVideoPlayer success
'
);
}
else
{
console
.
info
(
`video createVideoPlayer fail, error:
${
error
.
message
}
`
);
console
.
info
(
`video createVideoPlayer fail, error:
${
error
}
`
);
}
});
```
...
...
@@ -96,7 +96,7 @@ media.createVideoPlayer().then((video) => {
console
.
info
(
'
video createVideoPlayer fail
'
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -146,7 +146,7 @@ media.createVideoRecorder((error, video) => {
videoRecorder
=
video
;
console
.
info
(
'
video createVideoRecorder success
'
);
}
else
{
console
.
info
(
`video createVideoRecorder fail, error:
${
error
.
message
}
`
);
console
.
info
(
`video createVideoRecorder fail, error:
${
error
}
`
);
}
});
```
...
...
@@ -179,7 +179,7 @@ media.createVideoRecorder().then((video) => {
console
.
info
(
'
video createVideoRecorder fail
'
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -447,7 +447,7 @@ audioPlayer.getTrackDescription((error, arrlist) => {
printfDescription
(
arrlist
[
i
]);
}
}
else
{
console
.
log
(
`audio getTrackDescription fail, error:
${
error
.
message
}
`
);
console
.
log
(
`audio getTrackDescription fail, error:
${
error
}
`
);
}
});
```
...
...
@@ -484,7 +484,7 @@ audioPlayer.getTrackDescription().then((arrlist) => {
console
.
log
(
'
audio getTrackDescription fail
'
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`audio catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`audio catchCallback, error:
${
error
}
`
);
});
for
(
let
i
=
0
;
i
<
arrayDescription
.
length
;
i
++
)
{
...
...
@@ -569,9 +569,7 @@ audioPlayer.on('finish', () => { //设置'finish'事件回调
audioPlayer
.
stop
();
//停止播放,并触发'stop'事件回调
});
audioPlayer
.
on
(
'
error
'
,
(
error
)
=>
{
//设置'error'事件回调
console
.
info
(
`audio error called, errName is
${
error
.
name
}
`
);
console
.
info
(
`audio error called, errCode is
${
error
.
code
}
`
);
console
.
info
(
`audio error called, errMessage is
${
error
.
message
}
`
);
console
.
info
(
`audio error called, error:
${
error
}
`
);
});
// 用户选择视频设置fd(本地播放)
...
...
@@ -636,9 +634,7 @@ on(type: 'error', callback: ErrorCallback): void
```
js
audioPlayer
.
on
(
'
error
'
,
(
error
)
=>
{
//设置'error'事件回调
console
.
info
(
`audio error called, errName is
${
error
.
name
}
`
);
//打印错误类型名称
console
.
info
(
`audio error called, errCode is
${
error
.
code
}
`
);
//打印错误码
console
.
info
(
`audio error called, errMessage is
${
error
.
message
}
`
);
//打印错误类型详细描述
console
.
info
(
`audio error called, error:
${
error
}
`
);
});
audioPlayer
.
setVolume
(
3
);
//设置volume为无效值,触发'error'事件
```
...
...
@@ -762,7 +758,7 @@ setDisplaySurface(surfaceId: string): Promise\<void>
videoPlayer
.
setDisplaySurface
(
surfaceId
).
then
(()
=>
{
console
.
info
(
'
setDisplaySurface success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -812,7 +808,7 @@ prepare(): Promise\<void>
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
prepare success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -862,7 +858,7 @@ play(): Promise\<void>;
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
play success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -912,7 +908,7 @@ pause(): Promise\<void>
videoPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
pause success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -962,7 +958,7 @@ stop(): Promise\<void>
videoPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
stop success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1012,7 +1008,7 @@ reset(): Promise\<void>
videoPlayer
.
reset
().
then
(()
=>
{
console
.
info
(
'
reset success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1103,13 +1099,13 @@ let seekTime = 5000;
videoPlayer
.
seek
(
seekTime
).
then
((
seekDoneTime
)
=>
{
// seekDoneTime表示seek完成后的时间点
console
.
info
(
'
seek success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
videoPlayer
.
seek
(
seekTime
,
seekMode
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
seek success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1168,7 +1164,7 @@ let vol = 0.5;
videoPlayer
.
setVolume
(
vol
).
then
()
=>
{
console
.
info
(
'
setVolume success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1218,7 +1214,7 @@ release(): Promise\<void>
videoPlayer
.
release
().
then
()
=>
{
console
.
info
(
'
release success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1253,7 +1249,7 @@ videoPlayer.getTrackDescription((error, arrlist) => {
printfDescription
(
arrlist
[
i
]);
}
}
else
{
console
.
log
(
`video getTrackDescription fail, error:
${
error
.
message
}
`
);
console
.
log
(
`video getTrackDescription fail, error:
${
error
}
`
);
}
});
```
...
...
@@ -1291,7 +1287,7 @@ videoPlayer.getTrackDescription().then((arrlist) => {
console
.
log
(
'
video getTrackDescription fail
'
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
for
(
let
i
=
0
;
i
<
arrayDescription
.
length
;
i
++
)
{
printfDescription
(
arrayDescription
[
i
]);
...
...
@@ -1357,7 +1353,7 @@ let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X;
videoPlayer
.
setSpeed
(
speed
).
then
()
=>
{
console
.
info
(
'
setSpeed success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1416,7 +1412,7 @@ let bitrate = 1024000;
videoPlayer
.
selectBitrate
(
bitrate
).
then
()
=>
{
console
.
info
(
'
selectBitrate success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
.
message
}
`
);
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
```
...
...
@@ -1533,9 +1529,7 @@ on(type: 'error', callback: ErrorCallback): void
```
js
videoPlayer
.
on
(
'
error
'
,
(
error
)
=>
{
// 设置'error'事件回调
console
.
info
(
`video error called, errName is
${
error
.
name
}
`
);
// 打印错误类型名称
console
.
info
(
`video error called, errCode is
${
error
.
code
}
`
);
// 打印错误码
console
.
info
(
`video error called, errMessage is
${
error
.
message
}
`
);
// 打印错误类型详细描述
console
.
info
(
`video error called, error:
${
error
}
`
);
});
videoPlayer
.
url
=
'
fd://error
'
;
//设置错误的播放地址,触发'error'事件
```
...
...
@@ -1644,7 +1638,7 @@ audioPlayer.getTrackDescription((error, arrlist) => {
printfItemDescription
(
arrlist
[
i
],
MD_KEY_TRACK_TYPE
);
//打印出每条轨道MD_KEY_TRACK_TYPE的值
}
}
else
{
console
.
log
(
`audio getTrackDescription fail, error:
${
error
.
message
}
`
);
console
.
log
(
`audio getTrackDescription fail, error:
${
error
}
`
);
}
});
```
...
...
@@ -1824,9 +1818,7 @@ let audioRecorderConfig = {
location
:
{
latitude
:
30
,
longitude
:
130
},
}
audioRecorder
.
on
(
'
error
'
,
(
error
)
=>
{
// 设置'error'事件回调
console
.
info
(
`audio error called, errName is
${
error
.
name
}
`
);
console
.
info
(
`audio error called, errCode is
${
error
.
code
}
`
);
console
.
info
(
`audio error called, errMessage is
${
error
.
message
}
`
);
console
.
info
(
`audio error called, error:
${
error
}
`
);
});
audioRecorder
.
on
(
'
prepare
'
,
()
=>
{
// 设置'prepare'事件回调
console
.
log
(
'
prepare success
'
);
...
...
@@ -1872,9 +1864,7 @@ on(type: 'error', callback: ErrorCallback): void
```
js
audioRecorder
.
on
(
'
error
'
,
(
error
)
=>
{
// 设置'error'事件回调
console
.
info
(
`audio error called, errName is
${
error
.
name
}
`
);
// 打印错误类型名称
console
.
info
(
`audio error called, errCode is
${
error
.
code
}
`
);
// 打印错误码
console
.
info
(
`audio error called, errMessage is
${
error
.
message
}
`
);
// 打印错误类型详细描述
console
.
info
(
`audio error called, error:
${
error
}
`
);
});
audioRecorder
.
prepare
();
// prepare不设置参数,触发'error'事件
```
...
...
@@ -2492,10 +2482,7 @@ on(type: 'error', callback: ErrorCallback): void
```
js
videoRecorder
.
on
(
'
error
'
,
(
error
)
=>
{
// 设置'error'事件回调
console
.
info
(
`audio error called, errName is
${
error
.
name
}
`
);
// 打印错误类型名称
console
.
info
(
`audio error called, errCode is
${
error
.
code
}
`
);
// 打印错误码
console
.
info
(
`audio error called, errMessage is
${
error
.
message
}
`
);
// 打印错误类型详细描述
});
console
.
info
(
`audio error called, error:
${
error
}
`
);
// 当获取videoRecordState接口出错时通过此订阅事件上报
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录