Package org.javacord.api.audio
Interface SeekableAudioSource
-
- All Superinterfaces:
AudioSource,AudioSourceAttachableListenerManager,Specializable<AudioSource>
- All Known Implementing Classes:
SilentAudioSource
public interface SeekableAudioSource extends AudioSource
A seekable audio source.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.time.DurationgetDuration()Gets the duration of the audio source.java.time.DurationgetPosition()Gets the position of the audio source.longsetPosition(long position, java.util.concurrent.TimeUnit unit)Sets the position of the audio source.-
Methods inherited from interface org.javacord.api.audio.AudioSource
addTransformer, asBufferableAudioSource, asDownloadableAudioSource, asPauseableAudioSource, asSeekableAudioSource, copy, getApi, getNextFrame, getTransformers, hasFinished, hasNextFrame, isMuted, mute, removeTransformer, removeTransformers, setMuted, unmute
-
Methods inherited from interface org.javacord.api.listener.audio.AudioSourceAttachableListenerManager
addAudioSourceAttachableListener, addAudioSourceFinishedListener, getAudioSourceAttachableListeners, getAudioSourceFinishedListeners, removeAudioSourceAttachableListener, removeListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
-
-
-
Method Detail
-
setPosition
long setPosition(long position, java.util.concurrent.TimeUnit unit)Sets the position of the audio source.As audio frames always have a fixed
20msduration, the position will be rounded down to the closest multiple of20ms. E.g. when callingsetPosition(79, TimeUnit.MILLISECONDS), the position will instead be set to60ms.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- ATimeUnitdetermining how to interpret thepositionparameter. As audio frames have a fixed size of20ms, units bellowTimeUnit.MILLISECONDSare not recommended.- Returns:
- The new position of the audio source in the given time unit.
-
getPosition
java.time.Duration getPosition()
Gets the position of the audio source.- Returns:
- The position of the audio source.
-
getDuration
java.time.Duration getDuration()
Gets the duration of the audio source.- Returns:
- The duration of the audio source.
-
-