Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
296f3059
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,发现更多精彩内容 >>
未验证
提交
296f3059
编写于
8月 22, 2022
作者:
Z
zengyawen
提交者:
Gitee
8月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-media.md.
Signed-off-by:
N
zengyawen
<
zengyawen1@huawei.com
>
上级
76cdc343
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
34 addition
and
34 deletion
+34
-34
zh-cn/application-dev/reference/apis/js-apis-media.md
zh-cn/application-dev/reference/apis/js-apis-media.md
+34
-34
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-media.md
浏览文件 @
296f3059
...
...
@@ -60,7 +60,7 @@ createVideoPlayer(callback: AsyncCallback\<[VideoPlayer](#videoplayer8)>): void
let
videoPlayer
media
.
createVideoPlayer
((
error
,
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
if
(
video
!=
null
)
{
videoPlayer
=
video
;
console
.
info
(
'
video createVideoPlayer success
'
);
}
else
{
...
...
@@ -89,7 +89,7 @@ createVideoPlayer(): Promise<[VideoPlayer](#videoplayer8)>
let
videoPlayer
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
if
(
video
!=
null
)
{
videoPlayer
=
video
;
console
.
info
(
'
video createVideoPlayer success
'
);
}
else
{
...
...
@@ -142,7 +142,7 @@ createVideoRecorder(callback: AsyncCallback\<[VideoRecorder](#videorecorder9)>):
let
videoRecorder
media
.
createVideoRecorder
((
error
,
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
if
(
video
!=
null
)
{
videoRecorder
=
video
;
console
.
info
(
'
video createVideoRecorder success
'
);
}
else
{
...
...
@@ -172,7 +172,7 @@ createVideoRecorder(): Promise<[VideoRecorder](#videorecorder9)>
let
videoRecorder
media
.
createVideoRecorder
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
if
(
video
!=
null
)
{
videoRecorder
=
video
;
console
.
info
(
'
video createVideoRecorder success
'
);
}
else
{
...
...
@@ -369,7 +369,7 @@ seek(timeMs: number): void
```
js
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
//设置'timeUpdate'事件回调
if
(
typeof
(
seekDoneTime
)
==
'
undefined
'
)
{
if
(
seekDoneTime
==
null
)
{
console
.
info
(
'
audio seek fail
'
);
return
;
}
...
...
@@ -442,7 +442,7 @@ function printfDescription(obj) {
}
audioPlayer
.
getTrackDescription
((
error
,
arrlist
)
=>
{
if
(
typeof
(
arrlist
)
!=
'
undefined
'
)
{
if
(
arrlist
!=
null
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
printfDescription
(
arrlist
[
i
]);
}
...
...
@@ -478,7 +478,7 @@ function printfDescription(obj) {
}
audioPlayer
.
getTrackDescription
().
then
((
arrlist
)
=>
{
if
(
typeof
(
arrlist
)
!=
'
undefined
'
)
{
if
(
arrlist
!=
null
)
{
arrayDescription
=
arrlist
;
}
else
{
console
.
log
(
'
audio getTrackDescription fail
'
);
...
...
@@ -553,7 +553,7 @@ audioPlayer.on('reset', () => { //设置'reset'事件回调
audioPlayer
=
undefined
;
});
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
//设置'timeUpdate'事件回调
if
(
typeof
(
seekDoneTime
)
==
"
undefined
"
)
{
if
(
seekDoneTime
==
null
)
{
console
.
info
(
'
audio seek fail
'
);
return
;
}
...
...
@@ -608,7 +608,7 @@ on(type: 'timeUpdate', callback: Callback\<number>): void
```
js
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
//设置'timeUpdate'事件回调
if
(
typeof
(
seekDoneTime
)
==
'
undefined
'
)
{
if
(
seekDoneTime
==
null
)
{
console
.
info
(
'
audio seek fail
'
);
return
;
}
...
...
@@ -726,7 +726,7 @@ setDisplaySurface(surfaceId: string, callback: AsyncCallback\<void>): void
```
js
videoPlayer
.
setDisplaySurface
(
surfaceId
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
setDisplaySurface success!
'
);
}
else
{
console
.
info
(
'
setDisplaySurface fail!
'
);
...
...
@@ -784,7 +784,7 @@ prepare(callback: AsyncCallback\<void>): void
```
js
videoPlayer
.
prepare
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
prepare success!
'
);
}
else
{
console
.
info
(
'
prepare fail!
'
);
...
...
@@ -834,7 +834,7 @@ play(callback: AsyncCallback\<void>): void;
```
js
videoPlayer
.
play
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
play success!
'
);
}
else
{
console
.
info
(
'
play fail!
'
);
...
...
@@ -884,7 +884,7 @@ pause(callback: AsyncCallback\<void>): void
```
js
videoPlayer
.
pause
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
pause success!
'
);
}
else
{
console
.
info
(
'
pause fail!
'
);
...
...
@@ -934,7 +934,7 @@ stop(callback: AsyncCallback\<void>): void
```
js
videoPlayer
.
stop
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
stop success!
'
);
}
else
{
console
.
info
(
'
stop fail!
'
);
...
...
@@ -984,7 +984,7 @@ reset(callback: AsyncCallback\<void>): void
```
js
videoPlayer
.
reset
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
reset success!
'
);
}
else
{
console
.
info
(
'
reset fail!
'
);
...
...
@@ -1036,7 +1036,7 @@ seek(timeMs: number, callback: AsyncCallback\<number>): void
```
js
let
seekTime
=
5000
;
videoPlayer
.
seek
(
seekTime
,
(
err
,
result
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
seek success!
'
);
}
else
{
console
.
info
(
'
seek fail!
'
);
...
...
@@ -1067,7 +1067,7 @@ import media from '@ohos.multimedia.media'
let
seekTime
=
5000
;
let
seekMode
=
media
.
SeekMode
.
SEEK_NEXT_SYNC
;
videoPlayer
.
seek
(
seekTime
,
seekMode
,
(
err
,
result
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
seek success!
'
);
}
else
{
console
.
info
(
'
seek fail!
'
);
...
...
@@ -1133,7 +1133,7 @@ setVolume(vol: number, callback: AsyncCallback\<void>): void
```
js
let
vol
=
0.5
;
videoPlayer
.
setVolume
(
vol
,
(
err
,
result
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
setVolume success!
'
);
}
else
{
console
.
info
(
'
setVolume fail!
'
);
...
...
@@ -1190,7 +1190,7 @@ release(callback: AsyncCallback\<void>): void
```
js
videoPlayer
.
release
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
release success!
'
);
}
else
{
console
.
info
(
'
release fail!
'
);
...
...
@@ -1248,7 +1248,7 @@ function printfDescription(obj) {
}
videoPlayer
.
getTrackDescription
((
error
,
arrlist
)
=>
{
if
(
typeof
(
arrlist
)
!=
'
undefined
'
)
{
if
(
arrlist
)
!=
null
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
printfDescription
(
arrlist
[
i
]);
}
...
...
@@ -1285,7 +1285,7 @@ function printfDescription(obj) {
let
arrayDescription
;
videoPlayer
.
getTrackDescription
().
then
((
arrlist
)
=>
{
if
(
typeof
(
arrlist
)
!=
'
undefined
'
)
{
if
(
arrlist
!=
null
)
{
arrayDescription
=
arrlist
;
}
else
{
console
.
log
(
'
video getTrackDescription fail
'
);
...
...
@@ -1320,7 +1320,7 @@ import media from '@ohos.multimedia.media'
let
speed
=
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
;
videoPlayer
.
setSpeed
(
speed
,
(
err
,
result
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
setSpeed success!
'
);
}
else
{
console
.
info
(
'
setSpeed fail!
'
);
...
...
@@ -1381,7 +1381,7 @@ selectBitrate(bitrate:number, callback: AsyncCallback\<number>): void
```
js
let
bitrate
=
1024000
;
videoPlayer
.
selectBitrate
(
bitrate
,
(
err
,
result
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
selectBitrate success!
'
);
}
else
{
console
.
info
(
'
selectBitrate fail!
'
);
...
...
@@ -1639,7 +1639,7 @@ function printfItemDescription(obj, key) {
}
audioPlayer
.
getTrackDescription
((
error
,
arrlist
)
=>
{
if
(
typeof
(
arrlist
)
!=
'
undefined
'
)
{
if
(
arrlist
!=
null
)
{
for
(
let
i
=
0
;
i
<
arrlist
.
length
;
i
++
)
{
printfItemDescription
(
arrlist
[
i
],
MD_KEY_TRACK_TYPE
);
//打印出每条轨道MD_KEY_TRACK_TYPE的值
}
...
...
@@ -1995,7 +1995,7 @@ let eventEmitter = new events.EventEmitter();
eventEmitter
.
on
(
'
prepare
'
,
()
=>
{
videoRecorder
.
prepare
(
videoConfig
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
prepare success
'
);
}
else
{
console
.
info
(
'
prepare failed and error is
'
+
err
.
message
);
...
...
@@ -2004,7 +2004,7 @@ eventEmitter.on('prepare', () => {
});
media
.
createVideoRecorder
((
err
,
recorder
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
&&
typeof
(
recorder
)
!=
'
undefined
'
)
{
if
(
err
==
null
&&
recorder
)
!=
null
)
{
videoRecorder
=
recorder
;
console
.
info
(
'
createVideoRecorder success
'
);
eventEmitter
.
emit
(
'
prepare
'
);
// prepare事件触发
...
...
@@ -2064,7 +2064,7 @@ let videoConfig = {
// promise
let
videoRecorder
=
null
;
media
.
createVideoRecorder
().
then
((
recorder
)
=>
{
if
(
typeof
(
recorder
)
!=
'
undefined
'
)
{
if
(
recorder
!=
null
)
{
videoRecorder
=
recorder
;
console
.
info
(
'
createVideoRecorder success
'
);
}
else
{
...
...
@@ -2105,7 +2105,7 @@ getInputSurface(callback: AsyncCallback\<string>): void;
// asyncallback
let
surfaceID
=
null
;
// 传递给外界的surfaceID
videoRecorder
.
getInputSurface
((
err
,
surfaceId
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
getInputSurface success
'
);
surfaceID
=
surfaceId
;
}
else
{
...
...
@@ -2166,7 +2166,7 @@ start(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
videoRecorder
.
start
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
start videorecorder success
'
);
}
else
{
console
.
info
(
'
start videorecorder failed and error is
'
+
err
.
message
);
...
...
@@ -2222,7 +2222,7 @@ pause(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
videoRecorder
.
pause
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
pause videorecorder success
'
);
}
else
{
console
.
info
(
'
pause videorecorder failed and error is
'
+
err
.
message
);
...
...
@@ -2276,7 +2276,7 @@ resume(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
videoRecorder
.
resume
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
resume videorecorder success
'
);
}
else
{
console
.
info
(
'
resume videorecorder failed and error is
'
+
err
.
message
);
...
...
@@ -2330,7 +2330,7 @@ stop(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
videoRecorder
.
stop
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
stop videorecorder success
'
);
}
else
{
console
.
info
(
'
stop videorecorder failed and error is
'
+
err
.
message
);
...
...
@@ -2384,7 +2384,7 @@ release(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
videoRecorder
.
release
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
console
.
info
(
'
release videorecorder success
'
);
}
else
{
console
.
info
(
'
release videorecorder failed and error is
'
+
err
.
message
);
...
...
@@ -2438,7 +2438,7 @@ reset(callback: AsyncCallback\<void>): void;
```
js
// asyncallback
videoRecorder
.
reset
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
if
(
err
==
null
)
{
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录