Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f07a0129
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f07a0129
编写于
6月 21, 2022
作者:
N
NOBUGGERS
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增HLS用例 Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>
Signed-off-by:
N
NOBUGGERS
<
ruanmeng@huawei.com
>
上级
b4a2a52f
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
272 addition
and
251 deletion
+272
-251
multimedia/media/media_js_standard/VideoPlayerTestBase.js
multimedia/media/media_js_standard/VideoPlayerTestBase.js
+144
-0
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+0
-33
multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/List.test.js
...media_js_standard/hlsPlayer/src/main/js/test/List.test.js
+2
-1
multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js
...hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js
+126
-0
multimedia/media/media_js_standard/httpPlayer/src/main/js/test/List.test.js
...edia_js_standard/httpPlayer/src/main/js/test/List.test.js
+0
-1
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+0
-17
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+0
-52
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+0
-147
未找到文件。
multimedia/media/media_js_standard/VideoPlayerTestBase.js
浏览文件 @
f07a0129
...
...
@@ -164,3 +164,147 @@ export async function playVideoSource(url, width, height, duration, playTime, do
console
.
info
(
'
case release called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
async
function
testVideoSeek
(
url
,
duration
,
playTime
,
done
)
{
console
.
info
(
`case media source url:
${
url
}
`
)
let
videoPlayer
=
null
;
let
surfaceID
=
globalThis
.
value
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
console
.
info
(
'
case createVideoPlayer success
'
);
videoPlayer
=
video
;
}
else
{
console
.
error
(
'
case createVideoPlayer failed
'
);
expect
().
assertFail
();
done
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
on
(
'
videoSizeChanged
'
,
(
w
,
h
)
=>
{
console
.
info
(
'
case videoSizeChanged width:
'
+
w
+
'
height:
'
+
h
);
});
videoPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
error
(
`case error called, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
videoPlayer
.
release
();
done
();
});
videoPlayer
.
url
=
url
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// pause when seeking
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
);
await
videoPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
case pause called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
paused
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// play when seeking
videoPlayer
.
seek
(
0
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
mediaTestBase
.
msleep
(
playTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// setVolume when setSpeeding
videoPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
).
then
((
speedMode
)
=>
{
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
);
await
videoPlayer
.
setVolume
(
0.5
).
then
(()
=>
{
console
.
info
(
'
case setVolume called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// setSpeed when seeking
videoPlayer
.
seek
(
0
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_00_X
).
then
((
speedMode
)
=>
{
console
.
info
(
'
case setSpeed called and speedMode is
'
+
speedMode
);
expect
(
speedMode
).
assertEqual
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_00_X
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// seek when pausing
videoPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
case pause called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
paused
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
0
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// seek when playing
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case pause called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
videoPlayer
.
duration
/
3
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// seek when seeking
videoPlayer
.
seek
(
videoPlayer
.
duration
/
3
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
0
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// stop when seeking
videoPlayer
.
seek
(
videoPlayer
.
duration
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
case stop called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
stopped
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
reset
().
then
(()
=>
{
console
.
info
(
'
case reset called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
url
;
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// reset when seeking
videoPlayer
.
seek
(
videoPlayer
.
duration
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
reset
().
then
(()
=>
{
console
.
info
(
'
case reset called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
url
;
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
// release when seeking
videoPlayer
.
seek
(
videoPlayer
.
duration
,
media
.
SeekMode
.
SEEK_PREV_SYNC
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
\ No newline at end of file
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
f07a0129
...
...
@@ -307,39 +307,6 @@ describe('PlayerLocalTestAudioFUNC', function () {
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SEEK
* @tc.name : 001.test seek mode 0 / 0.5 * duration/ duration
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SEEK
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
SEEK_STATE
,
DURATION_TIME
/
2
,
SEEK_STATE
,
DURATION_TIME
,
FINISH_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_GETTRECKDESCRIPTION
* @tc.name : 001.test getTrackDescription
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_GETTRECKDESCRIPTION
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
GETDESCRIPTION_PROMISE
,
GETDESCRIPTION_CALLBACK
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_LOOP
* @tc.name : 001.test loop
...
...
multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/List.test.js
浏览文件 @
f07a0129
...
...
@@ -15,4 +15,5 @@
require
(
'
./VideoPlayerHLSTest.test.js
'
)
require
(
'
./AudioPlayerHLSTest.test.js
'
)
require
(
'
./VideoPlayerHLSBitrateTest.test.js
'
)
\ No newline at end of file
require
(
'
./VideoPlayerHLSBitrateTest.test.js
'
)
require
(
'
./VideoPlayerHLSSeekTest.test.js
'
)
\ No newline at end of file
multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js
0 → 100644
浏览文件 @
f07a0129
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
{
testVideoSeek
}
from
'
../../../../../VideoPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerHLSTest
'
,
function
()
{
const
HTTP_PATH
=
'
http://123.57.24.33:8000/
'
;
const
PLAY_TIME
=
3000
;
const
pagePath1
=
'
pages/surfaceTest/surfaceTest
'
;
const
pagePath2
=
'
pages/surfaceTest2/surfaceTest2
'
;
let
pageId
=
0
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
async
function
()
{
await
mediaTestBase
.
toNewPage
(
pagePath1
,
pagePath2
,
pageId
);
pageId
=
(
pageId
+
1
)
%
2
;
await
mediaTestBase
.
msleepAsync
(
1000
).
then
(
()
=>
{},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
async
function
()
{
await
mediaTestBase
.
clearRouter
();
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK
* @tc.name : 001.test hls
* @tc.desc : HLS Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
testHlsVideoPlayerSeek
'
,
0
,
async
function
(
done
)
{
await
testVideoSeek
(
HTTP_PATH
+
'
05.hls/1/index.m3u8
'
,
10033
,
PLAY_TIME
,
done
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_SEPARATE
* @tc.name : 001.test hls audio video separate
* @tc.desc : HLS Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
testHlsVideoPlayerSeekSeparate
'
,
0
,
async
function
(
done
)
{
await
testVideoSeek
(
HTTP_PATH
+
'
05.hls/2/index.m3u8
'
,
10033
,
PLAY_TIME
,
done
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_AUDIOONLY
* @tc.name : 001.test hls audio only
* @tc.desc : HLS Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
testHlsVideoPlayerSeekAudioOnly
'
,
0
,
async
function
(
done
)
{
await
testVideoSeek
(
HTTP_PATH
+
'
05.hls/audio_only/index.m3u8
'
,
10033
,
PLAY_TIME
,
done
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_VARIANT
* @tc.name : 001.test hls variant
* @tc.desc : HLS Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
testHlsVideoPlayerSeekVariant
'
,
0
,
async
function
(
done
)
{
await
testVideoSeek
(
HTTP_PATH
+
'
05.hls/hls_variant/index.m3u8
'
,
10033
,
PLAY_TIME
,
done
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_AUDIOOFF
* @tc.name : 001.test hls variant
* @tc.desc : HLS Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
testHlsVideoPlayerSeekVariantAudioOff
'
,
0
,
async
function
(
done
)
{
await
testVideoSeek
(
HTTP_PATH
+
'
05.hls/hls_variant2/index.m3u8
'
,
10080
,
PLAY_TIME
,
done
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK_CODEC_CHAGNGE
* @tc.name : 001.test hls variant
* @tc.desc : HLS Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
testHlsVideoPlayerSeekCodecChange
'
,
0
,
async
function
(
done
)
{
await
testVideoSeek
(
HTTP_PATH
+
'
05.hls/hls_variant3/index.m3u8
'
,
10080
,
PLAY_TIME
,
done
);
done
();
})
})
multimedia/media/media_js_standard/httpPlayer/src/main/js/test/List.test.js
浏览文件 @
f07a0129
...
...
@@ -13,5 +13,4 @@
* limitations under the License.
*/
require
(
'
./HttpPlayerCompatibilityTest.test.js
'
)
require
(
'
./HttpPlayerFuncPromiseTest.test.js
'
)
\ No newline at end of file
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
f07a0129
...
...
@@ -1744,23 +1744,6 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1100
* @tc.name : 11.seek 3 times
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
SEEK_TIME
,
SEEK_EVENT
,
SEEK_TIME
,
SEEK_EVENT
,
SEEK_TIME
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1300
* @tc.name : 13.seek(-1)
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
f07a0129
...
...
@@ -511,23 +511,6 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE
* @tc.name : 001.test seek mode SEEK_PREV_SYNC/SEEK_NEXT_SYNC (callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_CALLBACK
* @tc.name : 001.test callback bufferingUpdate/videoSizeChanged/startRenderFrame/playbackCompleted
...
...
@@ -632,22 +615,6 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
emit
(
'
test_create
'
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION
* @tc.name : 001.test getTrackDescription (callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
GETDESCRIPTION
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_LOOP
* @tc.name : 001.test LOOP (callback)
...
...
@@ -665,23 +632,4 @@ describe('VideoPlayerFuncCallbackTest', function () {
SEEK_EVENT
,
DURATION_TIME
,
WAIT_EVENT
,
SETLOOP_EVENT
,
false
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE
* @tc.name : 001.test video playe (callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
fdPath
=
fdHead
+
fileDescriptor
.
fd
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
RESET_EVENT
,
SETSOURCE_EVENT
,
fdPath
,
PREPARE_EVENT
,
SETLOOP_EVENT
,
true
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
/
2
,
SEEK_EVENT
,
0
,
SEEK_EVENT
,
DURATION_TIME
,
WAIT_EVENT
,
SETLOOP_EVENT
,
false
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
})
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
f07a0129
...
...
@@ -269,92 +269,6 @@ describe('VideoPlayerFuncPromiseTest', function () {
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode
* @tc.name : 001.seek mode SEEK_PREV_SYNC/SEEK_NEXT_SYNC (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fdHead
+
fileDescriptor
.
fd
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
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
);
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
);
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
);
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
);
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
);
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
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
/* *
...
...
@@ -432,67 +346,6 @@ describe('VideoPlayerFuncPromiseTest', function () {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription
* @tc.name : 001.getTrackDescription (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
arrayDescription
=
null
;
let
videoTrackKey
=
new
Array
(
'
bitrate
'
,
'
codec_mime
'
,
'
frame_rate
'
,
'
height
'
,
'
track_index
'
,
'
track_type
'
,
'
width
'
);
let
audioTrackKey
=
new
Array
(
'
bitrate
'
,
'
channel_count
'
,
'
codec_mime
'
,
'
sample_rate
'
,
'
track_index
'
,
'
track_type
'
);
let
videoTrackValue
=
new
Array
(
1366541
,
'
video/x-h264
'
,
6000
,
480
,
0
,
1
,
720
);
let
audioTrackValue
=
new
Array
(
129207
,
2
,
'
audio/mpeg
'
,
44100
,
1
,
0
);
let
descriptionKey
=
new
Array
(
videoTrackKey
,
audioTrackKey
);
let
descriptionValue
=
new
Array
(
videoTrackValue
,
audioTrackValue
);
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fdHead
+
fileDescriptor
.
fd
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
getTrackDescription
().
then
((
arrayList
)
=>
{
console
.
info
(
'
case getTrackDescription called!!
'
);
if
(
typeof
(
arrayList
)
!=
'
undefined
'
)
{
arrayDescription
=
arrayList
;
}
else
{
console
.
info
(
'
case getTrackDescription is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
for
(
let
i
=
0
;
i
<
arrayDescription
.
length
;
i
++
)
{
mediaTestBase
.
checkDescription
(
arrayDescription
[
i
],
descriptionKey
[
i
],
descriptionValue
[
i
]);
}
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_Loop
* @tc.name : 001.Loop true (promise)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录