Implement seek
This commit is contained in:
parent
5a11f17155
commit
3d284a8903
@ -128,6 +128,9 @@ class BasePlaybackController(object):
|
||||
def resume(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def seek(self, time_position):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def next_track(self):
|
||||
playlist = self.backend.current_playlist.playlist
|
||||
|
||||
@ -84,6 +84,14 @@ class GStreamerPlaybackController(BasePlaybackController):
|
||||
else:
|
||||
self._set_state(gst.STATE_PLAYING)
|
||||
|
||||
def seek(self, time_position):
|
||||
if self.state == self.STOPPED:
|
||||
self.play()
|
||||
|
||||
self.bin.seek_simple(gst.Format(gst.FORMAT_TIME),
|
||||
gst.SEEK_FLAG_FLUSH, time_position * gst.MSECOND)
|
||||
self._set_state(gst.STATE_PLAYING)
|
||||
|
||||
@property
|
||||
def volume(self):
|
||||
return int(self.bin.get_property('volume') * 100)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user