File tree Expand file tree Collapse file tree
packages/mobile/src/components/audio Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -593,6 +593,10 @@ export const AudioPlayer = () => {
593593 }
594594 } , [ ] )
595595
596+ // Single subscription with cleanup on unmount only. handlePlayerStateChange
597+ // is stable (useCallback with [] deps) and only uses refs/TrackPlayer, so
598+ // we avoid re-running this effect to prevent removing the listener during
599+ // track switches (which can break playback when playing a second track).
596600 useEffect ( ( ) => {
597601 const subscription = TrackPlayer . addEventListener (
598602 Event . PlaybackState ,
@@ -602,7 +606,8 @@ export const AudioPlayer = () => {
602606 return ( ) => {
603607 subscription . remove ( )
604608 }
605- } , [ handlePlayerStateChange ] )
609+ // eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: register once, cleanup on unmount only
610+ } , [ ] )
606611
607612 // Seek handler
608613 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments