diff --git a/multimedia/media/media_js_standard/audioPlayer/Test.json b/multimedia/media/media_js_standard/audioPlayer/Test.json index 8d705ef062a1f50e917474387d1415222f66a863..3a839ac35e933b9f50de438b02a7ace5f9a9228a 100644 --- a/multimedia/media/media_js_standard/audioPlayer/Test.json +++ b/multimedia/media/media_js_standard/audioPlayer/Test.json @@ -19,30 +19,30 @@ "pre-push": [ ], "push": [ - "./resource/audio/01.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/02.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/03.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/04.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/47.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/49.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/50.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/51.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/54.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/55.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/57.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/58.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/59.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/62.m4a ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/64.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/65.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/66.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/67.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/92.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/93.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/94.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/96.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/97.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/", - "./resource/audio/98.mp4 ->/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/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/03.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/04.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/47.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/49.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/50.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/51.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/54.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/55.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/57.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/58.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/59.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/62.m4a ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/64.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/65.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/66.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/67.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/92.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/93.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/94.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/96.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/97.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/", + "./resource/audio/98.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files/" ] }, { diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java b/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java deleted file mode 100644 index c3adacfc7a7e0e86651b857ee2f6e857d5c173be..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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(); - } - } diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java b/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java deleted file mode 100644 index 956bc88979f54b82cf83932c34081ad9f26e8588..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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(); - } - } diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js index 4b041dad98a44bf29ae5013f26a888a429f7d51a..588cf2fe6f1e051e204a2ca1cfacf6e2785fe17f 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js @@ -15,13 +15,14 @@ import media from '@ohos.multimedia.media' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('PlayerLocalTestAudioAPI', function () { let audioPlayer = media.createAudioPlayer(); let loopValue = 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 END_STATE = 0; const SRC_STATE = 1; @@ -39,11 +40,11 @@ describe('PlayerLocalTestAudioAPI', function () { const SEEK_TIME = 5000; const DELTA_TIME = 1000; const SECOND_INDEX = 1; - const TIME_OUT = 20000; const VOLUME_VALUE = 0.5; let fdPath; let fdValue; - + let context = featureAbility.getContext(); + let audioPath = ''; beforeAll(async function() { await getFd(); console.info('beforeAll case'); @@ -68,8 +69,13 @@ describe('PlayerLocalTestAudioAPI', function () { } 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://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(audioPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js index 13a6355f1eb3cc4a50a0c4add13e31b86806ff29..a17fd38003601953b0c45b826f10a3508a99a383 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js @@ -15,12 +15,13 @@ import media from '@ohos.multimedia.media' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('PlayerLocalTestAudioFUNC', function () { let audioPlayer = media.createAudioPlayer(); 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 DURATION_TIME = 219600; const SEEK_TIME = 5000; @@ -43,7 +44,8 @@ describe('PlayerLocalTestAudioFUNC', function () { const MAX_VOLUME = 1; let fdPath; let fdValue; - + let context = featureAbility.getContext(); + let audioPath = ''; beforeAll(async function() { await getFd(); console.info('beforeAll case'); @@ -68,8 +70,13 @@ describe('PlayerLocalTestAudioFUNC', function () { } 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://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(audioPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js index 7e5c445830abf1eebab47cb3d34e4fd6bf1d2183..e86f3b57b8bc312375cd7a165718076f2692359a 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js @@ -15,10 +15,10 @@ import media from '@ohos.multimedia.media' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' describe('PlayerLocalTestAudioFormat', function () { - const BASIC_PATH = '/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/'; const MAX_VOLUME = 1; const PLAY_TIME = 3000; const SEEK_TIME = 10000; // 10s @@ -26,7 +26,7 @@ describe('PlayerLocalTestAudioFormat', function () { let isToDuration = false; let fdPath; let fdValue; - + let context = featureAbility.getContext(); beforeAll(function() { console.info('beforeAll case'); }) @@ -51,8 +51,14 @@ describe('PlayerLocalTestAudioFormat', function () { } 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://'; - await fileIO.open(pathName).then((fdNumber) => { + await fileIO.open(audioPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); @@ -151,7 +157,7 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ 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 () { * @tc.level : Level0 */ it('SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0700', 0, async function (done) { - playSource(BASIC_PATH + '62.m4a', done); + playSource('62.m4a', done); }) }) diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java b/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java deleted file mode 100644 index c3adacfc7a7e0e86651b857ee2f6e857d5c173be..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MainAbility.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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(); - } - } diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java b/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java deleted file mode 100644 index 956bc88979f54b82cf83932c34081ad9f26e8588..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/java/ohos/acts/multimedia/audio/audioplayer/MyApplication.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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(); - } - } diff --git a/multimedia/media/media_js_standard/videoPlayer/Test.json b/multimedia/media/media_js_standard/videoPlayer/Test.json index 97db72d66aaeed92612c080d86a203ca68bd9d40..21ba0fb2fe3d1827d75c4a9b49548aad1f8d0de2 100644 --- a/multimedia/media/media_js_standard/videoPlayer/Test.json +++ b/multimedia/media/media_js_standard/videoPlayer/Test.json @@ -19,7 +19,7 @@ "pre-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/" ] }, { diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js index e47312f3694b24ed57bf13be071e7d10b8c2e57f..3ede8e0eac672aed7851cc738884fe7a105c2ce4 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js @@ -16,13 +16,13 @@ import media from '@ohos.multimedia.media' import router from '@system.router' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' 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 SEEK_TIME = 5000; - const SEEK_CLOSEST = 3; const WIDTH_VALUE = 720; const HEIGHT_VALUE = 480; const DURATION_TIME = 10034; @@ -51,6 +51,8 @@ describe('VideoPlayerAPICallbackTest', function () { let temp = 0; let events = require('events'); let eventEmitter = new events.EventEmitter(); + let context = featureAbility.getContext(); + let videoPath = ''; beforeAll(function() { console.info('beforeAll case'); @@ -90,8 +92,13 @@ describe('VideoPlayerAPICallbackTest', function () { } 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://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(videoPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js index 68a686010452fdb136055a95317df4d7b4d097d2..84def34649a32d72403796704dc099f1a235e3fa 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js @@ -16,10 +16,11 @@ import media from '@ohos.multimedia.media' import router from '@system.router' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' 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 SEEK_TIME = 5000; const WIDTH_VALUE = 720; @@ -51,6 +52,8 @@ describe('VideoPlayerFuncCallbackTest', function () { let temp = 0; let events = require('events'); let eventEmitter = new events.EventEmitter(); + let context = featureAbility.getContext(); + let videoPath = ''; beforeAll(function() { console.info('beforeAll case'); @@ -99,7 +102,7 @@ describe('VideoPlayerFuncCallbackTest', function () { path = 'pages/surfaceTest/surfaceTest'; temp = 1; } else { - path = 'pages/surfaceTest/surfaceTest2'; + path = 'pages/surfaceTest2/surfaceTest2'; temp = 0; } let options = { @@ -113,8 +116,13 @@ describe('VideoPlayerFuncCallbackTest', function () { } 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://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(videoPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath); diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js index 8c031160b9de304674f3c9cabed8fa30ed38b7dd..b58b09c44846f92da3678a11b979e26ca5ae4254 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js @@ -16,13 +16,13 @@ import media from '@ohos.multimedia.media' import router from '@system.router' import fileIO from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' 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 SEEK_TIME = 5000; - const SEEK_CLOSEST = 3; const WIDTH_VALUE = 720; const HEIGHT_VALUE = 480; const DURATION_TIME = 10034; @@ -33,6 +33,8 @@ describe('VideoPlayerFuncPromiseTest', function () { let fdPath; let fdValue; let temp = 0; + let context = featureAbility.getContext(); + let videoPath = ''; beforeAll(function() { console.info('beforeAll case'); }) @@ -80,7 +82,7 @@ describe('VideoPlayerFuncPromiseTest', function () { path = 'pages/surfaceTest/surfaceTest'; temp = 1; } else { - path = 'pages/surfaceTest/surfaceTest2'; + path = 'pages/surfaceTest2/surfaceTest2'; temp = 0; } let options = { @@ -94,8 +96,13 @@ describe('VideoPlayerFuncPromiseTest', function () { } 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://'; - await fileIO.open(AUDIO_SOURCE).then((fdNumber) => { + await fileIO.open(videoPath).then((fdNumber) => { fdPath = fdPath + '' + fdNumber; fdValue = fdNumber; console.info('[fileIO]case open fd success,fdPath is ' + fdPath);