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

MPRIS Seek and SetPosition implementations are incompatible with what playerctl expects #1112

Closed
1 of 6 tasks
wasamasa opened this issue Sep 7, 2022 · 3 comments · Fixed by #1113
Closed
1 of 6 tasks
Labels
bug A functionality or parts of a program that do not work as intended
Milestone

Comments

@wasamasa
Copy link

wasamasa commented Sep 7, 2022

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.

20220907_132647

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 10 to set absolute position to 10s
  • playerctl -p spotifyd position 10+ to seek forward by 10s
  • playerctl -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/MediaPlayer2 path
  • Click on the org.mpris.MediaPlayer2.Player interface
  • 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
  • alsa_backend
  • portaudio_backend
  • pulseaudio_backend
  • rodio_backend

Versions (please complete the following information):

@wasamasa wasamasa added the bug A functionality or parts of a program that do not work as intended label Sep 7, 2022
@eladyn
Copy link
Member

eladyn commented Sep 8, 2022

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.

@wasamasa
Copy link
Author

Thank you, I've tested now with playerctl as well and it stopped raising errors and segfaulting.

@flying-sheep
Copy link

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.

@eladyn eladyn added this to the v0.3.4 milestone Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A functionality or parts of a program that do not work as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants