E-Kuerschner / useAudioPlayer

React hooks for controlling audio on the web
MIT License
328 stars 36 forks source link

docs: :memo: fix readme error #126

Closed theslantedroom closed 1 year ago

theslantedroom commented 1 year ago
E-Kuerschner commented 1 year ago

hey @theslantedroom I double checked the example apps and I actually don't think the README was incorrect afterall. Feel free to run them for yourself to see what I am talking about. It appears as if the duration is returning the number of seconds. Closing this PR out for now

theslantedroom commented 1 year ago

hey @theslantedroom I double checked the example apps and I actually don't think the README was incorrect afterall. Feel free to run them for yourself to see what I am talking about. It appears as if the duration is returning the number of seconds. Closing this PR out for now

Oh interesting. I didn't try the sample app but used in a project of mine and I'm sure I needed fade(1,0,3000) for a 3 second fade.

Maybe I did something wrong. Never looked at the source code to confirm tho.

theslantedroom commented 1 year ago

hey @theslantedroom I double checked the example apps and I actually don't think the README was incorrect afterall. Feel free to run them for yourself to see what I am talking about. It appears as if the duration is returning the number of seconds. Closing this PR out for now

EDIT: I made a new fixed PR, we are talking about two different 'duration' and I led you to the wrong one via editting the wrong one in my initial PR. Sorry bout that.

On second look I really believe it is in milliseconds.

see the following proof:

this repo source code, looks like useGlobalAudioPlayer() uses https://howlerjs.com/ and calls a howl method also called fade

https://github.com/E-Kuerschner/useAudioPlayer/blob/657620fd3239b5d4ce18e9f9d650822d605ecbb2/src/useGlobalAudioPlayer.ts#L109-L116

Looking at the howler docs, we see that method is documented as milliseconds.

https://github.com/goldfire/howler.js#documentation:~:text=duration%3A%20Number%20Time%20in%20milliseconds%20to%20fade.

This is consistent with what I experienced in practice.