未验证 提交 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,12 +514,11 @@ export async function avPlayerWithoutCallBack(src, avPlayer, playTest, done) { ...@@ -517,12 +514,11 @@ 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
} for(var i = 0;i < 1000; i++){
// play to pause loop 1000 times await playToPauseLoop(avPlayer)
for(var i = 0;i < 1000; i++){ console.info(`case avPlayerWithoutCallBack playToPauseLoop is ${i}`);
await playToPauseLoop(avPlayer,prepared) }
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')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册