diff --git a/pages.json b/pages.json
index 3ef35ee1b5f4b969c0d15db5b25f85ffe65ea363..6dfacdf4c32bfc91dfc2a9a39d1c11c6f5bb36cd 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 d1a67162c3c95c352948a2ef782977ef82775bca..e9be875499f16764596180e215e79f128b14d2c1 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();