E-Kuerschner / useAudioPlayer

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

Allow player to control arbitrary audio out #143

Open sammbeller opened 2 months ago

sammbeller commented 2 months ago

Is your feature request related to a problem? Please describe. I would like to use useAudioPlayer to fulfill the requirements for this issue but we need to be able to control a remote "jukebox" - the audio out of the computer the server is running on.

Describe the solution you'd like I'd like useAudioPlayer to take an optional AudioOutProvider which implements against a defined API the required calls to support useAuditoPlayer's API. For a remote server this would involve calling out to the server to control playback of the audio. I would be happy to help contribute to this solution or implement it myself, but I wanted to open this issue to start the conversation and determine if you're open to these changes.

deluan commented 2 months ago

Just to add to what @sammbeller said, ideally we would specify the AudioOutProvider using a React Context.Provider (https://react.dev/reference/react/useContext)

In this scenario, the current Howl-based audio out would be the default provider, if none is set in the context.