- Integrate togglePlayPause, getNextIndex, getPrevIndex, handleRepeatOrNext, seekTo, toggleShuffle, setAudioVolume, toggleMute library functions - Fix ESLint warnings: remove unused eslint-disable, add missing useEffect dependencies - Fix ESLint error in useMusicPlayer.ts togglePlayPause function - Add force-dynamic export to root layout to prevent prerendering errors - Improve seek slider with preview/commit functionality - Add isSeeking state to prevent UI flickering during seek Fixes: Build PageNotFoundError for admin/darmasaba pages Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
22 lines
414 B
TypeScript
22 lines
414 B
TypeScript
import { RefObject } from "react";
|
|
|
|
export function handleRepeatOrNext(
|
|
audioRef: RefObject<HTMLAudioElement | null>,
|
|
isRepeat: boolean,
|
|
playNext: () => void
|
|
) {
|
|
if (!audioRef.current) return;
|
|
|
|
if (isRepeat) {
|
|
audioRef.current.currentTime = 0;
|
|
audioRef.current.play();
|
|
} else {
|
|
playNext();
|
|
}
|
|
}
|
|
|
|
//dipakai di ui
|
|
|
|
// onEnded={() =>
|
|
// handleRepeatOrNext(audioRef, isRepeat, playNext)
|
|
// }
|