refactor(musik): integrate music player library functions and fix build errors
- 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>
This commit is contained in:
25
src/app/darmasaba/(pages)/musik/lib/seek.ts
Normal file
25
src/app/darmasaba/(pages)/musik/lib/seek.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export function seekTo(
|
||||
audioRef: React.RefObject<HTMLAudioElement | null>,
|
||||
time: number
|
||||
) {
|
||||
if (!audioRef.current) return;
|
||||
audioRef.current.currentTime = time;
|
||||
}
|
||||
|
||||
|
||||
// import { RefObject } from "react";
|
||||
|
||||
// export function seekTo(
|
||||
// audioRef: RefObject<HTMLAudioElement | null>,
|
||||
// time: number,
|
||||
// setCurrentTime: (v: number) => void
|
||||
// ) {
|
||||
// if (!audioRef.current) return;
|
||||
|
||||
// audioRef.current.currentTime = time;
|
||||
// setCurrentTime(time);
|
||||
// }
|
||||
|
||||
// //pakai di ui
|
||||
|
||||
// // onChange={(v) => seekTo(audioRef, v, setCurrentTime)}
|
||||
Reference in New Issue
Block a user