feat(musik): tambahkan extensive debug logging untuk tracking seek issue

- Tambah key stabil pada audio element untuk mencegah remount
- Log di seekTo: before/after currentTime
- Log di onTimeUpdate: currentTime, rounded, isSeeking
- Log di onChangeEnd slider: value, seekTime
- Log di useEffect song change: currentSong, currentSongIndex
- Log di skipBack/skipForward: index perubahan lagu

Purpose: Track urutan eksekusi dan identifikasi race condition atau re-render yang tidak diinginkan

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-03-02 11:58:40 +08:00
parent 0563f9664f
commit 4d03908f23
2 changed files with 21 additions and 10 deletions

View File

@@ -3,16 +3,23 @@ export function seekTo(
time: number,
setCurrentTime?: (v: number) => void
) {
if (!audioRef.current) return;
if (!audioRef.current) {
console.error('[seekTo] Audio element tidak ada!');
return;
}
console.log('[seekTo] Before seek - currentTime:', audioRef.current.currentTime, 'Target:', time);
// Set waktu audio
audioRef.current.currentTime = time;
console.log('[seekTo] After seek - currentTime:', audioRef.current.currentTime);
// Update state jika provided
if (setCurrentTime) {
setCurrentTime(Math.round(time));
}
// Debug log (bisa dihapus nanti)
// Debug log
console.log('[seekTo] Seek to:', time, 'seconds');
}