Fix duration slider

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-01-26 23:26:53 +04:00
parent d5b4133c0a
commit f7ed8ea6db
+4 -4
View File
@@ -116,10 +116,10 @@ export default function Lekte({audio, url, teks}) {
useEffect(() => { useEffect(() => {
audioRef.current.pause() audioRef.current.pause()
setPosition(0)
audioRef.current = new Audio(audio) audioRef.current = new Audio(audio)
setIsPlaying(false) setIsPlaying(false)
setVolume(100) setVolume(100)
setPosition(0)
}, [audio]) }, [audio])
const handleChangePosition = value => { const handleChangePosition = value => {
@@ -161,11 +161,11 @@ export default function Lekte({audio, url, teks}) {
<Slider <Slider
aria-label='time-indicator' aria-label='time-indicator'
size='small' size='small'
defaultValue={0} defaultValue={position}
value={position} value={position || 0}
min={0} min={0}
step={1} step={1}
max={duration} max={duration || 100}
sx={{ sx={{
color: theme.palette.mode === 'dark' ? '#fff' : 'rgba(0,0,0,0.87)', color: theme.palette.mode === 'dark' ? '#fff' : 'rgba(0,0,0,0.87)',
height: 4, height: 4,