Closed myagoo closed 4 years ago
If I set an initial playbackRate or volume other than 1 and never change them, it will have no effect. Instead I must use the play options as follow play({playbackRate: 0.5}).
play({playbackRate: 0.5})
This is because there is no sound when the following effect run for the first (and in my case, also last) time: https://github.com/joshwcomeau/use-sound/blob/master/src/index.ts#L74
The workaround is to use the play options instead.
Anyway, great work and great blog post ! I'm working on a side project that will make good use of sounds (I hope) thanks to you !
trying to circumvent rules-of-hooks is always risky. Maybe you could try to set initial options here : https://github.com/joshwcomeau/use-sound/blob/master/src/index.ts#L56
If I set an initial playbackRate or volume other than 1 and never change them, it will have no effect. Instead I must use the play options as follow
play({playbackRate: 0.5})
.This is because there is no sound when the following effect run for the first (and in my case, also last) time: https://github.com/joshwcomeau/use-sound/blob/master/src/index.ts#L74
The workaround is to use the play options instead.
Anyway, great work and great blog post ! I'm working on a side project that will make good use of sounds (I hope) thanks to you !