Interface SeekableAudioSource

    • Method Detail

      • setPosition

        long setPosition​(long position,
                         TimeUnit unit)
        Sets the position of the audio source.

        As audio frames always have a fixed 20ms duration, the position will be rounded down to the closest multiple of 20ms. E.g. when calling setPosition(79, TimeUnit.MILLISECONDS), the position will instead be set to 60ms.

        Attempting to set the position to a value that's larger than the audio source's duration, will instead set it to the maximum duration of the audio source.

        Negative positions will be interpreted as 0.

        Parameters:
        position - The position to jump to.
        unit - A TimeUnit determining how to interpret the position parameter. As audio frames have a fixed size of 20ms, units bellow TimeUnit.MILLISECONDS are not recommended.
        Returns:
        The new position of the audio source in the given time unit.
      • getPosition

        Duration getPosition​()
        Gets the position of the audio source.
        Returns:
        The position of the audio source.
      • getDuration

        Duration getDuration​()
        Gets the duration of the audio source.
        Returns:
        The duration of the audio source.