Skip to content

Commit

Permalink
fix(ui) Handle play() promise being rejected. (#20884)
Browse files Browse the repository at this point in the history
We need to handle the play() promise being rejected by the browser.

Fixes JAVASCRIPT-22VM
  • Loading branch information
markstory committed Sep 21, 2020
1 parent 8dc4efa commit 18ef12d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sentry/static/sentry/app/components/loadingIndicator.tsx
Expand Up @@ -40,7 +40,14 @@ class LoadingIndicator extends React.Component<Props> {
// https://github.com/facebook/react/issues/10389
// So we need to set the muted property then trigger play.
this.videoRef.current.muted = true;
this.videoRef.current.play();
const playPromise = this.videoRef.current.play();

// non-chromium Edge doesn't return a promise.
if (playPromise && playPromise.catch) {
playPromise.catch(() => {
// Do nothing. Interrupting this playback is fine.
});
}
}
}

Expand Down

0 comments on commit 18ef12d

Please sign in to comment.