fix(logic): context creation should NOT depend on autoplay setting
CRITICAL LOGIC FIX: The autoplay setting was misunderstood. Corrected behavior: BEFORE (wrong): - Setting controls whether context is created - 'continue' = create context - 'track_only' = clear context AFTER (correct): - Context is ALWAYS created when playing from a source (album/playlist) - Stack icon ALWAYS appears - Setting only affects what happens at END of track: - 'continue' = play next track in context - 'track_only' = stop after current track Why this makes sense: - You're playing from an album = that's the context - Stack icon shows the origin (informative) - Setting controls continuation behavior (not context existence) Also: - Added logging to handleAutoplayModeChange - Will investigate why setting doesn't persist cp
This commit is contained in:
1 parent
f69a7ab461
commit
17cd6f0ae2
2 files changed
+16
-24
No files matched your search
@@ -1120,11 +1120,13 @@
|
||||
}
|
||||
|
||||
async function handleAutoplayModeChange(mode: AutoplayMode) {
|
||||
console.log('[Settings] Changing autoplay mode to:', mode);
|
||||
try {
|
||||
await setAutoplayMode(mode);
|
||||
autoplayMode = mode;
|
||||
console.log('[Settings] Autoplay mode saved successfully');
|
||||
} catch (err) {
|
||||
console.error('Failed to set autoplay mode:', err);
|
||||
console.error('[Settings] Failed to set autoplay mode:', err);
|
||||
showToast('Failed to save autoplay preference', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
+13
-23
@@ -598,32 +598,22 @@
|
||||
async function handleAlbumTrackPlay(track: Track) {
|
||||
console.log('Playing album track:', track);
|
||||
|
||||
// Check autoplay preference and create/clear context
|
||||
const prefs = getCachedPreferences();
|
||||
console.log('[Album] Autoplay preference:', prefs.autoplay_mode);
|
||||
|
||||
// ALWAYS create context when playing from an album
|
||||
// The setting only affects menu options visibility, not implicit behavior
|
||||
if (selectedAlbum?.tracks) {
|
||||
const trackIndex = selectedAlbum.tracks.findIndex(t => t.id === track.id);
|
||||
console.log('[Album] Track index:', trackIndex, 'of', selectedAlbum.tracks.length);
|
||||
const trackIds = selectedAlbum.tracks.map(t => t.id);
|
||||
|
||||
if (prefs.autoplay_mode === 'continue') {
|
||||
// Create album context
|
||||
const trackIds = selectedAlbum.tracks.map(t => t.id);
|
||||
console.log('[Album] Creating context with', trackIds.length, 'tracks, starting at', trackIndex);
|
||||
await setPlaybackContext(
|
||||
'album',
|
||||
selectedAlbum.id,
|
||||
selectedAlbum.title,
|
||||
'qobuz',
|
||||
trackIds,
|
||||
trackIndex >= 0 ? trackIndex : 0
|
||||
);
|
||||
console.log('[Album] Context created for continuous playback');
|
||||
} else {
|
||||
// Clear context for single track playback
|
||||
await clearPlaybackContext();
|
||||
console.log('[Album] Context cleared for single track playback');
|
||||
}
|
||||
console.log('[Album] Creating context with', trackIds.length, 'tracks, starting at', trackIndex);
|
||||
await setPlaybackContext(
|
||||
'album',
|
||||
selectedAlbum.id,
|
||||
selectedAlbum.title,
|
||||
'qobuz',
|
||||
trackIds,
|
||||
trackIndex >= 0 ? trackIndex : 0
|
||||
);
|
||||
console.log('[Album] Context created - stack icon should appear');
|
||||
} else {
|
||||
console.log('[Album] No album tracks found, cannot create context');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user