Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2148ac43
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看板
提交
2148ac43
编写于
9月 01, 2022
作者:
F
fulizhong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify testcases Signed-off-by: FULIZHONG<fulizhong1@huawei.com>
Signed-off-by:
N
fulizhong
<
fulizhong@huawei.com
>
上级
707d9743
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
283 addition
and
280 deletion
+283
-280
multimedia/media/media_js_standard/AudioPlayerTestBase.js
multimedia/media/media_js_standard/AudioPlayerTestBase.js
+17
-35
multimedia/media/media_js_standard/VideoPlayerTestBase.js
multimedia/media/media_js_standard/VideoPlayerTestBase.js
+4
-4
multimedia/media/media_js_standard/VideoRecorderTestBase.js
multimedia/media/media_js_standard/VideoRecorderTestBase.js
+21
-8
multimedia/media/media_js_standard/audioPlayer/Test.json
multimedia/media/media_js_standard/audioPlayer/Test.json
+5
-2
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
...ioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
+15
-23
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+28
-51
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
...layer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
+121
-104
multimedia/media/media_js_standard/audioRecorder/Test.json
multimedia/media/media_js_standard/audioRecorder/Test.json
+3
-1
multimedia/media/media_js_standard/videoPlayer/Test.json
multimedia/media/media_js_standard/videoPlayer/Test.json
+7
-4
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+8
-8
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+15
-15
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+36
-24
multimedia/media/media_js_standard/videoRecorder/Test.json
multimedia/media/media_js_standard/videoRecorder/Test.json
+3
-1
未找到文件。
multimedia/media/media_js_standard/AudioPlayerTestBase.js
浏览文件 @
2148ac43
...
...
@@ -41,7 +41,7 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) {
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertClose
(
duration
,
500
);
expect
(
Math
.
abs
(
audioPlayer
.
duration
-
duration
)).
assertLess
(
500
);
// step 0: dataLoad -> play
audioPlayer
.
play
();
});
...
...
@@ -53,10 +53,23 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) {
// step 1: play -> seek duration/3
mediaTestBase
.
msleep
(
playTime
);
audioPlayer
.
seek
(
audioPlayer
.
duration
/
3
);
// step 2: seek duration/3 -> pause
mediaTestBase
.
msleep
(
playTime
);
audioPlayer
.
pause
();
}
else
if
(
playCount
==
2
)
{
// step 5: play -> seek duration when loop is true
audioPlayer
.
loop
=
true
;
audioPlayer
.
seek
(
audioPlayer
.
duration
);
// step 6: seek duration -> setVolume + seek duration when loop is false
mediaTestBase
.
msleep
(
playTime
);
console
.
info
(
'
case state 2 is :
'
+
audioPlayer
.
state
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
audioPlayer
.
loop
=
false
;
audioPlayer
.
setVolume
(
0.5
);
audioPlayer
.
seek
(
audioPlayer
.
duration
);
seekEOS
=
true
;
// step 7: wait for finish
mediaTestBase
.
msleep
(
playTime
);
}
else
if
(
playCount
==
3
)
{
// step 9: play -> stop
audioPlayer
.
stop
();
...
...
@@ -72,6 +85,8 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) {
if
(
pauseCount
==
1
)
{
// step 3: pause -> seek 0
audioPlayer
.
seek
(
0
);
// step 4: seek 0 -> play
audioPlayer
.
play
();
}
else
{
// step 13: pause -> stop
audioPlayer
.
stop
();
...
...
@@ -112,40 +127,7 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) {
done
();
return
;
}
console
.
info
(
'
case seek success, and seek time is
'
+
seekDoneTime
);
if
(
seekCount
==
1
)
{
// step 2: seek duration/3 -> pause
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
if
(
checkSeekTime
)
{
expect
(
audioPlayer
.
duration
/
3
).
assertClose
(
seekDoneTime
,
1
);
}
mediaTestBase
.
msleep
(
playTime
);
audioPlayer
.
pause
();
}
else
if
(
seekCount
==
2
){
// step 4: seek 0 -> play
if
(
checkSeekTime
)
{
expect
(
0
).
assertEqual
(
seekDoneTime
);
}
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
audioPlayer
.
play
();
}
else
if
(
seekCount
==
3
){
// step 6: seek duration -> setVolume + seek duration when loop is false
if
(
checkSeekTime
)
{
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
}
mediaTestBase
.
msleep
(
playTime
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
audioPlayer
.
loop
=
false
;
audioPlayer
.
setVolume
(
0.5
);
audioPlayer
.
seek
(
audioPlayer
.
duration
);
seekEOS
=
true
;
}
else
if
(
seekEOS
&&
seekDoneTime
!=
0
){
// step 7: wait for finish
if
(
checkSeekTime
)
{
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
}
mediaTestBase
.
msleep
(
playTime
);
}
console
.
info
(
'
case timeUpdate success, and timeUpdate is
'
+
seekDoneTime
);
});
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
'
case set volume success
'
);
...
...
multimedia/media/media_js_standard/VideoPlayerTestBase.js
浏览文件 @
2148ac43
...
...
@@ -49,7 +49,7 @@ export async function playVideoSource(url, width, height, duration, playTime, do
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called
'
);
expect
(
videoPlayer
.
duration
).
assertClose
(
duration
,
500
);
expect
(
Math
.
abs
(
videoPlayer
.
duration
-
duration
)).
assertLess
(
500
);
if
(
width
!=
null
&
height
!=
null
)
{
expect
(
videoPlayer
.
width
).
assertEqual
(
width
);
expect
(
videoPlayer
.
height
).
assertEqual
(
height
);
...
...
@@ -75,7 +75,7 @@ export async function playVideoSource(url, width, height, duration, playTime, do
mediaTestBase
.
msleep
(
playTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
playTime
,
1000
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
playTime
)).
assertLess
(
1000
);
await
videoPlayer
.
seek
(
videoPlayer
.
duration
/
3
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
...
...
@@ -203,7 +203,7 @@ export async function testVideoSeek(url, duration, playTime, done) {
videoPlayer
.
seek
(
videoPlayer
.
duration
/
3
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
duration
).
assertClose
(
duration
,
500
);
expect
(
Math
.
abs
(
videoPlayer
.
duration
-
duration
)).
assertLess
(
500
);
await
videoPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
case pause called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
paused
'
);
...
...
@@ -224,7 +224,7 @@ export async function testVideoSeek(url, duration, playTime, done) {
console
.
info
(
'
case setSpeed called and speedMode is
'
+
speedMode
);
expect
(
speedMode
).
assertEqual
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
duration
).
assertClose
(
duration
,
500
);
expect
(
Math
.
abs
(
videoPlayer
.
duration
-
duration
)).
assertLess
(
500
);
await
videoPlayer
.
setVolume
(
0.5
).
then
(()
=>
{
console
.
info
(
'
case setVolume called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
...
multimedia/media/media_js_standard/VideoRecorderTestBase.js
浏览文件 @
2148ac43
...
...
@@ -22,7 +22,8 @@ const VIDEO_TRACK = 'video_track';
const
AUDIO_TRACK
=
'
audio_track
'
;
const
AUDIO_VIDEO_TYPE
=
'
audio_video
'
;
const
ONLYVIDEO_TYPE
=
'
only_video
'
;
const
DELTA_TIME
=
1000
;
const
DELTA_TIME
=
1500
;
const
BITRATE_DELTA_TIME
=
20000
;
const
PLAY_TIME
=
1000
;
...
...
@@ -50,13 +51,25 @@ export function getTrackArray(videoType, recorderConfigFile) {
if
(
videoType
==
AUDIO_VIDEO_TYPE
)
{
let
audioTrack
=
new
Array
(
recorderConfigFile
.
audioBitrate
,
recorderConfigFile
.
audioChannels
,
'
audio/mpeg
'
,
recorderConfigFile
.
audioSampleRate
);
let
videoTrack
=
new
Array
(
'
video/mpeg
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
let
videoTrack
=
null
;
if
(
recorderConfigFile
.
videoCodec
==
'
video/avc
'
)
{
videoTrack
=
new
Array
(
'
video/x-h264
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
}
else
{
videoTrack
=
new
Array
(
'
video/mpeg
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
}
let
trackArray
=
new
Array
(
videoTrack
,
audioTrack
);
return
trackArray
;
}
else
if
(
videoType
==
ONLYVIDEO_TYPE
)
{
let
videoTrack
=
new
Array
(
'
video/mpeg
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
let
videoTrack
=
null
;
if
(
recorderConfigFile
.
videoCodec
==
'
video/avc
'
)
{
videoTrack
=
new
Array
(
'
video/x-h264
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
}
else
{
videoTrack
=
new
Array
(
'
video/mpeg
'
,
recorderConfigFile
.
videoFrameHeight
,
recorderConfigFile
.
videoFrameWidth
);
}
let
trackArray
=
new
Array
(
videoTrack
);
return
trackArray
;
}
else
{
...
...
@@ -78,7 +91,7 @@ export function checkDescription(obj, trackTpye, descriptionValue) {
expect
(
obj
[
'
width
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
}
else
{
console
.
info
(
'
case audio bitrate is
'
+
obj
[
'
bitrate
'
]);
expect
(
obj
[
'
bitrate
'
]).
assertClose
(
descriptionValue
[
index
++
],
2
*
DELTA_TIME
);
expect
(
Math
.
abs
(
obj
[
'
bitrate
'
]
-
descriptionValue
[
index
++
])).
assertLess
(
BITRATE_
DELTA_TIME
);
console
.
info
(
'
case audio channel_count is
'
+
obj
[
'
channel_count
'
]);
expect
(
obj
[
'
channel_count
'
]).
assertEqual
(
descriptionValue
[
index
++
]);
console
.
info
(
'
case audio codec_mime is
'
+
obj
[
'
codec_mime
'
]);
...
...
@@ -115,7 +128,7 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac
}
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertClose
(
duration
,
DELTA_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
duration
-
duration
)).
assertLess
(
DELTA_TIME
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
...
@@ -136,7 +149,7 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
await
videoPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
case stop called!!
'
);
...
...
multimedia/media/media_js_standard/audioPlayer/Test.json
浏览文件 @
2148ac43
...
...
@@ -19,9 +19,12 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files"
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files"
,
"power-shell setmode 602"
],
"teardown-command"
:
[]
"teardown-command"
:
[
"power-shell setmode 600"
]
},
{
"type"
:
"PushKit"
,
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
浏览文件 @
2148ac43
...
...
@@ -117,6 +117,9 @@ describe('PlayerLocalTestAudioAPI', function () {
case
SEEK_STATE
:
console
.
info
(
`case seek to time is
${
mySteps
[
SECOND_INDEX
]}
`
);
audioPlayer
.
seek
(
mySteps
[
SECOND_INDEX
]);
mySteps
.
shift
();
mySteps
.
shift
();
nextStep
(
mySteps
,
done
);
break
;
case
VOLUME_STATE
:
console
.
info
(
`case to setVolume`
);
...
...
@@ -195,36 +198,25 @@ describe('PlayerLocalTestAudioAPI', function () {
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
return
;
}
if
(
mySteps
[
0
]
!=
SEEK_STATE
)
{
return
;
}
mySteps
.
shift
();
mySteps
.
shift
();
console
.
info
(
`case seekDoneTime is
${
seekDoneTime
}
`
);
console
.
info
(
`case seek called`
);
expect
(
audioPlayer
.
currentTime
+
DELTA_TIME
).
assertClose
(
seekDoneTime
+
DELTA_TIME
,
DELTA_TIME
);
console
.
info
(
`case loop is
${
audioPlayer
.
loop
}
`
);
if
((
audioPlayer
.
loop
==
true
)
&&
(
seekDoneTime
==
DURATION_TIME
))
{
console
.
info
(
'
case loop is true
'
);
mediaTestBase
.
msleep
(
PLAY_STATE
);
}
if
((
seekDoneTime
<
audioPlayer
.
duration
)
||
(
audioPlayer
.
state
==
'
paused
'
))
{
nextStep
(
mySteps
,
done
);
}
console
.
info
(
`case timeUpdate, seekDoneTime is
${
seekDoneTime
}
`
);
});
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
mySteps
.
shift
();
if
(
audioPlayer
.
state
==
'
playing
'
)
{
mediaTestBase
.
msleep
(
PLAY_TIME
);
if
(
mySteps
[
0
]
!=
VOLUME_STATE
)
{
console
.
info
(
`case setvolume called by system`
);
}
else
{
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
mySteps
.
shift
();
if
(
audioPlayer
.
state
==
'
playing
'
)
{
mediaTestBase
.
msleep
(
PLAY_TIME
);
}
nextStep
(
mySteps
,
done
);
}
nextStep
(
mySteps
,
done
);
});
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
mySteps
.
shift
();
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
expect
(
audioPlayer
.
currentTime
).
assertClose
(
audioPlayer
.
duration
,
DELTA_TIME
);
expect
(
Math
.
abs
(
audioPlayer
.
currentTime
-
audioPlayer
.
duration
)).
assertLess
(
DELTA_TIME
);
console
.
info
(
`case finish called`
);
nextStep
(
mySteps
,
done
);
});
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
2148ac43
...
...
@@ -130,6 +130,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
case
SEEK_STATE
:
console
.
info
(
'
case seek to time is
'
+
mySteps
[
SECOND_INDEX
]);
audioPlayer
.
seek
(
mySteps
[
SECOND_INDEX
]);
mySteps
.
shift
();
mySteps
.
shift
();
nextStep
(
mySteps
,
done
);
break
;
case
VOLUME_STATE
:
console
.
info
(
`case to setVolume`
);
...
...
@@ -235,38 +238,25 @@ describe('PlayerLocalTestAudioFUNC', function () {
nextStep
(
mySteps
,
done
);
});
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
'
undefined
'
)
{
expect
().
assertFail
();
console
.
info
(
'
case seek failed
'
);
return
;
}
if
(
mySteps
[
0
]
!=
SEEK_STATE
)
{
return
;
}
mySteps
.
shift
();
mySteps
.
shift
();
console
.
info
(
'
case seekDoneTime is
'
+
seekDoneTime
);
expect
(
audioPlayer
.
currentTime
+
DELTA_TIME
).
assertClose
(
seekDoneTime
+
DELTA_TIME
,
DELTA_TIME
);
console
.
info
(
'
case loop is
'
+
audioPlayer
.
loop
);
if
((
audioPlayer
.
loop
==
true
)
&&
(
seekDoneTime
==
DURATION_TIME
))
{
console
.
info
(
'
case loop is true
'
);
mediaTestBase
.
msleep
(
PLAY_STATE
);
}
nextStep
(
mySteps
,
done
);
console
.
info
(
'
case timeUpdate seekDoneTime is
'
+
seekDoneTime
);
});
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
mySteps
.
shift
();
if
(
audioPlayer
.
state
==
'
playing
'
)
{
mediaTestBase
.
msleep
(
PLAY_TIME
);
if
(
mySteps
[
0
]
!=
VOLUME_STATE
)
{
console
.
info
(
`case setvolume called by system`
);
}
else
{
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
mySteps
.
shift
();
if
(
audioPlayer
.
state
==
'
playing
'
)
{
mediaTestBase
.
msleep
(
PLAY_TIME
);
}
nextStep
(
mySteps
,
done
);
}
nextStep
(
mySteps
,
done
);
});
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
mySteps
.
shift
();
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
expect
(
audioPlayer
.
currentTime
).
assertClose
(
audioPlayer
.
duration
,
DELTA_TIME
);
expect
(
Math
.
abs
(
audioPlayer
.
currentTime
-
audioPlayer
.
duration
)).
assertLess
(
DELTA_TIME
);
console
.
info
(
`case finish called`
);
nextStep
(
mySteps
,
done
);
});
...
...
@@ -397,37 +387,24 @@ describe('PlayerLocalTestAudioFUNC', function () {
console
.
info
(
'
case seek failed
'
);
return
;
}
console
.
info
(
`case seekDoneTime is
${
seekDoneTime
}
`
);
if
(
seekDoneTime
==
DURATION_TIME
)
{
if
(
seekCount
==
3
)
{
console
.
info
(
'
case loop is false, seek time is
'
+
seekDoneTime
);
testAudioPlayer
.
loop
=
false
;
testAudioPlayer
.
seek
(
DURATION_TIME
);
seekCount
++
;
}
else
if
(
seekCount
<
3
)
{
seekCount
++
;
console
.
info
(
'
case seek time is
'
+
seekDoneTime
);
console
.
info
(
'
case seek testAudioPlayer.loop is
'
+
testAudioPlayer
.
loop
);
expect
(
testAudioPlayer
.
loop
).
assertEqual
(
true
);
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
playing
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
testAudioPlayer
.
seek
(
DURATION_TIME
);
}
else
{
console
.
info
(
'
case last seek time is
'
+
seekDoneTime
);
}
}
else
if
(
seekDoneTime
==
0
)
{
console
.
info
(
'
case seek time is
'
+
seekDoneTime
);
console
.
info
(
'
case timeUpdate, seekDoneTime is
'
+
seekDoneTime
);
console
.
info
(
'
case timeUpdate, testAudioPlayer.state is
'
+
testAudioPlayer
.
state
);
if
(
seekDoneTime
==
DURATION_TIME
&&
seekCount
==
0
)
{
console
.
info
(
'
case loop step 1
'
);
seekCount
++
;
//mediaTestBase.msleep(PLAY_TIME);
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
playing
'
);
if
(
seekCount
==
4
)
{
expect
(
testAudioPlayer
.
loop
).
assertEqual
(
false
);
}
else
{
expect
(
testAudioPlayer
.
loop
).
assertEqual
(
true
)
;
}
testAudioPlayer
.
seek
(
DURATION_TIME
-
1000
);
}
else
if
((
seekDoneTime
==
(
DURATION_TIME
-
1000
))
&&
seekCount
==
1
)
{
console
.
info
(
'
case loop step 2
'
);
seekCount
++
;
testAudioPlayer
.
loop
=
false
;
}
});
testAudioPlayer
.
on
(
'
finish
'
,
()
=>
{
console
.
info
(
'
case finish success seekCount is
'
+
seekCount
);
expect
(
seekCount
).
assertEqual
(
4
);
expect
(
seekCount
).
assertEqual
(
2
);
testAudioPlayer
.
reset
();
});
testAudioPlayer
.
on
(
'
reset
'
,
()
=>
{
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
浏览文件 @
2148ac43
...
...
@@ -13,15 +13,13 @@
* limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
playAudioSource
}
from
'
../../../../../AudioPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
export
default
function
PlayerLocalTestAudioFormat
()
{
describe
(
'
PlayerLocalTestAudioFormat
'
,
function
()
{
const
MAX_VOLUME
=
1
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
10000
;
// 10s
let
isToSeek
=
false
;
let
isToDuration
=
false
;
let
fdNumber
=
0
;
...
...
@@ -44,83 +42,6 @@ describe('PlayerLocalTestAudioFormat', function () {
console
.
info
(
'
afterAll case
'
);
})
async
function
playSource
(
audioFile
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
await
mediaTestBase
.
getFdRead
(
audioFile
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
audioPlayer
.
play
();
});
audioPlayer
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
case start to play
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
if
(
!
isToSeek
)
{
audioPlayer
.
pause
();
}
else
{
audioPlayer
.
seek
(
SEEK_TIME
);
}
});
audioPlayer
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
case now is paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
audioPlayer
.
setVolume
(
MAX_VOLUME
);
});
audioPlayer
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
case stop success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
audioPlayer
.
reset
();
});
audioPlayer
.
on
(
'
reset
'
,
()
=>
{
console
.
info
(
'
case reset success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
audioPlayer
.
release
();
audioPlayer
=
null
;
done
();
});
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
seekDoneTime
==
null
)
{
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
audioPlayer
.
release
();
expect
().
assertFail
();
done
();
return
;
}
console
.
info
(
'
case seek success, and seek time is
'
+
seekDoneTime
);
if
(
!
isToDuration
)
{
expect
(
SEEK_TIME
).
assertEqual
(
seekDoneTime
);
isToDuration
=
true
;
mediaTestBase
.
msleep
(
PLAY_TIME
);
audioPlayer
.
seek
(
audioPlayer
.
duration
);
}
else
{
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
}
});
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
'
case set volume value to
'
+
MAX_VOLUME
);
audioPlayer
.
play
();
isToSeek
=
true
;
});
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
console
.
info
(
'
case play end
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
audioPlayer
.
stop
();
});
audioPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
console
.
info
(
`case error called,errMessage is
${
err
.
message
}
`
);
audioPlayer
.
release
();
expect
().
assertFail
();
done
();
});
audioPlayer
.
src
=
'
fd://
'
+
fdNumber
;
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0100
* @tc.name : 001.Playing mp3 streams
...
...
@@ -134,7 +55,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
'
01.mp3
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
01.mp3
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219600
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -150,7 +75,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0200
'
,
0
,
async
function
(
done
)
{
playSource
(
'
02.mp3
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
02.mp3
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
;
playAudioSource
(
path
,
219600
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -166,7 +95,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
'
03.mp3
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
03.mp3
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
;
playAudioSource
(
path
,
219600
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -182,7 +115,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
'
04.mp3
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
04.mp3
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219600
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -198,7 +135,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
'
47.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
47.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219575
,
PLAY_TIME
,
true
,
done
);
})
...
...
@@ -215,7 +156,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
'
49.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
49.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219575
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -231,7 +176,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
'
50.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
50.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219575
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -247,7 +196,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0500
'
,
0
,
async
function
(
done
)
{
playSource
(
'
51.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
51.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219565
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -263,7 +216,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0600
'
,
0
,
async
function
(
done
)
{
playSource
(
'
54.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
54.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219577
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -279,7 +236,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0700
'
,
0
,
async
function
(
done
)
{
playSource
(
'
64.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
64.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219577
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -295,7 +256,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0800
'
,
0
,
async
function
(
done
)
{
playSource
(
'
65.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
65.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219577
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -311,7 +276,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0900
'
,
0
,
async
function
(
done
)
{
playSource
(
'
66.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
66.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219577
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -327,7 +296,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1000
'
,
0
,
async
function
(
done
)
{
playSource
(
'
67.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
67.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219577
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -343,7 +316,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1100
'
,
0
,
async
function
(
done
)
{
playSource
(
'
92.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
92.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219555
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -359,7 +336,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1200
'
,
0
,
async
function
(
done
)
{
playSource
(
'
93.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
93.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219555
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -375,7 +356,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1300
'
,
0
,
async
function
(
done
)
{
playSource
(
'
94.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
94.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219555
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -391,7 +376,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1400
'
,
0
,
async
function
(
done
)
{
playSource
(
'
96.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
96.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219554
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -407,7 +396,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1500
'
,
0
,
async
function
(
done
)
{
playSource
(
'
97.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
97.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219554
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -423,7 +416,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1600
'
,
0
,
async
function
(
done
)
{
playSource
(
'
98.mp4
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
98.mp4
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219554
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -439,7 +436,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
'
55.m4a
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
55.m4a
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219575
,
PLAY_TIME
,
true
,
done
);
})
...
...
@@ -456,7 +457,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
'
57.m4a
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
57.m4a
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219575
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -472,7 +477,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
'
58.m4a
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
58.m4a
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219575
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -488,7 +497,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0500
'
,
0
,
async
function
(
done
)
{
playSource
(
'
59.m4a
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
59.m4a
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219565
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -504,7 +517,11 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0700
'
,
0
,
async
function
(
done
)
{
playSource
(
'
62.m4a
'
,
done
);
await
mediaTestBase
.
getFdRead
(
'
62.m4a
'
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
let
path
=
'
fd://
'
+
fdNumber
playAudioSource
(
path
,
219565
,
PLAY_TIME
,
true
,
done
);
})
})
}
multimedia/media/media_js_standard/audioRecorder/Test.json
浏览文件 @
2148ac43
...
...
@@ -10,9 +10,11 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"rm -rf /storage/media/100/local/files/Videos/audio_*"
"rm -rf /storage/media/100/local/files/Videos/audio_*"
,
"power-shell setmode 602"
],
"teardown-command"
:[
"power-shell setmode 600"
]
},
{
...
...
multimedia/media/media_js_standard/videoPlayer/Test.json
浏览文件 @
2148ac43
...
...
@@ -17,11 +17,14 @@
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files"
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files"
,
"power-shell setmode 602"
],
"teardown-command"
:
[]
"teardown-command"
:[
"power-shell setmode 600"
]
},
{
"type"
:
"PushKit"
,
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
2148ac43
...
...
@@ -305,24 +305,24 @@ describe('VideoPlayerAPICallbackTest', function () {
});
});
function
checkSeekTime
(
seekMode
,
seekTime
,
seekDoneTime
)
{
function
checkSeekTime
(
videoPlayer
,
seekMode
,
seekTime
,
seekDoneTime
)
{
switch
(
seekMode
)
{
case
media
.
SeekMode
.
SEEK_NEXT_SYNC
:
if
(
seekTime
==
0
)
{
expect
(
seekDoneTime
+
DELTA_TIME
).
assertClose
(
DELTA_TIME
,
DELTA_TIME
);
expect
(
seekDoneTime
).
assertLess
(
DELTA_TIME
);
}
else
if
(
seekTime
==
DURATION_TIME
)
{
expect
(
seekDoneTime
).
assertClose
(
DURATION_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
DURATION_TIME
)).
assertLess
(
DELTA_TIME
);
}
else
{
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
)).
assertLess
(
DELTA_TIME
);
}
break
;
case
media
.
SeekMode
.
SEEK_PREV_SYNC
:
if
(
seekTime
==
0
)
{
expect
(
seekDoneTime
+
DELTA_TIME
).
assertClose
(
DELTA_TIME
,
DELTA_TIME
);
expect
(
seekDoneTime
).
assertLess
(
DELTA_TIME
);
}
else
if
(
seekTime
==
DURATION_TIME
)
{
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
)).
assertLess
(
DELTA_TIME
);
}
else
{
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
PREV_FRAME_TIME
)).
assertLess
(
DELTA_TIME
);
}
break
;
default
:
...
...
@@ -336,7 +336,7 @@ describe('VideoPlayerAPICallbackTest', function () {
steps
.
shift
();
videoPlayer
.
seek
(
seekTime
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
(
err
,
seekDoneTime
)
=>
{
if
(
err
==
null
)
{
checkSeekTime
(
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
seekTime
,
seekDoneTime
);
checkSeekTime
(
videoPlayer
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
seekTime
,
seekDoneTime
);
console
.
info
(
'
case seek success and seekDoneTime is
'
+
seekDoneTime
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
if
((
err
!=
null
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
2148ac43
...
...
@@ -264,7 +264,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
console
.
info
(
'
case play success!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
if
((
err
!=
null
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
steps
.
shift
();
...
...
@@ -338,24 +338,24 @@ describe('VideoPlayerFuncCallbackTest', function () {
});
});
function
checkSeekTime
(
seekMode
,
seekTime
,
seekDoneTime
)
{
function
checkSeekTime
(
videoPlayer
,
seekMode
,
seekTime
,
seekDoneTime
)
{
switch
(
seekMode
)
{
case
media
.
SeekMode
.
SEEK_NEXT_SYNC
:
if
(
seekTime
==
0
)
{
expect
(
seekDoneTime
+
DELTA_SEEK_TIME
).
assertClose
(
DELTA_SEEK_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertLess
(
DELTA_SEEK_TIME
);
}
else
if
(
seekTime
==
DURATION_TIME
)
{
expect
(
seekDoneTime
).
assertClose
(
DURATION_TIME
,
DELTA_SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
DURATION_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
}
else
{
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
}
break
;
case
media
.
SeekMode
.
SEEK_PREV_SYNC
:
if
(
seekTime
==
0
)
{
expect
(
seekDoneTime
+
DELTA_SEEK_TIME
).
assertClose
(
DELTA_SEEK_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertLess
(
DELTA_SEEK_TIME
);
}
else
if
(
seekTime
==
DURATION_TIME
)
{
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
}
else
{
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
PREV_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
}
break
;
default
:
...
...
@@ -372,7 +372,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
if
(
seekTime
>
DURATION_TIME
)
{
seekTime
=
DURATION_TIME
;
}
checkSeekTime
(
media
.
SeekMode
.
SEEK_PREV_SYNC
,
seekTime
,
seekDoneTime
);
checkSeekTime
(
videoPlayer
,
media
.
SeekMode
.
SEEK_PREV_SYNC
,
seekTime
,
seekDoneTime
);
console
.
info
(
'
case seek success and seekDoneTime is
'
+
seekDoneTime
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
if
((
err
!=
null
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
...
...
@@ -395,7 +395,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
if
(
seekTime
>
DURATION_TIME
)
{
seekTime
=
DURATION_TIME
;
}
checkSeekTime
(
seekMode
,
seekTime
,
seekDoneTime
);
checkSeekTime
(
videoPlayer
,
seekMode
,
seekTime
,
seekDoneTime
);
console
.
info
(
'
case seek success and seekDoneTime is
'
+
seekDoneTime
);
toNextStep
(
videoPlayer
,
steps
,
done
);
}
else
if
((
err
!=
null
)
&&
(
steps
[
0
]
==
ERROR_EVENT
))
{
...
...
@@ -429,19 +429,19 @@ describe('VideoPlayerFuncCallbackTest', function () {
if
(
videoPlayer
.
state
==
'
playing
'
)
{
switch
(
speedValue
)
{
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
:
expect
(
endTime
-
startTime
).
assertClose
(
0.75
*
1000
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
(
0.75
*
1000
))).
assertLess
(
DELTA_TIME
*
0.75
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_00_X
:
expect
(
endTime
-
startTime
).
assertClose
(
1000
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
(
1000
))).
assertLess
(
DELTA_TIME
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_25_X
:
expect
(
endTime
-
startTime
).
assertClose
(
1.25
*
1000
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
(
1.25
*
1000
))).
assertLess
(
DELTA_TIME
*
1.25
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_75_X
:
expect
(
endTime
-
startTime
).
assertClose
(
1.75
*
1000
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
(
1.75
*
1000
))).
assertLess
(
DELTA_TIME
*
1.75
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
:
expect
(
endTime
-
startTime
).
assertClose
(
2
*
1000
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
(
2
*
1000
))).
assertLess
(
DELTA_TIME
*
2
);
break
;
}
}
else
{
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
2148ac43
...
...
@@ -27,7 +27,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
const
WIDTH_VALUE
=
720
;
const
HEIGHT_VALUE
=
480
;
const
DURATION_TIME
=
10034
;
const
DELTA_TIME
=
1
0
00
;
const
DELTA_TIME
=
1
5
00
;
const
NEXT_FRAME_TIME
=
8333
;
const
PREV_FRAME_TIME
=
4166
;
const
DELTA_SEEK_TIME
=
100
;
...
...
@@ -88,19 +88,24 @@ describe('VideoPlayerFuncPromiseTest', function () {
if
(
videoPlayer
.
state
==
'
playing
'
)
{
switch
(
speedValue
)
{
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
:
expect
(
newTime
-
startTime
).
assertClose
(
0.75
*
1000
,
DELTA_TIME
);
console
.
error
(
'
checkSpeedTime time is :
'
+
(
newTime
-
startTime
));
expect
(
Math
.
abs
(
newTime
-
startTime
-
(
0.75
*
1000
))).
assertLess
(
DELTA_TIME
*
0.75
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_00_X
:
expect
(
newTime
-
startTime
).
assertClose
(
1000
,
DELTA_TIME
);
console
.
error
(
'
checkSpeedTime time is :
'
+
(
newTime
-
startTime
));
expect
(
Math
.
abs
(
newTime
-
startTime
-
(
1000
))).
assertLess
(
DELTA_TIME
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_25_X
:
expect
(
newTime
-
startTime
).
assertClose
(
1.25
*
1000
,
DELTA_TIME
);
console
.
error
(
'
checkSpeedTime time is :
'
+
(
newTime
-
startTime
));
expect
(
Math
.
abs
(
newTime
-
startTime
-
(
1.25
*
1000
))).
assertLess
(
DELTA_TIME
*
1.25
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_75_X
:
expect
(
newTime
-
startTime
).
assertClose
(
1.75
*
1000
,
DELTA_TIME
);
console
.
error
(
'
checkSpeedTime time is :
'
+
(
newTime
-
startTime
));
expect
(
Math
.
abs
(
newTime
-
startTime
-
(
1.75
*
1000
))).
assertLess
(
DELTA_TIME
*
1.75
);
break
;
case
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
:
expect
(
newTime
-
startTime
).
assertClose
(
2
*
1000
,
DELTA_TIME
);
console
.
error
(
'
checkSpeedTime time is :
'
+
(
newTime
-
startTime
));
expect
(
Math
.
abs
(
newTime
-
startTime
-
(
2
*
1000
))).
assertLess
(
DELTA_TIME
*
2
);
break
;
}
}
else
{
...
...
@@ -182,8 +187,8 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
for
(
let
i
=
0
;
i
<
3
;
i
++
)
{
await
videoPlayer
.
setVolume
(
i
*
0.5
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
...
...
@@ -239,7 +244,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
).
then
((
speedMode
)
=>
{
...
...
@@ -334,41 +339,47 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
await
videoPlayer
.
seek
(
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertEqual
(
SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
SEEK_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertEqual
(
SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
PREV_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
PREV_FRAME_TIME
-
100
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
+
DELTA_SEEK_TIME
).
assertClose
(
DELTA_SEEK_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertEqual
(
PREV_FRAME_TIME
-
100
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
PREV_FRAME_TIME
+
100
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertEqual
(
PREV_FRAME_TIME
+
100
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
PREV_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
NEXT_FRAME_TIME
-
100
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertEqual
(
NEXT_FRAME_TIME
-
100
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
NEXT_FRAME_TIME
+
100
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
+
100
,
DELTA_SEEK_TIME
);
expect
(
seekDoneTime
).
assertEqual
(
NEXT_FRAME_TIME
+
100
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
NEXT_FRAME_TIME
-
100
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
...
...
@@ -581,12 +592,12 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
await
videoPlayer
.
seek
(
DURATION_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
DURATION_TIME
,
DELTA_SEEK_TIME
);
expect
(
Math
.
abs
(
seekDoneTime
-
DURATION_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
mediaTestBase
.
msleep
(
3000
);
...
...
@@ -646,7 +657,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
await
videoPlayer
.
pause
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
paused
'
);
...
...
@@ -685,7 +696,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
await
videoPlayer
.
seek
(
videoPlayer
.
duration
/
2
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
...
...
@@ -765,7 +776,8 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
console
.
info
(
'
case set videoScaleType : 0
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
await
videoPlayer
.
pause
().
then
(()
=>
{
...
...
@@ -810,7 +822,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
console
.
info
(
'
case set videoScaleType : 0
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
await
videoPlayer
.
seek
(
videoPlayer
.
duration
/
2
).
then
((
seekDoneTime
)
=>
{
...
...
@@ -905,7 +917,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
expect
(
Math
.
abs
(
endTime
-
startTime
-
PLAY_TIME
)).
assertLess
(
DELTA_TIME
);
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
if
(
count
==
0
)
{
...
...
@@ -1120,7 +1132,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
await
videoPlayer
.
seek
(
SEEK_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
expect
(
Math
.
abs
(
videoPlayer
.
currentTime
-
PREV_FRAME_TIME
)).
assertLess
(
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
startTime
=
videoPlayer
.
currentTime
;
...
...
multimedia/media/media_js_standard/videoRecorder/Test.json
浏览文件 @
2148ac43
...
...
@@ -10,9 +10,11 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"rm -rf /storage/media/100/local/files/Videos/*"
"rm -rf /storage/media/100/local/files/Videos/*"
,
"power-shell setmode 602"
],
"teardown-command"
:[
"power-shell setmode 600"
]
},
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录