diff options
author | ThibG <thib@sitedethib.com> | 2020-08-02 18:47:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-02 18:47:09 +0200 |
commit | 635b6a0f1af21bd4055f950930a681aa0a96535b (patch) | |
tree | 854d2e37a74033df7378f30a408c52d3b524aee6 /app | |
parent | 3ade83483054cdc2f8e7887ad236ede4341c0c09 (diff) |
Fix audio player on Safari (#14485)
Diffstat (limited to 'app')
-rw-r--r-- | app/javascript/mastodon/features/audio/index.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/javascript/mastodon/features/audio/index.js b/app/javascript/mastodon/features/audio/index.js index a4e00ba96..5b8172694 100644 --- a/app/javascript/mastodon/features/audio/index.js +++ b/app/javascript/mastodon/features/audio/index.js @@ -115,6 +115,10 @@ class Audio extends React.PureComponent { } togglePlay = () => { + if (!this.audioContext) { + this._initAudioContext(); + } + if (this.state.paused) { this.setState({ paused: false }, () => this.audio.play()); } else { @@ -133,10 +137,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(); } |