diff --git a/pages.json b/pages.json
index 7420c8085361d2544df5fb5fd805a6bd0e493100..a03b72a93794ccfcd2b8cb8245a8f43e348959f0 100644
--- a/pages.json
+++ b/pages.json
@@ -1125,6 +1125,12 @@
"navigationBarTitleText": "inner-audio-path"
}
},
+ {
+ "path": "pages/API/create-inner-audio-context/inner-audio-mult",
+ "style": {
+ "navigationBarTitleText": "inner-audio-mult"
+ }
+ },
// #endif
// #ifdef WEB || MP
{
diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue
index 2dd3522f7bc70031265685768fd980959f70a836..21b9ae7c55f2cbe3e467a62f16d4556b9b9425f5 100644
--- a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue
+++ b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue
@@ -63,6 +63,9 @@
+
+
+
diff --git a/pages/API/create-inner-audio-context/inner-audio-mult.uvue b/pages/API/create-inner-audio-context/inner-audio-mult.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..dc1ee1600a7a557b243145bae5d1229df7172197
--- /dev/null
+++ b/pages/API/create-inner-audio-context/inner-audio-mult.uvue
@@ -0,0 +1,92 @@
+
+
+
+
+ 多音频同时播放
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/API/create-inner-audio-context/inner-audio-path.uvue b/pages/API/create-inner-audio-context/inner-audio-path.uvue
index bf769c3637c335f5863a8df22c3559c4bf6beae8..42d1284393f68e762938f9ea7029fb9c613bf5c5 100644
--- a/pages/API/create-inner-audio-context/inner-audio-path.uvue
+++ b/pages/API/create-inner-audio-context/inner-audio-path.uvue
@@ -22,7 +22,9 @@
return {
title: 'audio-path',
playIndex: 0,
- isPlaying: false,
+ isPlaying: false,
+ nativePath:uni.env.CACHE_PATH+'uni-audio/test/test.mp3' as string,
+ sdcardPath :'sdcard/uni-audio/test.mp3',
_audioContext: null as InnerAudioContext | null,
supportPaths: [
{
@@ -32,7 +34,11 @@
{
description: '本地路径:../static/',
src: '../../../static/test-audio/ForElise.mp3'
- },
+ },
+ {
+ description: '本地路径:env方式',
+ src: 'env'
+ },
{
description: '网络路径',
src: 'https://web-ext-storage.dcloud.net.cn/uni-app-x/audio/ForElise.mp3'
@@ -60,8 +66,26 @@
this._audioContext!.onError((err) => {
this.isPlaying = false;
console.log('err', err);
- });
- },
+ });
+
+ const fileManager = uni.getFileSystemManager()
+ try {
+ fileManager.rmdirSync(uni.env.CACHE_PATH+'uni-audio/test',true)
+ } catch (e) {
+ }
+
+ try {
+ fileManager.mkdirSync(uni.env.CACHE_PATH+'uni-audio/test',true)
+ } catch (e) {
+ }
+ try{
+ fileManager.copyFileSync(
+ '/static/test-audio/ForElise.mp3',
+ this.nativePath)
+ } catch(e){
+ }
+ },
+
onUnload() {
if (this._audioContext != null) {
this.pause();
@@ -78,7 +102,11 @@
if (this.isPlaying && this.playIndex == index) {
this.pause();
return;
- }
+ }
+ if(audioUrl == 'env'){
+ audioUrl=this.nativePath
+ }
+
this.playIndex = index
this._audioContext!.src = audioUrl;
this._audioContext!.play();