[Glitch] Fix audio player on Safari

Port 62324e9870 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
lolsob-rspec
ThibG 2020-08-02 18:47:09 +02:00 committed by Thibaut Girka
parent 8d79bb4097
commit 6a39f0123b
1 changed files with 4 additions and 4 deletions

View File

@ -113,6 +113,10 @@ class Audio extends React.PureComponent {
}
togglePlay = () => {
if (!this.audioContext) {
this._initAudioContext();
}
if (this.state.paused) {
this.setState({ paused: false }, () => this.audio.play());
} else {
@ -131,10 +135,6 @@ class Audio extends React.PureComponent {
handlePlay = () => {
this.setState({ paused: false });
if (this.canvas && !this.audioContext) {
this._initAudioContext();
}
if (this.audioContext && this.audioContext.state === 'suspended') {
this.audioContext.resume();
}