mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-05-11 11:03:25 +08:00
Compare commits
2 Commits
f014befbbd
...
d4a2c38484
Author | SHA1 | Date | |
---|---|---|---|
d4a2c38484 | |||
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, { capture: true });
|
||||||
|
document.body.addEventListener('touchstart', func, { capture: true });
|
||||||
|
document.body.addEventListener('keydown', func, { capture: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user