spotifyd
spotifyd copied to clipboard
MPRIS Seek and SetPosition implementations are incompatible with what playerctl expects
Description
Basic playback control with playerctl is possible, but triggers an error or segfault when attempting to seek to an absolute/relative position. When inspecting the D-Bus interfaces with d-feet, it becomes obvious that spotifyd offers a different interface from all other software implementing the MPRIS specification.

The Seek method expects a signed int64 to be able to seek backwards and forwards. Additionally, it is currently interpreted in milliseconds, but should be interpreted in microseconds.
The SetPosition method expects a string trackid (the rationale being "to avoid race conditions where a client tries to seek to a position when the track has already changed") and a signed int64 in microseconds. Given that the implementation looks very similar to the Seek one, it's likely it's interpreted in milliseconds instead.
To Reproduce
playerctl -p spotifyd position 10to set absolute position to 10splayerctl -p spotifyd position 10+to seek forward by 10splayerctl -p spotifyd position 10-to seek backward by 10s
To use d-feet:
d-feet- Click on "Session Bus"
- Narrow down search results by entering "mpris"
- Select the spotifyd one
- Click on the
/org/mpris/MediaPlayer2path - Click on the
org.mpris.MediaPlayer2.Playerinterface - Click on the methods
Expected behavior
- spotifyd playback continues at 10s or 10s later or 10s earlier
Actual behavior
The first playerctl call segfaults:
(playerctl:251381): GLib-CRITICAL **: 13:52:57.116: g_variant_new_object_path: assertion 'g_variant_is_object_path (object_path)' failed
The second and third fail with a D-Bus error:
Could not execute command: GDBus.Error:org.freedesktop.DBus.Error.Failed: D-Bus argument type mismatch at position 0: expected u32, found i64
Logs
Click to show logs
No logs, duh
Compilation flags
- [ ] dbus_mpris
- [ ] dbus_keyring
- [x] alsa_backend
- [ ] portaudio_backend
- [ ] pulseaudio_backend
- [ ] rodio_backend
Versions (please complete the following information):
- OS: Arch Linux
- Spotifyd: 0.3.3 (7146f64a819590a16de9991de74f8bc2fea9c2ac) https://aur.archlinux.org/packages/spotifyd-full-git
- cargo: 1.63.0
Thanks for the report! Apart from the two that you discovered, there are also some other methods that don't strictly conform to the spec. (There is only VolumeUp and VolumeDown, but no Volume.)
But the one that you mention should be quite easy to fix, I'll create a PR.
Thank you, I've tested now with playerctl as well and it stopped raising errors and segfaulting.
Should this be in https://github.com/Spotifyd/spotifyd/milestone/11? 0.3.4 will come with MPRIS support, so fixing it up fully might be a worthy target.