forked from treehouse/mastodon
[Glitch] Fix audio player on Safari
Port 635b6a0f1a
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
signup-info-prompt
parent
b578d70957
commit
8f0e6122a9
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue