未验证 提交 fc947786 编写于 作者: N Nicklaus 提交者: Gitee

update multimedia/media/media_js_standard/AVPlayerTestBase.js.

Signed-off-by: NNicklaus <dongwei@kaihong.com>
上级 75cfb6f8
...@@ -472,15 +472,13 @@ export async function avPlayerWithCallBack(src, avPlayer, playTest, playTime, do ...@@ -472,15 +472,13 @@ export async function avPlayerWithCallBack(src, avPlayer, playTest, playTime, do
setSource(avPlayer, src); setSource(avPlayer, src);
} }
export async function playToPauseLoop(avPlayer,prepared){ async function playToPauseLoop(avPlayer){
if(prepared == 1){
await avPlayer.play().then(() => { await avPlayer.play().then(() => {
console.info('playToPauseLoop play success'); console.info('playToPauseLoop play success');
expect(avPlayer.state).assertEqual(AV_PLAYER_STATE.PLAYING); expect(avPlayer.state).assertEqual(AV_PLAYER_STATE.PLAYING);
}, (err) => { }, (err) => {
console.error('playToPauseLoop play filed,error message is :' + err.message) console.error('playToPauseLoop play filed,error message is :' + err.message)
}) })
}
if(avPlayer.state == AV_PLAYER_STATE.PLAYING){ if(avPlayer.state == AV_PLAYER_STATE.PLAYING){
avPlayer.loop = true; avPlayer.loop = true;
await mediaTestBase.msleepAsync(2); await mediaTestBase.msleepAsync(2);
...@@ -496,7 +494,6 @@ export async function playToPauseLoop(avPlayer,prepared){ ...@@ -496,7 +494,6 @@ export async function playToPauseLoop(avPlayer,prepared){
export async function avPlayerWithoutCallBack(src, avPlayer, playTest, done) { export async function avPlayerWithoutCallBack(src, avPlayer, playTest, done) {
let surfaceID = globalThis.value; let surfaceID = globalThis.value;
let prepared = 0;
console.info(`case avPlayerWithoutCallBack in, surfaceID is ${surfaceID}`); console.info(`case avPlayerWithoutCallBack in, surfaceID is ${surfaceID}`);
console.info(`case media source: ${src}`) console.info(`case media source: ${src}`)
await media.createAVPlayer().then((video) => { await media.createAVPlayer().then((video) => {
...@@ -517,13 +514,12 @@ export async function avPlayerWithoutCallBack(src, avPlayer, playTest, done) { ...@@ -517,13 +514,12 @@ export async function avPlayerWithoutCallBack(src, avPlayer, playTest, done) {
} }
if(avPlayer.state == AV_PLAYER_STATE.PREPARED){ if(avPlayer.state == AV_PLAYER_STATE.PREPARED){
console.info('avPlayerWithoutCallBack avPlayer from PREPARED to play') console.info('avPlayerWithoutCallBack avPlayer from PREPARED to play')
prepared = 1
}
// play to pause loop 1000 times // play to pause loop 1000 times
for(var i = 0;i < 1000; i++){ for(var i = 0;i < 1000; i++){
await playToPauseLoop(avPlayer,prepared) await playToPauseLoop(avPlayer)
console.info(`case avPlayerWithoutCallBack playToPauseLoop is ${i}`); console.info(`case avPlayerWithoutCallBack playToPauseLoop is ${i}`);
} }
}
await avPlayer.stop().then(() => { await avPlayer.stop().then(() => {
console.info('avPlayerWithoutCallBack avPlayer from play to stop') console.info('avPlayerWithoutCallBack avPlayer from play to stop')
avPlayer.release().then(() => { avPlayer.release().then(() => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册