question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't play sound before component unmounts

See original GitHub issue

componentWillUnmount() { this.player.howler.play() }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thangngoc89commented, May 28, 2017

@sAs59 I think you should use howler.js directly, you’ll have more control. https://github.com/goldfire/howler.js/ (look for audio sprites)

1reaction
Stenersoncommented, May 28, 2017

No worries! componentDidMount would be a good place, as long as the sound file is preloaded or cached. If that’s not the case you may want to place ReactHowler somewhere else in your component tree or just use Howler directly somewhere in your app to allow for better Howl lifecycle control.

Happy Howling! 😎

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't stop playing on componentWillUnmount #316 - GitHub
I have the same problem if I unmount the component BEFORE the sound is done preloading. If I wait for the sound to...
Read more >
Expo stop audio playing after component closed
When I close the popup I want the audio to stop playing. I tried using a cleanup function in the audio component, but...
Read more >
Cancel your promises when a component unmounts
The component unmounted before the "fetchAuthenticatedUser" promise was resolved. What means that if the promise does resolve: The setUser ...
Read more >
Avoid setState warnings on unmounted React components
Otherwise you'll get the following warning: "Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no -op, ...
Read more >
Avoid updates on unmounted React components - Medium
The easiest way to avoid the warning would be by forcing the component to check its isMounted state before calling setState() . This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found