Commit 62b9653
Refactor mobile AudioPlayer: simplify queue management (#14220)
## Summary
- Replace middle-out serial enqueue with batch `Promise.all` resolution
— tracks load concurrently instead of one-by-one
- Split `handleQueueChange` into `resetQueue()` and `appendToQueue()`
for clarity
- Remove polling loop, abort controller, and `enqueueTracksJobRef` — no
longer needed with batch loading
- Extract 920-line monolith into 4 focused hooks: `useAudioPlayerSetup`,
`useQueueSync`, `usePlaybackEvents`, `usePlaybackControls`,
`useRecordListen`
- Remove 7 trivial `useCallback` dispatch wrappers, dead code, duplicate
`getProgress()` call, inline genre checks → `isLongFormContent()`
utility
- Preserves the lineup race condition fix (queueListRef vs queueTrackIds
guard)
## Test plan
- [ ] Play a track from Feed, switch to Trending, play a track there —
correct track plays (no wrong-lineup bug)
- [ ] Skip forward/backward within a lineup — tracks play in correct
order
- [ ] Verify queue append works (e.g. autoplay adds tracks at end)
- [ ] Test gated content skipping (track without access auto-skips)
- [ ] Test podcast/audiobook playback rate and position restore
- [ ] Lock screen controls work (play/pause/skip/seek)
- [ ] Offline playback still works
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 432167f commit 62b9653
1 file changed
Lines changed: 473 additions & 514 deletions
0 commit comments