E-Kuerschner / useAudioPlayer

React hooks for controlling audio on the web
MIT License
332 stars 37 forks source link

Remove useAudioPlayer useEffect in favor of explicit clean function #134

Closed E-Kuerschner closed 1 year ago

E-Kuerschner commented 1 year 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.