-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: expose underlying Howl instance and events to the client to allow for greater expandability #118
base: main
Are you sure you want to change the base?
Conversation
…ow for greater expandability. Add type `getHowl` as Howl to `AudioPlayer`. Add the method `getHowl` to `useAudioPlayer`. Return the `howl` instance in `useAudioPlayer().load()`. Add the method `getHowl` to `useGlobalAudioPlayer`. Return the `howl` instance in `useGlobalAudioPlayer().load()`. Export `useHowlEventSync` from the package to allow external usage of the events. Resolves the previously closed issues: E-Kuerschner#50, E-Kuerschner#48
hey @kilokeith thanks for the PR! Let's get some of these changes in! First off, I'm curious what your use case is and how you would be using the event sync hook. It's really too technical to be used by devs IMO. Perhaps there is a way we can extend existing API to make it easier to set up your own event listening? But I'll need to know more about your use case before I can offer any ideas Regarding |
For sure, I was wondering if something like
I didn't really have any plans Turns out I didn't need any of these added features by the time I finished my project. I wanted to share the audio context with a media recorder so that I could record the screen and get audio without accessing mic permissions or anything extra. But that doesn't come form the howler instances, it's part of the Howler window global. What I could have used most of all was:
|
hey @kilokeith i love those ideas. if you have a moment can you elaborate on this point?
|
@E-Kuerschner I may be able to chime in here. Are you familiar with Ableton Live or any DAW for music production? I believe Keith is stating it'd be nice to be able to display a list of audio files (like drums / vocalist / etc) and load all of them at once so that you could click "play" and have all audio files play in sync at once. I believe he also says it would be difficult to create multiple instances of hooks since those audio files would be dynamic and would need to be loaded from storage thus not knowing how many instances of the hook to create. @kilokeith correct me if I'm on the wrong path though. I'm coming back to this package after successfully using this in production with this very exact request (made a PR like a year ago if you remember haha) My search for this feature started from the Howler library where I found an open issue so maybe this helps give you an understanding of what I'd like to have achieved as well goldfire/howler.js#672 Thanks for actively maintaining this library! |
Gotcha - I'm tracking! @uncvrd do you think you would mind opening up an Issue/Feature request so that we can discuss and track this there? I'm going to close out this pull request shortly. If you could just list out the high level requirements you think the feature should follow that would be awesome. As for an API, I was considering introducing an abstraction for an audio bus which the programmer can create and programmatically add sounds too; maybe something similar to this:
|
@E-Kuerschner is there any chance this might be merged/released? I'm also looking to get access to the underlying Howl instance to be able to get the |
Prior to v2 the Howler instance was exposed. I needed access to the Howler api to get the audio context for recording.
This PR attempts to add back that ability by adding a
getHowl()
method to the hooks.I also wanted to expose
useHowlEventSync
so that the events could be listened to outside the hooks.getHowl
as Howl toAudioPlayer
.getHowl
touseAudioPlayer
.howl
instance inuseAudioPlayer().load()
.getHowl
touseGlobalAudioPlayer
.howl
instance inuseGlobalAudioPlayer().load()
.useHowlEventSync
from the package to allow external usage of the events.Resolves the previously closed issues: #50 (resolved by this PR ).