From d39da0f60295e2637f6867eef027f30621cb16d1 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Thu, 23 Jan 2025 23:50:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9F=B3=E9=A2=91=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/module/audio/player.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/module/audio/player.ts b/src/module/audio/player.ts index 33d0bcf..7529d49 100644 --- a/src/module/audio/player.ts +++ b/src/module/audio/player.ts @@ -35,6 +35,16 @@ export class AudioPlayer extends EventEmitter { this.ac = new AudioContext(); this.gain = this.ac.createGain(); this.gain.connect(this.ac.destination); + + const func = () => { + this.ac.resume(); + document.body.removeEventListener('mousedown', func); + document.body.removeEventListener('touchstart', func); + document.body.removeEventListener('keydown', func); + }; + document.body.addEventListener('mousedown', func); + document.body.addEventListener('touchstart', func); + document.body.addEventListener('keydown', func); } /**