'Returns a tuple containing (position, length) where both
values are integers in seconds. If no stream is available,
returns (0, 0).'

def time(self):

    fmt = Gst.Format(Gst.Format.TIME)
    try:
        posq = self.player.query_position(fmt)
        if (not posq[0]):
            raise QueryError('query_position    failed')
        pos = (posq[1] // (10 ** 9))
        lengthq = self.player.query_duration(fmt)
        if (not lengthq[0]):
            raise QueryError('query_duration    failed')
        length = (lengthq[1] // (10 ** 9))
        self.cached_time = (pos, length)
        return (pos, length)
    except QueryError:
        if (self.playing and self.cached_time):
            return self.cached_time
        else:
            return (0, 0)
