Compare commits

..

2 Commits

Author SHA1 Message Date
d4a2c38484 fix: 应该使用捕获,而非冒泡 2025-01-23 23:53:21 +08:00
d39da0f602 fix: 音频不能正确播放 2025-01-23 23:50:48 +08:00

View File

@ -35,6 +35,16 @@ export class AudioPlayer extends EventEmitter<AudioPlayerEvent> {
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, { capture: true });
document.body.addEventListener('touchstart', func, { capture: true });
document.body.addEventListener('keydown', func, { capture: true });
}
/**