Can't play sound before component unmounts
See original GitHub issuecomponentWillUnmount() { this.player.howler.play() }
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@sAs59 I think you should use howler.js directly, you’ll have more control. https://github.com/goldfire/howler.js/ (look for audio sprites)
No worries!
componentDidMountwould 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! 😎