提交 67450500 编写于 作者: C chenjiahuan

<videoRecorder下库>

Signed-off-by: Nchenjiahuan <chenjiahuan@huawei.com>
上级 8856bcf1
......@@ -47,7 +47,6 @@ group("multimedia") {
"media/media_js_standard/audioRecorder:audio_recorder_js_hap",
"media/media_js_standard/recorderFormat:recorder_format_js_hap",
"media/media_js_standard/videoPlayer:video_player_js_hap",
"media/media_js_standard/videoRecorder:video_recorder_js_hap",
"medialibrary/mediaLibrary_album:mediaLibrary_album_hap",
"medialibrary/mediaLibrary_base:mediaLibrary_base_hap",
"medialibrary/mediaLibrary_favorite:mediaLibrary_favorite_hap",
......
# Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("video_recorder_js_hap") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":video_recorder_js_assets",
":video_recorder_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsVideoRecorderJsTest"
subsystem_name = "multimedia"
part_name = "multimedia_player_framework"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("video_recorder_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("video_recorder_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for videoRecorder Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1000000",
"shell-timeout": "1000000",
"testcase-timeout": 60000,
"bundle-name": "ohos.acts.multimedia.video.videorecorder",
"package-name": "ohos.acts.multimedia.video.videorecorder"
},
"kits": [
{
"test-file-name": [
"ActsVideoRecorderJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/Videos/*",
"param set persist.ace.testmode.enabled 1",
"power-shell wakeup",
"uinput -T -d 300 600 -m 300 600 300 100 -u 300 100",
"power-shell setmode 602"
],
"teardown-command":[
"power-shell setmode 600"
],
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.video.videorecorder",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"deviceType": [
"tablet",
"default",
"default",
"tablet",
"tv",
"wearable"
],
"mainAbility": ".MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.CAMERA",
"reason" : "use ohos.permission.CAMERA"
},
{
"name" : "ohos.permission.MICROPHONE",
"reason" : "use ohos.permission.MICROPHONE"
},
{
"name" : "ohos.permission.MEDIA_LOCATION",
"reason" : "use ohos.permission.MEDIA_LOCATION"
},
{
"name" : "ohos.permission.READ_MEDIA",
"reason" : "use ohos.permission.READ_MEDIA"
},
{
"name" : "ohos.permission.WRITE_MEDIA",
"reason" : "use ohos.permission.WRITE_MEDIA"
}
],
"package": "ohos.acts.multimedia.video.videorecorder",
"name": ".entry",
"js": [
{
"pages": [
"pages/index/index",
"pages/surfaceTest/surfaceTest",
"pages/surfaceTest2/surfaceTest2"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"srcPath": ""
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
setTimeout(()=>{
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},100)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
VideoRecorder Test
</text>
<Xcomponent id = 'XcomponentId2'
type = 'surface'
onload = 'LoadXcomponent2'
style = "width:720px;height:480px;border-color:red;border-width:5px">
</Xcomponent>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
import Fileio from '@ohos.fileio'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
},
onReady() {
},
LoadXcomponent2() {
globalThis.value = this.$element('XcomponentId2').getXComponentSurfaceId()
},
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
VideoRecorder Test
</text>
<Xcomponent id = 'XcomponentId3'
type = 'surface'
onload = 'LoadXcomponent3'
style = "width:720px;height:480px;border-color:red;border-width:5px">
</Xcomponent>
</div>
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Core, ExpectExtend} from 'deccjsunit/index'
import Fileio from '@ohos.fileio'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
},
onReady() {
},
LoadXcomponent3() {
globalThis.value = this.$element('XcomponentId3').getXComponentSurfaceId()
},
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import VideoRecorderFuncPromiseTest from './VideoRecorderFuncPromiseTest.test.js'
import VideoRecorderFuncCallbackTest from './VideoRecorderFuncCallbackTest.test.js'
import VideoRecorderAPICallbackTest from './VideoRecorderAPICallbackTest.test.js'
import VideoRecorderEnumTest from './VideoRecorderEnumTest.test.js'
export default function testsuite() {
VideoRecorderFuncPromiseTest()
VideoRecorderFuncCallbackTest()
VideoRecorderAPICallbackTest()
VideoRecorderEnumTest()
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import camera from '@ohos.multimedia.camera'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as videoRecorderBase from '../../../../../VideoRecorderTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
export default function VideoRecorderAPICallbackTest() {
describe('VideoRecorderAPICallbackTest', function () {
const RECORDER_TIME = 3000;
const PAUSE_TIME = 1000;
const END_EVENT = 'end';
const CREATE_EVENT = 'create';
const PREPARE_EVENT = 'prepare';
const GETSURFACE_EVENT = 'getInputSurface';
const START_EVENT = 'start';
const PAUSE_EVENT = 'pause';
const RESUME_EVENT = 'resume';
const STOP_EVENT = 'stop';
const RESET_EVENT = 'reset';
const RELEASE_EVENT = 'release';
const START_STREEAM = 'start_stream';
const CLOSE_STREAM = 'close_stream';
const ERROR_EVENT = 'error';
let cameraManager;
let cameras;
let captureSession;
let videoOutput;
let surfaceID;
let fdPath;
let fdObject;
let cameraID = 0;
let playerSurfaceId = '';
let pageId = 0;
let videoProfiles;
let previewProfiles;
let previewOutput;
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let events = require('events');
let eventEmitter = new events.EventEmitter();
let configFile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
durationTime : 1000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 48000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 10
}
// rotation 0, 90, 180, 270
let videoConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV,
profile : configFile,
url : 'fd://',
rotation : 0,
location : { latitude : 30, longitude : 130 },
maxSize : 100,
maxDuration : 500
}
beforeAll(async function () {
cameraManager = await camera.getCameraManager(null);
if (cameraManager != null) {
console.info('[camera] case getCameraManager success');
} else {
console.info('[camera] case getCameraManager failed');
return;
}
await cameraManager.getSupportedCameras().then((cameraDevices)=> {
cameras = cameraDevices;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
if (cameras != null) {
console.info('[camera] case getCameras success');
} else {
console.info('[camera] case getCameras failed');
}
await cameraManager.getSupportedOutputCapability(cameras[0]).then((cameraoutputcapability) => {
console.info('[camera] case getSupportedOutputCapability success');
videoProfiles = cameraoutputcapability.videoProfiles;
videoProfiles[0].size.height = 480;
videoProfiles[0].size.width = 640;
previewProfiles = cameraoutputcapability.previewProfiles;
previewProfiles[0].size.height = 480;
previewProfiles[0].size.width = 640;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback)
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_YUV');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
} else {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_ES');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
}
fdObject = await mediaTestBase.getFd('recorder_callback_api.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
console.info('beforeAll case');
})
beforeEach(async function () {
await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2;
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
playerSurfaceId = globalThis.value;
surfaceID = null;
console.info('beforeEach case');
})
afterEach(function () {
console.info('afterEach case');
})
afterAll(async function () {
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
console.info('afterAll case');
})
function printfError(error, done) {
expect().assertFail();
console.info(`case error called,errMessage is ${error.message}`);
done();
}
function toNextStep(videoRecorder, steps, done) {
if (steps[0] == END_EVENT) {
console.info('case success!!');
done();
} else {
eventEmitter.emit(steps[0], videoRecorder, steps, done);
}
}
eventEmitter.on(START_STREEAM, async (videoRecorder, steps, done) => {
steps.shift();
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
if (videoOutput == null) {
console.info('[camera] case createVideoOutput failed');
} else {
console.info('[camera] case createVideoOutput success');
}
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await videoOutput.start().then(() => {
console.info('[camera] case videoOutput start success');
});
toNextStep(videoRecorder, steps, done);
});
eventEmitter.on(CLOSE_STREAM, async (videoRecorder, steps, done) => {
steps.shift();
await videoOutput.stop().then(() => {
console.info('[camera] case videoOutput stop success');
});
await videoRecorderBase.stopCaptureSession(captureSession);
toNextStep(videoRecorder, steps, done);
});
eventEmitter.on(CREATE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
media.createVideoRecorder((err, recorder) => {
if (typeof (err) == 'undefined') {
console.info('case createVideoRecorder success ');
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case createVideoRecorder error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(PREPARE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.prepare(videoConfig, (err) => {
if (typeof (err) == 'undefined') {
console.info('case prepare success');
expect(videoRecorder.state).assertEqual('prepared');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case prepare error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(GETSURFACE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.getInputSurface((err, outPutSurface) => {
if (typeof (err) == 'undefined') {
console.info('case getInputSurface success');
surfaceID = outPutSurface;
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case getInputSurface error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(START_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.start((err) => {
if (typeof (err) == 'undefined') {
console.info('case start success');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case start error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(PAUSE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.pause((err) => {
if (typeof (err) == 'undefined') {
console.info('case pause success');
mediaTestBase.msleep(PAUSE_TIME);
expect(videoRecorder.state).assertEqual('paused');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case pause error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(RESUME_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.resume((err) => {
if (typeof (err) == 'undefined') {
console.info('case resume success');
mediaTestBase.msleep(RECORDER_TIME);
expect(videoRecorder.state).assertEqual('playing');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case resume error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(STOP_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.stop((err) => {
if (typeof (err) == 'undefined') {
console.info('case stop success');
expect(videoRecorder.state).assertEqual('stopped');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case stop error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(RESET_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.reset((err) => {
if (typeof (err) == 'undefined') {
console.info('case reset success');
expect(videoRecorder.state).assertEqual('idle');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case reset error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(RELEASE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.release((err) => {
if (typeof (err) == 'undefined') {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release success');
toNextStep(videoRecorder, steps, done);
} else if ((typeof (err) != 'undefined') && (steps[0] == ERROR_EVENT)) {
steps.shift();
console.info('case release error hanpped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100
* @tc.name : 01.create->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0200
* @tc.name : 02.start->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0300
* @tc.name : 03.pause->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, CLOSE_STREAM, PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0400
* @tc.name : 04.resume->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, RESUME_EVENT,
PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0500
* @tc.name : 05.stop->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0600
* @tc.name : 06.reset->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, CLOSE_STREAM, RESET_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0700
* @tc.name : 07.getInputSurface->prepare
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, PREPARE_EVENT,
ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0800
* @tc.name : 08.prepare 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, PREPARE_EVENT, ERROR_EVENT,
PREPARE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0100
* @tc.name : 01.create->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, START_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0200
* @tc.name : 02.prepare->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0300
* @tc.name : 03.pause->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, START_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0400
* @tc.name : 04.resume->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, RESUME_EVENT,
START_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0500
* @tc.name : 05.stop->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, START_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0600
* @tc.name : 06.reset->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESET_EVENT, CLOSE_STREAM, START_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0700
* @tc.name : 07.getInputSurface->start
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0800
* @tc.name : 08.start 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_START_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, START_EVENT, ERROR_EVENT, START_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0100
* @tc.name : 01.create->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0200
* @tc.name : 02.prepare->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0300
* @tc.name : 03.start->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0400
* @tc.name : 04.resume->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, RESUME_EVENT,
PAUSE_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0500
* @tc.name : 05.stop->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0600
* @tc.name : 06.reset->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESET_EVENT, CLOSE_STREAM, PAUSE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0700
* @tc.name : 07.getInputSurface->pause
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, PAUSE_EVENT,
ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0800
* @tc.name : 08.pause 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_PAUSE_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, PAUSE_EVENT, ERROR_EVENT, PAUSE_EVENT, ERROR_EVENT,
CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0100
* @tc.name : 01.create->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, RESUME_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0200
* @tc.name : 02.prepare->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RESUME_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0300
* @tc.name : 03.start->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESUME_EVENT, ERROR_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0400
* @tc.name : 04.pause->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0500
* @tc.name : 05.stop->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, RESUME_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0600
* @tc.name : 06.reset->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESET_EVENT, CLOSE_STREAM, RESUME_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0700
* @tc.name : 07.getInputSurface->resume
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, RESUME_EVENT,
ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0800
* @tc.name : 08.resume 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESUME_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RESUME_EVENT, ERROR_EVENT, RESUME_EVENT, ERROR_EVENT,
RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0100
* @tc.name : 01.create->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0200
* @tc.name : 02.prepare->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0300
* @tc.name : 03.start->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0400
* @tc.name : 04.pause->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0500
* @tc.name : 05.resume->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, RESUME_EVENT,
STOP_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0600
* @tc.name : 06.reset->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RESET_EVENT, STOP_EVENT,
ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0700
* @tc.name : 07.getInputSurface->stop
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT,
STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0800
* @tc.name : 08.stop 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_STOP_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, STOP_EVENT, ERROR_EVENT,
STOP_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0100
* @tc.name : 01.create->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0200
* @tc.name : 02.prepare->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0300
* @tc.name : 03.start->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0400
* @tc.name : 04.pause->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0500
* @tc.name : 05.resume->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, PAUSE_EVENT, RESUME_EVENT,
RESET_EVENT, CLOSE_STREAM, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0600
* @tc.name : 06.stop->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM,
START_EVENT, STOP_EVENT, CLOSE_STREAM, RESET_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0700
* @tc.name : 07.getInputSurface->reset
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0800
* @tc.name : 08.reset 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_RESET_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, RESET_EVENT,
RESET_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0100
* @tc.name : 01.create->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0100', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, GETSURFACE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0200
* @tc.name : 02.prepare->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0200', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0300
* @tc.name : 03.start->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0300', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
GETSURFACE_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0400
* @tc.name : 04.pause->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0400', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
PAUSE_EVENT, GETSURFACE_EVENT, RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0500
* @tc.name : 05.resume->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0500', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, GETSURFACE_EVENT,
RELEASE_EVENT, CLOSE_STREAM, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0600
* @tc.name : 06.stop->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0600', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_STREEAM, START_EVENT,
STOP_EVENT, CLOSE_STREAM, GETSURFACE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0700
* @tc.name : 07.reset->getInputSurface
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0700', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RESET_EVENT,
GETSURFACE_EVENT, ERROR_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0800
* @tc.name : 08.getInputSurface 3 times
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_GETSURFACE_CALLBACK_0800', 0, async function (done) {
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT,
GETSURFACE_EVENT, GETSURFACE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
})
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
export default function VideoRecorderEnumTest() {
describe('VideoRecorderEnumTest', function () {
beforeAll(function() {
console.info('beforeAll case');
})
beforeEach(function() {
console.info('beforeEach case');
})
afterEach(function() {
console.info('afterEach case');
})
afterAll(function() {
console.info('afterAll case');
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_ENUM_AUDIO_SOURCE_TYPE_0100
* @tc.name : AudioSourceType
* @tc.desc : AudioSourceType Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_ENUM_AUDIO_SOURCE_TYPE_0100', 0, async function (done) {
expect(media.AudioSourceType.AUDIO_SOURCE_TYPE_DEFAULT).assertEqual(0);
expect(media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC).assertEqual(1);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_ENUM_VIDEO_SOURCE_TYPE_0100
* @tc.name : VideoSourceType
* @tc.desc : VideoSourceType Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_ENUM_VIDEO_SOURCE_TYPE_0100', 0, async function (done) {
expect(media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV).assertEqual(0);
expect(media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES).assertEqual(1);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DECODER_ENUM_CODECMIMETYPE_0100
* @tc.name : CodecMimeType
* @tc.desc : Test Enumerate CodecMimeType
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_DECODER_ENUM_CODECMIMETYPE_0100', 0, async function (done) {
expect(media.CodecMimeType.VIDEO_H263).assertEqual('video/h263');
expect(media.CodecMimeType.VIDEO_AVC).assertEqual('video/avc');
expect(media.CodecMimeType.VIDEO_MPEG2).assertEqual('video/mpeg2');
expect(media.CodecMimeType.VIDEO_MPEG4).assertEqual('video/mp4v-es');
expect(media.CodecMimeType.VIDEO_VP8).assertEqual('video/x-vnd.on2.vp8');
done();
})
})
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import camera from '@ohos.multimedia.camera'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as videoRecorderBase from '../../../../../VideoRecorderTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
export default function VideoRecorderFuncCallbackTest() {
describe('VideoRecorderFuncCallbackTest', function () {
const RECORDER_TIME = 3000;
const PAUSE_TIME = 1000;
const END_EVENT = 'end';
const CREATE_EVENT = 'create';
const PREPARE_EVENT = 'prepare';
const PREPARE_OLNYVIDEO_EVENT = 'prepare_only';
const GETSURFACE_EVENT = 'getInputSurface';
const START_EVENT = 'start';
const PAUSE_EVENT = 'pause';
const RESUME_EVENT = 'resume';
const STOP_EVENT = 'stop';
const RESET_EVENT = 'reset';
const RELEASE_EVENT = 'release';
const CHECK_EVENT = "check";
const ONLYVIDEO_TYPE = 'only_video';
const AUDIO_VIDEO_TYPE = 'audio_video';
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let cameraManager;
let cameras;
let captureSession;
let videoOutput;
let surfaceID;
let playerSurfaceId = '';
let fdPath;
let fdObject;
let cameraID = 0;
let pageId = 0;
let videoProfiles;
let previewProfiles;
let previewOutput;
let configFile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
durationTime : 1000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 48000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 10
}
// rotation 0, 90, 180, 270
let videoConfig = {
audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV,
profile : configFile,
url : 'fd://',
rotation : 0,
location : { latitude : 30, longitude : 130 },
maxSize : 100,
maxDuration : 500
}
let onlyVideoProfile = {
durationTime : 1000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 48000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 10
}
let onlyVideoConfig = {
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV,
profile : onlyVideoProfile,
url : 'fd://',
rotation : 0,
location : { latitude : 30, longitude : 130 },
maxSize : 100,
maxDuration : 500
}
beforeAll(async function () {
cameraManager = await camera.getCameraManager(null);
if (cameraManager != null) {
console.info('[camera] case getCameraManager success');
} else {
console.info('[camera] case getCameraManager failed');
return;
}
await cameraManager.getSupportedCameras().then((cameraDevices)=> {
cameras = cameraDevices;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
if (cameras != null) {
console.info('[camera] case getCameras success');
} else {
console.info('[camera] case getCameras failed');
}
await cameraManager.getSupportedOutputCapability(cameras[0]).then((cameraoutputcapability) => {
console.info('[camera] case getSupportedOutputCapability success');
videoProfiles = cameraoutputcapability.videoProfiles;
videoProfiles[0].size.height = 480;
videoProfiles[0].size.width = 640;
previewProfiles = cameraoutputcapability.previewProfiles;
previewProfiles[0].size.height = 480;
previewProfiles[0].size.width = 640;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback)
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_YUV');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
} else {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_ES');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
}
console.info('beforeAll case');
})
beforeEach(async function () {
await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2;
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
if (pageId == 0) {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_AVC;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_AVC;
}
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
}
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
playerSurfaceId = globalThis.value;
cameraID = 0;
console.info('beforeEach case');
})
afterEach(async function () {
await mediaTestBase.clearRouter();
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
function printfError(error, done) {
expect().assertFail();
console.info(`case error called,errMessage is ${error.message}`);
done();
}
let events = require('events');
let eventEmitter = new events.EventEmitter();
async function toNextStep(videoRecorder, steps, done) {
if (steps[0] == END_EVENT) {
console.info('case success!!');
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
} else {
console.info('case toNextStep is ' + steps[0]);
eventEmitter.emit(steps[0], videoRecorder, steps, done);
}
}
function setOnCallback(videoRecorder) {
videoRecorder.on('info', (infoType, extra) => {
console.info('case info called, infoType is ' + infoType);
console.info('case info called, extra is ' + extra);
});
videoRecorder.on('error', (err) => {
console.info('case error called, errMessage is ' + err.message);
expect().assertFail();
});
}
eventEmitter.on(CREATE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
media.createVideoRecorder((err, recorder) => {
if (typeof (err) == 'undefined') {
console.info('case createVideoRecorder success ');
videoRecorder = recorder;
setOnCallback(videoRecorder);
expect(videoRecorder.state).assertEqual('idle');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(PREPARE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.prepare(videoConfig, (err) => {
if (typeof (err) == 'undefined') {
console.info('case prepare success');
expect(videoRecorder.state).assertEqual('prepared');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(PREPARE_OLNYVIDEO_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.prepare(onlyVideoConfig, (err) => {
if (typeof (err) == 'undefined') {
console.info('case prepare success');
expect(videoRecorder.state).assertEqual('prepared');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(GETSURFACE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.getInputSurface((err, outPutsurface) => {
if (typeof (err) == 'undefined') {
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutsurface;
console.info('case getInputSurface success :' + surfaceID);
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(START_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
if (videoOutput == null) {
console.info('case createVideoOutput failed');
} else {
console.info('case createVideoOutput success');
}
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await videoOutput.start().then(() => {
console.info('case videoOutput start success');
});
videoRecorder.start((err) => {
if (typeof (err) == 'undefined') {
console.info('case start success');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(PAUSE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.pause((err) => {
if (typeof (err) == 'undefined') {
console.info('case pause success');
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(RESUME_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.resume((err) => {
if (typeof (err) == 'undefined') {
console.info('case resume success');
mediaTestBase.msleep(RECORDER_TIME);
expect(videoRecorder.state).assertEqual('playing');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(STOP_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.stop((err) => {
if (typeof (err) == 'undefined') {
console.info('case stop success');
expect(videoRecorder.state).assertEqual('stopped');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(RESET_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.reset((err) => {
if (typeof (err) == 'undefined') {
console.info('case reset success');
expect(videoRecorder.state).assertEqual('idle');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(RELEASE_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
videoRecorder.release(async (err) => {
await videoOutput.stop().then(() => {
console.info('case videoOutput stop success');
});
await videoRecorderBase.stopCaptureSession(captureSession);
if (typeof (err) == 'undefined') {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release success');
toNextStep(videoRecorder, steps, done);
} else {
printfError(err, done);
}
});
});
eventEmitter.on(CHECK_EVENT, async (videoRecorder, steps, done) => {
steps.shift();
let trackArray = steps[0];
let recorderTime = steps[1];
steps.shift();
steps.shift();
await videoRecorderBase.checkVideos(fdPath, recorderTime, trackArray, playerSurfaceId);
toNextStep(videoRecorder, steps, done);
});
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0100
* @tc.name : 01.start->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0100', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_01.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, CHECK_EVENT,
trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0200
* @tc.name : 02.start->pause->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0200', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_02.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RELEASE_EVENT, CHECK_EVENT,
trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0300
* @tc.name : 03.start->pause->resume->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0300', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_03.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, CHECK_EVENT,
trackArray, RECORDER_TIME * 2, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0400
* @tc.name : 04.start->stop->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0400', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_04.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0500
* @tc.name : 05.start->reset->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0500', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_05.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0600
* @tc.name : 06.start->pause->stop->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0600', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_06.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0700
* @tc.name : 07.start->pause->reset->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0700', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_07.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0800
* @tc.name : 08.start->pause->resume->stop->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0800', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_08.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0900
* @tc.name : 09.start->pause->resume->reset->release (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0900', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_09.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1000
* @tc.name : 10.start->stop->release
* (audioBitrate 8000,audioSampleRate 8000,videoBitrateRange 8000)(promise)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1000', 0, async function (done) {
configFile.audioBitrate = 8000;
configFile.audioSampleRate = 8000;
configFile.videoBitrate = 8000;
fdObject = await mediaTestBase.getFd('recorder_callback_10.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1100
* @tc.name : 11.start->stop->release
* (audioBitrate 16000, audioSampleRate 32000, videoBitrateRange 16000)(callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1100', 0, async function (done) {
configFile.audioBitrate = 16000;
configFile.audioSampleRate = 32000;
configFile.videoBitrate = 16000;
fdObject = await mediaTestBase.getFd('recorder_callback_11.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1200
* @tc.name : 12.start->stop->release
* (audioBitrate 32000, audioSampleRate 44100, videoBitrateRange 32000)(callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1200', 0, async function (done) {
configFile.audioBitrate = 32000;
configFile.audioSampleRate = 44100;
configFile.videoBitrate = 32000;
fdObject = await mediaTestBase.getFd('recorder_callback_12.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1300
* @tc.name : 13.start->stop->release
* (audioBitrate 112000, audioSampleRate 96000, videoBitrateRange 112000)(callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1300', 0, async function (done) {
configFile.audioBitrate = 112000;
configFile.audioSampleRate = 96000;
configFile.videoBitrate = 112000;
fdObject = await mediaTestBase.getFd('recorder_callback_13.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1400
* @tc.name : 14.start->release (only video) (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1400', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_14.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT,
START_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1500
* @tc.name : 15.start->pause->release (only video) (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1500', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_15.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1600
* @tc.name : 16.start->pause->resume->releas (only video) (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1600', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_16.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME * 2, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1700
* @tc.name : 17.start->stop->release (only video) (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1700', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_17.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1800
* @tc.name : 18.start->reset->release (only video) (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1800', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_18.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
RESET_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1900
* @tc.name : 19.rotation 90 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1900', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_19.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.audioSampleRate = 48000;
videoConfig.rotation = 90;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT,
START_EVENT, RELEASE_EVENT, CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2000
* @tc.name : 20.rotation 180 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2000', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_20.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
videoConfig.rotation = 180;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2100
* @tc.name : 21.rotation 270 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2100', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_21.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
videoConfig.rotation = 270;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2200
* @tc.name : 22.videoFrameRate 20 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2200', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_22.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.videoFrameRate = 20;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2300
* @tc.name : 23.videoFrameRate 30 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2300', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_23.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.videoFrameRate = 30;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2400
* @tc.name : 24.videoFrameRate 60 (callback)
* @tc.desc : Audio recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2400', 0, async function (done) {
fdObject = await mediaTestBase.getFd('recorder_callback_24.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.videoFrameRate = 60;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT,
CHECK_EVENT, trackArray, RECORDER_TIME, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
})
})
}
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import camera from '@ohos.multimedia.camera'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import * as videoRecorderBase from '../../../../../VideoRecorderTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
export default function VideoRecorderFuncPromiseTest() {
describe('VideoRecorderFuncPromiseTest', function () {
const RECORDER_TIME = 3000;
const PAUSE_TIME = 1000;
const ONLYVIDEO_TYPE = 'only_video';
const AUDIO_VIDEO_TYPE = 'audio_video';
let cameraManager;
let cameras;
let captureSession;
let fdPath;
let fdObject;
let cameraID = 0;
let playerSurfaceId = '';
let pageId = 0;
let videoProfiles;
let previewProfiles;
const pagePath1 = 'pages/surfaceTest/surfaceTest';
const pagePath2 = 'pages/surfaceTest2/surfaceTest2';
let configFile = {
audioBitrate : 48000,
audioChannels : 2,
audioCodec : media.CodecMimeType.AUDIO_AAC,
audioSampleRate : 48000,
durationTime : 1000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 48000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 10
}
let videoConfig = {
audioSourceType : 1,
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : configFile,
url : 'fd://',
rotation : 0,
location : { latitude : 30, longitude : 130 },
maxSize : 100,
maxDuration : 500
}
let onlyVideoProfile = {
durationTime : 1000,
fileFormat : media.ContainerFormatType.CFT_MPEG_4,
videoBitrate : 48000,
videoCodec : media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth : 640,
videoFrameHeight : 480,
videoFrameRate : 10
}
let onlyVideoConfig = {
videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES,
profile : onlyVideoProfile,
url : 'fd://',
rotation : 0,
location : { latitude : 30, longitude : 130 },
maxSize : 100,
maxDuration : 500
}
beforeAll(async function () {
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
let permissionName5 = 'ohos.permission.CAMERA';
let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4, permissionName5];
await mediaTestBase.getPermission(permissionNames);
await mediaTestBase.msleepAsync(2000);
await mediaTestBase.driveFn(3);
cameraManager = await camera.getCameraManager(null);
if (cameraManager != null) {
console.info('[camera] case getCameraManager success');
} else {
console.info('[camera] case getCameraManager failed');
return;
}
await cameraManager.getSupportedCameras().then((cameraDevices)=> {
cameras = cameraDevices;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
if (cameras != null) {
console.info('[camera] case getCameras success');
} else {
console.info('[camera] case getCameras failed');
}
await cameraManager.getSupportedOutputCapability(cameras[0]).then((cameraoutputcapability) => {
console.info('[camera] case getSupportedOutputCapability success');
videoProfiles = cameraoutputcapability.videoProfiles;
videoProfiles[0].size.height = 480;
videoProfiles[0].size.width = 640;
previewProfiles = cameraoutputcapability.previewProfiles;
previewProfiles[0].size.height = 480;
previewProfiles[0].size.width = 640;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback)
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_YUV');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
onlyVideoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV;
} else {
console.info('[camera] case format is VIDEO_SOURCE_TYPE_SURFACE_ES');
videoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
onlyVideoConfig.videoSourceType = media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_ES;
}
console.info('beforeAll case');
})
beforeEach(async function () {
await mediaTestBase.toNewPage(pagePath1, pagePath2, pageId);
pageId = (pageId + 1) % 2;
if (previewProfiles[0].format == camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP) {
if (pageId == 0) {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_AVC;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_AVC;
}
} else {
configFile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
onlyVideoProfile.videoCodec = media.CodecMimeType.VIDEO_MPEG4;
}
await mediaTestBase.msleepAsync(1000).then(
() => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
playerSurfaceId = globalThis.value;
cameraID = 0;
console.info('beforeEach case');
})
afterEach(async function () {
await mediaTestBase.clearRouter();
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
function checkErrorCode(errorCode)
{
let value = false;
switch (errorCode) {
case 0:
case 201:
case 401:
case 801:
case 5400101:
case 5400102:
case 5400103:
case 5400104:
case 5400105:
case 5400106:
value = true;
break;
}
return value;
}
async function startVideoOutput(videoOutPut) {
if (videoOutPut == null) {
console.info('[camera] case videoOutPut is null');
return;
}
await videoOutPut.start().then(() => {
console.info('[camera] case videoOutput start success');
});
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0100
* @tc.name : 01.start->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0100', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_01.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
console.info('case release ');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0200
* @tc.name : 02.start->pause->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0200', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_02.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.pause().then(() => {
console.info('case pause called');
mediaTestBase.msleep(PAUSE_TIME);
expect(videoRecorder.state).assertEqual('paused');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
console.info('case release ');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0300
* @tc.name : 03.start->pause->resume->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0300', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_03.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
console.info('case pause called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.start();
await videoRecorder.resume().then(() => {
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
console.info('case resume called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0400
* @tc.name : 04.start->stop->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0400', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_04.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId);
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0500
* @tc.name : 05.start->reset->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0500', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_05.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.reset().then(() => {
console.info('case reset called');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0600
* @tc.name : 06.start->pause->stop->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0600', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_06.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
console.info('case pause called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0700
* @tc.name : 07.start->pause->reset->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0700', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_07.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
console.info('case pause called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.reset().then(() => {
console.info('case reset called');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0800
* @tc.name : 08.start->pause->resume->stop->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0800', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_08.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
console.info('case pause called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.start();
await videoRecorder.resume().then(() => {
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
console.info('case resume called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0900
* @tc.name : 09.start->pause->resume->reset->release (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_0900', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
fdObject = await mediaTestBase.getFd('recorder_promise_09.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
console.info('case pause called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.start();
await videoRecorder.resume().then(() => {
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
console.info('case resume called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.reset().then(() => {
console.info('case reset called');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1000
* @tc.name : 10.start->stop->release
* (audioBitrate 8000,audioSampleRate 8000,videoBitrateRange 8000)(promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1000', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_10.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.audioBitrate = 8000;
configFile.audioSampleRate = 8000;
configFile.videoBitrate = 8000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1100
* @tc.name : 11.start->stop->release
* (audioBitrate 16000,audioSampleRate 32000,videoBitrateRange 16000)(promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1100', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_11.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.audioBitrate = 16000;
configFile.audioSampleRate = 32000;
configFile.videoBitrate = 16000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1200
* @tc.name : 12.start->stop->release
* (audioBitrate 32000,audioSampleRate 44100,videoBitrateRange 32000)(promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1200', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_12.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.audioBitrate = 32000;
configFile.audioSampleRate = 44100;
configFile.videoBitrate = 32000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1300
* @tc.name : 13.start->stop->release
* (audioBitrate 112000,audioSampleRate 96000,videoBitrateRange 112000)(promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1300', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_13.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.audioBitrate = 112000;
configFile.audioSampleRate = 96000;
configFile.videoBitrate = 112000;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1400
* @tc.name : 14.start->release (only video) (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1400', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_14.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(onlyVideoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case prepare called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1500
* @tc.name : 15.start->pause->release (only video) (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1500', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_15.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(onlyVideoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
console.info(`case getInputSurface,state is ${videoRecorder.state}`);
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
console.info('case pause called');
mediaTestBase.msleep(PAUSE_TIME);
expect(videoRecorder.state).assertEqual('paused');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
console.info('case release ');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1600
* @tc.name : 16.start->pause->resume->releas (only video) (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1600', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_16.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(onlyVideoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.pause().then(() => {
expect(videoRecorder.state).assertEqual('paused');
mediaTestBase.msleep(PAUSE_TIME);
console.info('case pause called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.start();
await videoRecorder.resume().then(() => {
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
console.info('case resume called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME * 2, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1700
* @tc.name : 17.start->stop->release (only video) (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1700', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_17.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(onlyVideoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.stop().then(() => {
expect(videoRecorder.state).assertEqual('stopped');
console.info('case stop called');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1800
* @tc.name : 18.start->reset->release (only video) (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1800', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_18.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
onlyVideoConfig.url = fdPath;
let trackArray = videoRecorderBase.getTrackArray(ONLYVIDEO_TYPE, onlyVideoProfile,
onlyVideoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(onlyVideoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
expect(videoRecorder.state).assertEqual('prepared');
console.info('case getInputSurface called');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case start called');
expect(videoRecorder.state).assertEqual('playing');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.reset().then(() => {
console.info('case reset called');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1900
* @tc.name : 19.rotation 90 (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_1900', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_19.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.audioSampleRate = 48000;
videoConfig.rotation = 90;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2000
* @tc.name : 20.rotation 180 (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2000', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_20.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
videoConfig.rotation = 180;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2100
* @tc.name : 21.rotation 270 (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2100', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_21.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
videoConfig.rotation = 270;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2200
* @tc.name : 22.videoFrameRate 20 (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2200', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_22.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.videoFrameRate = 20;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2300
* @tc.name : 23.videoFrameRate 30 (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2300', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_23.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.videoFrameRate = 30;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2400
* @tc.name : 24.videoFrameRate 60 (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_2400', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
fdObject = await mediaTestBase.getFd('recorder_promise_24.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = fdPath;
configFile.videoFrameRate = 60;
let trackArray = videoRecorderBase.getTrackArray(AUDIO_VIDEO_TYPE, configFile, videoConfig.videoSourceType);
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
expect().assertFail();
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
expect(videoRecorder.state).assertEqual('prepared');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
expect(videoRecorder.state).assertEqual('playing');
console.info('case start called');
mediaTestBase.msleep(RECORDER_TIME);
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorder.release().then(() => {
expect(videoRecorder.state).assertEqual('idle');
console.info('case release ');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoRecorderBase.stopCaptureSession(captureSession);
await videoRecorderBase.checkVideos(fdPath, RECORDER_TIME, trackArray, playerSurfaceId);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_ERRORCODE
* @tc.name : 25.error code (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_ERRORCODE', 0, async function (done) {
let videoRecorder = undefined;
let surfaceID = '';
let videoOutput;
let previewOutput;
let errorCode = false;
fdObject = await mediaTestBase.getFd('recorder_promise_25.mp4');
fdPath = "fd://" + fdObject.fdNumber.toString();
videoConfig.url = '';
await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') {
videoRecorder = recorder;
expect(videoRecorder.state).assertEqual('idle');
} else {
console.info('case recordr is undefined!!');
}
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoRecorder.on('error', (err) => {
console.info('case on error called, errMessage is ' + err.code);
errorCode = checkErrorCode(err.code);
expect(errorCode).assertEqual(true);
});
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, (err) => {
console.info('case promise error called, errMessage is ' + err.code);
errorCode = checkErrorCode(err.code);
expect(errorCode).assertEqual(true);
}).catch(mediaTestBase.catchCallback);
await videoRecorder.reset().then(() => {
console.info('case recordr reset called');
expect(videoRecorder.state).assertEqual('idle');
}, (err) => {
console.info('case promise error called, errMessage is ' + err.code);
errorCode = checkErrorCode(err.code);
expect(errorCode).assertEqual(true);
}).catch(mediaTestBase.catchCallback);
videoConfig.url = fdPath;
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
expect(videoRecorder.state).assertEqual('prepared');
}, (err) => {
expect(videoRecorder.state).assertEqual('error');
console.info('case promise error called, errMessage is ' + err.code);
expect().assertFail();
}).catch(mediaTestBase.catchCallback);
await videoRecorder.getInputSurface().then((outPutSurface) => {
console.info('case getInputSurface called');
expect(videoRecorder.state).assertEqual('prepared');
surfaceID = outPutSurface;
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID);
previewOutput = await cameraManager.createPreviewOutput(previewProfiles[0], playerSurfaceId)
captureSession = await videoRecorderBase.initCaptureSession(videoOutput, cameraManager,
cameras[0], previewOutput);
await startVideoOutput(videoOutput);
await videoRecorder.start().then(() => {
console.info('case recordr play called');
expect(videoRecorder.state).assertEqual('playing');
}, (err) => {
console.info('case promise error called, errMessage is ' + err.code);
expect().assertFail();
}).catch(mediaTestBase.catchCallback);
await videoRecorder.start().then(() => {
console.info('case recordr start called');
}, (err) => {
console.info('case promise error called, errMessage is ' + err.code);
errorCode = checkErrorCode(err.code);
expect(errorCode).assertEqual(true);
}).catch(mediaTestBase.catchCallback);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
}, (err) => {
console.info('case promise error called, errMessage is ' + err.code);
errorCode = checkErrorCode(err.code);
expect(errorCode).assertEqual(true);
}).catch(mediaTestBase.catchCallback);
await videoRecorder.release().then(() => {
console.info('case release ');
expect(videoRecorder.state).assertEqual('idle');
}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback);
await videoOutput.stop();
await videoRecorderBase.stopCaptureSession(captureSession);
await mediaTestBase.closeFd(fdObject.fileAsset, fdObject.fdNumber);
await videoRecorder.prepare(videoConfig).then(() => {
console.info('case recordr prepare called');
}, (err) => {
console.info('case promise error called, errMessage is ' + err.code);
errorCode = checkErrorCode(err.code);
expect(errorCode).assertEqual(true);
}).catch(mediaTestBase.catchCallback);
done();
})
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册