Skip to content

fix(ios): preserve playback speed after pause/resume and audio interruptions#146

Open
notsuhas wants to merge 1 commit intoevergrace-co:mainfrom
notsuhas:fix/playback-speed-reset-on-resume
Open

fix(ios): preserve playback speed after pause/resume and audio interruptions#146
notsuhas wants to merge 1 commit intoevergrace-co:mainfrom
notsuhas:fix/playback-speed-reset-on-resume

Conversation

@notsuhas
Copy link

@notsuhas notsuhas commented Jan 28, 2026

Summary

  • Fix playback speed resetting to 1.0x on resume — AVPlayer.play() implicitly sets rate = 1.0, discarding the stored currentPlaybackSpeed
  • Fix the same issue in the audio interruption handler (e.g., phone call, Siri), where speed was also lost on resume
  • Update updateNowPlayingInfo calls to use currentPlaybackSpeed instead of hardcoded 1.0 so lock screen controls reflect the correct rate

Root Cause

AVPlayer.play() is equivalent to setting rate = 1.0. Both resume() and the interruption-ended handler called player?.play() without restoring the custom
rate afterward.

Android is unaffected — Media3's play() sets playWhenReady = true without changing PlaybackParameters.

Test plan

  • Play audio, set speed to 1.5x or 2x
  • Pause, then resume — speed should remain at the set value
  • While playing at non-1.0 speed, trigger an audio interruption (e.g., Siri) and verify speed is preserved after interruption ends
  • Verify lock screen now-playing info shows the correct playback rate

@notsuhas
Copy link
Author

@bradfloodx please do check this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant