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 a single group of tracks, including the underlyingTrackGroup, thetypeof tracks it contains, and the level to which each track is supported by the player.
-
-
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, @com.google.android.exoplayer2.C.FormatSupport 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.@com.google.android.exoplayer2.C.FormatSupport intgetTrackSupport(int trackIndex)Returns the level of support for a specified track.@com.google.android.exoplayer2.C.TrackType intgetTrackType()Returns theC.TrackTypeof the group.inthashCode()booleanisSelected()Returns whether at least one track in the group is selected for playback.booleanisSupported()Returns whether at least one track in the group is supported for playback, without exceeding the advertised capabilities of the device.booleanisSupported(boolean allowExceedsCapabilities)Returns whether at least one track in the group is supported for playback.booleanisTrackSelected(int trackIndex)Returns whether a specified track is selected for playback.booleanisTrackSupported(int trackIndex)Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device.booleanisTrackSupported(int trackIndex, boolean allowExceedsCapabilities)Returns whether a specified track is 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 @com.google.android.exoplayer2.C.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 @com.google.android.exoplayer2.C.FormatSupport int getTrackSupport(int trackIndex)
Returns the level of support for a specified track.- Parameters:
trackIndex- The index of the track in theTrackGroup.- Returns:
- The
C.FormatSupportof the track.
-
isTrackSupported
public boolean isTrackSupported(int trackIndex)
Returns whether a specified track is supported for playback, without exceeding the advertised capabilities of the device. Equivalent toisTrackSupported(trackIndex, false).- Parameters:
trackIndex- The index of the track in theTrackGroup.- Returns:
- True if the track's format can be played, false otherwise.
-
isTrackSupported
public boolean isTrackSupported(int trackIndex, boolean allowExceedsCapabilities)Returns whether a specified track is supported for playback.- Parameters:
trackIndex- The index of the track in theTrackGroup.allowExceedsCapabilities- Whether to consider the track as supported if it has a supportedMIME type, but otherwise exceeds the advertised capabilities of the device. For example, a video track for which there's a corresponding decoder whose maximum advertised resolution is exceeded by the resolution of the track. Such tracks may be playable in some cases.- Returns:
- True if the track's format can be played, false otherwise.
-
isSelected
public boolean isSelected()
Returns whether at least one track in the group is selected for playback.
-
isSupported
public boolean isSupported()
Returns whether at least one track in the group is supported for playback, without exceeding the advertised capabilities of the device. Equivalent toisSupported(false).
-
isSupported
public boolean isSupported(boolean allowExceedsCapabilities)
Returns whether at least one track in the group is supported for playback.- Parameters:
allowExceedsCapabilities- Whether to consider a track as supported if it has a supportedMIME type, but otherwise exceeds the advertised capabilities of the device. For example, a video track for which there's a corresponding decoder whose maximum advertised resolution is exceeded by the resolution of the track. Such tracks may be playable in some cases.
-
isTrackSelected
public boolean isTrackSelected(int trackIndex)
Returns whether a specified track is selected for playback.Note that multiple tracks in the group may be selected. This is common in adaptive streaming, where tracks of different qualities are selected and the player switches between them during playback (e.g., based on the available network bandwidth).
This class doesn't provide a way to determine which of the selected tracks is currently playing, however some player implementations have ways of getting such information. For example, ExoPlayer provides this information via
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 group.
-
toBundle
public Bundle toBundle()
Description copied from interface:BundleableReturns aBundlerepresenting the information stored in this object.- Specified by:
toBundlein interfaceBundleable
-
-