Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
adbc34e7
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看板
未验证
提交
adbc34e7
编写于
3月 22, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 22, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8149 【媒体子系统】新增接口覆盖
Merge pull request !8149 from 秦莉文/OpenHarmony-3.2-Release
上级
115de1bd
5049a0bb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
37 deletion
+49
-37
multimedia/media/media_js_standard/AVRecorderTestBase.js
multimedia/media/media_js_standard/AVRecorderTestBase.js
+49
-37
未找到文件。
multimedia/media/media_js_standard/AVRecorderTestBase.js
浏览文件 @
adbc34e7
...
...
@@ -31,18 +31,31 @@ export async function idle(avRecorder) {
return
avRecorder
;
}
export
async
function
idleCallback
(
avRecorder
)
{
console
.
info
(
'
case idleCallback called
'
);
media
.
createAVRecorder
((
error
,
recorder
)
=>
{
if
(
recorder
!=
null
)
{
avRecorder
=
recorder
;
console
.
info
(
'
createAVRecorder success
'
);
}
else
{
console
.
info
(
`createAVRecorder fail, error:
${
error
}
`
);
}
});
return
avRecorder
;
}
export
const
AV_RECORDER_STATE
=
{
IDLE
:
'
idle
'
,
PREPARED
:
'
prepared
'
,
STARTED
:
'
started
'
,
PAUSED
:
'
paused
'
,
STOPPED
:
'
stopped
'
,
RELEASED
:
'
released
'
,
ERROR
:
'
error
'
,
IDLE
:
'
idle
'
,
PREPARED
:
'
prepared
'
,
STARTED
:
'
started
'
,
PAUSED
:
'
paused
'
,
STOPPED
:
'
stopped
'
,
RELEASED
:
'
released
'
,
ERROR
:
'
error
'
,
}
export
function
prepareCallback
(
avRecorder
,
avConfig
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
prepare
(
avConfig
,
(
err
)
=>
{
...
...
@@ -56,31 +69,31 @@ export function prepareCallback(avRecorder, avConfig) {
}
export
function
preparePromise
(
avRecorder
,
avConfig
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
prepare
(
avConfig
).
then
(()
=>
{
console
.
info
(
'
prepare success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
getInputSurfacePromise
(
avRecorder
)
{
let
surfaceID
=
null
;
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
}
avRecorder
.
getInputSurface
().
then
((
surfaceId
)
=>
{
console
.
info
(
'
getInputSurface success
'
);
surfaceID
=
surfaceId
;
}).
catch
((
err
)
=>
{
console
.
info
(
'
getInputSurface failed and catch error is
'
+
err
.
message
);
});
// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
}
export
function
getInputSurfaceCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
let
surfaceID
=
null
;
...
...
@@ -96,7 +109,7 @@ export function getInputSurfaceCallback(avRecorder) {
}
export
function
startCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
start
((
err
)
=>
{
...
...
@@ -110,16 +123,16 @@ export function startCallback(avRecorder) {
}
export
function
startPromise
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
start
().
then
(()
=>
{
console
.
info
(
'
start success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
pauseCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
pause
((
err
)
=>
{
...
...
@@ -133,16 +146,16 @@ export function pauseCallback(avRecorder) {
}
export
function
pausePromise
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
pause
().
then
(()
=>
{
console
.
info
(
'
pause success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
resumeCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
resume
((
err
)
=>
{
...
...
@@ -156,16 +169,16 @@ export function resumeCallback(avRecorder) {
}
export
function
resumePromise
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
resume
().
then
(()
=>
{
console
.
info
(
'
resume success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
stopCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
stop
((
err
)
=>
{
...
...
@@ -179,16 +192,16 @@ export function stopCallback(avRecorder) {
}
export
function
stopPromise
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
stop
().
then
(()
=>
{
console
.
info
(
'
stop success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
resetCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
reset
((
err
)
=>
{
...
...
@@ -202,16 +215,16 @@ export function resetCallback(avRecorder) {
}
export
function
resetPromise
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
reset
().
then
(()
=>
{
console
.
info
(
'
reset success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
releaseCallback
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
release
((
err
)
=>
{
...
...
@@ -225,24 +238,23 @@ export function releaseCallback(avRecorder) {
}
export
function
releasePromise
(
avRecorder
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
if
(
typeof
(
avRecorder
)
==
'
undefined
'
)
{
return
;
}
avRecorder
.
release
().
then
(()
=>
{
console
.
info
(
'
release success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
export
function
offCallback
(
avRecorder
,
typeArr
)
{
export
function
offCallback
(
avRecorder
,
typeArr
)
{
if
(
avRecorder
==
null
)
{
return
;
}
for
(
let
i
=
0
;
i
<
typeArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
typeArr
.
length
;
i
++
)
{
switch
(
typeArr
[
i
])
{
case
'
stateChange
'
:
avRecorder
.
off
(
'
stateChange
'
);
...
...
@@ -300,7 +312,7 @@ export async function setOnCallback(avConfig, avRecorder, recorderTime, done) {
console
.
info
(
'
case state is unknown
'
);
}
});
avRecorder
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
'
case avRecorder.on(error) called, errMessage is
'
+
err
.
message
);
});
...
...
@@ -381,7 +393,7 @@ export async function avRecorderReliabilitTest02(avConfig, avRecorder, recorderT
}
export
async
function
avRecorderReliabilitTest03
(
avConfig
,
avRecorder
,
recorderTime
,
done
)
{
avRecorder
=
await
idle
(
avRecorder
);
avRecorder
=
await
idle
Callback
(
avRecorder
);
setPrepareOnCallback
(
avConfig
,
avRecorder
,
recorderTime
,
done
)
await
avRecorder
.
prepare
(
avConfig
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录