Browse Source

Fix audio player not working when media files are hosted on a different domain (#14118)

master
ThibG 3 years ago
committed by GitHub
parent
commit
aaf91abffa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      app/javascript/mastodon/features/audio/index.js

+ 3
- 0
app/javascript/mastodon/features/audio/index.js View 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

Loading…
Cancel
Save