Implement seek

This commit is contained in:
Thomas Adamcik 2010-02-18 12:59:15 +01:00
parent 5a11f17155
commit 3d284a8903
2 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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)