Package com.google.android.exoplayer2
Class TracksInfo.TrackGroupInfo
- java.lang.Object
-
- com.google.android.exoplayer2.TracksInfo.TrackGroupInfo
-
- All Implemented Interfaces:
Bundleable
- Enclosing class:
- TracksInfo
public static final class TracksInfo.TrackGroupInfo extends Object implements Bundleable
Information about tracks in aTrackGroup: theirC.TrackType, if their format is supported by the player and if they are selected for playback.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Bundleable
Bundleable.Creator<T extends Bundleable>
-
-
Field Summary
Fields Modifier and Type Field Description static Bundleable.Creator<TracksInfo.TrackGroupInfo>CREATORObject that can restores aTracksInfofrom aBundle.
-
Constructor Summary
Constructors Constructor Description TrackGroupInfo(TrackGroup trackGroup, int[] trackSupport, @com.google.android.exoplayer2.C.TrackType int trackType, boolean[] tracksSelected)Constructs a TrackGroupInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)TrackGroupgetTrackGroup()Returns theTrackGroupdescribed by thisTrackGroupInfo.intgetTrackSupport(int trackIndex)Returns the level of support for a track in aTrackGroup.@com.google.android.exoplayer2.C.TrackType intgetTrackType()Returns theC.TrackTypeof the tracks in theTrackGroup.inthashCode()booleanisSelected()Returns if at least one track in aTrackGroupis selected for playback.booleanisSupported()Returns if at least one track in aTrackGroupis supported.booleanisTrackSelected(int trackIndex)Returns if a track in aTrackGroupis selected for playback.booleanisTrackSupported(int trackIndex)Returns if a track in aTrackGroupis supported for playback.BundletoBundle()Returns aBundlerepresenting the information stored in this object.
-
-
-
Field Detail
-
CREATOR
public static final Bundleable.Creator<TracksInfo.TrackGroupInfo> CREATOR
Object that can restores aTracksInfofrom aBundle.
-
-
Constructor Detail
-
TrackGroupInfo
public TrackGroupInfo(TrackGroup trackGroup, @FormatSupport int[] trackSupport, @com.google.android.exoplayer2.C.TrackType int trackType, boolean[] tracksSelected)
Constructs a TrackGroupInfo.- Parameters:
trackGroup- TheTrackGroupdescribed.trackSupport- TheC.FormatSupportof each track in thetrackGroup.trackType- TheC.TrackTypeof the tracks in thetrackGroup.tracksSelected- Whether a track is selected for each track intrackGroup.
-
-
Method Detail
-
getTrackGroup
public TrackGroup getTrackGroup()
Returns theTrackGroupdescribed by thisTrackGroupInfo.
-
getTrackSupport
@FormatSupport public int getTrackSupport(int trackIndex)
Returns the level of support for a track in aTrackGroup.- Parameters:
trackIndex- The index of the track in theTrackGroup.- Returns:
- The
C.FormatSupportof the track.
-
isTrackSupported
public boolean isTrackSupported(int trackIndex)
Returns if a track in aTrackGroupis supported for playback.- Parameters:
trackIndex- The index of the track in theTrackGroup.- Returns:
- True if the track's format can be played, false otherwise.
-
isSelected
public boolean isSelected()
Returns if at least one track in aTrackGroupis selected for playback.
-
isSupported
public boolean isSupported()
Returns if at least one track in aTrackGroupis supported.
-
isTrackSelected
public boolean isTrackSelected(int trackIndex)
Returns if a track in aTrackGroupis selected for playback.Multiple tracks of a track group may be selected. This is common in adaptive streaming, where multiple tracks of different quality are selected and the player switches between them depending on the network and the
TrackSelectionParameters.While this class doesn't provide which selected track is currently playing, some player implementations have ways of getting such information. For example ExoPlayer provides this information in
ExoTrackSelection.getSelectedFormat.- Parameters:
trackIndex- The index of the track in theTrackGroup.- Returns:
- true if the track is selected, false otherwise.
-
getTrackType
public @com.google.android.exoplayer2.C.TrackType int getTrackType()
Returns theC.TrackTypeof the tracks in theTrackGroup. Tracks in a group are all of the same type.
-
toBundle
public Bundle toBundle()
Description copied from interface:BundleableReturns aBundlerepresenting the information stored in this object.- Specified by:
toBundlein interfaceBundleable
-
-