diff --git a/src/components/MusicPlayer.tsx b/src/components/MusicPlayer.tsx index 0900e91..c4c8d70 100644 --- a/src/components/MusicPlayer.tsx +++ b/src/components/MusicPlayer.tsx @@ -18,6 +18,7 @@ export default function MusicPlayer() { const [showLyrics, setShowLyrics] = useState(false); const [lyrics, setLyrics] = useState(null); const [isLoadingLyrics, setIsLoadingLyrics] = useState(false); + const [volume, setVolume] = useState(1); const audioRef = useRef(null); @@ -54,6 +55,12 @@ export default function MusicPlayer() { } }, [isPlaying, currentIndex]); + useEffect(() => { + if (audioRef.current) { + audioRef.current.volume = volume; + } + }, [volume]); + const loadLyrics = async (song: Song) => { setIsLoadingLyrics(true); try { @@ -95,7 +102,7 @@ export default function MusicPlayer() {
+
+ + + + + setVolume(parseFloat(e.target.value))} + style={{ flex: 1, accentColor: 'var(--color-primary)' }} + /> +
+ {showLyrics && (
{isLoadingLyrics ? (