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 ()