diff --git a/pages.json b/pages.json index 056138fa448a7e275378beda6b904351b1bcbedb..22d9fcd1d49f4a84e61b7a4497b679d57c2517c0 100644 --- a/pages.json +++ b/pages.json @@ -1097,16 +1097,16 @@ } }, // #endif - // #ifdef APP - { - "path": "pages/API/background-audio/background-audio", - "group": "1,7,9", - "style": { - "navigationBarTitleText": "backgroundAudio | 背景音乐" - } - }, - // #endif - // #ifdef WEB || MP + // // #ifdef APP + // { + // "path": "pages/API/background-audio/background-audio", + // "group": "1,7,10", + // "style": { + // "navigationBarTitleText": "backgroundAudio | 背景音乐" + // } + // }, + // // #endif + // #ifdef WEB || MP || APP { "path": "pages/API/create-inner-audio-context/create-inner-audio-context", "group": "1,7,9", @@ -1116,7 +1116,7 @@ }, // #endif - // #ifdef WEB || MP + // #ifdef WEB || MP || APP { "path": "pages/API/create-inner-audio-context/inner-audio-format", "style": { @@ -1124,7 +1124,7 @@ } }, // #endif - // #ifdef WEB || MP + // #ifdef WEB || MP ||APP { "path": "pages/API/create-inner-audio-context/inner-audio-path", "style": { diff --git a/pages/API/background-audio/background-audio.uvue b/pages/API/background-audio/background-audio.uvue index 4b9d10e7cc80f067f2d510de0dfd03c9cd8a2a6b..dc02b74be8fed238498c732b0cfaa1cc05f7e00d 100644 --- a/pages/API/background-audio/background-audio.uvue +++ b/pages/API/background-audio/background-audio.uvue @@ -68,7 +68,7 @@ bgAudioMannager.title = '致爱丽丝'+this.count++; bgAudioMannager.singer = '暂无2'+this.count++; bgAudioMannager.coverImgUrl = 'https://web-assets.dcloud.net.cn/unidoc/zh/Alice.jpeg'; - this.bgAudioMannager!!.src = this.dataUrl; + this.bgAudioMannager!.src = this.dataUrl; this.bgAudioMannager?.play() }) bgAudioMannager.onPrev(() => { @@ -76,7 +76,7 @@ this.bgAudioMannager?.stop() bgAudioMannager.title = '致爱丽丝'+this.count--; bgAudioMannager.singer = '暂无'+this.count--; - this.bgAudioMannager!!.src = this.dataUrl; + this.bgAudioMannager!.src = this.dataUrl; this.bgAudioMannager?.play() }) // bgAudioMannager.onTimeUpdate((e) => { @@ -91,17 +91,17 @@ methods: { play: function () { console.log('play') - this.bgAudioMannager!!.src = this.dataUrl; + this.bgAudioMannager!.src = this.dataUrl; // #ifdef APP-ANDROID if (UTSAndroid.checkSystemPermissionGranted(UTSAndroid.getUniActivity()!, ["android.permission.POST_NOTIFICATIONS"])) { - this.bgAudioMannager!!.play() + this.bgAudioMannager!.play() } else { // 检查当前 Android 版本和 targetSdkVersion if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { // Android 13 及以上版本 if ((UTSAndroid.getAppContext() as Application).applicationInfo.targetSdkVersion >= 33) { UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, ["android.permission.POST_NOTIFICATIONS"], (_ : boolean, p : string[]) => { - this.bgAudioMannager!!.play() + this.bgAudioMannager!.play() }, (_ : boolean, p : string[]) => { uni.showToast({ title: "权限被拒绝了", @@ -178,4 +178,4 @@ flex-direction: row; justify-content: center; } - \ No newline at end of file + 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 93d272a5c01470b00fd4454ad014b2a01f21fbee..d3f36be4cfe57ad822edd28ed140b9d4d1d742f3 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 @@ -1,4 +1,7 @@