O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.

SessionPlayer.TrackInfo

public static class SessionPlayer.TrackInfo
extends Object implements VersionedParcelable

java.lang.Object
   ↳ androidx.media2.common.SessionPlayer.TrackInfo


Class for the player to return each audio/video/subtitle track's metadata. Note: TrackInfo holds a MediaFormat instance, but only the following key-values will be supported when sending it over different processes:

Summary

Constants

int MEDIA_TRACK_TYPE_AUDIO

int MEDIA_TRACK_TYPE_METADATA

int MEDIA_TRACK_TYPE_SUBTITLE

int MEDIA_TRACK_TYPE_UNKNOWN

int MEDIA_TRACK_TYPE_VIDEO

Public constructors

TrackInfo(int id, int type, MediaFormat format)

Constructor to create a TrackInfo instance.

TrackInfo(int id, int type, MediaFormat format, boolean isSelectable)

Constructor to create a TrackInfo instance.

Public methods

boolean equals(Object obj)
MediaFormat getFormat()

Gets the MediaFormat of the track.

int getId()

Gets the id of the track.

Locale getLanguage()

Gets the language code of the track.

int getTrackType()

Gets the track type.

int hashCode()
boolean isSelectable()

Whether the current track can be selected via SessionPlayer.selectTrack(TrackInfo) or not.

String toString()

Inherited methods

Constants

MEDIA_TRACK_TYPE_AUDIO

public static final int MEDIA_TRACK_TYPE_AUDIO

Constant Value: 2 (0x00000002)

MEDIA_TRACK_TYPE_METADATA

public static final int MEDIA_TRACK_TYPE_METADATA

Constant Value: 5 (0x00000005)

MEDIA_TRACK_TYPE_SUBTITLE

public static final int MEDIA_TRACK_TYPE_SUBTITLE

Constant Value: 4 (0x00000004)

MEDIA_TRACK_TYPE_UNKNOWN

public static final int MEDIA_TRACK_TYPE_UNKNOWN

Constant Value: 0 (0x00000000)

MEDIA_TRACK_TYPE_VIDEO

public static final int MEDIA_TRACK_TYPE_VIDEO

Constant Value: 1 (0x00000001)

Public constructors

TrackInfo

public TrackInfo (int id, 
                int type, 
                MediaFormat format)

Constructor to create a TrackInfo instance. Note: The default value for isSelectable() is false.

Parameters
id int: id of track unique across MediaItems

type int: type of track. Can be video, audio or subtitle

format MediaFormat: format of track

TrackInfo

public TrackInfo (int id, 
                int type, 
                MediaFormat format, 
                boolean isSelectable)

Constructor to create a TrackInfo instance.

Parameters
id int: id of track unique across MediaItems

type int: type of track. Can be video, audio or subtitle

format MediaFormat: format of track

isSelectable boolean: whether track can be selected via SessionPlayer.selectTrack(TrackInfo).

Public methods

equals

public boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getFormat

public MediaFormat getFormat ()

Gets the MediaFormat of the track. If the format is unknown or could not be determined, null is returned.

Returns
MediaFormat

getId

public int getId ()

Gets the id of the track. The id is used by SessionPlayer.selectTrack(TrackInfo) and SessionPlayer.deselectTrack(TrackInfo) to identify the track to be (de)selected. So, it's highly recommended to ensure that the id of each track is unique across MediaItems to avoid potential mis-selection when a stale SessionPlayer.TrackInfo is used.

Returns
int id of the track

getLanguage

public Locale getLanguage ()

Gets the language code of the track.

Returns
Locale Locale which includes the language information

getTrackType

public int getTrackType ()

Gets the track type.

Returns
int MediaTrackType which indicates if the track is video, audio or subtitle

hashCode

public int hashCode ()

Returns
int

isSelectable

public boolean isSelectable ()

Whether the current track can be selected via SessionPlayer.selectTrack(TrackInfo) or not.

Returns
boolean true if the current track can be selected; false if otherwise.

toString

public String toString ()

Returns
String