From 44d96264fb22d6baea250a7c1ba366ee440c0494 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 7 Mar 2026 14:06:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E6=AD=8C=E6=9B=B2=E6=B2=A1=E6=9C=89=E5=A3=B0=E9=9F=B3?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#2693)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 1 + src/renderer/plugins/player/index.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/publish/changeLog.md b/publish/changeLog.md index 700d941b..8da3a3f3 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -4,3 +4,4 @@ ### 修复 - 修复桌面歌词的 鼠标移入歌词区域时提高透明度 设置不稳定的问题(#2679, @Little100) +- 修复某些情况下可能播放没有声音的问题(#2693) diff --git a/src/renderer/plugins/player/index.ts b/src/renderer/plugins/player/index.ts index ec850a78..a1b70ce1 100644 --- a/src/renderer/plugins/player/index.ts +++ b/src/renderer/plugins/player/index.ts @@ -65,6 +65,16 @@ export const createAudio = () => { audio.autoplay = true audio.preload = 'auto' audio.crossOrigin = 'anonymous' + + // https://developer.chrome.com/blog/autoplay + audio.addEventListener('playing', () => { + if (audioContext?.state == 'suspended') { + void audioContext.resume().catch((err) => { + console.error('Resume audio context failed:', err) + throw err + }) + } + }) } const initAnalyser = () => {