'Callback for status updates from GStreamer.'

def _handle_message(self, bus, message):

    if (message.type == Gst.MessageType.EOS):
        self.player.set_state(Gst.State.NULL)
        self.playing = False
        self.cached_time = None
        if self.finished_callback:
            self.finished_callback()
    elif (message.type == Gst.MessageType.ERROR):
        self.player.set_state(Gst.State.NULL)
        (err, debug) = message.parse_error()
        print(u'Error:    {0}'.format(err))
        self.playing = False
