Skip to content
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

Patch: Fix Index Resetting on Removal #59

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

johnnyshankman
Copy link

@johnnyshankman johnnyshankman commented Nov 16, 2024

This PR

This fixes a bug causing the index/trackNumber of the currently playing song to be incorrect after calling removeTrack (or replaceTrack which defers to removeTrack)

Maintains error logging when the index requested is out of bounds, and maintains that it returns early in that case.

Found while developing this PR on my music app hihat

Reproduction of Issue

  1. Load up a track list of three songs.
  2. getIndex() now returns 0
  3. Move to song at index 1
  4. getIndex() now returns 1
  5. Remove or replace the song at index 2
  6. getIndex now returns 0 instead of 1

This causes the currently playing song to do weird things, like pausing and start returning the wrong song info.

QA

The new unit tests which regression test this behavior are passing.

@johnnyshankman johnnyshankman force-pushed the johnny/fix-index-on-remove-error branch from 268d3cd to 978ac27 Compare November 16, 2024 20:58
@@ -331,7 +331,7 @@ declare class Gapless5Source {
isPlayActive: (checkStarting: any) => boolean;
getPosition: () => number;
getLength: () => number;
play: (syncPosition: any) => void;
play: (syncPosition: any, skipCallback: any) => void;
Copy link
Author

Choose a reason for hiding this comment

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

Note: I reran the type generator and this just appeared.

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