]> cat aescling's git repositories - mastodon.git/commitdiff
Fix audio player not working when media files are hosted on a different domain (...
authorThibG <thib@sitedethib.com>
Mon, 22 Jun 2020 17:24:16 +0000 (19:24 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2020 17:24:16 +0000 (19:24 +0200)
app/javascript/mastodon/features/audio/index.js

index 5f5d85b95f6af7a8398e21af6b3a2bed84327128..029750d850f7383ec734443e3b407114ee5187d5 100644 (file)
@@ -229,6 +229,7 @@ class Audio extends React.PureComponent {
     window.addEventListener('scroll', this.handleScroll);
 
     const img = new Image();
+    img.crossOrigin = 'anonymous';
     img.onload = () => this.handlePosterLoad(img);
     img.src = this.props.poster;
   }
@@ -236,6 +237,7 @@ class Audio extends React.PureComponent {
   componentDidUpdate (prevProps, prevState) {
     if (prevProps.poster !== this.props.poster) {
       const img = new Image();
+      img.crossOrigin = 'anonymous';
       img.onload = () => this.handlePosterLoad(img);
       img.src = this.props.poster;
     }
@@ -606,6 +608,7 @@ class Audio extends React.PureComponent {
           onPause={this.handlePause}
           onProgress={this.handleProgress}
           onTimeUpdate={this.handleTimeUpdate}
+          crossOrigin='anonymous'
         />
 
         <canvas