From e58a701adf33a124eba05955070098026b9195d1 Mon Sep 17 00:00:00 2001 From: dongwei Date: Sat, 29 Jul 2023 21:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=8A=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dongwei --- .../AvVideoRecorderTestBase.js | 1202 --- .../test/AvVideoRecorderFuncTestOne.test.js | 7706 +++++++++++++++-- 2 files changed, 6989 insertions(+), 1919 deletions(-) diff --git a/multimedia/media/media_js_standard/AvVideoRecorderTestBase.js b/multimedia/media/media_js_standard/AvVideoRecorderTestBase.js index 0d7955260..94b572d34 100644 --- a/multimedia/media/media_js_standard/AvVideoRecorderTestBase.js +++ b/multimedia/media/media_js_standard/AvVideoRecorderTestBase.js @@ -18,18 +18,6 @@ import * as mediaTestBase from './MediaTestBase.js'; import * as AVRecorderTestBase from './AVRecorderTestBase.js'; import camera from '@ohos.multimedia.camera' -let TAG = "[avVideoRecorderTest] "; -let cameraManager; -let videoOutput; -let captureSession; -let cameraInput; -let previewOutput; -let cameraOutputCap; -let videoSurfaceId = null; - -let events = require('events'); -let eventEmitter = new events.EventEmitter(); - export const AV_RECORDER_STATE = { IDLE : 'idle', PREPARED : 'prepared', @@ -46,1196 +34,6 @@ export function resourceName(){ return filename; } -export async function initCamera() { - - // 创建CameraManager对象 - let context = globalThis.contextVideo; - cameraManager = camera.getCameraManager(context) - if (!cameraManager) { - console.error("camera.getCameraManager error") - return; - } - cameraManager.on('cameraStatus', (cameraStatusInfo) => { - console.log(`camera : ${cameraStatusInfo.camera.cameraId}`); - console.log(`status: ${cameraStatusInfo.status}`); - }) - - // 获取相机列表 - let cameras = cameraManager.getSupportedCameras(); - let cameraDevice = cameras[0]; - - // 查询相机设备在模式下支持的输出能力 - let cameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraDevice); - console.info('getSupportedOutputCapability success'); - console.log(`cameraOutputCapability previewProfiles: ${cameraOutputCapability.previewProfiles}`); - console.log(`cameraOutputCapability photoProfiles: ${cameraOutputCapability.photoProfiles}`); - console.log(`cameraOutputCapability videoProfiles: ${cameraOutputCapability.videoProfiles}`); - - // 创建相机输入流 - try { - cameraInput = cameraManager.createCameraInput(cameraDevice); - console.info('createCameraInput success'); - } catch (error) { - console.error('Failed to createCameraInput errorCode = ' + error.code); - } - - // 监听cameraInput错误信息 - cameraInput.on('error', cameraDevice, (error) => { - console.log(`Camera input error code: ${error.code}`); - }) - - // 创建VideoOutput对象 - let profile = cameraOutputCapability.videoProfiles[0]; - try { - videoOutput = cameraManager.createVideoOutput(profile, videoSurfaceId) - console.info('createVideoOutput success'); - } catch (error) { - console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); - } - // 监听视频输出错误信息 - videoOutput.on('error', (error) => { - console.log(`Preview output error code: ${error.code}`); - }) - - // 创建previewOutput输出对象 - let surfaceId = globalThis.value; - let previewProfile = cameraOutputCapability.previewProfiles[0]; - try { - previewOutput = cameraManager.createPreviewOutput(previewProfile, surfaceId) - console.info('createPreviewOutput success'); - } catch (error) { - console.error('Failed to create the PreviewOutput instance errorCode = ' + error.code); - } - - // 打开相机 - await cameraInput.open(); - - //创建会话 - try { - captureSession = cameraManager.createCaptureSession() - console.info('createCaptureSession success'); - } catch (error) { - console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); - } - - // 监听session错误信息 - captureSession.on('error', (error) => { - console.log(`Capture session error code: ${error.code}`); - }) - - // 开始配置会话 - try { - captureSession.beginConfig() - console.info('beginConfig success'); - } catch (error) { - console.error('Failed to beginConfig. errorCode = ' + error.code); - } - - // 向会话中添加相机输入流 - try { - captureSession.addInput(cameraInput) - } catch (error) { - console.error('Failed to addInput. errorCode = ' + error.code); - } - - // 向会话中添加预览输入流 - try { - captureSession.addOutput(previewOutput) - } catch (error) { - console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); - } - - // 向会话中添加录像输出流 - try { - captureSession.addOutput(videoOutput) - } catch (error) { - console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); - } - - // 提交会话配置 - await captureSession.commitConfig() - - // 启动会话 - await captureSession.start().then(() => { - console.log('Promise returned to indicate the session start success.'); - }) -} - -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); -} diff --git a/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AvVideoRecorderFuncTestOne.test.js b/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AvVideoRecorderFuncTestOne.test.js index 3e1160c83..a9b353dd0 100644 --- a/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AvVideoRecorderFuncTestOne.test.js +++ b/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AvVideoRecorderFuncTestOne.test.js @@ -24,6 +24,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from export default function avVideoRecorderTestOne() { describe('avVideoRecorderTestOne', function () { let avRecorder = null; + let isInitCamera = false; const recorderTime = 3000; const RECORDER_LONG_TIME = 3600000; const LOOP_TIMES = 1000; @@ -33,7 +34,7 @@ export default function avVideoRecorderTestOne() { let trackArray; let fdObject; let fdPath; - let TAG = "[avVideoRecorderTest] "; + let TAG = "[avVideoRecorderTestOne] "; let avProfile = { audioBitrate : 48000, audioChannels : 2, @@ -53,7 +54,86 @@ export default function avVideoRecorderTestOne() { profile : avProfile, url : 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件 rotation : 0, // 视频旋转角度,默认为0不旋转,支持的值为0、90、180、270 - location : { latitude : 30, longitude : 130 } + 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 + } } let events = require('events'); @@ -109,7 +189,7 @@ export default function avVideoRecorderTestOne() { let permissionName5 = 'ohos.permission.CAMERA'; let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4, permissionName5]; await mediaTestBase.getPermission(permissionNames); - await mediaTestBase.msleepAsync(3000); + await mediaTestBase.msleepAsync(5000); await mediaTestBase.driveFn(4) console.info('beforeAll out'); }) @@ -120,6 +200,7 @@ export default function avVideoRecorderTestOne() { }) afterEach(async function () { + isInitCamera = false console.info('afterEach case'); if (avRecorder != null) { avRecorder.release().then(() => { @@ -248,6 +329,7 @@ export default function avVideoRecorderTestOne() { // 启动会话 await captureSession.start().then(() => { + isInitCamera = true console.log('captureSession start success.'); toNextStep(avRecorder, avConfig, recorderTime, steps, done); }) @@ -262,6 +344,32 @@ export default function avVideoRecorderTestOne() { } } + 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); + } + }); + } + + async function releaseRecorderPromise(avRecorder, done) { + await avRecorderTestBase.releasePromise(avRecorder) + if(isInitCamera == true){ + releaseCameraError(avRecorder, done) + }else{ + done(); + } + } + eventEmitter.on(CREATE_CALLBACK_EVENT, (avRecorder, avConfig, recorderTime, steps, done) => { steps.shift(); media.createAVRecorder((error, recorder) => { @@ -296,7 +404,7 @@ export default function avVideoRecorderTestOne() { eventEmitter.on(SETONCALLBACK_EVENT, (avRecorder, avConfig, recorderTime, steps, done) => { steps.shift(); try{ - avVideoRecorderTestBase.setAvRecorderCallback(avRecorder, done) + setAvRecorderCallback(avRecorder, done) toNextStep(avRecorder, avConfig, recorderTime, steps, done); }catch(error){ console.info('setAvRecorderCallback failed and catch error is ' + error.message); @@ -397,7 +505,6 @@ export default function avVideoRecorderTestOne() { }, recorderTime); } else { console.info('start AVRecorder failed and error is ' + err.message); - toNextStep(avRecorder, avConfig, recorderTime, steps, done); } }) }); @@ -591,7 +698,6 @@ export default function avVideoRecorderTestOne() { return; } console.log('Callback invoked to indicate the video output stop success.'); - toNextStep(avRecorder, avConfig, recorderTime, steps, done); }); @@ -607,6 +713,32 @@ export default function avVideoRecorderTestOne() { } }); + async function releaseCameraError(avRecorder, done) { + try{ + await captureSession.stop() + console.info('releaseCameraError 001'); + console.info('captureSession.stop success'); + await cameraInput.close() + console.info('releaseCameraError 002'); + console.info('cameraInput.close success'); + await previewOutput.release() + console.info('releaseCameraError 003'); + console.info('previewOutput.release success'); + await videoOutput.release() + console.info('releaseCameraError 004'); + console.info('videoOutput.release success'); + await captureSession.release() + console.info('releaseCameraError 005'); + console.info('captureSession.release success'); + captureSession = null + console.info('releaseCameraError success'); + done(); + } catch(err){ + console.info('releaseCameraError failed and catch error is ' + err.message); + done(); + } + } + async function releaseCamera(avRecorder, avConfig, recorderTime, steps, done) { try{ await captureSession.stop() @@ -629,48 +761,84 @@ export default function avVideoRecorderTestOne() { toNextStep(avRecorder, avConfig, recorderTime, steps, done); } catch(err){ console.info('releaseCamera failed and catch error is ' + err.message); + toNextStep(avRecorder, avConfig, recorderTime, steps, done); } } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_0100 end') + }) + /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100 - * @tc.name : 001.test create-resume - * @tc.desc : Recorder video create-resume + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0400 + * @tc.name : 001.test start-pause-resume + * @tc.desc : Recorder video start-pause-resume * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0400 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; - console.info('avRecorderResumeCallBack1 test start'); let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, // resume recorder - RESUMERECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0400 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200 - * @tc.name : 001.test prepare-resume - * @tc.desc : Recorder video prepare-resume + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0500 + * @tc.name : 001.test start-stop-resume + * @tc.desc : Recorder video start-stop-resume * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0500 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; @@ -678,27 +846,35 @@ export default function avVideoRecorderTestOne() { let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, // resume recorder - RESUMERECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0500 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700 - * @tc.name : 001.test create-prepare-getInputSurface-resume - * @tc.desc : Recorder create-prepare-getInputSurface-resume + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0600 + * @tc.name : 001.test start-reset-resume + * @tc.desc : Recorder video start-reset-resume * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0600 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; @@ -706,563 +882,591 @@ export default function avVideoRecorderTestOne() { let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, // resume recorder - RESUMERECORDER_CALLBACK_EVENT, + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, // release avRecorder and camera - RELEASECORDER_CALLBACK_EVENT, + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0600 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100 - * @tc.name : 001.test create-reset - * @tc.desc : Recorder video create-reset + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0800 + * @tc.name : 001.test create-prepare-getInputSurface-start-pause-resume-resume-resume + * @tc.desc : Recorder create-prepare-getInputSurface-start-pause-resume-resume-resume * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0800 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; - console.info('avRecorderResumeCallBack1 test start'); let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, - // reset recorder - RESETRECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0800 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200 - * @tc.name : 001.test prepare-reset - * @tc.desc : Recorder video prepare-reset + * @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_RESET_CALLBACK_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200 start') + 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; let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // reset recorder - RESETRECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // pause + PAUSERECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT,RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0400 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700 - * @tc.name : 001.test create-prepare-getInputSurface-reset - * @tc.desc : Recorder create-prepare-getInputSurface-reset + * @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_RESET_CALLBACK_0700', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700 start') + 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; let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, - // reset recorder - RESETRECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // stop + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT,RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0500 end') }) - // promise prepare /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100 - * @tc.name : 01. create->prepare - * @tc.desc : 1.create 2.prepare + * @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 - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100 start') + 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; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // AVRecorderTestBase.preparePromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // RESET + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.create2PreparePromise(avConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0600 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.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 - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800 start') + 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; - let loopTimes = 3; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT - ); - for (let i = 0; i < loopTimes; i++) - { - mySteps.push( - // preparePromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.resetPromise - RESETRECORDER_PROMISE_EVENT, - ) - } - mySteps.push( - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // pause + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT,RESUMERECORDER_PROMISE_EVENT, + // resume recorder + RESUMERECORDER_PROMISE_EVENT, + // resume recorder + RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT - ) + ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0800 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_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.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0500 + * @tc.name : 001.test start-pause-resume-stop + * @tc.desc : Recorder start-pause-resume-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - 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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0500 start') 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 - } + avConfig.url = fdPath; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // prepareErrPromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_0900 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0500 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1000 - * @tc.name : 10.audioSampleRate -1 - * @tc.desc : 1.create 2.prepare (audioSampleRate -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0500 + * @tc.name : 001.test resume-stop + * @tc.desc : Recorder video resume-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - 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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0500 start') 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 - } + avConfig.url = fdPath; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // prepareErrPromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT,PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + //pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + //resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1000 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0500 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1100 - * @tc.name : 11.videoBitrateRange -1 - * @tc.desc : 1.create 2.prepare (videoBitrateRange -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0500 + * @tc.name : 001.test start-resume-reset + * @tc.desc : Recorder video start-resume-reset * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - 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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0500 start') 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 - } + avConfig.url = fdPath; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // prepareErrPromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0500 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1200 - * @tc.name : 12.videoFrameRate -1 - * @tc.desc : 1.create 2.prepare (videoFrameRate -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100 + * @tc.name : 001.test create-resume + * @tc.desc : Recorder video create-resume * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - 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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100 start') 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 - } + avConfig.url = fdPath; + console.info('avRecorderResumeCallBack1 test start'); let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // prepareErrPromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.avConfigChangedPromise(avNewConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_PROMISE_1200 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0100 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') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200 + * @tc.name : 001.test prepare-resume + * @tc.desc : Recorder video prepare-resume + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - //? getInputSurfaceErrPromise - GETINPUTSURFACE_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.create2GetInputSurfacePromise(avConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_PROMISE_0100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0200 end') }) - // Promise start /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100 - * @tc.name : 01. create->start - * @tc.desc : 1.create 2.start + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0300 + * @tc.name : 001.test start-resume + * @tc.desc : Recorder video start-resume * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0300 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - //? startErrPromise - STARTRECORDER_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.create2StartPromise(avConfig, avRecorder, recorderTime, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0300 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200 - * @tc.name : 02. prepare->start - * @tc.desc : 1.create 2.prepare 4.start + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700 + * @tc.name : 001.test create-prepare-getInputSurface-resume + * @tc.desc : Recorder create-prepare-getInputSurface-resume * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; avConfig.url = fdPath; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // AVRecorderTestBase.preparePromise - PREPARE_PROMISE_EVENT, - //? startErrPromise - STARTRECORDER_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - - // avVideoRecorderTestBase.prepare2StartPromise(avConfig, avRecorder, recorderTime, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_PROMISE_0200 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_CALLBACK_0700 end') }) - // Promise pause + + /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100 - * @tc.name : 01. create->pause - * @tc.desc : 1.create 2.pause + * @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 - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0100 start') + 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; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - //? pauseErrPromise - PAUSERECORDER_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0100 end') + }) - // avVideoRecorderTestBase.create2PausePromise(avConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0200 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200 - * @tc.name : 02. prepare->pause - * @tc.desc : 1.create 2.prepare 3.pause + * @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 - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200 start') + 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; let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, - // AVRecorderTestBase.preparePromise - PREPARE_PROMISE_EVENT, - //? pauseErrPromise - PAUSERECORDER_PROMISE_EVENT, - // AVRecorderTestBase.releasePromise - RELEASECORDER_PROMISE_EVENT, + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // resume recorder + RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0300 end') + }) - // avVideoRecorderTestBase.prepare2PausePromise(avConfig, avRecorder, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_PROMISE_0200 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESUME_PROMISE_0700 end') }) - // Callback prepare + + + /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0100 - * @tc.name : 01. create->prepare - * @tc.desc : 1.create 2.prepare + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0300 + * @tc.name : 001.test start-stop + * @tc.desc : Recorder video start-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0100 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0300 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; @@ -1270,25 +1474,31 @@ export default function avVideoRecorderTestOne() { let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // release avRecorde - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0300 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0800 - * @tc.name : 08. prepare 3 times - * @tc.desc : 1.create 2.prepare 3.prepare 4.prepare + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0400 + * @tc.name : 001.test start-pause-stop + * @tc.desc : Recorder video start-pause-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0800', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0800 start') + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0400 start') let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; @@ -1296,498 +1506,6560 @@ export default function avVideoRecorderTestOne() { let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // prepare avRecorder - PREPARE_CALLBACK_EVENT, - // prepare avRecorder - PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, // release avRecorder and camera - RELEASECORDER_CALLBACK_EVENT, + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0800 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0400 end') }) + + /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0900 - * @tc.name : 09.audioBitrate -1 - * @tc.desc : 1.create 2.prepare (audioBitrate -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0600 + * @tc.name : 001.test start-reset-stop + * @tc.desc : Recorder start-reset-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0900', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0900 start') - let avNewProfile = { - audioBitrate : -1, - audioChannels : 2, - audioSampleRate : 48000, - audioCodec : media.CodecMimeType.AUDIO_AAC, - fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 - videoBitrate : 100000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, - 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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0600 start') 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 - } + avConfig.url = fdPath; let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0900 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0600 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1000 - * @tc.name : 10.audioSampleRate -1 - * @tc.desc : 1.create 2.prepare (audioSampleRate -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0800 + * @tc.name : 001.test start-stop-stop-stop + * @tc.desc : Recorder start-stop-stop-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1000', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1000 start') - let avNewProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioSampleRate : -1, - audioCodec : media.CodecMimeType.AUDIO_AAC, - fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 - videoBitrate : 100000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, - 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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0800 start') 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 - } + avConfig.url = fdPath; let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1000 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_CALLBACK_0800 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1100 - * @tc.name : 11.videoBitrateRange -1 - * @tc.desc : 1.create 2.prepare (videoBitrateRange -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0100 + * @tc.name : 001.test create-stop + * @tc.desc : Recorder video create-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0100 start') 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 - } + avConfig.url = fdPath; let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, // end END_EVENT ); eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1100 end') + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0100 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1200 - * @tc.name : 12.videoFrameRate -1 - * @tc.desc : 1.create 2.prepare (videoFrameRate -1) + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0200 + * @tc.name : 001.test prepare-stop + * @tc.desc : Recorder video prepare-stop * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 2 + * @tc.type : Function test + * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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 } - } + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0300 + * @tc.name : 001.test start-stop + * @tc.desc : Recorder video start-stop + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT,PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0300 end') + }) + + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0400 + * @tc.name : 001.test pause-stop + * @tc.desc : Recorder video pause-stop + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT,PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + //pause recorder + PAUSERECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0400 end') + }) + + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0600 + * @tc.name : 001.test reset-stop + * @tc.desc : Recorder video reset-stop + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT,PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT,STARTRECORDER_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0700 + * @tc.name : 001.test getInputSurface-stop + * @tc.desc : Recorder video getInputSurface-stop + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, + // start recorder + STARTRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // release avRecorder + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0800 + * @tc.name : 001.test start-stop-stop-stop + * @tc.desc : Recorder video start-stop-stop-stop + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT,PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STOP_PROMISE_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100 + * @tc.name : 001.test create-reset + * @tc.desc : Recorder video create-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + console.info('avRecorderResumeCallBack1 test start'); + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200 + * @tc.name : 001.test prepare-reset + * @tc.desc : Recorder video prepare-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0300 + * @tc.name : 001.test start-reset + * @tc.desc : Recorder video start-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0400 + * @tc.name : 001.test start-pause-reset + * @tc.desc : Recorder video start-pause-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0500 + * @tc.name : 001.test start-resume-reset + * @tc.desc : Recorder video start-resume-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0500 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // resume recorder + RESUMERECORDER_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0600 + * @tc.name : 001.test start-stop-reset + * @tc.desc : Recorder video start-stop-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700 + * @tc.name : 001.test create-prepare-getInputSurface-reset + * @tc.desc : Recorder create-prepare-getInputSurface-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0800 + * @tc.name : 001.test create-prepare-getInputSurface-start-reset-reset-reset + * @tc.desc : Recorder create-prepare-getInputSurface-start-reset-reset-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // reset recorder + RESETRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_CALLBACK_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0100 + * @tc.name : 001.test create-reset + * @tc.desc : Recorder video create-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0200 + * @tc.name : 001.test prepare-reset + * @tc.desc : Recorder video prepare-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT,PREPARE_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0300 + * @tc.name : 001.test start-reset + * @tc.desc : Recorder video start-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0400 + * @tc.name : 001.test start-pause-reset + * @tc.desc : Recorder video start-pause-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0400 end') + }) + + + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0600 + * @tc.name : 001.test start-stop-reset + * @tc.desc : Recorder video start-stop-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0700 + * @tc.name : 001.test create-prepare-getInputSurface-reset + * @tc.desc : Recorder create-prepare-getInputSurface-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0800 + * @tc.name : 001.test create-prepare-getInputSurface-start-reset-reset-reset + * @tc.desc : Recorder create-prepare-getInputSurface-start-reset-reset-reset + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // reset recorder + RESETRECORDER_PROMISE_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_RESET_PROMISE_0800 end') + }) + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.start2PreparePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.pause2PreparePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.resume2PreparePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.stopPromise + STOPRECORDER_PROMISE_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.stop2PreparePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.resetPromise + RESETRECORDER_PROMISE_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.reset2PreparePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // releaseRecorderCallBack + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT + ); + for (let i = 0; i < loopTimes; i++) + { + mySteps.push( + // preparePromise + PREPARE_PROMISE_EVENT, + // AVRecorderTestBase.resetPromise + RESETRECORDER_PROMISE_EVENT, + ) + } + mySteps.push( + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ) + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // prepareErrPromise + PREPARE_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.create2GetInputSurfacePromise3(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.create2GetInputSurfacePromise4(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.create2GetInputSurfacePromise5(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.stopPromise + STOPRECORDER_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.create2GetInputSurfacePromise6(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.resetPromise + RESETRECORDER_PROMISE_EVENT, + //? getInputSurfaceErrPromise + GETINPUTSURFACE_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.create2GetInputSurfacePromise7(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT + ); + for (let i = 0; i < loopTimes; i++) + { + mySteps.push( + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT + ) + } + mySteps.push( + // initCamera + INITCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + END_EVENT + ) + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + //? startErrPromise + STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.create2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? startErrPromise + STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.prepare2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? startErrPromise + STARTRECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.pause2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + //? startErrPromise + STARTRECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.resume2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.stopPromise + STOPRECORDER_PROMISE_EVENT, + //? startErrPromise + STARTRECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.stop2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.resetPromise + RESETRECORDER_PROMISE_EVENT, + //? startErrPromise + STARTRECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.reset2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.getInputSurface2StartPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT + ); + for (let i = 0; i < loopTimes; i++) + { + mySteps.push( + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.resetPromise + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + ) + } + mySteps.push( + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ) + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + //? pauseErrPromise + PAUSERECORDER_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + //? pauseErrPromise + PAUSERECORDER_PROMISE_EVENT, + // AVRecorderTestBase.releasePromise + RELEASECORDER_PROMISE_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pauseRecordingProcessPromise + PAUSERECORDER_PROMISE_EVENT, STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.start2PausePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pauseRecordingProcessPromise + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + //? resumeRecordingProcessPromise + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // pauseRecordingProcessPromise + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.resume2PausePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.stopPromise + STOPRECORDER_PROMISE_EVENT, + //? pauseErrPromise + PAUSERECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.stop2PausePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.resetPromise + RESETRECORDER_PROMISE_EVENT, + //? pauseErrPromise + PAUSERECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.reset2PausePromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + //? pauseErrPromise + PAUSERECORDER_PROMISE_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT + ); + for (let i = 0; i < loopTimes; i++) + { + mySteps.push( + // pauseRecordingProcessPromise + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + //? resumeRecordingProcessPromise + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT + ) + } + mySteps.push( + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ) + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2ReleaseWithPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pauseRecordingProcessPromise + PAUSERECORDER_PROMISE_EVENT, STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2PauseWithPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2ResumeWithPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // stopRecordingProcessPromise + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2StopWithPromise(avConfig, avRecorder, recorderTime, 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; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // resetRecordingProcessPromise + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2ResetWithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0600 + * @tc.name : 06.AVRecorder test stop recording after recording 3 seconds + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.stop 7.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + // stopRecordingProcessPromise + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2Pause2StopWithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0700 + * @tc.name : 07.AVRecorder test reset recording after recording 3 seconds + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.reset 7.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + // resetRecordingProcessPromise + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2Pause2ResetWithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0800 + * @tc.name : 08.AVRecorder test resume recording after pause and stop recording + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.stop 8.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + // stopRecordingProcessPromise + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2Resume2WithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0900 + * @tc.name : 09.AVRecorder test resume recording after pause and reset recording + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.reset 8.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0900 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + // resetRecordingProcessPromise + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2reset2WithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_0900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1000 + * @tc.name : 10.AVRecorder test recording 3 seconds (only video) + * @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_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1000 start') + let avNewProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + let avNewConfig = { + 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // stop camera + STOPCAMERA_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2ReleaseWithPromise(avNewConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1100 + * @tc.name : 11.AVRecorder test recording 3 seconds to pause (only video) + * @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_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1100 start') + let avNewProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + let avNewConfig = { + 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pauseRecordingProcessPromise + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2PauseWithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1200 + * @tc.name : 12.AVRecorder test recording 3 seconds to pause to resume (only video) + * @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_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1200 start') + let avNewProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + let avNewConfig = { + 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // AVRecorderTestBase.pausePromise + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + //? AVRecorderTestBase.resumePromise + RESUMERECORDER_PROMISE_EVENT, + // stopCameraOutput + STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1300 + * @tc.name : 13.AVRecorder test recording 3 seconds to stop (only video) + * @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_1300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1300 start') + let avNewProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + let avNewConfig = { + 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // stopRecordingProcessPromise + STOPRECORDER_PROMISE_EVENT,STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2StopWithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1400 + * @tc.name : 14.AVRecorder test recording 3 seconds to reset (only video) + * @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_1400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1400 start') + let avNewProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + let avNewConfig = { + 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 + } + let mySteps = new Array( + // setAvRecorderCallback + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, + // AVRecorderTestBase.preparePromise + PREPARE_PROMISE_EVENT, + // getInputSurfacePromise + GETINPUTSURFACE_PROMISE_EVENT, + // initCamera + INITCAMERA_EVENT, + // startRecordingProcessPromise + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // resetRecordingProcessPromise + RESETRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, STOPRECORDER_CALLBACK_EVENT, + // releaseRecorderPromise + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + + // avVideoRecorderTestBase.recordStart2ResetWithPromise(avConfig, avRecorder, recorderTime, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_1400 end') + }) + + // 02.callback回调 + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0500 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0600 + * @tc.name : 06.AVRecorder test stop recording after recording 3 seconds + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.stop 7.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0700 + * @tc.name : 07.AVRecorder test reset recording after recording 3 seconds + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.reset 7.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0800 + * @tc.name : 08.AVRecorder test resume recording after pause and stop recording + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.stop 8.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0900 + * @tc.name : 09.AVRecorder test resume recording after pause and reset recording + * @tc.desc : 1.createAVRecorder 2.prepare 3.getInputSurface 4.start 5.pause 6.resume 7.reset 8.release + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0900 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_0900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1000 + * @tc.name : 10.AVRecorder test recording 3 seconds (only video) + * @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_CALLBACK_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1000 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1100 + * @tc.name : 11.AVRecorder test recording 3 seconds to pause (only video) + * @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_CALLBACK_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1200 + * @tc.name : 12.AVRecorder test recording 3 seconds to pause to resume (only video) + * @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_CALLBACK_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1300 + * @tc.name : 13.AVRecorder test recording 3 seconds to stop (only video) + * @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_CALLBACK_1300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1400 + * @tc.name : 14.AVRecorder test recording 3 seconds to reset (only video) + * @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_CALLBACK_1400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_1400 end') + }) + + // Callback prepare + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // release avRecorde + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pasue avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pasue avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0500 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // prepare avRecorder + PREPARE_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_0900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0900 start') + let avNewProfile = { + audioBitrate : -1, + audioChannels : 2, + audioSampleRate : 48000, + audioCodec : media.CodecMimeType.AUDIO_AAC, + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, + videoCodec : media.CodecMimeType.VIDEO_MPEG4, + 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 + } + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_0900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1000 start') + let avNewProfile = { + audioBitrate : 48000, + audioChannels : 2, + audioSampleRate : -1, + audioCodec : media.CodecMimeType.AUDIO_AAC, + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, + videoCodec : media.CodecMimeType.VIDEO_MPEG4, + 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 + } + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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 + } + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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_CALLBACK_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_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 + } + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1200 end') + }) + + // Callback getInputSurface + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0500 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // getInputSurface + GETINPUTSURFACE_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0800 end') + }) + + // Callback start + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0500 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // start avRecorder + STARTRECORDER_CALLBACK_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0800 end') + }) + + // Callback pause + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0200 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // release avRecorder + RELEASECORDER_CALLBACK_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0300 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0400 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // resume avRecorder + RESUMERECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0500 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // stop avRecorder + STOPRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0600 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0700 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // reset avRecorder + RESETRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0800 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start avRecorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // pause avRecorder + PAUSERECORDER_CALLBACK_EVENT, + // stop camera + STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0800 end') + }) + + /* * + * @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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, 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 + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_MPEG4_1200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0100 + * @tc.name : 001.test 1,record 3s; 2,pause 3,resume 4,stop 5,restart + * @tc.desc : Recorder video 1,record 3s; 2,pause 3,resume 4,stop 5,restart + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpegAac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0600 start') + + avConfigMpegAac.orientationHint = 90 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpegAac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0700 start') + + avConfigMpegAac.orientationHint = 180 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpegAac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0800 start') + + avConfigMpegAac.orientationHint = 270 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpegAac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0800 end') + }) + + // /* * + // * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0900 + // * @tc.name : 09.AVRecorder recording videoFrameRate:5 + // * @tc.desc : Recorder video (test failed) + // * @tc.size : MediumTest + // * @tc.type : Function test + // * @tc.level : Level2 + // */ + // it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0900', 0, async function (done) { + // console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0900 start') + // + // avProfileMpegAac.videoFrameRate = 5 + // + // let fileName = avVideoRecorderTestBase.resourceName() + // fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + // fdPath = "fd://" + fdObject.fdNumber; + // avConfigMpegAac.url = fdPath; + // + // let mySteps = new Array( + // // init avRecorder + // CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // // init camera + // GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // // start recorder + // STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // // pause recorder + // PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // // resume recorder + // STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // // stop recorder + // STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // // release avRecorder and camera + // RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // // end + // END_EVENT + // ); + // + // eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + // console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_0900 end') + // }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_1000 start') + + avProfileMpegAac.videoFrameRate = 30 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpegAac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_1100 start') + + avProfileMpegAac.videoFrameRate = 60 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpegAac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpegAac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_1100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_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_CALLBACK_MPEG4_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_1200 start') + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigMpeg.url = fdPath + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigMpeg, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_MPEG4_1200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0100 + * @tc.name : 01.AVRecorder Record H264+AAC + * @tc.desc : Recorder video + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0100 start') + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0200 start') + + avProfileH264Aac.audioBitrate = 8000 + avProfileH264Aac.audioSampleRate = 8000 + avProfileH264Aac.videoBitrate = 280000 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0200 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0300 start') + + avProfileH264Aac.audioBitrate = 16000 + avProfileH264Aac.audioSampleRate = 32000 + avProfileH264Aac.videoBitrate = 560000 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0300 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0400 start') + + avProfileH264Aac.audioBitrate = 32000 + avProfileH264Aac.audioSampleRate = 44100 + avProfileH264Aac.videoBitrate = 1120000 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0400 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0500 start') + + avProfileH264Aac.audioBitrate = 112000 + avProfileH264Aac.audioSampleRate = 96000 + avProfileH264Aac.videoBitrate = 2240000 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0500 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0600 start') + + avConfigH264Aac.orientationHint = 90 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0600 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0700 start') + + avConfigH264Aac.orientationHint = 180 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0700 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0800 start') + + avConfigH264Aac.orientationHint = 270 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0800 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_0900', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0900 start') + + avProfileH264Aac.videoFrameRate = 5 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_0900 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_1000 start') + + avProfileH264Aac.videoFrameRate = 30 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_1100 start') + + avProfileH264Aac.videoFrameRate = 60 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( + // init avRecorder + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT + ); + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_1100 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_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_H264_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_1200 start') + 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 - } + avConfigH264.url = fdPath let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT, PREPARE_PROMISE_EVENT, + // init camera + GETINPUTSURFACE_PROMISE_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_PROMISE_EVENT, + // pause recorder + PAUSERECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_PROMISE_EVENT, + // stop recorder + STOPRECORDER_PROMISE_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_PROMISE_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PREPARE_CALLBACK_1200 end') + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_PROMISE_H264_1200 end') }) - // Callback getInputSurface + // /* * + // * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0100 + // * @tc.name : 01.AVRecorder Record H264+AAC + // * @tc.desc : Recorder video (test failed) + // * @tc.size : MediumTest + // * @tc.type : Function test + // * @tc.level : Level2 + // */ + // it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0100', 0, async function (done) { + // console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0100 start') + // let fileName = avVideoRecorderTestBase.resourceName() + // fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + // fdPath = "fd://" + fdObject.fdNumber; + // avConfigH264Aac.url = fdPath; + // + // let mySteps = new Array( + // // init avRecorder + // CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // // init camera + // GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // // start recorder + // STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // // pause recorder + // PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // // resume recorder + // STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // // stop recorder + // STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // // release avRecorder and camera + // RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // // end + // END_EVENT + // ); + // + // eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + // console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0100 end') + // }) + /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0100 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0200 start') + + avProfileH264Aac.audioBitrate = 8000 + avProfileH264Aac.audioSampleRate = 8000 + avProfileH264Aac.videoBitrate = 280000 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0100 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0200 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0200 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0300', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0300 start') + + avProfileH264Aac.audioBitrate = 16000 + avProfileH264Aac.audioSampleRate = 32000 + avProfileH264Aac.videoBitrate = 560000 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0200 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0300 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_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_CALLBACK_0800', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0800 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0400 start') + + avProfileH264Aac.audioBitrate = 32000 + avProfileH264Aac.audioSampleRate = 44100 + avProfileH264Aac.videoBitrate = 1120000 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, - // getInputSurface - GETINPUTSURFACE_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_GETSURFACE_CALLBACK_0800 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0400 end') }) - // Callback start /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0100 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0500', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0500 start') + + avProfileH264Aac.audioBitrate = 112000 + avProfileH264Aac.audioSampleRate = 96000 + avProfileH264Aac.videoBitrate = 2240000 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, - // start avRecorder - STARTRECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0100 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0500 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_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_CALLBACK_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0200 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0600', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0600 start') + + avConfigH264Aac.orientationHint = 90 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // start avRecorder - STARTRECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_START_CALLBACK_0200 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0600 end') }) - // Callback pause /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0100 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0700', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0700 start') + + avConfigH264Aac.orientationHint = 180 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, - // pause avRecorder - PAUSERECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0100 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0700 end') }) /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_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_CALLBACK_0200', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0200 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_0800', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0800 start') + + avConfigH264Aac.orientationHint = 270 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( // init avRecorder CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, - // pause avRecorder - PAUSERECORDER_CALLBACK_EVENT, - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT ); - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_PAUSE_CALLBACK_0200 end') + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0800 end') }) - // stability test Promise + // /* * + // * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0900 + // * @tc.name : 09.AVRecorder recording videoFrameRate:5 + // * @tc.desc : Recorder video (test failed) + // * @tc.size : MediumTest + // * @tc.type : Function test + // * @tc.level : Level2 + // */ + // it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0900', 0, async function (done) { + // console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0900 start') + // + // avProfileH264Aac.videoFrameRate = 5 + // + // let fileName = avVideoRecorderTestBase.resourceName() + // fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + // fdPath = "fd://" + fdObject.fdNumber; + // avConfigH264Aac.url = fdPath; + // + // let mySteps = new Array( + // // init avRecorder + // CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // // init camera + // GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // // start recorder + // STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // // pause recorder + // PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // // resume recorder + // STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // // stop recorder + // STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // // release avRecorder and camera + // RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // // end + // END_EVENT + // ); + // + // eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + // console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_0900 end') + // }) + /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_PROMISE_0100 - * @tc.name : 01.AVRecorder.prepare(promise) - * @tc.desc : 1. createAVRecorder 2. prepare 2. 执行1000次 - * @tc.size : MediumTest - * @tc.type : Stability test - * @tc.level : Level 4 - */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_PROMISE_0100 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_1000', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_1000 start') + + avProfileH264Aac.videoFrameRate = 30 + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; - let loopTimes = 1000; + avConfigH264Aac.url = fdPath; + let mySteps = new Array( - // setAvRecorderCallback - CREATE_PROMISE_EVENT, SETONCALLBACK_EVENT + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, + // end + END_EVENT ); - for (let i = 0; i < loopTimes; i++) - { - mySteps.push( - // AVRecorderTestBase.preparePromise - PREPARE_PROMISE_EVENT, - // AVRecorderTestBase.resetPromise - RESETRECORDER_PROMISE_EVENT - ) - } - mySteps.push( - RELEASECORDER_PROMISE_EVENT, + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_1000 end') + }) + + /* * + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_1100', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_1100 start') + + avProfileH264Aac.videoFrameRate = 60 + + let fileName = avVideoRecorderTestBase.resourceName() + fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); + fdPath = "fd://" + fdObject.fdNumber; + avConfigH264Aac.url = fdPath; + + let mySteps = new Array( + // init avRecorder + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT - ) - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_PROMISE_0100 end') + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264Aac, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_1100 end') }) - // stability test Callback /* * - * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_CALLBACK_0100 - * @tc.name : 01.AVRecorder.prepare(callback) - * @tc.desc : 1. createAVRecorder 2. prepare 2. 执行1000次 - * @tc.size : MediumTest - * @tc.type : Stability test - * @tc.level : Level 4 - */ - it('SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_CALLBACK_0100 start') + * @tc.number : SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_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_CALLBACK_H264_1200', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_1200 start') + let fileName = avVideoRecorderTestBase.resourceName() fdObject = await mediaTestBase.getAvRecorderFd(fileName, "video"); fdPath = "fd://" + fdObject.fdNumber; - avConfig.url = fdPath; - let mySteps = new Array(); - mySteps.push( + avConfigH264.url = fdPath + + let mySteps = new Array( // init avRecorder - CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT - ) - for (let i = 0; i < 1000; i++) { - mySteps.push( - PREPARE_CALLBACK_EVENT, GETINPUTSURFACE_CALLBACK_EVENT, RESETRECORDER_CALLBACK_EVENT - ) - } - mySteps.push( - // release avRecorder - RELEASECORDER_CALLBACK_EVENT, + CREATE_CALLBACK_EVENT, SETONCALLBACK_EVENT, PREPARE_CALLBACK_EVENT, + // init camera + GETINPUTSURFACE_CALLBACK_EVENT, INITCAMERA_EVENT, + // start recorder + STARTCAMERA_EVENT, STARTRECORDER_CALLBACK_EVENT, + // pause recorder + PAUSERECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // resume recorder + STARTCAMERA_EVENT, RESUMERECORDER_CALLBACK_EVENT, + // stop recorder + STOPRECORDER_CALLBACK_EVENT, STOPCAMERA_EVENT, + // release avRecorder and camera + RELEASECORDER_CALLBACK_EVENT, RELEASECAMERA_EVENT, // end END_EVENT - ) - eventEmitter.emit(mySteps[0], avRecorder, avConfig, recorderTime, mySteps, done); - console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_STABILITY_API_CALLBACK_0100 end') + ); + + eventEmitter.emit(mySteps[0], avRecorder, avConfigH264, recorderTime, mySteps, done); + console.info(TAG + 'SUB_MULTIMEDIA_AVRECORDER_VIDEO_FUNCTION_CALLBACK_H264_1200 end') }) }) } - -- GitLab