WIP: Audio context fixes - single context, playback switching, playhead sync improvements

This commit is contained in:
Mistral Vibe
2026-04-08 16:52:10 +02:00
parent e8862d99b3
commit 5f95d88741
5 changed files with 147 additions and 41 deletions

View File

@@ -91,10 +91,10 @@ export function useWaveform(
setCurrentSong(options.songId, options.bandId);
}
// If this is the same song that was playing globally, restore play state
// If this is the currently playing song, restore play state
if (options.songId && options.bandId &&
currentSongId === options.songId &&
globalBandId === options.bandId &&
currentPlayingSongId === options.songId &&
currentPlayingBandId === options.bandId &&
globalIsPlaying) {
@@ -103,7 +103,7 @@ export function useWaveform(
const checkReady = setInterval(() => {
if (audioService.getDuration() > 0) {
clearInterval(checkReady);
audioService.play();
audioService.play(options.songId, options.bandId);
if (globalCurrentTime > 0) {
audioService.seekTo(globalCurrentTime);
}
@@ -136,7 +136,7 @@ export function useWaveform(
const play = () => {
try {
audioService.play();
audioService.play(options.songId || null, options.bandId || null);
} catch (error) {
console.error('useWaveform.play failed:', error);
}