[GH-ISSUE #271] spotify_player resumes playback on bluetooth headphone disconnect. #140

Closed
opened 2026-03-02 23:44:55 +03:00 by kerem · 1 comment
Owner

Originally created by @SebRollen on GitHub (Oct 17, 2023).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/271

Describe the bug
A clear and concise description of what the bug is.

When I disconnect my bluetooth headphones from my computer (either by manually turning the off or disconnecting them from my connected bluetooth devices, or by moving out of range of my computer with my headphones), spotify-player resumes playback of the current track even if it was previously paused. This means that my computer often ends up playing music unexpectedly out of its speakers,

To Reproduce
Steps to reproduce the behavior.

  1. Build spotify-player with media controls.
  2. Connect bluetooth headphones to computer.
  3. Open spotify-player and begin playing a track. Sound should be coming out of the headphones at this point.
  4. Pause the playing track.
  5. Disconnect the bluetooth headphones. At this point, spotify-player unpauses the playing track, and plays music out of the computer speakers.

Expected behavior
A clear and concise description of what you expected to happen.
If the current track is paused when the bluetooth headphones are disconnected, it should remain paused.
If the current track is playing when the headphones are disconnected, I have less of a strong view of what the behavior should be.

Log and backtrace
Reference log and backtrace, which are usually located in $HOME/.cache/spotify-player/, of a run reproducing the bug.

Backtrace is empty.

Log:

2023-10-17T13:22:52.669195Z  INFO spotify_player: General configurations: AppConfig { theme: "nord", client_id: "REDACTED", client_port: 8080, copy_command: Command { command: "pbcopy", args: [] }, playback_format: "{track} • {artists}\n{album}\n{metadata}", tracks_playback_limit: 50, proxy: None, ap_port: None, app_refresh_duration_in_ms: 32, playback_refresh_duration_in_ms: 0, cover_image_refresh_duration_in_ms: 2000, page_size_in_rows: 20, track_table_item_max_len: 32, play_icon: "▶", pause_icon: "▌▌", liked_icon: "♥", border_type: Plain, progress_bar_type: Rectangle, playback_window_position: Top, cover_img_length: 9, cover_img_width: 5, cover_img_scale: 1.0, playback_window_width: 6, enable_media_control: true, enable_streaming: true, enable_cover_image_cache: true, default_device: "spotify-player", device: DeviceConfig { name: "spotify-player", device_type: "speaker", volume: 100, bitrate: 160, audio_cache: false } }
2023-10-17T13:22:52.669739Z  INFO spotify_player: Theme configurations: ThemeConfig { themes: [Theme { name: "default", palette: Palette { background: None, foreground: None, black: Color { color: Black }, blue: Color { color: LightBlue }, cyan: Color { color: LightCyan }, green: Color { color: LightGreen }, magenta: Color { color: LightMagenta }, red: Color { color: LightRed }, white: Color { color: Gray }, yellow: Color { color: LightYellow }, bright_black: Color { color: DarkGray }, bright_white: Color { color: White }, bright_red: Color { color: Red }, bright_magenta: Color { color: Magenta }, bright_green: Color { color: Green }, bright_cyan: Color { color: Cyan }, bright_blue: Color { color: Blue }, bright_yellow: Color { color: Yellow } }, component_style: ComponentStyle { block_title: None, border: None, playback_track: None, playback_artists: None, playback_album: None, playback_metadata: None, playback_progress_bar: None, current_playing: None, page_desc: None, table_header: None, selection: None } }, Theme { name: "nord", palette: Palette { background: Some(Color { color: Rgb(46, 52, 64) }), foreground: Some(Color { color: Rgb(216, 222, 233) }), black: Color { color: Rgb(59, 66, 82) }, blue: Color { color: Rgb(189, 147, 249) }, cyan: Color { color: Rgb(143, 188, 187) }, green: Color { color: Rgb(229, 233, 240) }, magenta: Color { color: Rgb(180, 142, 173) }, red: Color { color: Rgb(255, 85, 85) }, white: Color { color: Rgb(187, 187, 187) }, yellow: Color { color: Rgb(136, 192, 208) }, bright_black: Color { color: Rgb(67, 76, 94) }, bright_white: Color { color: Rgb(255, 255, 255) }, bright_red: Color { color: Rgb(255, 85, 85) }, bright_magenta: Color { color: Rgb(255, 121, 198) }, bright_green: Color { color: Rgb(80, 250, 123) }, bright_cyan: Color { color: Rgb(139, 233, 253) }, bright_blue: Color { color: Rgb(189, 147, 249) }, bright_yellow: Color { color: Rgb(241, 250, 140) } }, component_style: ComponentStyle { block_title: Some(Style { fg: Some(Magenta), bg: None, modifiers: [] }), border: Some(Style { fg: None, bg: None, modifiers: [] }), playback_track: Some(Style { fg: Some(Cyan), bg: None, modifiers: [Bold] }), playback_artists: Some(Style { fg: Some(Cyan), bg: None, modifiers: [Bold] }), playback_album: Some(Style { fg: Some(Yellow), bg: None, modifiers: [] }), playback_metadata: Some(Style { fg: Some(BrightBlack), bg: None, modifiers: [] }), playback_progress_bar: Some(Style { fg: Some(Green), bg: Some(BrightBlack), modifiers: [] }), current_playing: Some(Style { fg: Some(Green), bg: None, modifiers: [Bold] }), page_desc: Some(Style { fg: Some(Cyan), bg: None, modifiers: [Bold] }), table_header: Some(Style { fg: Some(Blue), bg: None, modifiers: [] }), selection: Some(Style { fg: None, bg: None, modifiers: [Bold, Reversed] }) } }] }
2023-10-17T13:22:52.670299Z  INFO spotify_player: Keymap configurations: KeymapConfig { keymaps: [Keymap { key_sequence: KeySequence { keys: [None(Char('n'))] }, command: NextTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('p'))] }, command: PreviousTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('.'))] }, command: PlayRandom }, Keymap { key_sequence: KeySequence { keys: [None(Char(' '))] }, command: ResumePause }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('r'))] }, command: Repeat }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('s'))] }, command: Shuffle }, Keymap { key_sequence: KeySequence { keys: [None(Char('+'))] }, command: VolumeUp }, Keymap { key_sequence: KeySequence { keys: [None(Char('-'))] }, command: VolumeDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('>'))] }, command: SeekForward }, Keymap { key_sequence: KeySequence { keys: [None(Char('<'))] }, command: SeekBackward }, Keymap { key_sequence: KeySequence { keys: [None(Enter)] }, command: ChooseSelected }, Keymap { key_sequence: KeySequence { keys: [None(Char('r'))] }, command: RefreshPlayback }, Keymap { key_sequence: KeySequence { keys: [None(Char('/'))] }, command: Search }, Keymap { key_sequence: KeySequence { keys: [None(Char('z'))] }, command: Queue }, Keymap { key_sequence: KeySequence { keys: [None(Char('Z'))] }, command: AddSelectedItemToQueue }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char(' '))] }, command: ShowActionsOnSelectedItem }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('a'))] }, command: ShowActionsOnSelectedItem }, Keymap { key_sequence: KeySequence { keys: [None(Char('a'))] }, command: ShowActionsOnCurrentTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('R'))] }, command: RestartIntegratedClient }, Keymap { key_sequence: KeySequence { keys: [None(Tab)] }, command: FocusNextWindow }, Keymap { key_sequence: KeySequence { keys: [None(BackTab)] }, command: FocusPreviousWindow }, Keymap { key_sequence: KeySequence { keys: [None(Char('T'))] }, command: SwitchTheme }, Keymap { key_sequence: KeySequence { keys: [None(Char('D'))] }, command: SwitchDevice }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('p'))] }, command: BrowseUserPlaylists }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('a'))] }, command: BrowseUserFollowedArtists }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('A'))] }, command: BrowseUserSavedAlbums }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char(' '))] }, command: CurrentlyPlayingContextPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('t'))] }, command: TopTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('r'))] }, command: RecentlyPlayedTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('y'))] }, command: LikedTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('L'))] }, command: LyricPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('l'))] }, command: LyricPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('l'))] }, command: LibraryPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('s'))] }, command: SearchPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('b'))] }, command: BrowsePage }, Keymap { key_sequence: KeySequence { keys: [None(Backspace)] }, command: PreviousPage }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('q'))] }, command: PreviousPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('?'))] }, command: OpenCommandHelp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('h'))] }, command: OpenCommandHelp }, Keymap { key_sequence: KeySequence { keys: [None(Char('q'))] }, command: Quit }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('c'))] }, command: Quit }, Keymap { key_sequence: KeySequence { keys: [None(Esc)] }, command: ClosePopup }, Keymap { key_sequence: KeySequence { keys: [None(Char('j'))] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('n'))] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Down)] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('k'))] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('p'))] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(Up)] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(PageUp)] }, command: PageSelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('b'))] }, command: PageSelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(PageDown)] }, command: PageSelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('f'))] }, command: PageSelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('g'))] }, command: SelectFirstOrScrollToTop }, Keymap { key_sequence: KeySequence { keys: [None(Home)] }, command: SelectFirstOrScrollToTop }, Keymap { key_sequence: KeySequence { keys: [None(Char('G'))] }, command: SelectLastOrScrollToBottom }, Keymap { key_sequence: KeySequence { keys: [None(End)] }, command: SelectLastOrScrollToBottom }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('t'))] }, command: SortTrackByTitle }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('a'))] }, command: SortTrackByArtists }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('A'))] }, command: SortTrackByAlbum }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('d'))] }, command: SortTrackByDuration }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('D'))] }, command: SortTrackByAddedDate }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('r'))] }, command: ReverseTrackOrder }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('k'))] }, command: MovePlaylistItemUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('j'))] }, command: MovePlaylistItemDown }] }
2023-10-17T13:22:53.191192Z  INFO spotify_player::auth: Successfully used the cached credentials to create a new session!
2023-10-17T13:22:53.193802Z  INFO spotify_player::token: Getting new authentication token...
2023-10-17T13:22:53.377969Z  INFO spotify_player::token: Got new token: Token { access_token: "REDACTED", expires_in: Duration { secs: 3600, nanos: 0 }, expires_at: Some(2023-10-17T14:22:53.377960Z), refresh_token: None, scopes: {} }
2023-10-17T13:22:53.378116Z  INFO spotify_player::streaming: Application's connect configurations: ConnectConfig { name: "spotify-player", device_type: Speaker, initial_volume: Some(65535), has_volume_ctrl: true, autoplay: false }
2023-10-17T13:22:53.379063Z  INFO spotify_player::streaming: Initializing a new integrated player with device_id=75655a38-1e1b-4ae0-903e-b815b51a72f1
2023-10-17T13:22:53.379174Z  INFO spotify_player::streaming: Starting an integrated Spotify player using librespot's spirc protocol
2023-10-17T13:22:53.614130Z  INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 }
2023-10-17T13:22:53.669336Z  INFO spotify_player: No playback found on startup, trying to connect to an available device...
2023-10-17T13:22:53.669521Z  INFO spotify_player::cli::client: Starting a client socket at 127.0.0.1:8080
2023-10-17T13:22:53.670313Z  INFO spotify_player::media_control: Initializing application's media control event watcher...
2023-10-17T13:22:53.771071Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 101ms
2023-10-17T13:22:53.783560Z  INFO client_request{request=GetCurrentUser}: spotify_player::client: successfully handled the client request, took: 113ms
2023-10-17T13:22:53.815883Z  INFO client_request{request=GetUserFollowedArtists}: spotify_player::client: successfully handled the client request, took: 145ms
2023-10-17T13:22:53.890053Z  INFO client_request{request=GetUserPlaylists}: spotify_player::client: successfully handled the client request, took: 219ms
2023-10-17T13:22:54.019127Z  INFO client_request{request=GetUserSavedTracks}: spotify_player::client: successfully handled the client request, took: 348ms
2023-10-17T13:22:54.191225Z  INFO client_request{request=GetUserSavedAlbums}: spotify_player::client: successfully handled the client request, took: 520ms
2023-10-17T13:22:54.780126Z  INFO client_request{request=ConnectDevice(None)}: spotify_player::client: Available devices: []
2023-10-17T13:22:54.780180Z  INFO client_request{request=ConnectDevice(None)}: spotify_player::client: Trying to connect to device (id=75655a38-1e1b-4ae0-903e-b815b51a72f1)
2023-10-17T13:22:55.199156Z  INFO spotify_player::streaming: Got an event from the integrated player: Started { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 21 }
2023-10-17T13:22:55.199231Z  INFO spotify_player::streaming: Got an event from the integrated player: Loading { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 21 }
2023-10-17T13:22:55.217524Z  INFO client_request{request=ConnectDevice(None)}: spotify_player::client: Connection succeeded (device_id=75655a38-1e1b-4ae0-903e-b815b51a72f1)!
2023-10-17T13:22:55.217618Z  INFO client_request{request=ConnectDevice(None)}: spotify_player::client: successfully handled the client request, took: 1547ms
2023-10-17T13:22:55.294875Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 95ms
2023-10-17T13:22:55.296613Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 97ms
2023-10-17T13:22:56.351378Z  INFO spotify_player::streaming: Got an event from the integrated player: Paused { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 20, duration_ms: 162501 }
2023-10-17T13:22:56.455604Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 104ms
2023-10-17T13:22:58.679242Z  INFO spotify_player::client: Retrieving an image from the file: /Users/rollen/.cache/spotify-player/image/TRON: Legacy - The Complete Edition (Original Motion Picture Soundtrack)-Daft Punk-cover.jpg
2023-10-17T13:22:58.679890Z  INFO spotify_player::client: Retrieving an image from the file: /Users/rollen/.cache/spotify-player/image/TRON: Legacy - The Complete Edition (Original Motion Picture Soundtrack)-Daft Punk-cover.jpg
2023-10-17T13:23:00.995884Z  INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 }
2023-10-17T13:23:00.999010Z  INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 20, duration_ms: 162501 }
2023-10-17T13:23:00.999037Z  INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 20, duration_ms: 162501 }
2023-10-17T13:23:01.010097Z  INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 268ms
2023-10-17T13:23:01.214771Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 215ms
2023-10-17T13:23:01.252894Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 253ms
2023-10-17T13:23:01.270841Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 271ms
2023-10-17T13:23:04.969595Z  INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 354ms
2023-10-17T13:23:04.993875Z  INFO spotify_player::streaming: Got an event from the integrated player: Paused { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4608, duration_ms: 162501 }
2023-10-17T13:23:05.214345Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 220ms
2023-10-17T13:23:07.146417Z  INFO spotify_player::media_control: Got a media control event: Pause
2023-10-17T13:23:07.409728Z  INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 }
2023-10-17T13:23:07.409808Z  INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4608, duration_ms: 162501 }
2023-10-17T13:23:07.410002Z  INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4631, duration_ms: 162501 }
2023-10-17T13:23:07.420551Z  INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 273ms
2023-10-17T13:23:07.626386Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 216ms
2023-10-17T13:23:07.643873Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 233ms
2023-10-17T13:23:07.684584Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 274ms
2023-10-17T13:23:10.788748Z  INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 262ms
2023-10-17T13:23:10.806242Z  INFO spotify_player::streaming: Got an event from the integrated player: Paused { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 8486, duration_ms: 162501 }
2023-10-17T13:23:11.034363Z  INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 227ms

Screenshots
If applicable, add screenshots to help explain your problem.

Environment

  • OS: macOS
  • Application version: Monterey 12.1
  • Application features: lyric-finder, image

Additional context
Add any other context about the problem here.

Originally created by @SebRollen on GitHub (Oct 17, 2023). Original GitHub issue: https://github.com/aome510/spotify-player/issues/271 **Describe the bug** A clear and concise description of what the bug is. When I disconnect my bluetooth headphones from my computer (either by manually turning the off or disconnecting them from my connected bluetooth devices, or by moving out of range of my computer with my headphones), spotify-player resumes playback of the current track even if it was previously paused. This means that my computer often ends up playing music unexpectedly out of its speakers, **To Reproduce** Steps to reproduce the behavior. 1. Build spotify-player with media controls. 2. Connect bluetooth headphones to computer. 3. Open spotify-player and begin playing a track. Sound should be coming out of the headphones at this point. 4. Pause the playing track. 5. Disconnect the bluetooth headphones. At this point, spotify-player unpauses the playing track, and plays music out of the computer speakers. **Expected behavior** A clear and concise description of what you expected to happen. If the current track _is paused_ when the bluetooth headphones are disconnected, it should remain paused. If the current track _is playing_ when the headphones are disconnected, I have less of a strong view of what the behavior should be. **Log and backtrace** Reference log and backtrace, which are usually located in `$HOME/.cache/spotify-player/`, of a run reproducing the bug. Backtrace is empty. Log: ``` 2023-10-17T13:22:52.669195Z INFO spotify_player: General configurations: AppConfig { theme: "nord", client_id: "REDACTED", client_port: 8080, copy_command: Command { command: "pbcopy", args: [] }, playback_format: "{track} • {artists}\n{album}\n{metadata}", tracks_playback_limit: 50, proxy: None, ap_port: None, app_refresh_duration_in_ms: 32, playback_refresh_duration_in_ms: 0, cover_image_refresh_duration_in_ms: 2000, page_size_in_rows: 20, track_table_item_max_len: 32, play_icon: "▶", pause_icon: "▌▌", liked_icon: "♥", border_type: Plain, progress_bar_type: Rectangle, playback_window_position: Top, cover_img_length: 9, cover_img_width: 5, cover_img_scale: 1.0, playback_window_width: 6, enable_media_control: true, enable_streaming: true, enable_cover_image_cache: true, default_device: "spotify-player", device: DeviceConfig { name: "spotify-player", device_type: "speaker", volume: 100, bitrate: 160, audio_cache: false } } 2023-10-17T13:22:52.669739Z INFO spotify_player: Theme configurations: ThemeConfig { themes: [Theme { name: "default", palette: Palette { background: None, foreground: None, black: Color { color: Black }, blue: Color { color: LightBlue }, cyan: Color { color: LightCyan }, green: Color { color: LightGreen }, magenta: Color { color: LightMagenta }, red: Color { color: LightRed }, white: Color { color: Gray }, yellow: Color { color: LightYellow }, bright_black: Color { color: DarkGray }, bright_white: Color { color: White }, bright_red: Color { color: Red }, bright_magenta: Color { color: Magenta }, bright_green: Color { color: Green }, bright_cyan: Color { color: Cyan }, bright_blue: Color { color: Blue }, bright_yellow: Color { color: Yellow } }, component_style: ComponentStyle { block_title: None, border: None, playback_track: None, playback_artists: None, playback_album: None, playback_metadata: None, playback_progress_bar: None, current_playing: None, page_desc: None, table_header: None, selection: None } }, Theme { name: "nord", palette: Palette { background: Some(Color { color: Rgb(46, 52, 64) }), foreground: Some(Color { color: Rgb(216, 222, 233) }), black: Color { color: Rgb(59, 66, 82) }, blue: Color { color: Rgb(189, 147, 249) }, cyan: Color { color: Rgb(143, 188, 187) }, green: Color { color: Rgb(229, 233, 240) }, magenta: Color { color: Rgb(180, 142, 173) }, red: Color { color: Rgb(255, 85, 85) }, white: Color { color: Rgb(187, 187, 187) }, yellow: Color { color: Rgb(136, 192, 208) }, bright_black: Color { color: Rgb(67, 76, 94) }, bright_white: Color { color: Rgb(255, 255, 255) }, bright_red: Color { color: Rgb(255, 85, 85) }, bright_magenta: Color { color: Rgb(255, 121, 198) }, bright_green: Color { color: Rgb(80, 250, 123) }, bright_cyan: Color { color: Rgb(139, 233, 253) }, bright_blue: Color { color: Rgb(189, 147, 249) }, bright_yellow: Color { color: Rgb(241, 250, 140) } }, component_style: ComponentStyle { block_title: Some(Style { fg: Some(Magenta), bg: None, modifiers: [] }), border: Some(Style { fg: None, bg: None, modifiers: [] }), playback_track: Some(Style { fg: Some(Cyan), bg: None, modifiers: [Bold] }), playback_artists: Some(Style { fg: Some(Cyan), bg: None, modifiers: [Bold] }), playback_album: Some(Style { fg: Some(Yellow), bg: None, modifiers: [] }), playback_metadata: Some(Style { fg: Some(BrightBlack), bg: None, modifiers: [] }), playback_progress_bar: Some(Style { fg: Some(Green), bg: Some(BrightBlack), modifiers: [] }), current_playing: Some(Style { fg: Some(Green), bg: None, modifiers: [Bold] }), page_desc: Some(Style { fg: Some(Cyan), bg: None, modifiers: [Bold] }), table_header: Some(Style { fg: Some(Blue), bg: None, modifiers: [] }), selection: Some(Style { fg: None, bg: None, modifiers: [Bold, Reversed] }) } }] } 2023-10-17T13:22:52.670299Z INFO spotify_player: Keymap configurations: KeymapConfig { keymaps: [Keymap { key_sequence: KeySequence { keys: [None(Char('n'))] }, command: NextTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('p'))] }, command: PreviousTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('.'))] }, command: PlayRandom }, Keymap { key_sequence: KeySequence { keys: [None(Char(' '))] }, command: ResumePause }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('r'))] }, command: Repeat }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('s'))] }, command: Shuffle }, Keymap { key_sequence: KeySequence { keys: [None(Char('+'))] }, command: VolumeUp }, Keymap { key_sequence: KeySequence { keys: [None(Char('-'))] }, command: VolumeDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('>'))] }, command: SeekForward }, Keymap { key_sequence: KeySequence { keys: [None(Char('<'))] }, command: SeekBackward }, Keymap { key_sequence: KeySequence { keys: [None(Enter)] }, command: ChooseSelected }, Keymap { key_sequence: KeySequence { keys: [None(Char('r'))] }, command: RefreshPlayback }, Keymap { key_sequence: KeySequence { keys: [None(Char('/'))] }, command: Search }, Keymap { key_sequence: KeySequence { keys: [None(Char('z'))] }, command: Queue }, Keymap { key_sequence: KeySequence { keys: [None(Char('Z'))] }, command: AddSelectedItemToQueue }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char(' '))] }, command: ShowActionsOnSelectedItem }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('a'))] }, command: ShowActionsOnSelectedItem }, Keymap { key_sequence: KeySequence { keys: [None(Char('a'))] }, command: ShowActionsOnCurrentTrack }, Keymap { key_sequence: KeySequence { keys: [None(Char('R'))] }, command: RestartIntegratedClient }, Keymap { key_sequence: KeySequence { keys: [None(Tab)] }, command: FocusNextWindow }, Keymap { key_sequence: KeySequence { keys: [None(BackTab)] }, command: FocusPreviousWindow }, Keymap { key_sequence: KeySequence { keys: [None(Char('T'))] }, command: SwitchTheme }, Keymap { key_sequence: KeySequence { keys: [None(Char('D'))] }, command: SwitchDevice }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('p'))] }, command: BrowseUserPlaylists }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('a'))] }, command: BrowseUserFollowedArtists }, Keymap { key_sequence: KeySequence { keys: [None(Char('u')), None(Char('A'))] }, command: BrowseUserSavedAlbums }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char(' '))] }, command: CurrentlyPlayingContextPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('t'))] }, command: TopTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('r'))] }, command: RecentlyPlayedTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('y'))] }, command: LikedTrackPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('L'))] }, command: LyricPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('l'))] }, command: LyricPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('l'))] }, command: LibraryPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('s'))] }, command: SearchPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('b'))] }, command: BrowsePage }, Keymap { key_sequence: KeySequence { keys: [None(Backspace)] }, command: PreviousPage }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('q'))] }, command: PreviousPage }, Keymap { key_sequence: KeySequence { keys: [None(Char('?'))] }, command: OpenCommandHelp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('h'))] }, command: OpenCommandHelp }, Keymap { key_sequence: KeySequence { keys: [None(Char('q'))] }, command: Quit }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('c'))] }, command: Quit }, Keymap { key_sequence: KeySequence { keys: [None(Esc)] }, command: ClosePopup }, Keymap { key_sequence: KeySequence { keys: [None(Char('j'))] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('n'))] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Down)] }, command: SelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('k'))] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('p'))] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(Up)] }, command: SelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(PageUp)] }, command: PageSelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('b'))] }, command: PageSelectPreviousOrScrollUp }, Keymap { key_sequence: KeySequence { keys: [None(PageDown)] }, command: PageSelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('f'))] }, command: PageSelectNextOrScrollDown }, Keymap { key_sequence: KeySequence { keys: [None(Char('g')), None(Char('g'))] }, command: SelectFirstOrScrollToTop }, Keymap { key_sequence: KeySequence { keys: [None(Home)] }, command: SelectFirstOrScrollToTop }, Keymap { key_sequence: KeySequence { keys: [None(Char('G'))] }, command: SelectLastOrScrollToBottom }, Keymap { key_sequence: KeySequence { keys: [None(End)] }, command: SelectLastOrScrollToBottom }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('t'))] }, command: SortTrackByTitle }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('a'))] }, command: SortTrackByArtists }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('A'))] }, command: SortTrackByAlbum }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('d'))] }, command: SortTrackByDuration }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('D'))] }, command: SortTrackByAddedDate }, Keymap { key_sequence: KeySequence { keys: [None(Char('s')), None(Char('r'))] }, command: ReverseTrackOrder }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('k'))] }, command: MovePlaylistItemUp }, Keymap { key_sequence: KeySequence { keys: [Ctrl(Char('j'))] }, command: MovePlaylistItemDown }] } 2023-10-17T13:22:53.191192Z INFO spotify_player::auth: Successfully used the cached credentials to create a new session! 2023-10-17T13:22:53.193802Z INFO spotify_player::token: Getting new authentication token... 2023-10-17T13:22:53.377969Z INFO spotify_player::token: Got new token: Token { access_token: "REDACTED", expires_in: Duration { secs: 3600, nanos: 0 }, expires_at: Some(2023-10-17T14:22:53.377960Z), refresh_token: None, scopes: {} } 2023-10-17T13:22:53.378116Z INFO spotify_player::streaming: Application's connect configurations: ConnectConfig { name: "spotify-player", device_type: Speaker, initial_volume: Some(65535), has_volume_ctrl: true, autoplay: false } 2023-10-17T13:22:53.379063Z INFO spotify_player::streaming: Initializing a new integrated player with device_id=75655a38-1e1b-4ae0-903e-b815b51a72f1 2023-10-17T13:22:53.379174Z INFO spotify_player::streaming: Starting an integrated Spotify player using librespot's spirc protocol 2023-10-17T13:22:53.614130Z INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 } 2023-10-17T13:22:53.669336Z INFO spotify_player: No playback found on startup, trying to connect to an available device... 2023-10-17T13:22:53.669521Z INFO spotify_player::cli::client: Starting a client socket at 127.0.0.1:8080 2023-10-17T13:22:53.670313Z INFO spotify_player::media_control: Initializing application's media control event watcher... 2023-10-17T13:22:53.771071Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 101ms 2023-10-17T13:22:53.783560Z INFO client_request{request=GetCurrentUser}: spotify_player::client: successfully handled the client request, took: 113ms 2023-10-17T13:22:53.815883Z INFO client_request{request=GetUserFollowedArtists}: spotify_player::client: successfully handled the client request, took: 145ms 2023-10-17T13:22:53.890053Z INFO client_request{request=GetUserPlaylists}: spotify_player::client: successfully handled the client request, took: 219ms 2023-10-17T13:22:54.019127Z INFO client_request{request=GetUserSavedTracks}: spotify_player::client: successfully handled the client request, took: 348ms 2023-10-17T13:22:54.191225Z INFO client_request{request=GetUserSavedAlbums}: spotify_player::client: successfully handled the client request, took: 520ms 2023-10-17T13:22:54.780126Z INFO client_request{request=ConnectDevice(None)}: spotify_player::client: Available devices: [] 2023-10-17T13:22:54.780180Z INFO client_request{request=ConnectDevice(None)}: spotify_player::client: Trying to connect to device (id=75655a38-1e1b-4ae0-903e-b815b51a72f1) 2023-10-17T13:22:55.199156Z INFO spotify_player::streaming: Got an event from the integrated player: Started { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 21 } 2023-10-17T13:22:55.199231Z INFO spotify_player::streaming: Got an event from the integrated player: Loading { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 21 } 2023-10-17T13:22:55.217524Z INFO client_request{request=ConnectDevice(None)}: spotify_player::client: Connection succeeded (device_id=75655a38-1e1b-4ae0-903e-b815b51a72f1)! 2023-10-17T13:22:55.217618Z INFO client_request{request=ConnectDevice(None)}: spotify_player::client: successfully handled the client request, took: 1547ms 2023-10-17T13:22:55.294875Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 95ms 2023-10-17T13:22:55.296613Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 97ms 2023-10-17T13:22:56.351378Z INFO spotify_player::streaming: Got an event from the integrated player: Paused { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 20, duration_ms: 162501 } 2023-10-17T13:22:56.455604Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 104ms 2023-10-17T13:22:58.679242Z INFO spotify_player::client: Retrieving an image from the file: /Users/rollen/.cache/spotify-player/image/TRON: Legacy - The Complete Edition (Original Motion Picture Soundtrack)-Daft Punk-cover.jpg 2023-10-17T13:22:58.679890Z INFO spotify_player::client: Retrieving an image from the file: /Users/rollen/.cache/spotify-player/image/TRON: Legacy - The Complete Edition (Original Motion Picture Soundtrack)-Daft Punk-cover.jpg 2023-10-17T13:23:00.995884Z INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 } 2023-10-17T13:23:00.999010Z INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 20, duration_ms: 162501 } 2023-10-17T13:23:00.999037Z INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 20, duration_ms: 162501 } 2023-10-17T13:23:01.010097Z INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 268ms 2023-10-17T13:23:01.214771Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 215ms 2023-10-17T13:23:01.252894Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 253ms 2023-10-17T13:23:01.270841Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 271ms 2023-10-17T13:23:04.969595Z INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 354ms 2023-10-17T13:23:04.993875Z INFO spotify_player::streaming: Got an event from the integrated player: Paused { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4608, duration_ms: 162501 } 2023-10-17T13:23:05.214345Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 220ms 2023-10-17T13:23:07.146417Z INFO spotify_player::media_control: Got a media control event: Pause 2023-10-17T13:23:07.409728Z INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 } 2023-10-17T13:23:07.409808Z INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4608, duration_ms: 162501 } 2023-10-17T13:23:07.410002Z INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4631, duration_ms: 162501 } 2023-10-17T13:23:07.420551Z INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 273ms 2023-10-17T13:23:07.626386Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 216ms 2023-10-17T13:23:07.643873Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 233ms 2023-10-17T13:23:07.684584Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 274ms 2023-10-17T13:23:10.788748Z INFO client_request{request=Player(ResumePause)}: spotify_player::client: successfully handled the client request, took: 262ms 2023-10-17T13:23:10.806242Z INFO spotify_player::streaming: Got an event from the integrated player: Paused { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 8486, duration_ms: 162501 } 2023-10-17T13:23:11.034363Z INFO client_request{request=GetCurrentPlayback}: spotify_player::client: successfully handled the client request, took: 227ms ``` **Screenshots** If applicable, add screenshots to help explain your problem. **Environment** - OS: macOS - Application version: Monterey 12.1 - Application features: lyric-finder, image **Additional context** Add any other context about the problem here.
kerem 2026-03-02 23:44:55 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SebRollen commented on GitHub (Oct 19, 2023):

Looking at my log file again, I think the relevant lines are

2023-10-17T13:23:07.146417Z  INFO spotify_player::media_control: Got a media control event: Pause
2023-10-17T13:23:07.409728Z  INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 }
2023-10-17T13:23:07.409808Z  INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4608, duration_ms: 162501 }

So the media control sends a Pause event, but the player starts playing. I think this might be because the media control Pause event gets mapped to ResumePause here: github.com/aome510/spotify-player@4c5d25c9fa/spotify_player/src/media_control.rs (L80-L82)

So if the player is already paused, this will instead resume playback. Will try to implement a fix in a pull request

<!-- gh-comment-id:1770971401 --> @SebRollen commented on GitHub (Oct 19, 2023): Looking at my log file again, I think the relevant lines are ``` 2023-10-17T13:23:07.146417Z INFO spotify_player::media_control: Got a media control event: Pause 2023-10-17T13:23:07.409728Z INFO spotify_player::streaming: Got an event from the integrated player: VolumeSet { volume: 65535 } 2023-10-17T13:23:07.409808Z INFO spotify_player::streaming: Got an event from the integrated player: Playing { play_request_id: 0, track_id: SpotifyId { id: 59069150920021058570632602234153092872, audio_type: Track }, position_ms: 4608, duration_ms: 162501 } ``` So the media control sends a `Pause` event, but the player starts playing. I _think_ this might be because the media control `Pause` event gets mapped to `ResumePause` here: https://github.com/aome510/spotify-player/blob/4c5d25c9fa1313cb1a33264352130847739d7451/spotify_player/src/media_control.rs#L80-L82 So if the player is already paused, this will instead resume playback. Will try to implement a fix in a pull request
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#140
No description provided.