summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-02 18:47:09 +0200
committerEugen Rochko <eugen@zeonfederated.com>2020-10-19 15:39:48 +0200
commit469c4c78a3ce2f7065c7273fd2800f9a39191a21 (patch)
tree7a0e67179a5633f838572d8b5b65f3bcb428ef28
parent399c5f09009e05d22e9acd8bb75f3f803b58e365 (diff)
Fix audio player on Safari (#14485)
-rw-r--r--app/javascript/mastodon/features/audio/index.js8
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 a4e00ba96c1..5b817269458 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();
}