Adds functions to seek the playing audio forward or back 5 seconds. Adds function in audio_player to play/pause the audio but wouldn't work right when bound to the UI so not implemented.

This commit is contained in:
Mason Armstrong
2016-08-10 21:59:19 -05:00
parent 3bc92af55f
commit 51ef047fb6
3 changed files with 39 additions and 0 deletions

View File

@@ -117,6 +117,22 @@ class URLStream(object):
log.debug("Transformed URL: %s. Prepared" % (self.url,))
self.prepared = True
def seek(self,step):
pos=self.stream.get_position()
pos=self.stream.bytes_to_seconds(pos)
pos+=step
pos=self.stream.seconds_to_bytes(pos)
if pos<0:
pos=0
self.stream.set_position(pos)
def playpause(self):
if self.stream.is_playing==True:
self.stream.pause()
else:
self.stream.play()
def play(self, url=None, volume=1.0, stream=None,announce=True):
if announce:
output.speak(_(u"Playing..."))