org.mpris.MediaPlayer2.Seek() sets absolute position instead of relative
I've had a bug report "downstream" in GSConnect that led me to discover that Gnome Music implements org.mpris.MediaPlayer2.Seek()
using absolute positioning because of gst_element_seek_simple()
.
https://gitlab.gnome.org/GNOME/gnome-music/blob/master/gnomemusic/gstplayer.py#L304-312
def seek(self, seconds):
"""Seek to position
:param float seconds: Position in seconds to seek
"""
# FIXME: seek should be signalled to MPRIS
self._player.seek_simple(
Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT,
seconds * Gst.SECOND)
Basically any "negative" seek results in the track being started at 0, while any "positive" seek results in a position equal to the value.
Simple API to perform a seek on the given element, meaning it just seeks to the given position relative to the start of the stream. For more complex operations like segment seeks (e.g. for looping) or changing the playback rate or seeking relative to the last configured playback segment you should use
gst_element_seek()
.
org.mpris.MediaPlayer2.Seek()
:
Seeks forward in the current track by the specified number of microseconds.
A negative value seeks back. If this would mean seeking back further than the start of the track, the position is set to 0.
If the value passed in would mean seeking beyond the end of the track, acts like a call to Next.
I guess this could be fixed using either gst_element_seek()
or by just summing the seek value with the current position.