Skip to content

Commit 8f20f3f

Browse files
authored
fix: 关于静音的问题 (#2693)
1 parent 8d6b207 commit 8f20f3f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/renderer/plugins/player/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ export const createAudio = () => {
6565
audio.autoplay = true
6666
audio.preload = 'auto'
6767
audio.crossOrigin = 'anonymous'
68+
audio.addEventListener('playing', () => {
69+
if (audioContext?.state == 'suspended') {
70+
void audioContext.resume().catch((err) => {
71+
console.error('Resume audio context failed:', err)
72+
throw err
73+
})
74+
}
75+
})
6876
}
6977

7078
const initAnalyser = () => {

0 commit comments

Comments
 (0)