Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1e7497d8
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看板
提交
1e7497d8
编写于
6月 30, 2022
作者:
F
fulizhong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add videoScaleType case Signed-off-by: NOBUGGERS<ruanmeng@huawei.com>
Signed-off-by:
N
fulizhong
<
fulizhong@huawei.com
>
上级
7e47a338
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
418 addition
and
87 deletion
+418
-87
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+5
-1
multimedia/media/media_js_standard/audioPlayer/Test.json
multimedia/media/media_js_standard/audioPlayer/Test.json
+25
-25
multimedia/media/media_js_standard/audioPlayer/src/main/config.json
.../media/media_js_standard/audioPlayer/src/main/config.json
+1
-1
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
...ioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
+34
-24
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+17
-6
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
...layer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
+8
-12
multimedia/media/media_js_standard/audioPlayer/src/main/resources/rawfile/01.mp3
...js_standard/audioPlayer/src/main/resources/rawfile/01.mp3
+0
-0
multimedia/media/media_js_standard/videoPlayer/Test.json
multimedia/media/media_js_standard/videoPlayer/Test.json
+3
-2
multimedia/media/media_js_standard/videoPlayer/src/main/config.json
.../media/media_js_standard/videoPlayer/src/main/config.json
+1
-1
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+12
-1
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerEnumTest.test.js
.../videoPlayer/src/main/js/test/VideoPlayerEnumTest.test.js
+14
-0
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+16
-4
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+278
-9
multimedia/media/media_js_standard/videoPlayer/src/main/resources/rawfile/01.mp3
...js_standard/videoPlayer/src/main/resources/rawfile/01.mp3
+0
-0
multimedia/media/media_js_standard/videoPlayer/src/main/resources/rawfile/H264_AAC.mp4
...ndard/videoPlayer/src/main/resources/rawfile/H264_AAC.mp4
+3
-0
multimedia/media/media_js_standard/videoRecorder/src/main/config.json
...edia/media_js_standard/videoRecorder/src/main/config.json
+1
-1
未找到文件。
multimedia/media/media_js_standard/MediaTestBase.js
浏览文件 @
1e7497d8
...
...
@@ -71,6 +71,10 @@ export async function getFdRead(pathName, done) {
return
fdReturn
;
}
export
async
function
closeFdNumber
(
fdNumber
)
{
await
fileio
.
close
(
fdNumber
);
}
// wait synchronously
export
function
msleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
...
...
@@ -159,7 +163,7 @@ export async function getFd(pathName) {
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
fdObject
.
fileAsset
=
await
fetchFileResult
.
getAllObject
();
fdObject
.
fdNumber
=
await
fdObject
.
fileAsset
[
0
].
open
(
'
R
w
'
);
fdObject
.
fdNumber
=
await
fdObject
.
fileAsset
[
0
].
open
(
'
r
w
'
);
console
.
info
(
'
case getFd number is:
'
+
fdObject
.
fdNumber
);
}
return
fdObject
;
...
...
multimedia/media/media_js_standard/audioPlayer/Test.json
浏览文件 @
1e7497d8
...
...
@@ -17,7 +17,7 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
"
"mkdir -p /data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
"
],
"teardown-command"
:[
]
...
...
@@ -27,30 +27,30 @@
"pre-push"
:
[
],
"push"
:
[
"./resource/audio/01.mp3 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/02.mp3 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/03.mp3 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/04.mp3 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/47.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/49.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/50.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/51.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/54.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/55.m4a ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/57.m4a ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/58.m4a ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/59.m4a ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/62.m4a ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/64.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/65.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/66.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/67.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/92.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/93.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/94.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/96.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/97.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/98.mp4 ->/data/app/el
1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
"./resource/audio/01.mp3 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/02.mp3 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/03.mp3 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/04.mp3 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/47.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/49.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/50.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/51.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/54.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/55.m4a ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/57.m4a ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/58.m4a ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/59.m4a ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/62.m4a ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/64.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/65.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/66.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/67.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/92.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/93.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/94.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/96.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/97.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
,
"./resource/audio/98.mp4 ->/data/app/el
2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files
/"
]
}
]
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/config.json
浏览文件 @
1e7497d8
...
...
@@ -40,7 +40,7 @@
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"homeAbility"
:
true
,
"launchType"
:
"s
tandard
"
"launchType"
:
"s
ingleton
"
}
],
"deviceType"
:
[
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
浏览文件 @
1e7497d8
...
...
@@ -42,7 +42,8 @@ describe('PlayerLocalTestAudioAPI', function () {
const
VOLUME_VALUE
=
0.5
;
let
fdHead
=
'
fd://
'
;
let
fileDescriptor
=
undefined
;
let
fdPath
=
''
;
let
fdNumber
=
0
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -52,10 +53,15 @@ describe('PlayerLocalTestAudioAPI', function () {
await
mediaTestBase
.
getFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
mediaTestBase
.
getFdRead
(
AUDIO_SOURCE
,
openFileFailed
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
fdPath
=
fdHead
+
''
+
fdNumber
;
})
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
async
function
()
{
await
mediaTestBase
.
closeFdNumber
(
fdNumber
);
await
mediaTestBase
.
closeFileDescriptor
(
AUDIO_SOURCE
);
console
.
info
(
'
afterEach case
'
);
})
...
...
@@ -64,6 +70,10 @@ describe('PlayerLocalTestAudioAPI', function () {
console
.
info
(
'
afterAll case
'
);
})
function
openFileFailed
()
{
console
.
info
(
'
case file fail
'
);
}
function
initAudioPlayer
()
{
if
(
typeof
(
audioPlayer
)
!=
'
undefined
'
)
{
audioPlayer
.
release
();
...
...
@@ -85,7 +95,7 @@ describe('PlayerLocalTestAudioAPI', function () {
switch
(
mySteps
[
0
])
{
case
SRC_STATE
:
console
.
info
(
`case to prepare`
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
break
;
case
PLAY_STATE
:
console
.
info
(
`case to play`
);
...
...
@@ -320,7 +330,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -336,7 +346,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -352,7 +362,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -368,7 +378,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
RESET_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -400,7 +410,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -416,7 +426,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
PLAY_STATE
,
STOP_STATE
,
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -432,7 +442,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -448,7 +458,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -464,7 +474,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -480,7 +490,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -496,7 +506,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -512,7 +522,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -528,7 +538,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -544,7 +554,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -560,7 +570,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -592,7 +602,7 @@ describe('PlayerLocalTestAudioAPI', function () {
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -608,7 +618,7 @@ describe('PlayerLocalTestAudioAPI', function () {
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -624,7 +634,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -640,7 +650,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -656,7 +666,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -672,7 +682,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -688,7 +698,7 @@ describe('PlayerLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
1e7497d8
...
...
@@ -14,6 +14,7 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
audio
from
'
@ohos.multimedia.audio
'
import
{
playAudioSource
}
from
'
../../../../../AudioPlayerTestBase.js
'
;
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
...
...
@@ -44,6 +45,8 @@ describe('PlayerLocalTestAudioFUNC', function () {
let
bufferFlag
=
false
;
let
fdHead
=
'
fd://
'
;
let
fileDescriptor
=
undefined
;
let
fdPath
=
''
;
let
fdNumber
=
0
;
let
audioTrackKey
=
new
Array
(
'
channel_count
'
,
'
codec_mime
'
,
'
sample_rate
'
,
'
track_index
'
,
'
track_type
'
);
let
audioTrackValue
=
new
Array
(
1
,
'
audio/mpeg
'
,
48000
,
0
,
0
);
...
...
@@ -53,6 +56,10 @@ describe('PlayerLocalTestAudioFUNC', function () {
await
mediaTestBase
.
getFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
mediaTestBase
.
getFdRead
(
AUDIO_SOURCE
,
openFileFailed
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
fdPath
=
fdHead
+
''
+
fdNumber
;
})
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -67,9 +74,14 @@ describe('PlayerLocalTestAudioFUNC', function () {
afterAll
(
async
function
()
{
await
mediaTestBase
.
closeFileDescriptor
(
AUDIO_SOURCE
);
await
mediaTestBase
.
closeFdNumber
(
fdNumber
);
console
.
info
(
'
afterAll case
'
);
})
function
openFileFailed
()
{
console
.
info
(
'
case file fail
'
);
}
function
initAudioPlayer
()
{
if
(
typeof
(
audioPlayer
)
!=
'
undefined
'
)
{
audioPlayer
.
release
();
...
...
@@ -299,12 +311,11 @@ describe('PlayerLocalTestAudioFUNC', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SETVOLUME
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
VOLUME_STATE
,
0
,
VOLUME_STATE
,
0.5
,
VOLUME_STATE
,
MAX_VOLUME
,
RESET_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
audioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -392,7 +403,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
testAudioPlayer
.
release
();
done
();
});
testAudioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
testAudioPlayer
.
src
=
fd
Path
;
})
/* *
...
...
@@ -405,7 +416,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_BASE_0100
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
playAudioSource
(
fd
Head
+
fileDescriptor
.
fd
,
DURATION_TIME
,
PLAY_TIME
,
true
,
done
);
playAudioSource
(
fd
Path
,
DURATION_TIME
,
PLAY_TIME
,
true
,
done
);
})
/* *
...
...
@@ -434,8 +445,8 @@ describe('PlayerLocalTestAudioFUNC', function () {
function
waitForDone
()
{
console
.
info
(
'
case wait for next player
'
);
}
playAudioSource
(
fd
Head
+
fileDescriptor
.
fd
,
DURATION_TIME
,
PLAY_TIME
,
true
,
waitForDone
);
playAudioSource
(
fd
Path
,
DURATION_TIME
,
PLAY_TIME
,
true
,
waitForDone
);
mediaTestBase
.
msleep
(
1000
);
playAudioSource
(
fd
Head
+
fileDescriptor
.
fd
,
DURATION_TIME
,
PLAY_TIME
,
true
,
done
);
playAudioSource
(
fd
Path
,
DURATION_TIME
,
PLAY_TIME
,
true
,
done
);
})
})
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
浏览文件 @
1e7497d8
...
...
@@ -18,14 +18,12 @@ import * as mediaTestBase from '../../../../../MediaTestBase.js';
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioFormat
'
,
function
()
{
let
audioSource
=
'
01.mp3
'
;
const
MAX_VOLUME
=
1
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
10000
;
// 10s
let
isToSeek
=
false
;
let
isToDuration
=
false
;
let
fileDescriptor
=
undefined
;
let
fdNumber
=
0
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -36,23 +34,20 @@ describe('PlayerLocalTestAudioFormat', function () {
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
afterEach
(
async
function
()
{
await
mediaTestBase
.
closeFdNumber
(
fdNumber
);
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
await
mediaTestBase
.
closeFileDescriptor
(
audioSource
);
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
async
function
playSource
(
audioFile
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
audioSource
=
audioFile
;
await
mediaTestBase
.
getFileDescriptor
(
audioSource
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
audioPlayer
.
src
=
'
fd://
'
+
fileDescriptor
.
fd
;
await
mediaTestBase
.
getFdRead
(
audioFile
,
done
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
})
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
...
...
@@ -122,6 +117,7 @@ describe('PlayerLocalTestAudioFormat', function () {
expect
().
assertFail
();
done
();
});
audioPlayer
.
src
=
'
fd://
'
+
fdNumber
;
}
/* *
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/resources/rawfile/01.mp3
0 → 100644
浏览文件 @
1e7497d8
文件已添加
multimedia/media/media_js_standard/videoPlayer/Test.json
浏览文件 @
1e7497d8
...
...
@@ -17,7 +17,7 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el
1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile
"
"mkdir -p /data/app/el
2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files
"
],
"teardown-command"
:[
]
...
...
@@ -27,7 +27,8 @@
"pre-push"
:
[
],
"push"
:
[
"./resource/audio/H264_AAC.mp4 ->/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/"
"./resource/audio/H264_AAC.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files/"
,
"./resource/audio/01.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files/"
]
}
]
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/config.json
浏览文件 @
1e7497d8
...
...
@@ -40,7 +40,7 @@
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"homeAbility"
:
true
,
"launchType"
:
"s
tandard
"
"launchType"
:
"s
ingleton
"
}
],
"deviceType"
:
[
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
1e7497d8
...
...
@@ -52,10 +52,16 @@ describe('VideoPlayerAPICallbackTest', function () {
const
pagePath2
=
'
pages/surfaceTest2/surfaceTest2
'
;
let
pageId
=
0
;
let
fdHead
=
'
fd://
'
;
let
fdPath
=
''
;
let
fdNumber
=
0
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
beforeAll
(
async
function
()
{
await
mediaTestBase
.
getFdRead
(
VIDEO_SOURCE
,
openFileFailed
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
fdPath
=
fdHead
+
''
+
fdNumber
;
})
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -79,9 +85,14 @@ describe('VideoPlayerAPICallbackTest', function () {
})
afterAll
(
async
function
()
{
await
mediaTestBase
.
closeFdNumber
(
fdNumber
);
console
.
info
(
'
afterAll case
'
);
})
function
openFileFailed
()
{
console
.
info
(
'
case file fail
'
);
}
function
toNextStep
(
videoPlayer
,
steps
,
done
)
{
if
(
steps
[
0
]
==
END_EVENT
)
{
console
.
info
(
'
case success!!
'
);
...
...
@@ -138,7 +149,7 @@ describe('VideoPlayerAPICallbackTest', function () {
});
eventEmitter
.
on
(
SETURL_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
steps
.
shift
();
videoPlayer
.
url
=
fd
Head
+
fileDescriptor
.
fd
;
videoPlayer
.
url
=
fd
Path
;
toNextStep
(
videoPlayer
,
steps
,
done
);
});
eventEmitter
.
on
(
SETSURFACE_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerEnumTest.test.js
浏览文件 @
1e7497d8
...
...
@@ -167,4 +167,18 @@ describe('VideoPlayerEnumTest', function () {
expect
(
media
.
MediaDescriptionKey
.
MD_KEY_AUD_SAMPLE_RATE
).
assertEqual
(
"
sample_rate
"
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_ENUM_MEDIA_SCALE_TYPE_00_0100
* @tc.name : MediaType
* @tc.desc : MediaType Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_ENUM_MEDIA_TYPE_00_0100
'
,
0
,
async
function
(
done
)
{
expect
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
).
assertEqual
(
0
);
expect
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
).
assertEqual
(
1
);
done
();
})
})
\ No newline at end of file
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
1e7497d8
...
...
@@ -54,6 +54,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
const
pagePath1
=
'
pages/surfaceTest/surfaceTest
'
;
const
pagePath2
=
'
pages/surfaceTest2/surfaceTest2
'
;
let
pageId
=
0
;
let
fdPath
=
''
;
let
fdNumber
=
0
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
...
...
@@ -62,6 +64,10 @@ describe('VideoPlayerFuncCallbackTest', function () {
await
mediaTestBase
.
getFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
mediaTestBase
.
getFdRead
(
VIDEO_SOURCE
,
openFileFailed
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
fdPath
=
fdHead
+
''
+
fdNumber
;
})
})
beforeEach
(
async
function
()
{
...
...
@@ -81,9 +87,14 @@ describe('VideoPlayerFuncCallbackTest', function () {
afterAll
(
async
function
()
{
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_SOURCE
);
await
mediaTestBase
.
closeFdNumber
(
fdNumber
);
console
.
info
(
'
afterAll case
'
);
})
function
openFileFailed
()
{
console
.
info
(
'
case file fail
'
);
}
function
toNextStep
(
videoPlayer
,
steps
,
done
)
{
if
(
steps
[
0
]
==
END_EVENT
)
{
console
.
info
(
'
case success!!
'
);
...
...
@@ -469,8 +480,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SETSOURCE
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
fdPath
=
''
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSOURCE_EVENT
,
fdPath
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSOURCE_EVENT
,
''
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
...
...
@@ -485,7 +495,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETVOLUME
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SET
FDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SET
SOURCE_EVENT
,
fdPath
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETVOLUME_EVENT
,
0
,
SETVOLUME_EVENT
,
0.5
,
SETVOLUME_EVENT
,
1
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
...
...
@@ -522,7 +532,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_CALLBACK
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
frameCount
=
-
1
;
let
frameCount
=
false
;
let
completedCount
=
0
;
let
widthValue
=
-
1
;
let
heightValue
=
-
1
;
...
...
@@ -547,6 +557,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
expect
(
widthValue
).
assertEqual
(
WIDTH_VALUE
);
expect
(
heightValue
).
assertEqual
(
HEIGHT_VALUE
);
expect
(
completedCount
).
assertEqual
(
1
);
expect
(
frameCount
).
assertEqual
(
true
);
videoPlayer
.
release
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case release success!!
'
);
...
...
@@ -564,6 +575,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
videoPlayer
.
on
(
'
startRenderFrame
'
,
()
=>
{
console
.
info
(
'
case startRenderFrame success
'
);
frameCount
=
true
;
});
videoPlayer
.
on
(
'
videoSizeChanged
'
,
(
width
,
height
)
=>
{
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
1e7497d8
...
...
@@ -14,11 +14,13 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
audio
from
'
@ohos.multimedia.audio
'
import
*
as
mediaTestBase
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncPromiseTest
'
,
function
()
{
const
VIDEO_SOURCE
=
'
H264_AAC.mp4
'
;
const
AUDIO_SOURCE
=
'
01.mp3
'
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
5000
;
const
WIDTH_VALUE
=
720
;
...
...
@@ -34,12 +36,18 @@ describe('VideoPlayerFuncPromiseTest', function () {
const
pagePath1
=
'
pages/surfaceTest/surfaceTest
'
;
const
pagePath2
=
'
pages/surfaceTest2/surfaceTest2
'
;
let
pageId
=
0
;
let
fdPath
=
''
;
let
fdNumber
=
0
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
await
mediaTestBase
.
getFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
mediaTestBase
.
getFdRead
(
VIDEO_SOURCE
,
openFileFailed
).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
fdPath
=
fdHead
+
''
+
fdNumber
;
})
})
beforeEach
(
async
function
()
{
...
...
@@ -59,9 +67,14 @@ describe('VideoPlayerFuncPromiseTest', function () {
afterAll
(
async
function
()
{
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_SOURCE
);
await
mediaTestBase
.
closeFdNumber
(
fdNumber
);
console
.
info
(
'
afterAll case
'
);
})
function
openFileFailed
()
{
console
.
info
(
'
case file fail
'
);
}
function
checkSpeedTime
(
videoPlayer
,
speedValue
,
startTime
)
{
let
newTime
=
videoPlayer
.
currentTime
;
if
(
videoPlayer
.
state
==
'
playing
'
)
{
...
...
@@ -140,7 +153,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fd
Head
+
fileDescriptor
.
fd
;
videoPlayer
.
url
=
fd
Path
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
...
...
@@ -197,7 +210,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fd
Head
+
fileDescriptor
.
fd
;
videoPlayer
.
url
=
fd
Path
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
...
...
@@ -282,7 +295,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_Callback
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
frameCount
=
-
1
;
let
frameCount
=
false
;
let
completedCount
=
0
;
let
widthValue
=
-
1
;
let
heightValue
=
-
1
;
...
...
@@ -304,7 +317,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
widthValue
).
assertEqual
(
WIDTH_VALUE
);
expect
(
heightValue
).
assertEqual
(
HEIGHT_VALUE
);
//expect(frameCount).assertEqual(1
);
expect
(
frameCount
).
assertEqual
(
true
);
expect
(
completedCount
).
assertEqual
(
1
);
done
();
});
...
...
@@ -316,7 +329,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
videoPlayer
.
on
(
'
startRenderFrame
'
,
()
=>
{
console
.
info
(
'
case startRenderFrame success
'
);
//frameCount++
;
frameCount
=
true
;
});
videoPlayer
.
on
(
'
videoSizeChanged
'
,
(
width
,
height
)
=>
{
...
...
@@ -325,7 +338,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
heightValue
=
height
;
});
videoPlayer
.
url
=
fd
Head
+
fileDescriptor
.
fd
;
videoPlayer
.
url
=
fd
Path
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
...
...
@@ -390,7 +403,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
console
.
info
(
'
case bufferingUpdate bufferCount value is
'
+
bufferCount
);
});
videoPlayer
.
url
=
fdHead
+
fileDescriptor
.
fd
;
videoPlayer
.
fdSrc
=
fileDescriptor
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
...
...
@@ -457,7 +470,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
done
();
});
videoPlayer
.
url
=
fd
Head
+
fileDescriptor
.
fd
;
videoPlayer
.
url
=
fd
Path
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
console
.
info
(
'
case setDisplaySurface success
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
...
...
@@ -501,7 +514,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fd
Head
+
fileDescriptor
.
fd
;
videoPlayer
.
url
=
fd
Path
;
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called!!
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
...
...
@@ -538,4 +551,260 @@ describe('VideoPlayerFuncPromiseTest', function () {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
loop
=
false
;
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_VIDEOSCALETYPE_0100
* @tc.name : 001.test video player videoScaleTpe (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_VIDEOSCALETYPE_0100
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
console
.
info
(
'
case createVideoPlayer success
'
);
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
on
(
'
error
'
,
(
error
)
=>
{
expect
().
assertFail
();
console
.
info
(
'
case error happened :
'
+
error
.
message
);
});
videoPlayer
.
on
(
'
playbackCompleted
'
,
async
()
=>
{
console
.
info
(
'
case playbackCompleted success
'
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
});
videoPlayer
.
url
=
fdPath
;
console
.
info
(
'
case set videoScaleType : 1
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
console
.
info
(
'
case setDisplaySurface success
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called!!
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
videoScaleType
).
assertEqual
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
);
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
);
console
.
info
(
'
case set videoScaleType : 0
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
await
videoPlayer
.
pause
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
paused
'
);
console
.
info
(
'
case pause called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
videoScaleType
).
assertEqual
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
);
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
case stop called!!
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
stopped
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
'
case set videoScaleType : 1
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
;
await
videoPlayer
.
reset
().
then
(()
=>
{
console
.
info
(
'
case reset called!!
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fdPath
;
console
.
info
(
'
case set videoScaleType : 1
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
;
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called!!
'
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
videoScaleType
).
assertEqual
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
);
videoPlayer
.
loop
=
true
;
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
);
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
console
.
info
(
'
case set videoScaleType : 0
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
await
videoPlayer
.
seek
(
videoPlayer
.
duration
/
2
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
videoPlayer
.
videoScaleType
).
assertEqual
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
'
case set videoScaleType : 1
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
;
await
videoPlayer
.
seek
(
0
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
videoPlayer
.
videoScaleType
).
assertEqual
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
'
case set videoScaleType : 0
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
await
videoPlayer
.
seek
(
videoPlayer
.
duration
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
videoPlayer
.
videoScaleType
).
assertEqual
(
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
loop
=
false
;
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_VIDEOSCALETYPE_0200
* @tc.name : 002.set videoScaleTpe 100 times in playing (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_VIDEOSCALETYPE_0200
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
bufferCount
=
false
;
let
count
=
0
;
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
.
on
(
'
playbackCompleted
'
,
async
()
=>
{
console
.
info
(
'
case playbackCompleted success
'
);
await
videoPlayer
.
play
().
then
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
bufferCount
).
assertEqual
(
true
);
done
();
});
videoPlayer
.
on
(
'
bufferingUpdate
'
,
(
infoType
,
value
)
=>
{
console
.
info
(
'
case bufferingUpdate success infoType is
'
+
infoType
);
console
.
info
(
'
case bufferingUpdate success value is
'
+
value
);
bufferCount
=
true
;
});
videoPlayer
.
url
=
fdPath
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
videoPlayer
.
loop
=
true
;
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
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
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
);
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
if
(
count
==
0
)
{
console
.
info
(
'
case set videoScaleType : 1
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT_CROP
;
count
=
1
;
}
else
{
console
.
info
(
'
case set videoScaleType : 0
'
);
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
count
=
0
;
}
mediaTestBase
.
msleep
(
500
);
}
videoPlayer
.
loop
=
false
;
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_VIDEOSCALETYPE_0300
* @tc.name : 003.set error value to videoScaleTpe (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_VIDEOSCALETYPE_0300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
errorCount
=
0
;
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
.
on
(
'
error
'
,
async
(
error
)
=>
{
errorCount
++
;
console
.
info
(
'
case error happened :
'
+
error
.
message
);
if
(
errorCount
==
3
)
{
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
}
});
videoPlayer
.
videoScaleType
=
media
.
VideoScaleType
.
VIDEO_SCALE_TYPE_FIT
;
videoPlayer
.
url
=
fdPath
;
videoPlayer
.
videoScaleType
=
2
;
videoPlayer
.
videoScaleType
=
-
1
;
})
})
multimedia/media/media_js_standard/videoPlayer/src/main/resources/rawfile/01.mp3
0 → 100644
浏览文件 @
1e7497d8
文件已添加
multimedia/media/media_js_standard/videoPlayer/src/main/resources/rawfile/H264_AAC.mp4
0 → 100644
LFS
浏览文件 @
1e7497d8
文件已添加
multimedia/media/media_js_standard/videoRecorder/src/main/config.json
浏览文件 @
1e7497d8
...
...
@@ -40,7 +40,7 @@
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"homeAbility"
:
true
,
"launchType"
:
"s
tandard
"
"launchType"
:
"s
ingleton
"
}
],
"deviceType"
:
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录