The useAudioPosition hook stores its own position state and encapsulates its own seek function. This doesn't allow a developer to use multiple instances of the hook and maintain synchronized stated when seek is invoked from one of them.
An example use case would be this: A developer has a seek bar component and a separate time component. When seek is invoked from within the seek bar component the position in both the seek bar and time components should be the same.
A separate React context for holding position state may be necessary so that consumers of the other player state (duration, isPlaying, etc.) do not rerender constantly as the position changes every second.
The useAudioPosition hook stores its own position state and encapsulates its own
seek
function. This doesn't allow a developer to use multiple instances of the hook and maintain synchronized stated when seek is invoked from one of them.An example use case would be this: A developer has a seek bar component and a separate time component. When
seek
is invoked from within the seek bar component the position in both the seek bar and time components should be the same.A separate React context for holding position state may be necessary so that consumers of the other player state (duration, isPlaying, etc.) do not rerender constantly as the position changes every second.