Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ee7a307a
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ee7a307a
编写于
5月 25, 2023
作者:
D
dongwei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
偶现阻塞修复
Signed-off-by:
N
dongwei
<
dongwei@kaihong.com
>
上级
68e601ea
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
31 deletion
+29
-31
multimedia/media/media_js_standard/AVPlayerTestBase.js
multimedia/media/media_js_standard/AVPlayerTestBase.js
+29
-31
未找到文件。
multimedia/media/media_js_standard/AVPlayerTestBase.js
浏览文件 @
ee7a307a
...
@@ -425,7 +425,6 @@ function setAVPlayerPlayAndPauseWithCallBack(src, avPlayer, playTime, done) {
...
@@ -425,7 +425,6 @@ function setAVPlayerPlayAndPauseWithCallBack(src, avPlayer, playTime, done) {
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from play to stop
'
)
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from stop to release
'
)
console
.
info
(
'
playPauseLoopWithCallBack avPlayer from stop to release
'
)
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
done
();
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
@@ -556,7 +555,6 @@ async function playToCompletedLoop(src, avPlayer, done) {
...
@@ -556,7 +555,6 @@ async function playToCompletedLoop(src, avPlayer, done) {
console
.
info
(
'
playToCompletedLoop avPlayer from play to stop
'
)
console
.
info
(
'
playToCompletedLoop avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
playToCompletedLoop avPlayer from stop to release
'
)
console
.
info
(
'
playToCompletedLoop avPlayer from stop to release
'
)
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
done
();
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
@@ -611,29 +609,30 @@ export async function seekLoop(src, avPlayer, done) {
...
@@ -611,29 +609,30 @@ export async function seekLoop(src, avPlayer, done) {
},
(
err
)
=>
{
},
(
err
)
=>
{
console
.
error
(
'
seekLoop play filed,error message is :
'
+
err
.
message
)
console
.
error
(
'
seekLoop play filed,error message is :
'
+
err
.
message
)
})
})
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PLAYING
){
await
seekLoopWithCallback
(
avPlayer
)
console
.
info
(
'
seekLoop avPlayer from play to seek
'
)
console
.
info
(
'
seekLoop avPlayer from play to seek
'
)
// play seek loop 1000 times
// play seek loop 1000 times
for
(
var
loopTime
=
0
;
loopTime
<
1000
;
loopTime
++
){
avPlayer
.
seek
(
loopTime
)
console
.
info
(
`case seekLoopWithCallback loopTime is
${
loopTime
}
`
);
}
}
await
avPlayer
.
stop
().
then
(()
=>
{
await
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from play to stop
'
)
console
.
info
(
'
seekLoopWithCallback avPlayer from play to stop
'
)
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
seekDone
'
]);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
avPlayer
.
release
().
then
(()
=>
{
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from stop to release
'
)
console
.
info
(
'
seekLoopWithCallback avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
}
async
function
seekLoopWithCallback
(
avPlayer
)
{
async
function
seekLoopWithCallback
(
avPlayer
)
{
avPlayer
.
on
(
'
seekDone
'
,
async
(
seekDoneTime
)
=>
{
for
(
let
loopTime
=
0
;
loopTime
<
5000
;
loopTime
+=
5
)
{
console
.
info
(
`case seekDone called seekDoneTime is
${
seekDoneTime
}
`
);
await
new
Promise
(
resolve
=>
{
});
avPlayer
.
on
(
'
seekDone
'
,
seekDoneTime
=>
{
console
.
info
(
`case seekDone called seekDoneTime is
${
seekDoneTime
}
`
);
resolve
();
});
avPlayer
.
seek
(
loopTime
);
console
.
info
(
`case seekLoopWithCallback loopTime is
${
loopTime
}
`
);
});
}
}
}
export
async
function
seekLoopWithoutCallback
(
src
,
avPlayer
,
done
)
{
export
async
function
seekLoopWithoutCallback
(
src
,
avPlayer
,
done
)
{
...
@@ -767,15 +766,12 @@ export async function createToReleaseLoop(src, avPlayer, done) {
...
@@ -767,15 +766,12 @@ export async function createToReleaseLoop(src, avPlayer, done) {
await
avPlayer
.
release
().
then
(()
=>
{
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
createToReleaseLoop avPlayer from stop to release
'
)
console
.
info
(
'
createToReleaseLoop avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
if
(
i
==
999
){
done
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
`case createToReleaseLoop loop is
${
i
}
`
);
console
.
info
(
`case createToReleaseLoop loop is
${
i
}
`
);
}
}
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
createToReleaseLoop avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
}
let
createLoopTime
=
0
;
let
createLoopTime
=
0
;
...
@@ -785,7 +781,7 @@ export async function createTimeWithCallback(src, avPlayer, done) {
...
@@ -785,7 +781,7 @@ export async function createTimeWithCallback(src, avPlayer, done) {
avPlayer
=
await
idle
(
src
,
avPlayer
)
avPlayer
=
await
idle
(
src
,
avPlayer
)
createStart
=
Date
.
now
();
createStart
=
Date
.
now
();
console
.
info
(
`createTimeWithCallback createStart time is :
${
createStart
}
`
)
console
.
info
(
`createTimeWithCallback createStart time is :
${
createStart
}
`
)
createTime
With
Callback
(
src
,
avPlayer
,
done
)
createTimeCallback
(
src
,
avPlayer
,
done
)
}
}
function
createTimeCallback
(
src
,
avPlayer
,
done
){
function
createTimeCallback
(
src
,
avPlayer
,
done
){
...
@@ -1778,7 +1774,6 @@ function setSpeedTimeCallback(avPlayer, done) {
...
@@ -1778,7 +1774,6 @@ function setSpeedTimeCallback(avPlayer, done) {
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
loopTime
==
10
){
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
console
.
info
(
'
setSpeedTimeCallback avPlayer is release
'
)
console
.
info
(
'
setSpeedTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
let
avg
=
totalTime
/
10
;
let
avg
=
totalTime
/
10
;
...
@@ -1889,7 +1884,6 @@ function setBitrateTimeCallback(avPlayer, done) {
...
@@ -1889,7 +1884,6 @@ function setBitrateTimeCallback(avPlayer, done) {
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
loopTime
==
10
){
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
console
.
info
(
'
setBitrateTimeCallback avPlayer is release
'
)
console
.
info
(
'
setBitrateTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
let
avg
=
totalTime
/
10
;
let
avg
=
totalTime
/
10
;
...
@@ -2001,7 +1995,6 @@ function setVolumeTimeCallback(avPlayer, done) {
...
@@ -2001,7 +1995,6 @@ function setVolumeTimeCallback(avPlayer, done) {
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
loopTime
==
10
){
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
console
.
info
(
'
setVolumeTimeCallback avPlayer is release
'
)
console
.
info
(
'
setVolumeTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
let
avg
=
totalTime
/
10
;
let
avg
=
totalTime
/
10
;
...
@@ -2058,7 +2051,6 @@ export async function firstFrameTime(src, avPlayer, done) {
...
@@ -2058,7 +2051,6 @@ export async function firstFrameTime(src, avPlayer, done) {
console
.
info
(
"
firstFrameTime execution time is :
"
+
execution
)
console
.
info
(
"
firstFrameTime execution time is :
"
+
execution
)
sleep
(
100
)
sleep
(
100
)
avPlayer
.
release
().
then
(()
=>
{
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
startRenderFrame
'
]);
console
.
info
(
'
firstFrameTime avPlayer is release
'
)
console
.
info
(
'
firstFrameTime avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
avPlayer
=
null
;
...
@@ -2122,6 +2114,13 @@ function setAVPlayerPlay(src, avPlayer, done) {
...
@@ -2122,6 +2114,13 @@ function setAVPlayerPlay(src, avPlayer, done) {
case
AV_PLAYER_STATE
.
PLAYING
:
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
setAVPlayerPlay play state is PLAYING
'
)
console
.
info
(
'
setAVPlayerPlay play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
avPlayer
.
duration
>
3000
){
mediaTestBase
.
msleepAsync
(
3000
);
avPlayer
.
seek
(
avPlayer
.
duration
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
)
}
else
{
mediaTestBase
.
msleepAsync
(
500
);
avPlayer
.
seek
(
avPlayer
.
duration
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
)
}
break
;
break
;
case
AV_PLAYER_STATE
.
COMPLETED
:
case
AV_PLAYER_STATE
.
COMPLETED
:
expect
(
avPlayer
.
currentTime
).
assertEqual
(
avPlayer
.
duration
);
expect
(
avPlayer
.
currentTime
).
assertEqual
(
avPlayer
.
duration
);
...
@@ -2131,7 +2130,6 @@ function setAVPlayerPlay(src, avPlayer, done) {
...
@@ -2131,7 +2130,6 @@ function setAVPlayerPlay(src, avPlayer, done) {
break
;
break
;
case
AV_PLAYER_STATE
.
RELEASED
:
case
AV_PLAYER_STATE
.
RELEASED
:
expect
(
avPlayer
.
state
).
assertEqual
(
'
released
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
'
released
'
);
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
avPlayer
=
null
;
avPlayer
=
null
;
done
();
done
();
break
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录