[PR #272] [MERGED] map media control Pause and Resume to PlayerRequests #696

Closed
opened 2026-03-02 23:49:25 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/aome510/spotify-player/pull/272
Author: @SebRollen
Created: 10/19/2023
Status: Merged
Merged: 10/20/2023
Merged by: @aome510

Base: masterHead: create-resume-and-paused-events


📝 Commits (1)

  • 4b30905 map media control Pause and Resume to PlayerRequests

📊 Changes

3 files changed (+27 additions, -1 deletions)

View changed files

📝 spotify_player/src/client/mod.rs (+14 -0)
📝 spotify_player/src/event/mod.rs (+2 -0)
📝 spotify_player/src/media_control.rs (+11 -1)

📄 Description

Fixes #271.

Currently, all of MediaControlEvent::{Play, Pause, Toggle} get mapped to PlayerRequest::ResumePause, which means the playback is toggled. In some cases, this means that the media player might send a Pause event, but playback is resumed, because the playback was already paused.

I ran into this issue in #271 where I would disconnect my bluetooth headphones when the playback was already paused, and the player would then resume playback through my computer speakers. Based on the logs, it appears to me that the headphones disconnecting generates a MediaControlEvent::Pause. Instead of resuming the playback, this PR now updates the code to ensure that playback stays paused.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/aome510/spotify-player/pull/272 **Author:** [@SebRollen](https://github.com/SebRollen) **Created:** 10/19/2023 **Status:** ✅ Merged **Merged:** 10/20/2023 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `master` ← **Head:** `create-resume-and-paused-events` --- ### 📝 Commits (1) - [`4b30905`](https://github.com/aome510/spotify-player/commit/4b30905f423ce4fec5d55d55c2b620f524407539) map media control Pause and Resume to PlayerRequests ### 📊 Changes **3 files changed** (+27 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `spotify_player/src/client/mod.rs` (+14 -0) 📝 `spotify_player/src/event/mod.rs` (+2 -0) 📝 `spotify_player/src/media_control.rs` (+11 -1) </details> ### 📄 Description Fixes #271. Currently, all of MediaControlEvent::{Play, Pause, Toggle} get mapped to PlayerRequest::ResumePause, which means the playback is toggled. In some cases, this means that the media player might send a `Pause` event, but playback is resumed, because the playback was already paused. I ran into this issue in #271 where I would disconnect my bluetooth headphones when the playback was already paused, and the player would then resume playback through my computer speakers. Based on the logs, it appears to me that the headphones disconnecting generates a `MediaControlEvent::Pause`. Instead of resuming the playback, this PR now updates the code to ensure that playback stays paused. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:49:25 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#696
No description provided.