def _duration(self):
        """Get media duration."""
        duration = 0
        if self.state != STATE_IDLE:
            resp = self._player.query_duration(_FORMAT_TIME)
            duration = resp[1] // _NANOSEC_MULT
        return duration