提交 d1e0e582 编写于 作者: D dongwei

avRecorder 视频录制用例上库

Signed-off-by: Ndongwei <dongwei@kaihong.com>
上级 e71a0278
......@@ -159,4 +159,1083 @@ export async function initCamera() {
await captureSession.start().then(() => {
console.log('Promise returned to indicate the session start success.');
})
}
\ No newline at end of file
}
export async function startCameraOutput() {
console.info('startCameraOutput start')
await videoOutput.start(async (err) => {
if (err) {
console.error(`Failed to start the video output ${err.message}`);
return;
}
console.log('Callback invoked to indicate the video output start success.');
});
}
export async function stopCameraOutput() {
await videoOutput.stop((err) => {
if (err) {
console.error(`Failed to stop the video output ${err.message}`);
return;
}
console.log('Callback invoked to indicate the video output stop success.');
});
}
// 释放相机实例
export async function releaseCamera() {
try{
await captureSession.stop()
console.info('releaseCamera 001');
console.info('captureSession.stop success');
await cameraInput.close()
console.info('releaseCamera 002');
console.info('cameraInput.close success');
await previewOutput.release()
console.info('releaseCamera 003');
console.info('previewOutput.release success');
await videoOutput.release()
console.info('releaseCamera 004');
console.info('videoOutput.release success');
await captureSession.release()
console.info('releaseCamera 005');
console.info('captureSession.release success');
captureSession = null
console.info('releaseCamera success');
} catch(err){
console.info('releaseCamera failed and catch error is ' + err.message);
}
}
// release camera and avRecorder
export async function releaseRecorderCallBack(avRecorder, done) {
await AVRecorderTestBase.releaseCallback(avRecorder)
await releaseCamera()
done();
}
export async function releaseRecorderPromise(avRecorder, done) {
await AVRecorderTestBase.releasePromise(avRecorder)
await releaseCamera()
done();
}
export async function releaseRecorderPromiseNotDone(avRecorder) {
await AVRecorderTestBase.releasePromise(avRecorder)
await releaseCamera()
}
export async function getInputSurfacePromise(avRecorder) {
if (typeof(avRecorder) == 'undefined') {
return;
}
// console.info('getInputSurfacePromise avRecorder.state is: ' + avRecorder.state)
await avRecorder.getInputSurface().then((surfaceId) => {
console.info('getInputSurface success');
videoSurfaceId = surfaceId;
}).catch((err) => {
console.info('getInputSurface failed and catch error is ' + err.message);
});
}
export async function getInputSurfaceCallback(avRecorder) {
if (typeof(avRecorder) == 'undefined') {
return;
}
await avRecorder.getInputSurface((err, surfaceId) => {
if (err == null) {
console.info('getInputSurface success');
videoSurfaceId = surfaceId;
} else {
console.info('getInputSurface failed and error is ' + err.message);
}
});
}
export function setAvRecorderCallback(avRecorder, done) {
// 状态机变化回调函数
avRecorder.on('stateChange', (state, reason) => {
console.info(TAG + 'current state is: ' + state);
})
// 错误上报回调函数
avRecorder.on('error', async (err) => {
try {
console.error(TAG + 'error ocConstantSourceNode, error message is ' + err);
await releaseRecorderPromise(avRecorder, done);
} catch (error) {
// 处理错误
console.error(TAG + 'when error on execute releaseRecorderPromise error message is ' + error);
}
});
}
// 开始录制对应的流程
export async function startRecordingProcessCallback(avRecorder, recorderTime) {
await startCameraOutput()
await AVRecorderTestBase.startCallback(avRecorder, recorderTime);
}
export async function startRecordingProcessPromise(avRecorder, recorderTime) {
await startCameraOutput()
await AVRecorderTestBase.startPromise(avRecorder, recorderTime);
}
// 暂停录制对应的流程
export async function pauseRecordingProcessCallback(avRecorder) {
if (avRecorder.state === 'started') {
// 仅在started状态下调用pause为合理状态切换
await AVRecorderTestBase.pauseCallback(avRecorder);
await stopCameraOutput(); // 停止相机出流
}
}
export async function pauseRecordingProcessPromise(avRecorder) {
if (avRecorder.state === 'started') {
// 仅在started状态下调用pause为合理状态切换
await AVRecorderTestBase.pausePromise(avRecorder);
await stopCameraOutput(); // 停止相机出流
}
}
// 恢复录制对应的流程
export async function resumeRecordingProcessCallback(avRecorder) {
if (avRecorder.state === 'paused') { // 仅在started状态下调用pause为合理状态切换
await startCameraOutput()
await AVRecorderTestBase.resumeCallback(avRecorder);
}
}
export async function resumeRecordingProcessPromise(avRecorder) {
if (avRecorder.state === 'paused') { // 仅在started状态下调用pause为合理状态切换
await startCameraOutput()
await AVRecorderTestBase.resumePromise(avRecorder);
}
}
// 停止录制对应的流程
export async function stopRecordingProcessCallback(avRecorder) {
await AVRecorderTestBase.stopCallback(avRecorder);
await stopCameraOutput()
}
export async function stopRecordingProcessPromise(avRecorder) {
await AVRecorderTestBase.stopPromise(avRecorder);
await stopCameraOutput();
}
// 重新录制对应的流程
export async function resetRecordingProcessPromise(avRecorder) {
await AVRecorderTestBase.resetPromise(avRecorder);
await stopCameraOutput();
}
// 重新录制对应的流程
export async function resetRecordingProcessCallback(avRecorder) {
await AVRecorderTestBase.resetCallback(avRecorder);
await stopCameraOutput();
}
export function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
export async function idleCallback(avRecorder) {
console.info('case idleCallback called');
media.createAVRecorder((error, recorder) => {
if (recorder != null) {
avRecorder = recorder;
console.info('createAVRecorder idleCallback success');
return avRecorder;
} else {
console.info(`createAVRecorder idleCallback fail, error:${error}`);
}
});
}
export async function prepareErrPromise(avRecorder, avConfig) {
let result = true;
if (typeof(avRecorder) == 'undefined') {
return;
}
await avRecorder.prepare(avConfig).then(() => {
console.info('prepare success');
}).catch((err) => {
result = false;
expect(result).assertEqual(false);
console.info('prepare failed and catch error is ' + err.message);
sleep(1000);
});
}
export async function avRecorderWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await sleep(3000)
await pauseRecordingProcessPromise(avRecorder)
await resumeRecordingProcessPromise(avRecorder);
await stopRecordingProcessPromise(avRecorder)
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderResumePromise1(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startCameraOutput()
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
}).catch((err) => {
resumeValue = false
console.info('avRecorderResumePromise1 resumeValue is ' + resumeValue);
console.info('resume avRecorderResumePromise1 failed and error is ' + err.message);
expect(resumeValue).assertEqual(false);
releaseRecorderPromise(avRecorder, done)
});
}
export async function avRecorderResumePromise2(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startCameraOutput()
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
}).catch((err) => {
resumeValue = false
console.info('avRecorderResumePromise2 resumeValue is ' + resumeValue);
console.info('resume avRecorderResumePromise2 failed and error is ' + err.message);
expect(resumeValue).assertEqual(false);
releaseRecorderPromise(avRecorder, done)
});
}
export async function avRecorderResumePromise3(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
console.info('avRecorderResumePromise3 resumeValue is ' + resumeValue);
expect(resumeValue).assertEqual(true);
}).catch((err) => {
console.info('resume AVRecorder failed and catch error is ' + err.message);
});
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderResumePromise4(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await pauseRecordingProcessPromise(avRecorder)
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
console.info('avRecorderResumePromise4 resumeValue is ' + resumeValue);
expect(resumeValue).assertEqual(true);
startCameraOutput()
}).catch((err) => {
console.info('resume AVRecorder failed and catch error is ' + err.message);
});
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderResumePromise5(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await stopRecordingProcessPromise(avRecorder)
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
}).catch((err) => {
resumeValue = false
console.info('resume avRecorderResumePromise5 failed and error is ' + err.message);
console.error(TAG + 'error avRecorderResumePromise5, error message is ' + err.message);
console.info('avRecorderResumePromise5 resumeValue is ' + resumeValue);
expect(resumeValue).assertEqual(false);
});
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderResumePromise6(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await AVRecorderTestBase.resetPromise(avRecorder) ;
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
console.info('avRecorderResumePromise6 resumeValue is ' + resumeValue);
}).catch((err) => {
resumeValue = false
console.info('resume avRecorderResumePromise6 failed and error is ' + err.message);
console.error(TAG + 'error avRecorderResumePromise6, error message is ' + err.message);
expect(resumeValue).assertEqual(false);
});
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderResumePromise7(avConfig, avRecorder, recorderTime, done) {
let resumeValue = true
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await avRecorder.resume().then(() => {
console.info('resume AVRecorder success');
console.info('avRecorderResumePromise7 resumeValue is ' + resumeValue);
}).catch((err) => {
resumeValue = false
console.info('resume avRecorderResumePromise7 failed and error is ' + err.message);
console.error(TAG + 'error avRecorderResumePromise7, error message is ' + err.message);
expect(resumeValue).assertEqual(false);
});
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderResumePromise8(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await pauseRecordingProcessPromise(avRecorder)
await resumeRecordingProcessCallback(avRecorder)
await resumeRecordingProcessCallback(avRecorder)
await resumeRecordingProcessCallback(avRecorder)
await releaseRecorderPromise(avRecorder, done)
}
export async function avRecorderStopPromise1(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await avRecorder.stop().then(() => {
console.info('stop avRecorderStopPromise1 success');
}).catch((err) => {
console.info('stop avRecorderStopPromise1 error');
console.info('stop avRecorderStopPromise1 failed and catch error is ' + err.message);
});
await AVRecorderTestBase.releaseDone(avRecorder, done)
}
export async function avRecorderStopPromise2(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await avRecorder.stop().then(() => {
console.info('stop avRecorderStopPromise2 success');
}).catch((err) => {
console.info('stop avRecorderStopPromise2 failed and catch error is ' + err.message);
});
await AVRecorderTestBase.releaseDone(avRecorder, done)
}
export async function avRecorderStopPromise7(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await avRecorder.stop().then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.STOPPED);
console.info('stop avRecorderStopPromise7 success');
}).catch((err) => {
console.info('stop avRecorderStopPromise7 failed and catch error is ' + err.message);
});
await AVRecorderTestBase.releaseDone(avRecorder, done)
}
export async function avRecorderResetPromise7(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder)
await avRecorder.reset().then(() => {
console.info('reset avRecorderResetPromise7 success');
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.IDLE);
}).catch((err) => {
console.info('reset AVRecorder failed and catch error is ' + err.message);
});
await AVRecorderTestBase.releaseDone(avRecorder, done)
}
// Promise prepare
export async function create2PreparePromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function start2PreparePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case start2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await prepareErrPromise(avRecorder, avConfig);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function pause2PreparePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case pause2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await prepareErrPromise(avRecorder, avConfig);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function resume2PreparePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case resume2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await AVRecorderTestBase.resumePromise(avRecorder);
await prepareErrPromise(avRecorder, avConfig);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function stop2PreparePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case stop2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.stopPromise(avRecorder);
await prepareErrPromise(avRecorder, avConfig);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function reset2PreparePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case reset2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.resetPromise(avRecorder);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function getInputSurface2PreparePromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case getInputSurface2PreparePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await prepareErrPromise(avRecorder, avConfig);
await releaseRecorderCallBack(avRecorder, done);
}
export async function prepare3TimesPromise(avConfig, avRecorder, loopTimes, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case prepare3TimesCallback avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
while (loopTimes > 0) {
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await AVRecorderTestBase.resetPromise(avRecorder);
loopTimes--;
}
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function avConfigChangedPromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfigChangedPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await prepareErrPromise(avRecorder, avConfig)
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function avRecorderWithPromise2(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case avConfig.url is ' + avConfig.url);
console.info('case avConfig.orientationHint is ' + avConfig.orientationHint);
console.info('case avConfig.profile.audioBitrate is ' + avConfig.profile.audioBitrate)
console.info('case avConfig.profile.audioSampleRate is ' + avConfig.profile.audioSampleRate)
console.info('case avConfig.profile.videoBitrate is ' + avConfig.profile.videoBitrate)
console.info('case avConfig.profile.videoFrameRate is ' + avConfig.profile.videoFrameRate);
setAvRecorderCallback(avRecorder, done)
await AVRecorderTestBase.preparePromise(avRecorder, avConfig)
await getInputSurfacePromise(avRecorder)
await initCamera()
await startRecordingProcessPromise(avRecorder, recorderTime)
await pauseRecordingProcessPromise(avRecorder)
await resumeRecordingProcessPromise(avRecorder);
await stopRecordingProcessPromise(avRecorder)
await releaseRecorderCallBack(avRecorder, done)
}
export async function getInputSurfaceErrPromise(avRecorder) {
let result = true;
if (typeof(avRecorder) == 'undefined') {
return;
}
await avRecorder.getInputSurface().then((surfaceId) => {
console.info('getInputSurface success');
videoSurfaceId = surfaceId;
}).catch((err) => {
result = false;
expect(result).assertEqual(false);
console.info('getInputSurface failed and catch error is ' + err.message);
sleep(1000);
});
}
export async function create2GetInputSurfacePromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await getInputSurfaceErrPromise(avRecorder);
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function create2GetInputSurfacePromise2(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await releaseRecorderPromise(avRecorder, done);
}
export async function create2GetInputSurfacePromise3(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await getInputSurfaceErrPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function create2GetInputSurfacePromise4(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await getInputSurfaceErrPromise(avRecorder);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function create2GetInputSurfacePromise5(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await AVRecorderTestBase.resumePromise(avRecorder);
await stopCameraOutput();
await getInputSurfaceErrPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function create2GetInputSurfacePromise6(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.stopPromise(avRecorder);
await getInputSurfaceErrPromise(avRecorder);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function create2GetInputSurfacePromise7(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.resetPromise(avRecorder);
await getInputSurfaceErrPromise(avRecorder);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function getInputSurface3TimesPromise(avConfig, avRecorder, loopTimes, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2GetInputSurfacePromise2 avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
while (loopTimes > 0) {
await getInputSurfacePromise(avRecorder);
loopTimes--;
}
await initCamera();
await releaseRecorderPromise(avRecorder, done);
}
// Promise start
export async function startErrPromise(avRecorder, recorderTime) {
let result = true;
if (typeof(avRecorder) == 'undefined') {
return;
}
await avRecorder.start().then(() => {
console.info('start success');
if (recorderTime != undefined) {
sleep(recorderTime);
}
}).catch((err) => {
result = false;
expect(result).assertEqual(false);
console.info('start failed and catch error is ' + err.message);
sleep(1000);
});
}
export async function create2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await startErrPromise(avRecorder, recorderTime);
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function prepare2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case prepare2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await startErrPromise(avRecorder, recorderTime);
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function pause2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case pause2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await startErrPromise(avRecorder, recorderTime);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function resume2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case resume2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await AVRecorderTestBase.resumePromise(avRecorder);
await startErrPromise(avRecorder, recorderTime);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function stop2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case stop2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.stopPromise(avRecorder);
await startErrPromise(avRecorder, recorderTime);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function reset2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case reset2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.resetPromise(avRecorder);
await startErrPromise(avRecorder, recorderTime);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function getInputSurface2StartPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case getInputSurface2StartPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await releaseRecorderPromise(avRecorder, done);
}
export async function start3TimesPromise(avConfig, avRecorder, recorderTime, loopTimes, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case start3TimesPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
while (loopTimes > 0) {
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.resetPromise(avRecorder);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
loopTimes--;
}
await releaseRecorderPromise(avRecorder, done);
}
// Promise pause
export async function pauseErrPromise(avRecorder) {
let result = true;
if (typeof(avRecorder) == 'undefined') {
return;
}
await avRecorder.pause().then(() => {
expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PAUSED);
console.info('pause success');
}).catch((err) => {
result = false;
expect(result).assertEqual(false);
console.info('pause failed and catch error is ' + err.message);
sleep(1000);
});
}
export async function create2PausePromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case create2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await pauseErrPromise(avRecorder);
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function prepare2PausePromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case prepare2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await pauseErrPromise(avRecorder);
await AVRecorderTestBase.releasePromise(avRecorder);
done();
}
export async function start2PausePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case start2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await pauseRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function resume2PausePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case resume2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await pauseRecordingProcessPromise(avRecorder);
await resumeRecordingProcessPromise(avRecorder);
// await AVRecorderTestBase.pausePromise(avRecorder);
// await AVRecorderTestBase.resumePromise(avRecorder);
await pauseRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function stop2PausePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case stop2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.stopPromise(avRecorder);
await pauseErrPromise(avRecorder);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function reset2PausePromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case reset2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.resetPromise(avRecorder);
await pauseErrPromise(avRecorder);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function getInputSurface2PausePromise(avConfig, avRecorder, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case getInputSurface2PausePromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await pauseErrPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function pause3TimesPromise(avConfig, avRecorder, recorderTime, loopTimes, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case pause3TimesPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
while (loopTimes > 0) {
await pauseRecordingProcessPromise(avRecorder);
await resumeRecordingProcessPromise(avRecorder);
loopTimes--;
}
await releaseRecorderPromise(avRecorder, done);
}
// Promise
export async function recordStart2ReleaseWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2ReleaseWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2PauseWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2PauseWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await pauseRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2ResumeWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2ResumeWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await AVRecorderTestBase.resumePromise(avRecorder);
await stopCameraOutput();
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2StopWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2StopWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await stopRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2ResetWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2ResetWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await resetRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2Pause2StopWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2Pause2StopWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await stopRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2Pause2ResetWithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2Pause2ResetWithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await resetRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2Resume2WithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2Resume2WithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await AVRecorderTestBase.resumePromise(avRecorder);
await stopRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
export async function recordStart2reset2WithPromise(avConfig, avRecorder, recorderTime, done) {
avRecorder = await AVRecorderTestBase.idle(avRecorder);
console.info('case recordStart2reset2WithPromise avConfig.url is ' + avConfig.url);
setAvRecorderCallback(avRecorder, done);
await AVRecorderTestBase.preparePromise(avRecorder, avConfig);
await getInputSurfacePromise(avRecorder);
await initCamera();
await startRecordingProcessPromise(avRecorder, recorderTime);
await AVRecorderTestBase.pausePromise(avRecorder);
await AVRecorderTestBase.resumePromise(avRecorder);
await resetRecordingProcessPromise(avRecorder);
await releaseRecorderPromise(avRecorder, done);
}
......@@ -118,6 +118,151 @@ export default function avVideoRecorderTestOne() {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0100
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0100 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise1(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0200
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise2(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0300
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0300 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise3(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0400
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0400 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise4(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0500
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0500 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise5(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0500 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0600
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0600 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise6(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0600 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0700
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0700 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise7(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0700 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0800
* @tc.name : 001.test start-resume
* @tc.desc : Recorder video start-resume
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0800 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.avRecorderResumePromise8(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0800 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0100
* @tc.name : 001.test create-stop
......@@ -189,8 +334,6 @@ export default function avVideoRecorderTestOne() {
avVideoRecorderTestBase.avRecorderResetPromise7(avConfig, avRecorder, recorderTime, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0700 end')
})
})
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 camera from '@ohos.multimedia.camera'
import deviceInfo from '@ohos.deviceInfo'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as avRecorderTestBase from '../../../../../AVRecorderTestBase.js';
import * as avVideoRecorderTestBase from '../../../../../AvVideoRecorderTestBase.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function avVideoRecorderTestThree() {
describe('avVideoRecorderTestThree', function () {
let avRecorder = null;
const RECORDER_TIME = 3000;
const RECORDER_LONG_TIME = 3600000;
const LOOP_TIMES = 1000;
const FORMAT_M4A = media.ContainerFormatType.CFT_MPEG_4A;
const ENCORDER_AAC = media.CodecMimeType.AUDIO_AAC;
const ONLYAUDIO_TYPE = 'only_audio';
let trackArray;
let fdObject;
let fdPath;
let TAG = "[avVideoRecorderTest] ";
let avProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4
videoBitrate : 100000, // 视频比特率
videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式
videoFrameWidth : 640, // 视频分辨率的宽
videoFrameHeight : 480, // 视频分辨率的高
videoFrameRate : 30 // 视频帧率
}
let avConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avProfile,
url : 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件
rotation : 0, // 视频旋转角度,默认为0不旋转,支持的值为0、90、180、270
location : { latitude : 30, longitude : 130 }
}
let avProfileMpeg = {
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 100000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
}
let avConfigMpeg = {
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avProfileMpeg,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
let avProfileMpegAac = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 100000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
}
let avConfigMpegAac = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avProfileMpegAac,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
let avProfileH264 = {
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 100000,
videoCodec : media.CodecMimeType.VIDEO_AVC,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
}
let avConfigH264 = {
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avProfileH264,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
let avProfileH264Aac = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 100000,
videoCodec : media.CodecMimeType.VIDEO_AVC,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 30
}
let avConfigH264Aac = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avProfileH264Aac,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
beforeAll(async function () {
if (deviceInfo.deviceType === 'default') {
avConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
avConfigMpeg.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
avConfigMpegAac.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
avConfigH264.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
avConfigH264Aac.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
} else {
avConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
avConfigMpeg.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
avConfigMpegAac.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
avConfigH264.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
avConfigH264Aac.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
}
console.info('beforeAll in1');
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
let permissionName5 = 'ohos.permission.CAMERA';
let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4, permissionName5];
await mediaTestBase.getPermission(permissionNames);
await mediaTestBase.msleepAsync(2000);
await mediaTestBase.driveFn(3)
console.info('beforeAll out');
})
beforeEach(async function () {
console.info('beforeEach case');
await avRecorderTestBase.sleep(3000);
})
afterEach(async function () {
console.info('afterEach case');
if (avRecorder != null) {
avRecorder.release().then(() => {
console.info(TAG + 'this testCase execution completed')
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
}
await avRecorderTestBase.sleep(1000);
console.info('afterEach case');
})
afterAll(function () {
mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
console.info('afterAll case');
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0200
* @tc.name : 02.AVRecorder recording(audioBitrate 8000,audioSampleRate 8000,videoBitrateRange 280000)
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0200 start')
avProfileMpegAac.audioBitrate = 8000
avProfileMpegAac.audioSampleRate = 8000
avProfileMpegAac.videoBitrate = 280000
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0300
* @tc.name : 03.AVRecorder recording(audioBitrate 16000,audioSampleRate 32000,videoBitrateRange 560000)
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0300 start')
avProfileMpegAac.audioBitrate = 16000
avProfileMpegAac.audioSampleRate = 32000
avProfileMpegAac.videoBitrate = 560000
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0400
* @tc.name : 04.AVRecorder recording(audioBitrate 32000,audioSampleRate 44100,videoBitrateRange 1120000)
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0400 start')
avProfileMpegAac.audioBitrate = 32000
avProfileMpegAac.audioSampleRate = 44100
avProfileMpegAac.videoBitrate = 1120000
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0500
* @tc.name : 05.AVRecorder recording(audioBitrate 112000,audioSampleRate 96000,videoBitrateRange 2240000)
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0500 start')
avProfileMpegAac.audioBitrate = 112000
avProfileMpegAac.audioSampleRate = 96000
avProfileMpegAac.videoBitrate = 2240000
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0500 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0600
* @tc.name : 06.AVRecorder recording orientationHint:90
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0600 start')
avConfigMpegAac.orientationHint = 90
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0600 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0700
* @tc.name : 07.AVRecorder recording orientationHint:180
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0700 start')
avConfigMpegAac.orientationHint = 180
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0700 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0800
* @tc.name : 08.AVRecorder recording orientationHint:270
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0800 start')
avConfigMpegAac.orientationHint = 270
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0800 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0900
* @tc.name : 09.AVRecorder recording videoFrameRate:5
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0900', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0900 start')
avProfileMpegAac.videoFrameRate = 5
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0900 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1000
* @tc.name : 10.AVRecorder recording videoFrameRate:30
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1000', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1000 start')
avProfileMpegAac.videoFrameRate = 30
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1000 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1100
* @tc.name : 11.AVRecorder recording videoFrameRate:60
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1100 start')
avProfileMpegAac.videoFrameRate = 60
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpegAac.url = fdPath;
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpegAac, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1200
* @tc.name : 12.AVRecorder Record MPEG4
* @tc.desc : Recorder video
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfigMpeg.url = fdPath
avVideoRecorderTestBase.avRecorderWithPromise2(avConfigMpeg, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1200 end')
})
})
}
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 camera from '@ohos.multimedia.camera'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as avRecorderTestBase from '../../../../../AVRecorderTestBase.js';
import * as avVideoRecorderTestBase from '../../../../../AvVideoRecorderTestBase.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import deviceInfo from '@ohos.deviceInfo'
export default function avVideoRecorderTestTwo() {
describe('avVideoRecorderTestTwo', function () {
let avRecorder = null;
const RECORDER_TIME = 3000;
const RECORDER_LONG_TIME = 3600000;
const LOOP_TIMES = 1000;
const FORMAT_M4A = media.ContainerFormatType.CFT_MPEG_4A;
const ENCORDER_AAC = media.CodecMimeType.AUDIO_AAC;
const ONLYAUDIO_TYPE = 'only_audio';
let trackArray;
let fdObject;
let fdPath;
let TAG = "[avVideoRecorderTest] ";
let avProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4
videoBitrate : 100000, // 视频比特率
videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式
videoFrameWidth : 640, // 视频分辨率的宽
videoFrameHeight : 480, // 视频分辨率的高
videoFrameRate : 30 // 视频帧率
}
let avConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES, // 视频源类型,支持YUV和ES两种格式
profile : avProfile,
url : 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件
rotation : 0, // 视频旋转角度,默认为0不旋转,支持的值为0、90、180、270
location : { latitude : 30, longitude : 130 }
}
beforeAll(async function () {
console.info('beforeAll in1');
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
let permissionName5 = 'ohos.permission.CAMERA';
let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4, permissionName5];
await mediaTestBase.getPermission(permissionNames);
await mediaTestBase.msleepAsync(2000);
await mediaTestBase.driveFn(3);
if (deviceInfo.deviceType === 'default') {
avConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
} else {
avConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
}
console.info('beforeAll out');
})
beforeEach(async function () {
console.info('beforeEach case');
await avRecorderTestBase.sleep(3000);
})
afterEach(async function () {
console.info('afterEach case');
if (avRecorder != null) {
avRecorder.release().then(() => {
console.info(TAG + 'this testCase execution completed')
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
}
await avRecorderTestBase.sleep(1000);
console.info('afterEach case');
})
afterAll(function () {
mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
console.info('afterAll case');
})
// promise prepare
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100
* @tc.name : 01. create->prepare
* @tc.desc : 1.create 2.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2PreparePromise(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0200
* @tc.name : 02. start->prepare
* @tc.desc : 1.create 2.prepare 3.start 4.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.start2PreparePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0300
* @tc.name : 03. pause->prepare
* @tc.desc : 1.create 2.prepare 3.start 4.pause 5.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0300 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.pause2PreparePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0400
* @tc.name : 04. resume->prepare
* @tc.desc : 1.create 2.prepare 3.start 4.pause 5.resume 6.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0400 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.resume2PreparePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0500
* @tc.name : 05. stop->prepare
* @tc.desc : 1.create 2.prepare 3.start 4.stop 5.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0500 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.stop2PreparePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0500 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0600
* @tc.name : 06. reset->prepare
* @tc.desc : 1.create 2.prepare 3.start 4.reset 5.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0600 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.reset2PreparePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0600 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0700
* @tc.name : 07. getInputSurface->prepare
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0700 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.getInputSurface2PreparePromise(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0700 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800
* @tc.name : 08. prepare 3 times
* @tc.desc : 1.create 2.prepare 3.prepare 4.prepare
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
let loopTimes = 3;
avVideoRecorderTestBase.prepare3TimesPromise(avConfig, avRecorder, loopTimes, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0900
* @tc.name : 09.audioBitrate -1
* @tc.desc : 1.create 2.prepare (audioBitrate -1)
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0900', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0900 start')
let avNewProfile = {
audioBitrate : -1,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4
videoBitrate : 100000, // 视频比特率
videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式
videoFrameWidth : 640, // 视频分辨率的宽
videoFrameHeight : 480, // 视频分辨率的高
videoFrameRate : 30 // 视频帧率
}
let avNewConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES, // 视频源类型,支持YUV和ES两种格式
profile : avNewProfile,
url : 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件
rotation : 0, // 视频旋转角度,默认为0不旋转,支持的值为0、90、180、270
location : { latitude : 30, longitude : 130 }
}
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avNewConfig.url = fdPath;
if (deviceInfo.deviceType === 'default') {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
} else {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
}
avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0900 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1000
* @tc.name : 10.audioSampleRate -1
* @tc.desc : 1.create 2.prepare (audioSampleRate -1)
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1000', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1000 start')
let avNewProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : -1,
fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4
videoBitrate : 100000, // 视频比特率
videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式
videoFrameWidth : 640, // 视频分辨率的宽
videoFrameHeight : 480, // 视频分辨率的高
videoFrameRate : 30 // 视频帧率
}
let avNewConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avNewProfile,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avNewConfig.url = fdPath;
if (deviceInfo.deviceType === 'default') {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
} else {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
}
avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1000 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1100
* @tc.name : 11.videoBitrateRange -1
* @tc.desc : 1.create 2.prepare (videoBitrateRange -1)
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1100 start')
let avNewProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4
videoBitrate : -1, // 视频比特率
videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式
videoFrameWidth : 640, // 视频分辨率的宽
videoFrameHeight : 480, // 视频分辨率的高
videoFrameRate : 30 // 视频帧率
}
let avNewConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avNewProfile,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avNewConfig.url = fdPath;
if (deviceInfo.deviceType === 'default') {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
} else {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
}
avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1200
* @tc.name : 12.videoFrameRate -1
* @tc.desc : 1.create 2.prepare (videoFrameRate -1)
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1200 start')
let avNewProfile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4
videoBitrate : 100000, // 视频比特率
videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式
videoFrameWidth : 640, // 视频分辨率的宽
videoFrameHeight : 480, // 视频分辨率的高
videoFrameRate : -1 // 视频帧率
}
let avNewConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : avNewProfile,
url : 'fd://35',
rotation : 0,
location : { latitude : 30, longitude : 130 }
}
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avNewConfig.url = fdPath;
if (deviceInfo.deviceType === 'default') {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES
} else {
avNewConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV
}
avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1200 end')
})
// Promise getInputSurface
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0100
* @tc.name : 01. create->getInputSurface
* @tc.desc : 1.create 2.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0100 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0200
* @tc.name : 02. prepare->getInputSurface
* @tc.desc : 1.create 2.prepare 3.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise2(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0300
* @tc.name : 03. start->getInputSurface
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0300 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise3(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0400
* @tc.name : 04. pause->getInputSurface
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause 6.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0400 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise4(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0500
* @tc.name : 05. resume->getInputSurface
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0500 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise5(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0500 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0600
* @tc.name : 06. stop->getInputSurface
* @tc.desc :1.create 2.prepare 3.getInputSurface 4.start 5.stop 6.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0600 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise6(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0600 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0700
* @tc.name : 07. reset->getInputSurface
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.reset 6.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0700 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2GetInputSurfacePromise7(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0700 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0800
* @tc.name : 08. getInputSurface 3 times
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.getInputSurface 5.getInputSurface
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0800 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
let loopTimes = 3;
avVideoRecorderTestBase.getInputSurface3TimesPromise(avConfig, avRecorder, loopTimes, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0800 end')
})
// Promise start
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100
* @tc.name : 01. create->start
* @tc.desc : 1.create 2.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200
* @tc.name : 02. prepare->start
* @tc.desc : 1.create 2.prepare 4.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.prepare2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0300
* @tc.name : 03. pause->start
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause 6.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0300 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.pause2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0400
* @tc.name : 04. resume->start
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0400 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.resume2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0500
* @tc.name : 05. stop->start
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.stop 6.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0500 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.stop2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0500 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0600
* @tc.name : 06. reset->start
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.reset 6.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0600 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.reset2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0600 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0700
* @tc.name : 07. getInputSurface->start
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0700 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.getInputSurface2StartPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0700 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0800
* @tc.name : 08. start 3 times
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.start 6.start
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0800 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
let loopTimes = 3;
avVideoRecorderTestBase.start3TimesPromise(avConfig, avRecorder, RECORDER_TIME, loopTimes, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0800 end')
})
// Promise pause
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100
* @tc.name : 01. create->pause
* @tc.desc : 1.create 2.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.create2PausePromise(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200
* @tc.name : 02. prepare->pause
* @tc.desc : 1.create 2.prepare 3.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.prepare2PausePromise(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0300
* @tc.name : 03. start->pause
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0300 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.start2PausePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0400
* @tc.name : 04. resume->pause
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0400 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.resume2PausePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0500
* @tc.name : 05. stop->pause
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.stop 6.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0500 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.stop2PausePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0500 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0600
* @tc.name : 06. reset->pause
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.reset 6.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0600', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0600 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.reset2PausePromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0600 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0700
* @tc.name : 07. getInputSurface->pause
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0700', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0700 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.getInputSurface2PausePromise(avConfig, avRecorder, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0700 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0800
* @tc.name : 08. pause 3 times
* @tc.desc : 1.create 2.prepare 3.getInputSurface 4.start 5.pause 6.pause 7.pause
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0800', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0800 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
let loopTimes = 3;
avVideoRecorderTestBase.pause3TimesPromise(avConfig, avRecorder, RECORDER_TIME, loopTimes, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0800 end')
})
// 状态切换
// 01.promise回调方式
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0100
* @tc.name : 01.AVRecorder test recording 3 seconds
* @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.release
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0100', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0100 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.recordStart2ReleaseWithPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0100 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0200
* @tc.name : 02.AVRecorder test recording 3 seconds to pause
* @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.release
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0200', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0200 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.recordStart2PauseWithPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0200 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0300
* @tc.name : 03.AVRecorder test recording 3 seconds to pause to resume
* @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.release
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0300', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0300 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.recordStart2ResumeWithPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0300 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0400
* @tc.name : 04.AVRecorder test recording 3 seconds to stop
* @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.stop 6.release
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0400', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0400 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.recordStart2StopWithPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0400 end')
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0500
* @tc.name : 05.AVRecorder test recording 3 seconds to reset
* @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.reset 6.release
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0500', 0, async function (done) {
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0500 start')
let fileName = avVideoRecorderTestBase.resourceName()
fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video");
fdPath = "fd://" + fdObject.fdNumber;
avConfig.url = fdPath;
avVideoRecorderTestBase.recordStart2ResetWithPromise(avConfig, avRecorder, RECORDER_TIME, done);
console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0500 end')
})
})
}
......@@ -14,8 +14,13 @@
*/
import avRecorderTest from './AVRecorderFuncTest.test.js'
import avVideoRecorderTestOne from './AvVideoRecorderFuncTestOne.test.js'
import avVideoRecorderTestTwo from './AvVideoRecorderFuncTestTwo.test.js'
import avVideoRecorderTestThree from './AvVideoRecorderFuncTestThree.test.js'
export default function testsuite() {
avRecorderTest()
avRecorderTest()
avVideoRecorderTestOne()
avVideoRecorderTestTwo()
avVideoRecorderTestThree()
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册