Skip to content

Limit playback position changes when switching episodes #3383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2025

Conversation

bjtitus
Copy link
Contributor

@bjtitus bjtitus commented Aug 1, 2025

Fixes #1359

When the changes position command from the lock screen happens while we are switching episodes, it seems that we sometimes run into race conditions where the episode is skipped. The remote command doesn't give us any info about the media item but we can track when the episode changes from our own internal notifications. For now, I've set a delay of 2 seconds since that seems like a reasonable amount of time where trying again would work.

The limitPlaybackPositionChanges flag controls these changes.

To test

Episode switching

  • Load several episodes in your Up Next queue. Ideally these should be unplayed so they aren't pre-cached. Also, make sure you know the order so you know whether one is skipped.
  • Play the first
  • Scrub to the end of the episode
  • ✅ Ensure the next episode from the queue is played
  • Repeat scrubbing and skipping
  • Try this with and without Trim Silence enabled

Normal scrubbing

  • Play an episode
  • Scrub from the lock screen
  • ✅ Ensure scrubbing works as expected and seeks to the proper position

One way you can tell this is being caught without checking the logs is that the scrub command may provide haptic feedback when it fails, this should mean the new code caught the case and, if you try again, scrubbing will work.

Checklist

  • I have considered if this change warrants user-facing release notes and have added them to CHANGELOG.md if necessary.
  • I have considered adding unit tests for my changes.
  • I have updated (or requested that someone edit) the spreadsheet to reflect any new or changed analytics.

When the changes position on the scrubber from the lock screen and we are switching episodes, it seems that we sometimes run into race conditions where the episode is skipped. The remote command doesn't give us any info about the media item but we can track when the episode changes from our own internal notifications. For now, I've set a delay of 2 seconds since that seems like a reasonable amount of time where trying again would work.
@bjtitus bjtitus requested a review from a team as a code owner August 1, 2025 03:33
@bjtitus bjtitus requested review from danielebogo and removed request for a team August 1, 2025 03:33
@bjtitus bjtitus added this to the 7.95 milestone Aug 1, 2025
@bjtitus bjtitus added the playback Issues related to playback label Aug 1, 2025
@bjtitus bjtitus requested a review from SergioEstevao August 1, 2025 03:34
if FeatureFlag.limitPlaybackPositionChanges.enabled {
// Check if we're still in the limiting window after an episode change
if let switchTime = episodeSwitchTime,
Date().timeIntervalSince(switchTime) < 2.0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit: Can we switch Date() to Date.now just find it a bit more explicit that is current date.

Copy link
Contributor

@SergioEstevao SergioEstevao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working correctly just left a small nit.

@bjtitus bjtitus merged commit 865bfc9 into trunk Aug 1, 2025
4 of 6 checks passed
@bjtitus bjtitus deleted the bjtitus/scrubber-skip-fix branch August 1, 2025 15:39
Copy link

sentry-io bot commented Aug 10, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
playback Issues related to playback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate: After Scrubbing Playback to the Right, the Next Episode Starts From Middle/End or Is Skipped
2 participants