E-Kuerschner / useAudioPlayer

React hooks for controlling audio on the web
MIT License
315 stars 35 forks source link

Remove useAudioPlayer useEffect in favor of explicit clean function #134

Closed E-Kuerschner closed 8 months ago

E-Kuerschner commented 8 months ago

This PR remove the useEffect from useAudioPlayer which was automatically destroying Howl objects as the component unmounted. This was causing bugs in certain scenarios, mainly when trying to sync the Howl up to the MediaSession in the browser. While this feature has been descoped (see Issues), using an effect for this can still lead to unexpected behaviors and a more explicit cleanup function is preferred.