提交 4d559dad 编写于 作者: F fulizhong

modify videoPlayer and audioPlayer testcases Signed-off-by: FULIZHONG<fulizhong1@huawei.com>

Signed-off-by: Nfulizhong <fulizhong@huawei.com>
上级 a7490811
...@@ -19,30 +19,30 @@ ...@@ -19,30 +19,30 @@
"pre-push": [ "pre-push": [
], ],
"push": [ "push": [
"./resource/audio/01.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/01.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/02.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/02.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/03.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/03.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/04.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/04.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/47.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/47.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/49.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/49.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/50.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/50.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/51.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/51.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/54.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/54.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/55.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/55.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/57.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/57.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/58.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/58.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/59.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/59.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/62.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/62.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/64.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/64.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/65.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/65.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/66.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/66.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/67.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/67.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/92.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/92.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/93.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/93.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/94.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/94.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/96.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/96.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/97.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", "./resource/audio/97.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/",
"./resource/audio/98.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/" "./resource/audio/98.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/"
] ]
}, },
{ {
......
/*
* 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
...@@ -15,13 +15,14 @@ ...@@ -15,13 +15,14 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import fileIO from '@ohos.fileio' import fileIO from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('PlayerLocalTestAudioAPI', function () { describe('PlayerLocalTestAudioAPI', function () {
let audioPlayer = media.createAudioPlayer(); let audioPlayer = media.createAudioPlayer();
let loopValue = false; let loopValue = false;
let isTimeOut = false; let isTimeOut = false;
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/01.mp3'; const AUDIO_SOURCE = '01.mp3';
const PLAY_TIME = 3000; const PLAY_TIME = 3000;
const END_STATE = 0; const END_STATE = 0;
const SRC_STATE = 1; const SRC_STATE = 1;
...@@ -39,11 +40,11 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -39,11 +40,11 @@ describe('PlayerLocalTestAudioAPI', function () {
const SEEK_TIME = 5000; const SEEK_TIME = 5000;
const DELTA_TIME = 1000; const DELTA_TIME = 1000;
const SECOND_INDEX = 1; const SECOND_INDEX = 1;
const TIME_OUT = 20000;
const VOLUME_VALUE = 0.5; const VOLUME_VALUE = 0.5;
let fdPath; let fdPath;
let fdValue; let fdValue;
let context = featureAbility.getContext();
let audioPath = '';
beforeAll(async function() { beforeAll(async function() {
await getFd(); await getFd();
console.info('beforeAll case'); console.info('beforeAll case');
...@@ -68,8 +69,13 @@ describe('PlayerLocalTestAudioAPI', function () { ...@@ -68,8 +69,13 @@ describe('PlayerLocalTestAudioAPI', function () {
} }
async function getFd() { async function getFd() {
await context.getFilesDir().then((data) => {
console.info("case file path is" + JSON.stringify(data));
audioPath = data + '/' + AUDIO_SOURCE;
console.info("case audioPath is" + audioPath);
});
fdPath = 'fd://'; fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { await fileIO.open(audioPath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber; fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber; fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath); console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
......
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import fileIO from '@ohos.fileio' import fileIO from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('PlayerLocalTestAudioFUNC', function () { describe('PlayerLocalTestAudioFUNC', function () {
let audioPlayer = media.createAudioPlayer(); let audioPlayer = media.createAudioPlayer();
let isTimeOut = false; let isTimeOut = false;
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/01.mp3'; const AUDIO_SOURCE = '01.mp3';
const PLAY_TIME = 3000; const PLAY_TIME = 3000;
const DURATION_TIME = 219600; const DURATION_TIME = 219600;
const SEEK_TIME = 5000; const SEEK_TIME = 5000;
...@@ -43,7 +44,8 @@ describe('PlayerLocalTestAudioFUNC', function () { ...@@ -43,7 +44,8 @@ describe('PlayerLocalTestAudioFUNC', function () {
const MAX_VOLUME = 1; const MAX_VOLUME = 1;
let fdPath; let fdPath;
let fdValue; let fdValue;
let context = featureAbility.getContext();
let audioPath = '';
beforeAll(async function() { beforeAll(async function() {
await getFd(); await getFd();
console.info('beforeAll case'); console.info('beforeAll case');
...@@ -68,8 +70,13 @@ describe('PlayerLocalTestAudioFUNC', function () { ...@@ -68,8 +70,13 @@ describe('PlayerLocalTestAudioFUNC', function () {
} }
async function getFd() { async function getFd() {
await context.getFilesDir().then((data) => {
console.info("case file path is" + JSON.stringify(data));
audioPath = data + '/' + AUDIO_SOURCE;
console.info("case audioPath is" + audioPath);
});
fdPath = 'fd://'; fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { await fileIO.open(audioPath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber; fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber; fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath); console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import fileIO from '@ohos.fileio' import fileIO from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('PlayerLocalTestAudioFormat', function () { describe('PlayerLocalTestAudioFormat', function () {
const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/';
const MAX_VOLUME = 1; const MAX_VOLUME = 1;
const PLAY_TIME = 3000; const PLAY_TIME = 3000;
const SEEK_TIME = 10000; // 10s const SEEK_TIME = 10000; // 10s
...@@ -26,7 +26,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -26,7 +26,7 @@ describe('PlayerLocalTestAudioFormat', function () {
let isToDuration = false; let isToDuration = false;
let fdPath; let fdPath;
let fdValue; let fdValue;
let context = featureAbility.getContext();
beforeAll(function() { beforeAll(function() {
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -51,8 +51,14 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -51,8 +51,14 @@ describe('PlayerLocalTestAudioFormat', function () {
} }
async function getFd(pathName) { async function getFd(pathName) {
let audioPath = '';
await context.getFilesDir().then((data) => {
console.info("case file path is" + JSON.stringify(data));
audioPath = data + '/' + pathName;
console.info("case audioPath is" + audioPath);
});
fdPath = 'fd://'; fdPath = 'fd://';
await fileIO.open(pathName).then((fdNumber) => { await fileIO.open(audioPath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber; fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber; fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath); console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
...@@ -151,7 +157,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -151,7 +157,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0100', 0, async function (done) {
playSource(BASIC_PATH + '01.mp3', done); playSource('01.mp3', done);
}) })
/* * /* *
...@@ -167,7 +173,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -167,7 +173,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0200', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0200', 0, async function (done) {
playSource(BASIC_PATH + '02.mp3', done); playSource('02.mp3', done);
}) })
/* * /* *
...@@ -183,7 +189,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -183,7 +189,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0300', 0, async function (done) {
playSource(BASIC_PATH + '03.mp3', done); playSource('03.mp3', done);
}) })
/* * /* *
...@@ -199,7 +205,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -199,7 +205,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0400', 0, async function (done) {
playSource(BASIC_PATH + '04.mp3', done); playSource('04.mp3', done);
}) })
/* * /* *
...@@ -215,7 +221,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -215,7 +221,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0100', 0, async function (done) {
playSource(BASIC_PATH + '47.mp4', done); playSource('47.mp4', done);
}) })
...@@ -232,7 +238,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -232,7 +238,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0300', 0, async function (done) {
playSource(BASIC_PATH + '49.mp4', done); playSource('49.mp4', done);
}) })
/* * /* *
...@@ -248,7 +254,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -248,7 +254,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0400', 0, async function (done) {
playSource(BASIC_PATH + '50.mp4', done); playSource('50.mp4', done);
}) })
/* * /* *
...@@ -264,7 +270,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -264,7 +270,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0500', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0500', 0, async function (done) {
playSource(BASIC_PATH + '51.mp4', done); playSource('51.mp4', done);
}) })
/* * /* *
...@@ -280,7 +286,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -280,7 +286,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0600', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0600', 0, async function (done) {
playSource(BASIC_PATH + '54.mp4', done); playSource('54.mp4', done);
}) })
/* * /* *
...@@ -296,7 +302,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -296,7 +302,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0700', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0700', 0, async function (done) {
playSource(BASIC_PATH + '64.mp4', done); playSource('64.mp4', done);
}) })
/* * /* *
...@@ -312,7 +318,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -312,7 +318,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0800', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0800', 0, async function (done) {
playSource(BASIC_PATH + '65.mp4', done); playSource('65.mp4', done);
}) })
/* * /* *
...@@ -328,7 +334,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -328,7 +334,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0900', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0900', 0, async function (done) {
playSource(BASIC_PATH + '66.mp4', done); playSource('66.mp4', done);
}) })
/* * /* *
...@@ -344,7 +350,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -344,7 +350,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1000', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1000', 0, async function (done) {
playSource(BASIC_PATH + '67.mp4', done); playSource('67.mp4', done);
}) })
/* * /* *
...@@ -360,7 +366,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -360,7 +366,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1100', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1100', 0, async function (done) {
playSource(BASIC_PATH + '92.mp4', done); playSource('92.mp4', done);
}) })
/* * /* *
...@@ -376,7 +382,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -376,7 +382,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1200', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1200', 0, async function (done) {
playSource(BASIC_PATH + '93.mp4', done); playSource('93.mp4', done);
}) })
/* * /* *
...@@ -392,7 +398,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -392,7 +398,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1300', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1300', 0, async function (done) {
playSource(BASIC_PATH + '94.mp4', done); playSource('94.mp4', done);
}) })
/* * /* *
...@@ -408,7 +414,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -408,7 +414,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1400', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1400', 0, async function (done) {
playSource(BASIC_PATH + '96.mp4', done); playSource('96.mp4', done);
}) })
/* * /* *
...@@ -424,7 +430,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -424,7 +430,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1500', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1500', 0, async function (done) {
playSource(BASIC_PATH + '97.mp4', done); playSource('97.mp4', done);
}) })
/* * /* *
...@@ -440,7 +446,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -440,7 +446,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1600', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1600', 0, async function (done) {
playSource(BASIC_PATH + '98.mp4', done); playSource('98.mp4', done);
}) })
/* * /* *
...@@ -456,7 +462,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -456,7 +462,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0100', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0100', 0, async function (done) {
playSource(BASIC_PATH + '55.m4a', done); playSource('55.m4a', done);
}) })
...@@ -473,7 +479,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -473,7 +479,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0300', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0300', 0, async function (done) {
playSource(BASIC_PATH + '57.m4a', done); playSource('57.m4a', done);
}) })
/* * /* *
...@@ -489,7 +495,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -489,7 +495,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0400', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0400', 0, async function (done) {
playSource(BASIC_PATH + '58.m4a', done); playSource('58.m4a', done);
}) })
/* * /* *
...@@ -505,7 +511,7 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -505,7 +511,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0500', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0500', 0, async function (done) {
playSource(BASIC_PATH + '59.m4a', done); playSource('59.m4a', done);
}) })
/* * /* *
...@@ -521,6 +527,6 @@ describe('PlayerLocalTestAudioFormat', function () { ...@@ -521,6 +527,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0 * @tc.level : Level0
*/ */
it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0700', 0, async function (done) { it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0700', 0, async function (done) {
playSource(BASIC_PATH + '62.m4a', done); playSource('62.m4a', 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.
*/
package ohos.acts.multimedia.audio.audioplayer;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"pre-push": [ "pre-push": [
], ],
"push": [ "push": [
"./resource/audio/H264_AAC.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/" "./resource/audio/H264_AAC.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files/"
] ]
}, },
{ {
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import router from '@system.router' import router from '@system.router'
import fileIO from '@ohos.fileio' import fileIO from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerAPICallbackTest', function () { describe('VideoPlayerAPICallbackTest', function () {
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4'; const VIDEO_SOURCE = 'H264_AAC.mp4';
const PLAY_TIME = 1000; const PLAY_TIME = 1000;
const SEEK_TIME = 5000; const SEEK_TIME = 5000;
const SEEK_CLOSEST = 3;
const WIDTH_VALUE = 720; const WIDTH_VALUE = 720;
const HEIGHT_VALUE = 480; const HEIGHT_VALUE = 480;
const DURATION_TIME = 10034; const DURATION_TIME = 10034;
...@@ -51,6 +51,8 @@ describe('VideoPlayerAPICallbackTest', function () { ...@@ -51,6 +51,8 @@ describe('VideoPlayerAPICallbackTest', function () {
let temp = 0; let temp = 0;
let events = require('events'); let events = require('events');
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
let context = featureAbility.getContext();
let videoPath = '';
beforeAll(function() { beforeAll(function() {
console.info('beforeAll case'); console.info('beforeAll case');
...@@ -90,8 +92,13 @@ describe('VideoPlayerAPICallbackTest', function () { ...@@ -90,8 +92,13 @@ describe('VideoPlayerAPICallbackTest', function () {
} }
async function getFd() { async function getFd() {
await context.getFilesDir().then((data) => {
console.info("case file path is" + JSON.stringify(data));
videoPath = data + '/' + VIDEO_SOURCE;
console.info("case audioPath is" + videoPath);
});
fdPath = 'fd://'; fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { await fileIO.open(videoPath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber; fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber; fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath); console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
......
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import router from '@system.router' import router from '@system.router'
import fileIO from '@ohos.fileio' import fileIO from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerFuncCallbackTest', function () { describe('VideoPlayerFuncCallbackTest', function () {
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4'; const VIDEO_SOURCE = 'H264_AAC.mp4';
const PLAY_TIME = 3000; const PLAY_TIME = 3000;
const SEEK_TIME = 5000; const SEEK_TIME = 5000;
const WIDTH_VALUE = 720; const WIDTH_VALUE = 720;
...@@ -51,6 +52,8 @@ describe('VideoPlayerFuncCallbackTest', function () { ...@@ -51,6 +52,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
let temp = 0; let temp = 0;
let events = require('events'); let events = require('events');
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
let context = featureAbility.getContext();
let videoPath = '';
beforeAll(function() { beforeAll(function() {
console.info('beforeAll case'); console.info('beforeAll case');
...@@ -99,7 +102,7 @@ describe('VideoPlayerFuncCallbackTest', function () { ...@@ -99,7 +102,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
path = 'pages/surfaceTest/surfaceTest'; path = 'pages/surfaceTest/surfaceTest';
temp = 1; temp = 1;
} else { } else {
path = 'pages/surfaceTest/surfaceTest2'; path = 'pages/surfaceTest2/surfaceTest2';
temp = 0; temp = 0;
} }
let options = { let options = {
...@@ -113,8 +116,13 @@ describe('VideoPlayerFuncCallbackTest', function () { ...@@ -113,8 +116,13 @@ describe('VideoPlayerFuncCallbackTest', function () {
} }
async function getFd() { async function getFd() {
await context.getFilesDir().then((data) => {
console.info("case file path is" + JSON.stringify(data));
videoPath = data + '/' + VIDEO_SOURCE;
console.info("case audioPath is" + videoPath);
});
fdPath = 'fd://'; fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { await fileIO.open(videoPath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber; fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber; fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath); console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import router from '@system.router' import router from '@system.router'
import fileIO from '@ohos.fileio' import fileIO from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoPlayerFuncPromiseTest', function () { describe('VideoPlayerFuncPromiseTest', function () {
const AUDIO_SOURCE = '/data/accounts/account_0/appdata/ohos.acts.multimedia.video.videoplayer/H264_AAC.mp4'; const VIDEO_SOURCE = 'H264_AAC.mp4';
const PLAY_TIME = 3000; const PLAY_TIME = 3000;
const SEEK_TIME = 5000; const SEEK_TIME = 5000;
const SEEK_CLOSEST = 3;
const WIDTH_VALUE = 720; const WIDTH_VALUE = 720;
const HEIGHT_VALUE = 480; const HEIGHT_VALUE = 480;
const DURATION_TIME = 10034; const DURATION_TIME = 10034;
...@@ -33,6 +33,8 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -33,6 +33,8 @@ describe('VideoPlayerFuncPromiseTest', function () {
let fdPath; let fdPath;
let fdValue; let fdValue;
let temp = 0; let temp = 0;
let context = featureAbility.getContext();
let videoPath = '';
beforeAll(function() { beforeAll(function() {
console.info('beforeAll case'); console.info('beforeAll case');
}) })
...@@ -80,7 +82,7 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -80,7 +82,7 @@ describe('VideoPlayerFuncPromiseTest', function () {
path = 'pages/surfaceTest/surfaceTest'; path = 'pages/surfaceTest/surfaceTest';
temp = 1; temp = 1;
} else { } else {
path = 'pages/surfaceTest/surfaceTest2'; path = 'pages/surfaceTest2/surfaceTest2';
temp = 0; temp = 0;
} }
let options = { let options = {
...@@ -94,8 +96,13 @@ describe('VideoPlayerFuncPromiseTest', function () { ...@@ -94,8 +96,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
} }
async function getFd() { async function getFd() {
await context.getFilesDir().then((data) => {
console.info("case file path is" + JSON.stringify(data));
videoPath = data + '/' + VIDEO_SOURCE;
console.info("case audioPath is" + videoPath);
});
fdPath = 'fd://'; fdPath = 'fd://';
await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { await fileIO.open(videoPath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber; fdPath = fdPath + '' + fdNumber;
fdValue = fdNumber; fdValue = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath); console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册