Class AudioTrack
java.lang.Object
com.castlabs.android.player.models.Track
com.castlabs.android.player.models.AudioTrack
A Audio track.
- Since:
- 3.0.0
-
Field Summary
Fields inherited from class com.castlabs.android.player.models.Track
LABEL_LOCALE, UNKNOWN_INDEX -
Constructor Summary
ConstructorsConstructorDescriptionAudioTrack(int bitrate) Create a new track with the given bitrateAudioTrack(long durationUs, com.google.android.exoplayer2.Format format) Create a new track with the given duration and initialise it from the given format data -
Method Summary
Modifier and TypeMethodDescriptionbooleanintGet the number of audio channels.floatGet the audio sampling rate in Hz.intGet The average bandwidth in bits per second.Get a list of codecs of this quality.getDrm()GetDrmof the current trackcom.google.android.exoplayer2.drm.DrmInitDataGet theDrmInitDataof the current track.longThe duration in microseconds, orSdkConsts.UNKNOWN_TIME_USif the duration is unknown, orSdkConsts.MATCH_LONGEST_USif the duration should match the duration of the longest track whose duration is known.getId()Get the id of this track.getLabel()Returns the default label for this track.The language of the format.Get the media mime type associated with this track.Get the codec mime type associated with this track.getName()The name associated with this track.The language tag as present in the manifest.intGet the selection flags.getType()Get the type of the track renderer plugin based on the codecs.inthashCode()booleanBased on the manifest mime type returns if it is possible to play this audio track either on the device querying the available decoders or via passthrough using HDMI information.voidsetAudioChannels(int audioChannels) Set the number of audio channels for this trackvoidsetAudioSamplingRate(float audioSamplingRate) Set the samplign ratevoidSet the codecs of this quality.voidAssignDrmto the current trackvoidsetDurationUs(long durationUs) Set the duration of this track in microsecondsvoidSet the id associated with this trackvoidsetLanguage(String language) Set the language of this track.voidsetMediaMimeType(String mimeType) Set the media mime type accociated with this trackvoidsetMimeType(String mimeType) Set the codec mime type accociated with this track.voidSet a name associated with this trackvoidsetOriginalLanguage(String language) Set the manifest language of this track.voidsetSelectionFlags(int selectionFlags) Set the selection flagstoString()Methods inherited from class com.castlabs.android.player.models.Track
addDescriptor, getDescriptors, getLocalizedLanguageName, getOriginalGroupIndex, getOriginalTrackIndex, getTrackIndex, hasTrickModeId, isTrickModeTrack, setDescriptors, setOriginalGroupIndex, setOriginalTrackIndex, setTrackIndex, setTrickModeIds
-
Constructor Details
-
AudioTrack
public AudioTrack(int bitrate) Create a new track with the given bitrate- Parameters:
bitrate- the bitrate
-
AudioTrack
public AudioTrack(long durationUs, @NonNull com.google.android.exoplayer2.Format format) Create a new track with the given duration and initialise it from the given format data- Parameters:
durationUs- the duration in micro secondsformat- the underlying format
-
-
Method Details
-
getDrmInitData
@Nullable public com.google.android.exoplayer2.drm.DrmInitData getDrmInitData()Get theDrmInitDataof the current track.- Returns:
- The
DrmInitDataornullif not available.
-
getDrm
GetDrmof the current track- Returns:
Drmornullfor clear content
-
setDrm
AssignDrmto the current track- Parameters:
drm-Drmornullfor clear content
-
getBitrate
public int getBitrate()Get The average bandwidth in bits per second.- Returns:
- The average bandwidth in bits per second.
-
getDurationUs
public long getDurationUs()The duration in microseconds, orSdkConsts.UNKNOWN_TIME_USif the duration is unknown, orSdkConsts.MATCH_LONGEST_USif the duration should match the duration of the longest track whose duration is known.- Returns:
- The duration in microseconds or
SdkConsts.UNKNOWN_TIME_US
-
setDurationUs
public void setDurationUs(long durationUs) Set the duration of this track in microseconds- Parameters:
durationUs- the duration of this track in microseconds orSdkConsts.UNKNOWN_TIME_US
-
getMediaMimeType
Get the media mime type associated with this track. This is the type of the media container.- Returns:
- The media mime type associated with this track. This is the type of the media container
-
setMediaMimeType
Set the media mime type accociated with this track- Parameters:
mimeType- media the mime type
-
getMimeType
Get the codec mime type associated with this track.- Returns:
- The codec mime type associated with this track
-
setMimeType
Set the codec mime type accociated with this track. This is the type of the elementary stream (i.e. the individual samples)- Parameters:
mimeType- codec the mime type
-
getId
Get the id of this track.- Returns:
- The id associated with this track
-
setId
Set the id associated with this track- Parameters:
id- the id
-
setSelectionFlags
public void setSelectionFlags(int selectionFlags) Set the selection flags- Parameters:
selectionFlags- the selection flags to set
-
getSelectionFlags
public int getSelectionFlags()Get the selection flags.- Returns:
- the selection flags
-
getAudioChannels
public int getAudioChannels()Get the number of audio channels.- Returns:
- The number of audio channels, or -1 if unknown
-
setAudioChannels
public void setAudioChannels(int audioChannels) Set the number of audio channels for this track- Parameters:
audioChannels- the number of channels
-
getLanguage
The language of the format. Can be null if unknown. The language codes are two-letter lowercase ISO language codes (such as "en") as defined by IETF BCP 47.- Returns:
- The language tag associated with this track or null
-
setLanguage
Set the language of this track.- Parameters:
language- the language
-
getOriginalLanguage
The language tag as present in the manifest. Can be null if unknown.- Returns:
- The manifest language tag associated with this track or null
-
setOriginalLanguage
Set the manifest language of this track.- Parameters:
language- the language
-
getAudioSamplingRate
public float getAudioSamplingRate()Get the audio sampling rate in Hz.- Returns:
- The audio sampling rate in Hz, or -1 if unknown
-
setAudioSamplingRate
public void setAudioSamplingRate(float audioSamplingRate) Set the samplign rate- Parameters:
audioSamplingRate- the sampling rate in Hz
-
getCodecs
Get a list of codecs of this quality.- Returns:
- A ist of codec of this quality or null
-
setCodecs
Set the codecs of this quality.- Parameters:
codecs- the codecs of this quality
-
getName
The name associated with this track.- Returns:
- The name associated with this track
-
setName
Set a name associated with this track- Parameters:
name- the name
-
getLabel
Returns the default label for this track. The label is either the DASH label if its available, ornameif its set or thelanguage, or it falls back to the codec name.- Returns:
- The default label for this track
-
isSupportedCodec
public boolean isSupportedCodec() throws com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryExceptionBased on the manifest mime type returns if it is possible to play this audio track either on the device querying the available decoders or via passthrough using HDMI information.- Returns:
- the audio track is supported on the device or some other device connected to this one (such as Android TVs)
- Throws:
com.google.android.exoplayer2.mediacodec.MediaCodecUtil.DecoderQueryException- in case an error occurs when decoder information is queried
-
getType
Get the type of the track renderer plugin based on the codecs.- Returns:
- The
TrackRendererPlugin.Typefor this audio track.
-
toString
-
hashCode
public int hashCode() -
equals
-