fix(web/player): auto-skip a failed track instead of dead-ending on "Try again"
test-web / test (push) Successful in 39s
test-web / test (push) Successful in 39s
A track that fails to load (e.g. a stale system-playlist snapshot pointing at a rebuilt/removed file) hard-set the player to the 'error' state and stranded the user on a "Try again" button that just re-queued the same failing track. Now a load error advances to the next track; the error state only surfaces once the whole queue has proven unplayable — every track failed, or we reached the end. A failure streak capped at queue length stops a fully-broken queue from cycling, and resets on the next successful play. Next (Track B cont.): self-heal a stale system-playlist / radio queue by re-pulling the fresh snapshot on total failure, plus the Android equivalent. Issue #968. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -288,6 +288,24 @@ describe('player store — shuffle + repeat + audio reports', () => {
|
||||
expect(player.state).toBe('error');
|
||||
expect(player.error).toBe('network lost');
|
||||
});
|
||||
|
||||
test('reportStateFromAudio("error") auto-advances past a bad track', () => {
|
||||
playQueue([track('1'), track('2'), track('3')]);
|
||||
reportStateFromAudio('error', 'boom');
|
||||
expect(player.index).toBe(1);
|
||||
expect(player.state).toBe('loading');
|
||||
expect(player.error).toBeNull();
|
||||
});
|
||||
|
||||
test('reportStateFromAudio("error") dead-ends once the whole queue is unplayable', () => {
|
||||
playQueue([track('1'), track('2')]);
|
||||
reportStateFromAudio('error', 'boom'); // track 1 fails → skip to track 2
|
||||
expect(player.index).toBe(1);
|
||||
expect(player.state).toBe('loading');
|
||||
reportStateFromAudio('error', 'boom'); // track 2 also fails → exhausted
|
||||
expect(player.state).toBe('error');
|
||||
expect(player.error).toBe('boom');
|
||||
});
|
||||
});
|
||||
|
||||
import {
|
||||
|
||||
Reference in New Issue
Block a user