about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/audio/index.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-06-22 19:24:16 +0200
committerThibG <thib@sitedethib.com>2020-07-02 17:31:09 +0200
commit1ad79d11f3b53d21669a01778b4efa8deb3cee58 (patch)
treeb0461b8bcedb25db9fde233bed013ae79ed99857 /app/javascript/flavours/glitch/features/audio/index.js
parentad978ab1d49ea043a65c07f3433fe141d9fab6b4 (diff)
[Glitch] Fix audio player not working when media files are hosted on a different domain
Port aaf91abffae590b2db1b9e6a7dd2a9e2b06b06ca to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/audio/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/audio/index.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/audio/index.js b/app/javascript/flavours/glitch/features/audio/index.js
index 172fe4c30..c7f807c8e 100644
--- a/app/javascript/flavours/glitch/features/audio/index.js
+++ b/app/javascript/flavours/glitch/features/audio/index.js
@@ -228,6 +228,7 @@ class Audio extends React.PureComponent {
  
   componentDidMount () {
     const img = new Image();
+    img.crossOrigin = 'anonymous';
     img.onload = () => this.handlePosterLoad(img);
     img.src = this.props.poster;
   }
@@ -235,6 +236,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;
     }
@@ -588,6 +590,7 @@ class Audio extends React.PureComponent {
           onPause={this.handlePause}
           onProgress={this.handleProgress}
           onTimeUpdate={this.handleTimeUpdate}
+          crossOrigin='anonymous'
         />
 
         <canvas