WIP: Audio context fixes - single context, playback switching, playhead sync improvements
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user