gst: Don't pass "play" value to audio.load()

We don't have a reason to set this anything other than True, so let's
just automatically start playing the track. Additionally, change the
playbin to READY instead of NULL to help playback start a little faster.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-03-21 11:50:32 -04:00
parent a9f48534e5
commit bd37bfd3f7
1 changed files with 3 additions and 3 deletions

View File

@ -37,11 +37,11 @@ class EmmentalAudio:
(res, cur) = self.playbin.query_duration(Gst.Format.TIME)
return cur / Gst.SECOND if res == True else 0.0
def load(self, track, play=True):
def load(self, track):
if track:
self.playbin.set_state(Gst.State.NULL)
self.playbin.set_state(Gst.State.READY)
self.playbin.set_property("uri", f"file://{track.path}")
self.playbin.set_state(Gst.State.PLAYING if play else Gst.State.PAUSED)
self.playbin.set_state(Gst.State.PLAYING)
Title.set_markup(f"<big>{GLib.markup_escape_text(track['title'])}</big>")
Subtitle.set_markup(f"<big>by {GLib.markup_escape_text(track['artist'])}</big>")