mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-19 17:16:08 +08:00
fix: 音频不能正确播放
This commit is contained in:
parent
f014befbbd
commit
d39da0f602
@ -35,6 +35,16 @@ export class AudioPlayer extends EventEmitter<AudioPlayerEvent> {
|
|||||||
this.ac = new AudioContext();
|
this.ac = new AudioContext();
|
||||||
this.gain = this.ac.createGain();
|
this.gain = this.ac.createGain();
|
||||||
this.gain.connect(this.ac.destination);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user