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

fix: prevent 'called pause from invalid state' warning #1363

Closed

Conversation

ThomasFrans
Copy link
Contributor

Calling pause() on the Librespot player while it is already paused generates a warning. Don't call pause when the player is already paused.

Describe your changes

  • Don't send Pause to the player when it's already paused during queue setup

Issue ticket number and link

Checklist before requesting a review

  • Documentation was updated (i.e. due to changes in keybindings, commands, etc.)
  • Changelog was updated with relevant user-facing changes (eg. not dependency updates,
    not performance improvements, etc.)

@ThomasFrans
Copy link
Contributor Author

I think this is correct, but the code still seems a bit weird to me. I don't understand why it calls pause() on the Spotify struct if the song was loaded with start_play set to true. From what I understand, it would only need to check for the PlaybackState::Stopped case and stop the player if it matches. The others are all handled by loading with playback_state == PlaybackState::Playing. I don't fully understand how PlaybackState::Default works so I might be wrong here.

Calling `pause()` on the Librespot player while it is already paused
generates a warning. Don't call pause when the player is already paused.
@ThomasFrans ThomasFrans force-pushed the fix-player-invalid-state branch from b1272a6 to aca4f54 Compare January 4, 2024 16:12
@ThomasFrans ThomasFrans marked this pull request as draft January 4, 2024 16:27
@ThomasFrans ThomasFrans closed this Feb 5, 2024
@ThomasFrans ThomasFrans deleted the fix-player-invalid-state branch February 8, 2024 12:13
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