No End of Stream message when playing has finished
Tom Hanson
tom at aporcupine.com
Sun Mar 2 08:47:44 PST 2014
I am using gstreamer with python to play some music and need to trigger an
event when playback has finished. I have tried this using the method
provided in the tutorial but it simply does nothing when the track
finishes. Here is the code I'm using:
class Slave(object):
"""Provides methods for playback on slave devices"""
def __init__(self):
self.playlist = []
self.playlist_index = 0
self.playlist_length = 0
self.player = gst.element_factory_make('playbin2', 'player')
fakesink = gst.element_factory_make('fakesink', 'fakesink')
self.player.set_property('video-sink', fakesink)
bus = self.player.get_bus()
bus.add_signal_watch()
bus.connect('message', self.on_message)
def play_list(self, playlist):
"""Starts playing the playlist provided"""
self.playlist = playlist
self.playlist_index = 0
self.playlist_length = len(self.playlist)
self.player.set_property('uri', self.playlist[self.playlist_index])
self.player.set_state(gst.STATE_PLAYING)
def on_message(self, bus, message):
t = message.type
if t == gst.MESSAGE_EOS:
self.skip_forward()
elif t == gst.MESSAGE_ERROR:
self.skip_forward()
#TODO: Log this
Either I'm doing something wrong or there's a bug somewhere. Anyone got any
ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140302/cb5ebcb4/attachment.html>
More information about the gstreamer-devel
mailing list