In the event ontimeupdate I pass the value of currentTime to the Slider and it works correctly, the bar advances and covers the range of audio duration.
But the problem is that it is not a fluid movement, it makes little jumps. I have the step property of the Slider set to 0.01 but it seems to be detected only when dragging, but not automatic movement.
In Angular I have a similar application with mat-slider and I do not have this problem that arises in React.
audioEl.current.ontimeupdate = () =>{
setCurrentTime(audioEl.current.currentTime)
setSliderValue(audioEl.current.currentTime);
}
const handleChange = (event, newValue) => {
setSliderValue(newValue);
setCurrentTime(newValue)
audioEl.current.currentTime = newValue;
};
<Slider aria-label="Current time" step={0.01} value={sliderValue} onChange={handleChange} min={0} max={duration}/>
Thanks! :)