Interface AudioTrack
-
- All Superinterfaces:
AudioItem
- All Known Subinterfaces:
InternalAudioTrack
- All Known Implementing Classes:
AdtsAudioTrack,BandcampAudioTrack,BaseAudioTrack,BeamAudioTrack,DelegatedAudioTrack,FlacAudioTrack,GetyarnAudioTrack,HlsStreamTrack,HttpAudioTrack,LocalAudioTrack,M3uStreamAudioTrack,MatroskaAudioTrack,Mp3AudioTrack,MpegAdtsAudioTrack,MpegAudioTrack,MpegTsM3uStreamAudioTrack,NicoAudioTrack,OggAudioTrack,SoundCloudAudioTrack,SoundCloudM3uAudioTrack,TwitchStreamAudioTrack,VimeoAudioTrack,WavAudioTrack,YandexMusicAudioTrack,YoutubeAudioTrack,YoutubeMpegStreamAudioTrack
public interface AudioTrack extends AudioItem
A playable audio track
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMarker(TrackMarker marker)Adds a marker to the track.longgetDuration()java.lang.StringgetIdentifier()AudioTrackInfogetInfo()longgetPosition()AudioSourceManagergetSourceManager()AudioTrackStategetState()java.lang.ObjectgetUserData()<T> TgetUserData(java.lang.Class<T> klass)booleanisSeekable()AudioTrackmakeClone()voidremoveMarker(TrackMarker marker)Removes a marker from the track.voidsetMarker(TrackMarker marker)Set the track position marker.voidsetPosition(long position)Seek to the specified position.voidsetUserData(java.lang.Object userData)Attach an object with this track which can later be retrieved withgetUserData().voidstop()Stop the track if it is currently playing
-
-
-
Method Detail
-
getInfo
AudioTrackInfo getInfo()
- Returns:
- Track meta information
-
getIdentifier
java.lang.String getIdentifier()
- Returns:
- The identifier of the track
-
getState
AudioTrackState getState()
- Returns:
- The current execution state of the track
-
stop
void stop()
Stop the track if it is currently playing
-
isSeekable
boolean isSeekable()
- Returns:
- True if the track is seekable.
-
getPosition
long getPosition()
- Returns:
- Get the current position of the track in milliseconds
-
setPosition
void setPosition(long position)
Seek to the specified position.- Parameters:
position- New position of the track in milliseconds
-
setMarker
void setMarker(TrackMarker marker)
Set the track position marker. This will clear all existing markers.- Parameters:
marker- Track position marker to place
-
addMarker
void addMarker(TrackMarker marker)
Adds a marker to the track. Markers can be used to execute code when the track reaches a certain position.- Parameters:
marker- The marker to add.
-
removeMarker
void removeMarker(TrackMarker marker)
Removes a marker from the track.- Parameters:
marker- The marker to remove.
-
getDuration
long getDuration()
- Returns:
- Duration of the track in milliseconds
-
makeClone
AudioTrack makeClone()
- Returns:
- Clone of this track which does not share the execution state of this track
-
getSourceManager
AudioSourceManager getSourceManager()
- Returns:
- The source manager which created this track. Null if not created by a source manager directly.
-
setUserData
void setUserData(java.lang.Object userData)
Attach an object with this track which can later be retrieved withgetUserData(). Useful for retrieving application-specific object from the track in callbacks.- Parameters:
userData- Object to store.
-
getUserData
java.lang.Object getUserData()
- Returns:
- Object previously stored with
setUserData(Object)
-
getUserData
<T> T getUserData(java.lang.Class<T> klass)
- Parameters:
klass- The expected class of the user data (or a superclass of it).- Returns:
- Object previously stored with
setUserData(Object)if it is of the specified type. If it is set, but with a different type, null is returned.
-
-