mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-27 23:55:52 +00:00
[Glitch] Fix audio player not working when media files are hosted on a different domain
Port aaf91abffa
to glitch-soc
Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
parent
ad978ab1d4
commit
1ad79d11f3
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue