From 8d7303596f0c7c533f567d2291998e3db3065075 Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Mon, 4 Nov 2024 18:00:48 +0800 Subject: [PATCH] =?UTF-8?q?[audio]=E4=BF=AE=E6=94=B9=E9=9F=B3=E9=A2=91?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../background-audio/background-audio.uvue | 12 ++++---- .../create-inner-audio-context.uvue | 10 +++++-- .../inner-audio-format.uvue | 25 +++++++++-------- .../inner-audio-path.uvue | 28 +++++++++---------- 4 files changed, 42 insertions(+), 33 deletions(-) diff --git a/pages/API/background-audio/background-audio.uvue b/pages/API/background-audio/background-audio.uvue index 4b9d10e7..dc02b74b 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 93d272a5..d3f36be4 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 @@