提交 69e15bf4 编写于 作者: F fulizhong

add apply permission and open by fd Signed-off-by: FULIZHONG<fulizhong@huawei.com>

Signed-off-by: Nfulizhong <fulizhong@huawei.com>
上级 668b76e3
...@@ -49,6 +49,32 @@ ...@@ -49,6 +49,32 @@
"tv", "tv",
"wearable" "wearable"
], ],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"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"
}
],
"mainAbility": "ohos.acts.multimedia.audio.audiorecorder.MainAbility", "mainAbility": "ohos.acts.multimedia.audio.audiorecorder.MainAbility",
"distro": { "distro": {
"moduleType": "entry", "moduleType": "entry",
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*/ */
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('RecorderLocalTestAudioAPI', function () { describe('RecorderLocalTestAudioAPI', function () {
...@@ -32,6 +33,9 @@ describe('RecorderLocalTestAudioAPI', function () { ...@@ -32,6 +33,9 @@ describe('RecorderLocalTestAudioAPI', function () {
const ENCORDER_AACLC = 3; const ENCORDER_AACLC = 3;
const CHANNEL_TWO = 2; const CHANNEL_TWO = 2;
const RECORDER_TIME = 1000; const RECORDER_TIME = 1000;
let fdPath;
let fileAsset;
let fdNumber;
let audioConfig = { let audioConfig = {
audioSourceType : SOURCE_TYPE, audioSourceType : SOURCE_TYPE,
audioEncoder : ENCORDER_AACLC, audioEncoder : ENCORDER_AACLC,
...@@ -45,7 +49,7 @@ describe('RecorderLocalTestAudioAPI', function () { ...@@ -45,7 +49,7 @@ describe('RecorderLocalTestAudioAPI', function () {
function sleep(time) { function sleep(time) {
for(let t = Date.now();Date.now() - t <= time;); for(let t = Date.now();Date.now() - t <= time;);
}; }
function initAudioRecorder() { function initAudioRecorder() {
if (typeof (audioRecorder) != 'undefined') { if (typeof (audioRecorder) != 'undefined') {
...@@ -153,7 +157,8 @@ describe('RecorderLocalTestAudioAPI', function () { ...@@ -153,7 +157,8 @@ describe('RecorderLocalTestAudioAPI', function () {
}); });
} }
beforeAll(function () { beforeAll(async function () {
await getFd('testAPI.m4a');
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -165,10 +170,43 @@ describe('RecorderLocalTestAudioAPI', function () { ...@@ -165,10 +170,43 @@ describe('RecorderLocalTestAudioAPI', function () {
console.info('afterEach case'); console.info('afterEach case');
}) })
afterAll(function () { afterAll(async function () {
await closeFd();
console.info('afterAll case'); console.info('afterAll case');
}) })
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
/* * /* *
* @tc.number : SUB_MEDIA_RECORDER_createAudioRecorder_API_0100 * @tc.number : SUB_MEDIA_RECORDER_createAudioRecorder_API_0100
* @tc.name : Create an AudioRecoder Object by function of createAudioRecorder * @tc.name : Create an AudioRecoder Object by function of createAudioRecorder
...@@ -178,6 +216,7 @@ describe('RecorderLocalTestAudioAPI', function () { ...@@ -178,6 +216,7 @@ describe('RecorderLocalTestAudioAPI', function () {
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MEDIA_RECORDER_createAudioRecorder_API_0100', 0, async function (done) { it('SUB_MEDIA_RECORDER_createAudioRecorder_API_0100', 0, async function (done) {
audioConfig.uri = fdPath;
let testAudioRecorder; let testAudioRecorder;
expect(testAudioRecorder).assertNull(); expect(testAudioRecorder).assertNull();
testAudioRecorder= media.createAudioRecorder(); testAudioRecorder= media.createAudioRecorder();
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
*/ */
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('RecorderLocalTestAudioFUNC', function () { describe('RecorderLocalTestAudioFUNC', function () {
...@@ -35,6 +38,9 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -35,6 +38,9 @@ describe('RecorderLocalTestAudioFUNC', function () {
const FORMAT_M4A = 6; const FORMAT_M4A = 6;
const SOURCE_TYPE = 1; const SOURCE_TYPE = 1;
const ENCORDER_AACLC = 3; const ENCORDER_AACLC = 3;
let fdPath;
let fileAsset;
let fdNumber;
let audioConfig = { let audioConfig = {
audioSourceType : SOURCE_TYPE, audioSourceType : SOURCE_TYPE,
audioEncoder : ENCORDER_AACLC, audioEncoder : ENCORDER_AACLC,
...@@ -58,7 +64,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -58,7 +64,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioRecorder = media.createAudioRecorder(); audioRecorder = media.createAudioRecorder();
} }
beforeAll(function () { beforeAll(async function () {
await applyPermission();
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -66,7 +73,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -66,7 +73,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
console.info('beforeEach case'); console.info('beforeEach case');
}) })
afterEach(function () { afterEach(async function () {
await closeFd();
console.info('afterEach case'); console.info('afterEach case');
}) })
...@@ -74,6 +82,73 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -74,6 +82,73 @@ describe('RecorderLocalTestAudioFUNC', function () {
console.info('afterAll case'); console.info('afterAll case');
}) })
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiorecorder', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
function nextStep(mySteps,done) { function nextStep(mySteps,done) {
if (mySteps[0] == END_STATE) { if (mySteps[0] == END_STATE) {
done(); done();
...@@ -181,7 +256,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -181,7 +256,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0100', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0100', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test1.m4a'; await getFd('test1.m4a');
audioConfig.uri = fdPath;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done); setCallback(mySteps, done);
...@@ -197,7 +273,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -197,7 +273,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0210', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0210', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test2.m4a'; await getFd('test2.m4a');
audioConfig.uri = fdPath;
audioConfig.numberOfChannels = CHANNEL_ONE; audioConfig.numberOfChannels = CHANNEL_ONE;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
...@@ -214,7 +291,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -214,7 +291,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0220', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0220', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test3.m4a'; await getFd('test3.m4a');
audioConfig.uri = fdPath;
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
...@@ -231,7 +309,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -231,7 +309,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0310', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0310', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test4.m4a'; await getFd('test4.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 8000; // samplerate 8000 audioConfig.audioSampleRate = 8000; // samplerate 8000
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
initAudioRecorder(); initAudioRecorder();
...@@ -249,7 +328,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -249,7 +328,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0320', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0320', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test5.mp4'; await getFd('test5.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 32000; // samplerate 32000 audioConfig.audioSampleRate = 32000; // samplerate 32000
audioConfig.numberOfChannels = CHANNEL_ONE; audioConfig.numberOfChannels = CHANNEL_ONE;
audioConfig.fileFormat = FORMAT_MP4; audioConfig.fileFormat = FORMAT_MP4;
...@@ -268,7 +348,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -268,7 +348,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0330', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0330', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test6.mp4'; await getFd('test6.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 44100; // samplerate 44100 audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_MP4; audioConfig.fileFormat = FORMAT_MP4;
...@@ -287,7 +368,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -287,7 +368,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0340', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0340', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test7.m4a'; await getFd('test7.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 64000; // samplerate 64000 audioConfig.audioSampleRate = 64000; // samplerate 64000
audioConfig.numberOfChannels = CHANNEL_ONE; audioConfig.numberOfChannels = CHANNEL_ONE;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
...@@ -306,7 +388,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -306,7 +388,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0340', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0340', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test8.m4a'; await getFd('test8.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 96000; // samplerate 96000 audioConfig.audioSampleRate = 96000; // samplerate 96000
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
...@@ -325,7 +408,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -325,7 +408,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0410', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0410', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test9.mp4'; await getFd('test9.mp4');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 22050; // samplerate 22050 audioConfig.audioSampleRate = 22050; // samplerate 22050
audioConfig.audioEncodeBitRate = 8000; // encodeBitrate 8000 audioConfig.audioEncodeBitRate = 8000; // encodeBitrate 8000
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
...@@ -345,7 +429,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -345,7 +429,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0420', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0420', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test10.mp4'; await getFd('test10.mp4');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 44100; // samplerate 44100 audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 16000; // encodeBitrate 16000 audioConfig.audioEncodeBitRate = 16000; // encodeBitrate 16000
audioConfig.numberOfChannels = CHANNEL_ONE; audioConfig.numberOfChannels = CHANNEL_ONE;
...@@ -365,7 +450,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -365,7 +450,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0430', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0430', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test11.m4a'; await getFd('test11.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 44100; // samplerate 44100 audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 32000; // encodeBitrate 32000 audioConfig.audioEncodeBitRate = 32000; // encodeBitrate 32000
audioConfig.numberOfChannels = CHANNEL_ONE; audioConfig.numberOfChannels = CHANNEL_ONE;
...@@ -385,7 +471,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -385,7 +471,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0440', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0440', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test12.m4a'; await getFd('test12.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 44100; // samplerate 44100 audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 64000; // encodeBitrate 64000 audioConfig.audioEncodeBitRate = 64000; // encodeBitrate 64000
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
...@@ -405,7 +492,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -405,7 +492,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_CODEC_AAC_0450', 0, async function (done) { it('SUB_MEDIA_RECORDER_CODEC_AAC_0450', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test13.m4a'; await getFd('test13.m4a');
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 44100; // samplerate 44100 audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 112000; // encodeBitrate 112000 audioConfig.audioEncodeBitRate = 112000; // encodeBitrate 112000
audioConfig.numberOfChannels = CHANNEL_TWO; audioConfig.numberOfChannels = CHANNEL_TWO;
...@@ -425,7 +513,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -425,7 +513,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_FORMAT_MP4_0200', 0, async function (done) { it('SUB_MEDIA_RECORDER_FORMAT_MP4_0200', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test14.mp4'; await getFd('test14.mp4');
audioConfig.uri = fdPath;
audioConfig.audioEncodeBitRate = 22050; // samplerate 22050 audioConfig.audioEncodeBitRate = 22050; // samplerate 22050
audioConfig.audioSampleRate = 22050; // encodeBitrate 22050 audioConfig.audioSampleRate = 22050; // encodeBitrate 22050
audioConfig.fileFormat = FORMAT_MP4; audioConfig.fileFormat = FORMAT_MP4;
...@@ -445,7 +534,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -445,7 +534,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_FORMAT_MP4_0200', 0, async function (done) { it('SUB_MEDIA_RECORDER_FORMAT_MP4_0200', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test15.m4a'; await getFd('test15.m4a');
audioConfig.uri = fdPath;
audioConfig.audioEncodeBitRate = 22050; // samplerate 22050 audioConfig.audioEncodeBitRate = 22050; // samplerate 22050
audioConfig.audioSampleRate = 22050; // encodeBitrate 22050 audioConfig.audioSampleRate = 22050; // encodeBitrate 22050
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
...@@ -465,7 +555,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -465,7 +555,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0100', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0100', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test16.m4a'; await getFd('test16.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
...@@ -482,7 +573,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -482,7 +573,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0200', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0200', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test17.m4a'; await getFd('test17.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
...@@ -499,7 +591,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -499,7 +591,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0300', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0300', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test18.m4a'; await getFd('test18.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE,
...@@ -517,7 +610,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -517,7 +610,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0500', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0500', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test19.m4a'; await getFd('test19.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RELEASE_STATE, END_STATE); let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
...@@ -534,7 +628,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -534,7 +628,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0600', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0600', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test20.m4a'; await getFd('test20.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PAUSE_STATE, let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PAUSE_STATE,
...@@ -552,7 +647,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -552,7 +647,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0700', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0700', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test21.m4a'; await getFd('test21.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE, let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE,
...@@ -570,7 +666,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -570,7 +666,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0800', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0800', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test22.m4a'; await getFd('test22.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, STOP_STATE, let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, STOP_STATE,
...@@ -588,7 +685,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -588,7 +685,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0900', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0900', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test23.m4a'; await getFd('test23.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE, let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE,
...@@ -606,7 +704,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -606,7 +704,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1000', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1000', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test24.m4a'; await getFd('test24.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A; audioConfig.fileFormat = FORMAT_M4A;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE, let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE,
...@@ -624,7 +723,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -624,7 +723,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1100', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1100', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test25.mp4'; await getFd('test25.mp4');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_MP4; audioConfig.fileFormat = FORMAT_MP4;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE,
...@@ -642,7 +742,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -642,7 +742,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1200', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1200', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test26.mp4'; await getFd('test26.mp4');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_MP4; audioConfig.fileFormat = FORMAT_MP4;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, START_STATE, ERROR_STATE, let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, START_STATE, ERROR_STATE,
...@@ -660,7 +761,8 @@ describe('RecorderLocalTestAudioFUNC', function () { ...@@ -660,7 +761,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1300', 0, async function (done) { it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1300', 0, async function (done) {
audioConfig.uri = BASIC_PATH + 'test27.mp4'; await getFd('test27.mp4');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_MP4; audioConfig.fileFormat = FORMAT_MP4;
initAudioRecorder(); initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE, let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE,
......
...@@ -49,6 +49,36 @@ ...@@ -49,6 +49,36 @@
"tv", "tv",
"wearable" "wearable"
], ],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_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"
}
],
"mainAbility": "ohos.acts.multimedia.video.videorecorder.MainAbility", "mainAbility": "ohos.acts.multimedia.video.videorecorder.MainAbility",
"distro": { "distro": {
"moduleType": "entry", "moduleType": "entry",
......
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./VideoRecorderFuncPromiseTest.test.js')
require('./VideoRecorderFuncCallbackTest.test.js') require('./VideoRecorderFuncCallbackTest.test.js')
require('./VideoRecorderFuncPromiseTest.test.js')
require('./VideoRecorderAPICallbackTest.test.js') require('./VideoRecorderAPICallbackTest.test.js')
\ No newline at end of file
...@@ -19,8 +19,8 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary' ...@@ -19,8 +19,8 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoRecorderAPICallbackTest', function () { describe('VideoRecorderAPICallbackTest', function () {
const RECORDER_TIME = 2000; const RECORDER_TIME = 3000;
const PAUSE_TIME = 2000; const PAUSE_TIME = 1000;
const END_EVENT = 'end'; const END_EVENT = 'end';
const CREATE_EVENT = 'create'; const CREATE_EVENT = 'create';
const PREPARE_EVENT = 'prepare'; const PREPARE_EVENT = 'prepare';
...@@ -43,7 +43,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -43,7 +43,7 @@ describe('VideoRecorderAPICallbackTest', function () {
let captureSession; let captureSession;
let videoOutput; let videoOutput;
let surfaceID; let surfaceID;
let fdPath;
let events = require('events'); let events = require('events');
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
...@@ -96,7 +96,9 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -96,7 +96,9 @@ describe('VideoRecorderAPICallbackTest', function () {
for(let t = Date.now();Date.now() - t <= time;); for(let t = Date.now();Date.now() - t <= time;);
} }
beforeAll(function () { beforeAll(async function () {
await initCamera();
await getFd('API.mp4');
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -109,10 +111,43 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -109,10 +111,43 @@ describe('VideoRecorderAPICallbackTest', function () {
console.info('afterEach case'); console.info('afterEach case');
}) })
afterAll(function () { afterAll(async function () {
await closeFd();
console.info('afterAll case'); console.info('afterAll case');
}) })
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
let fileAsset = await fetchFileResult.getAllObject();
let fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
async function initCamera() { async function initCamera() {
cameraManager = await camera.getCameraManager(null); cameraManager = await camera.getCameraManager(null);
if (cameraManager != null) { if (cameraManager != null) {
...@@ -386,7 +421,7 @@ describe('VideoRecorderAPICallbackTest', function () { ...@@ -386,7 +421,7 @@ describe('VideoRecorderAPICallbackTest', function () {
* @tc.level : Level2 * @tc.level : Level2
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_PREPARE_CALLBACK_0100', 0, async function (done) {
await initCamera(); videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
......
...@@ -16,9 +16,11 @@ ...@@ -16,9 +16,11 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import camera from '@ohos.multimedia.camera' import camera from '@ohos.multimedia.camera'
import mediaLibrary from '@ohos.multimedia.mediaLibrary' import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('RecorderLocalTestVideoFUNC', function () { describe('VideoRecorderFuncCallbackTest', function () {
const RECORDER_TIME = 3000; const RECORDER_TIME = 3000;
const PAUSE_TIME = 1000; const PAUSE_TIME = 1000;
const END_EVENT = 'end'; const END_EVENT = 'end';
...@@ -37,6 +39,9 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -37,6 +39,9 @@ describe('RecorderLocalTestVideoFUNC', function () {
let captureSession; let captureSession;
let videoOutput; let videoOutput;
let surfaceID; let surfaceID;
let fdPath;
let fileAsset;
let fdNumber;
let configFile = { let configFile = {
audioBitrate : 48000, audioBitrate : 48000,
audioChannels : 2, audioChannels : 2,
...@@ -86,7 +91,9 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -86,7 +91,9 @@ describe('RecorderLocalTestVideoFUNC', function () {
for(let t = Date.now();Date.now() - t <= time;); for(let t = Date.now();Date.now() - t <= time;);
} }
beforeAll(function () { beforeAll(async function () {
await initCamera();
await applyPermission();
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -94,7 +101,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -94,7 +101,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
console.info('beforeEach case'); console.info('beforeEach case');
}) })
afterEach(function () { afterEach(async function () {
await closeFd();
console.info('afterEach case'); console.info('afterEach case');
}) })
...@@ -102,6 +110,79 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -102,6 +110,79 @@ describe('RecorderLocalTestVideoFUNC', function () {
console.info('afterAll case'); console.info('afterAll case');
}) })
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.video.videorecorder', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections : fileKeyObj.ID + "=?",
selectionArgs : [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
async function initCamera() { async function initCamera() {
cameraManager = await camera.getCameraManager(null); cameraManager = await camera.getCameraManager(null);
if (cameraManager != null) { if (cameraManager != null) {
...@@ -304,7 +385,15 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -304,7 +385,15 @@ describe('RecorderLocalTestVideoFUNC', function () {
eventEmitter.on(RELEASE_EVENT, async (videoRecorder, steps, done) => { eventEmitter.on(RELEASE_EVENT, async (videoRecorder, steps, done) => {
steps.shift(); steps.shift();
videoRecorder.release((err) => { videoRecorder.release(async (err) => {
await videoOutput.stop().then(() => {
console.info('case videoOutput stop success');
});
await videoOutput.release().then(() => {
console.info('case videoOutput release success');
});
videoOutput = undefined;
await stopCaptureSession();
if (typeof (err) == 'undefined') { if (typeof (err) == 'undefined') {
expect(videoRecorder.state).assertEqual('idle'); expect(videoRecorder.state).assertEqual('idle');
console.info('case release success'); console.info('case release success');
...@@ -313,14 +402,6 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -313,14 +402,6 @@ describe('RecorderLocalTestVideoFUNC', function () {
printfError(err, done); printfError(err, done);
} }
}); });
await videoOutput.stop().then(() => {
console.info('case videoOutput stop success');
});
await videoOutput.release().then(() => {
console.info('case videoOutput release success');
});
videoOutput = undefined;
await stopCaptureSession();
}); });
/* * /* *
...@@ -332,8 +413,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -332,8 +413,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0100', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0100', 0, async function (done) {
await initCamera(); await getFd('19.mp4');
videoConfig.url = 'file:///data/media/19.mp4'; videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done); eventEmitter.emit(mySteps[0], videoRecorder, mySteps, done);
...@@ -348,7 +429,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -348,7 +429,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0200', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0200', 0, async function (done) {
videoConfig.url = 'file:///data/media/20.mp4'; await getFd('20.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RELEASE_EVENT, END_EVENT); PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -364,7 +446,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -364,7 +446,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0300', 0, async function (done) {
videoConfig.url = 'file:///data/media/21.mp4'; await getFd('21.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, END_EVENT); PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -380,7 +463,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -380,7 +463,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0400', 0, async function (done) {
videoConfig.url = 'file:///data/media/22.mp4'; await getFd('22.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -396,7 +480,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -396,7 +480,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0500', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0500', 0, async function (done) {
videoConfig.url = 'file:///data/media/23.mp4'; await getFd('23.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
RESET_EVENT, RELEASE_EVENT, END_EVENT); RESET_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -412,7 +497,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -412,7 +497,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0600', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0600', 0, async function (done) {
videoConfig.url = 'file:///data/media/24.mp4'; await getFd('24.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -428,7 +514,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -428,7 +514,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0700', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0700', 0, async function (done) {
videoConfig.url = 'file:///data/media/25.mp4'; await getFd('25.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESET_EVENT, RELEASE_EVENT, END_EVENT); RESET_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -444,7 +531,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -444,7 +531,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0800', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0800', 0, async function (done) {
videoConfig.url = 'file:///data/media/26.mp4'; await getFd('26.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT); RESUME_EVENT, STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -460,7 +548,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -460,7 +548,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0900', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0900', 0, async function (done) {
videoConfig.url = 'file:///data/media/27.mp4'; await getFd('27.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, PAUSE_EVENT,
RESUME_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT); RESUME_EVENT, RESET_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -480,7 +569,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -480,7 +569,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
configFile.audioBitrate = 8000; configFile.audioBitrate = 8000;
configFile.audioSampleRate = 8000; configFile.audioSampleRate = 8000;
configFile.videoBitrate = 8000; configFile.videoBitrate = 8000;
videoConfig.url = 'file:///data/media/28.mp4'; await getFd('28.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -500,7 +590,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -500,7 +590,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
configFile.audioBitrate = 16000; configFile.audioBitrate = 16000;
configFile.audioSampleRate = 32000; configFile.audioSampleRate = 32000;
configFile.videoBitrate = 16000; configFile.videoBitrate = 16000;
videoConfig.url = 'file:///data/media/29.mp4'; await getFd('29.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -520,7 +611,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -520,7 +611,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
configFile.audioBitrate = 32000; configFile.audioBitrate = 32000;
configFile.audioSampleRate = 44100; configFile.audioSampleRate = 44100;
configFile.videoBitrate = 32000; configFile.videoBitrate = 32000;
videoConfig.url = 'file:///data/media/30.mp4'; await getFd('30.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -540,7 +632,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -540,7 +632,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
configFile.audioBitrate = 112000; configFile.audioBitrate = 112000;
configFile.audioSampleRate = 96000; configFile.audioSampleRate = 96000;
configFile.videoBitrate = 112000; configFile.videoBitrate = 112000;
videoConfig.url = 'file:///data/media/31.mp4'; await getFd('31.mp4');
videoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -556,7 +649,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -556,7 +649,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1400', 0, async function (done) {
onlyVideoConfig.url = 'file:///data/media/32.mp4'; await getFd('32.mp4');
onlyVideoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT,
START_EVENT, RELEASE_EVENT, END_EVENT); START_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -572,7 +666,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -572,7 +666,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1500', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1500', 0, async function (done) {
onlyVideoConfig.url = 'file:///data/media/33.mp4'; await getFd('33.mp4');
onlyVideoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RELEASE_EVENT, END_EVENT); PAUSE_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -588,7 +683,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -588,7 +683,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1600', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1600', 0, async function (done) {
onlyVideoConfig.url = 'file:///data/media/34.mp4'; await getFd('34.mp4');
onlyVideoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, END_EVENT); PAUSE_EVENT, RESUME_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -604,7 +700,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -604,7 +700,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1700', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1700', 0, async function (done) {
onlyVideoConfig.url = 'file:///data/media/35.mp4'; await getFd('35.mp4');
onlyVideoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
STOP_EVENT, RELEASE_EVENT, END_EVENT); STOP_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -620,7 +717,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -620,7 +717,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1800', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1800', 0, async function (done) {
onlyVideoConfig.url = 'file:///data/media/36.mp4'; await getFd('36.mp4');
onlyVideoConfig.url = fdPath;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_OLNYVIDEO_EVENT, GETSURFACE_EVENT, START_EVENT,
RESET_EVENT, RELEASE_EVENT, END_EVENT); RESET_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -636,7 +734,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -636,7 +734,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level1 * @tc.level : Level1
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1900', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_1900', 0, async function (done) {
videoConfig.url = 'file:///data/media/37.mp4'; await getFd('37.mp4');
onlyVideoConfig.url = fdPath;
videoConfig.orientationHint = 90; videoConfig.orientationHint = 90;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT,
...@@ -653,7 +752,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -653,7 +752,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level1 * @tc.level : Level1
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2000', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2000', 0, async function (done) {
videoConfig.url = 'file:///data/media/38.mp4'; await getFd('38.mp4');
videoConfig.url = fdPath;
videoConfig.orientationHint = 180; videoConfig.orientationHint = 180;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -669,7 +769,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -669,7 +769,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level1 * @tc.level : Level1
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2100', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2100', 0, async function (done) {
videoConfig.url = 'file:///data/media/39.mp4'; await getFd('39.mp4');
videoConfig.url = fdPath;
videoConfig.orientationHint = 270; videoConfig.orientationHint = 270;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -685,7 +786,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -685,7 +786,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level1 * @tc.level : Level1
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2200', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2200', 0, async function (done) {
videoConfig.url = 'file:///data/media/46.mp4'; await getFd('46.mp4');
videoConfig.url = fdPath;
videoConfig.videoFrameRate = 20; videoConfig.videoFrameRate = 20;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -701,7 +803,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -701,7 +803,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level1 * @tc.level : Level1
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2300', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2300', 0, async function (done) {
videoConfig.url = 'file:///data/media/47.mp4'; await getFd('47.mp4');
videoConfig.url = fdPath;
videoConfig.videoFrameRate = 30; videoConfig.videoFrameRate = 30;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
...@@ -717,7 +820,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -717,7 +820,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level1 * @tc.level : Level1
*/ */
it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2400', 0, async function (done) { it('SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_2400', 0, async function (done) {
videoConfig.url = 'file:///data/media/48.mp4'; await getFd('48.mp4');
videoConfig.url = fdPath;
videoConfig.videoFrameRate = 60; videoConfig.videoFrameRate = 60;
let videoRecorder = null; let videoRecorder = null;
let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT); let mySteps = new Array(CREATE_EVENT, PREPARE_EVENT, GETSURFACE_EVENT, START_EVENT, RELEASE_EVENT, END_EVENT);
......
...@@ -18,13 +18,13 @@ import camera from '@ohos.multimedia.camera' ...@@ -18,13 +18,13 @@ import camera from '@ohos.multimedia.camera'
import mediaLibrary from '@ohos.multimedia.mediaLibrary' import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('RecorderLocalTestVideoFUNC', function () { describe('VideoRecorderFuncPromiseTest', function () {
const RECORDER_TIME = 3000; const RECORDER_TIME = 3000;
const PAUSE_TIME = 1000; const PAUSE_TIME = 1000;
let cameraManager; let cameraManager;
let cameras; let cameras;
let captureSession; let captureSession;
let testFdNumber; let fdPath;
let configFile = { let configFile = {
audioBitrate : 48000, audioBitrate : 48000,
audioChannels : 2, audioChannels : 2,
...@@ -74,7 +74,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -74,7 +74,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
for(let t = Date.now();Date.now() - t <= time;); for(let t = Date.now();Date.now() - t <= time;);
} }
beforeAll(function () { beforeAll(async function () {
await initCamera();
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -82,7 +83,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -82,7 +83,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
console.info('beforeEach case'); console.info('beforeEach case');
}) })
afterEach(function () { afterEach(async function () {
await closeFd();
console.info('afterEach case'); console.info('afterEach case');
}) })
...@@ -147,25 +149,35 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -147,25 +149,35 @@ describe('RecorderLocalTestVideoFUNC', function () {
await stopCaptureSession(); await stopCaptureSession();
} }
async function getFd(pathName) {
async function getFd() { let displayName = pathName;
let displayName = 'VID_202202081551.mp4'; const mediaTest = mediaLibrary.getMediaLibrary();
const medialib = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey; let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO; let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await medialib.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await medialib.createAsset(mediaType, displayName, publicPath); let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) { if (dataUri != undefined) {
let args = dataUri.id.toString(); let args = dataUri.id.toString();
let fetchOp = { let fetchOp = {
selections : fileKeyObj.ID + "=?", selections : fileKeyObj.ID + "=?",
selectionArgs : [args], selectionArgs : [args],
} }
let fetchFileResult = await medialib.getFileAssets(fetchOp); let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
let fileAsset = await fetchFileResult.getAllObject(); let fileAsset = await fetchFileResult.getAllObject();
let fdNumber = await fileAsset[0].open('Rw'); let fdNumber = await fileAsset[0].open('Rw');
fdNumber = "fd://" + fdNumber.toString(); fdPath = "fd://" + fdNumber.toString();
testFdNumber = fdNumber; }
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
} }
} }
...@@ -191,8 +203,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -191,8 +203,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
await initCamera(); await getFd('01.mp4');
videoConfig.url = 'file:///data/media/01.mp4'; videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -241,7 +253,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -241,7 +253,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/02.mp4'; await getFd('02.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -297,7 +310,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -297,7 +310,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/03.mp4'; await getFd('03.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -361,7 +375,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -361,7 +375,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/04.mp4'; await getFd('04.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -416,7 +431,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -416,7 +431,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/05.mp4'; await getFd('05.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -470,7 +486,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -470,7 +486,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/06.mp4'; await getFd('06.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -531,7 +548,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -531,7 +548,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/07.mp4'; await getFd('07.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -592,7 +610,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -592,7 +610,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/08.mp4'; await getFd('08.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -661,7 +680,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -661,7 +680,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/09.mp4'; await getFd('09.mp4');
videoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -730,7 +750,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -730,7 +750,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/10.mp4'; await getFd('10.mp4');
videoConfig.url = fdPath;
configFile.audioBitrate = 8000; configFile.audioBitrate = 8000;
configFile.audioSampleRate = 8000; configFile.audioSampleRate = 8000;
configFile.videoBitrate = 8000; configFile.videoBitrate = 8000;
...@@ -789,7 +810,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -789,7 +810,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/11.mp4'; await getFd('11.mp4');
videoConfig.url = fdPath;
configFile.audioBitrate = 16000; configFile.audioBitrate = 16000;
configFile.audioSampleRate = 32000; configFile.audioSampleRate = 32000;
configFile.videoBitrate = 16000; configFile.videoBitrate = 16000;
...@@ -848,7 +870,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -848,7 +870,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/12.mp4'; await getFd('12.mp4');
videoConfig.url = fdPath;
configFile.audioBitrate = 32000; configFile.audioBitrate = 32000;
configFile.audioSampleRate = 44100; configFile.audioSampleRate = 44100;
configFile.videoBitrate = 32000; configFile.videoBitrate = 32000;
...@@ -907,7 +930,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -907,7 +930,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/13.mp4'; await getFd('13.mp4');
videoConfig.url = fdPath;
configFile.audioBitrate = 112000; configFile.audioBitrate = 112000;
configFile.audioSampleRate = 96000; configFile.audioSampleRate = 96000;
configFile.videoBitrate = 112000; configFile.videoBitrate = 112000;
...@@ -965,7 +989,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -965,7 +989,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
onlyVideoConfig.url = 'file:///data/media/14.mp4'; await getFd('14.mp4');
onlyVideoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1013,7 +1038,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1013,7 +1038,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
onlyVideoConfig.url = 'file:///data/media/15.mp4'; await getFd('15.mp4');
onlyVideoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1070,7 +1096,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1070,7 +1096,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
onlyVideoConfig.url = 'file:///data/media/16.mp4'; await getFd('16.mp4');
onlyVideoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1133,7 +1160,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1133,7 +1160,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
onlyVideoConfig.url = 'file:///data/media/17.mp4'; await getFd('17.mp4');
onlyVideoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1187,7 +1215,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1187,7 +1215,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
onlyVideoConfig.url = 'file:///data/media/18.mp4'; await getFd('18.mp4');
onlyVideoConfig.url = fdPath;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
if (typeof (recorder) != 'undefined') { if (typeof (recorder) != 'undefined') {
...@@ -1241,7 +1270,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1241,7 +1270,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/40.mp4'; await getFd('40.mp4');
videoConfig.url = fdPath;
videoConfig.orientationHint = 90; videoConfig.orientationHint = 90;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
...@@ -1289,7 +1319,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1289,7 +1319,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/41.mp4'; await getFd('41.mp4');
videoConfig.url = fdPath;
videoConfig.orientationHint = 180; videoConfig.orientationHint = 180;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
...@@ -1337,7 +1368,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1337,7 +1368,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/42.mp4'; await getFd('42.mp4');
videoConfig.url = fdPath;
videoConfig.orientationHint = 270; videoConfig.orientationHint = 270;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
...@@ -1385,7 +1417,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1385,7 +1417,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/43.mp4'; await getFd('43.mp4');
videoConfig.url = fdPath;
videoConfig.videoFrameRate = 20; videoConfig.videoFrameRate = 20;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
...@@ -1433,7 +1466,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1433,7 +1466,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/44.mp4'; await getFd('44.mp4');
videoConfig.url = fdPath;
videoConfig.videoFrameRate = 30; videoConfig.videoFrameRate = 30;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
...@@ -1481,7 +1515,8 @@ describe('RecorderLocalTestVideoFUNC', function () { ...@@ -1481,7 +1515,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
let videoRecorder = undefined; let videoRecorder = undefined;
let surfaceID = ''; let surfaceID = '';
let videoOutput; let videoOutput;
videoConfig.url = 'file:///data/media/45.mp4'; await getFd('45.mp4');
videoConfig.url = fdPath;
videoConfig.videoFrameRate = 60; videoConfig.videoFrameRate = 60;
await media.createVideoRecorder().then((recorder) => { await media.createVideoRecorder().then((recorder) => {
console.info('case createVideoRecorder called'); console.info('case createVideoRecorder called');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册