Skip to content

playerctl selects the wrong player instance when playerctld is running #369

@CyrilSLi

Description

@CyrilSLi

playerctl incorrectly selects the player instance with the most recent activity rather than the instance specified by -p when playerctld is running. This bug only happens when the player with the .instance-AbCdEfGh suffix has the most recent activity.

Steps to reproduce:

  1. Run playerctld daemon.
  2. Play two audio files in separate mpv windows. I'll refer to them as 1.mp3 and 2.mp3, with 2.mp3 having been opened after 1.mp3.
  3. Interact with the window playing 2.mp3 to make mpv.instance-AbCdEfGh (the specific instance string is randomly generated each time) the player with the most recent activity. Verify this using playerctl -a metadata:
$ playerctl -a metadata -f "{{markup_escape(playerInstance)}}, {{markup_escape(title)}}"
mpv.instance-AbCdEfGh, 2.mp3
mpv, 1.mp3
  1. Try playing/pausing player mpv.instance-AbCdEfGh; all the commands below correctly affect 2.mp3.
$ playerctl -p mpv.instance-AbCdEfGh play
$ playerctl -p mpv.instance-AbCdEfGh pause
$ playerctl -p mpv.instance-AbCdEfGh play-pause
  1. Try playing/pausing mpv; all the commands below incorrectly affect 2.mp3 instead of 1.mp3.
$ playerctl -p mpv play
$ playerctl -p mpv pause
$ playerctl -p mpv play-pause
  1. Interact with the window playing 1.mp3 to make mpv the player with the most recent activity. Verify this using playerctl -a metadata:
$ playerctl -a metadata -f "{{markup_escape(playerInstance)}}, {{markup_escape(title)}}"
mpv, 1.mp3
mpv.instance-AbCdEfGh, 2.mp3
  1. Try playing/pausing player mpv; all the commands below correctly affect 1.mp3.
$ playerctl -p mpv play
$ playerctl -p mpv pause
$ playerctl -p mpv play-pause
  1. Try playing/pausing mpv.instance-AbCdEfGh; notice how these commands correctly affect 2.mp3, showing the bug only occurs when mpv.instance-AbCdEfGh has the most recent activity.
$ playerctl -p mpv.instance-AbCdEfGh play
$ playerctl -p mpv.instance-AbCdEfGh pause
$ playerctl -p mpv.instance-AbCdEfGh play-pause

When playerctld is not running mpv will always rank higher than mpv.instance-AbCdEfGh because the former was opened first, meaning the bug does not occur as step 8 has shown.

System info:
OS: Fedora 43 Sway spin
playerctl version: 2.4.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions