belongs to Maven artifact androidx.media2:media2:1.0.0-alpha01

MediaPlayer2.TrackInfo

public static abstract class MediaPlayer2.TrackInfo
extends Object

java.lang.Object
   ↳ androidx.media2.MediaPlayer2.TrackInfo


Class for MediaPlayer2 to return each audio/video/subtitle track's metadata.

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

MediaPlayer2.TrackInfo()

Public methods

abstract MediaFormat getFormat()

Gets the MediaFormat of the track.

abstract String getLanguage()

Gets the language code of the track.

abstract int getTrackType()

Gets the track type.

abstract 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

MediaPlayer2.TrackInfo

public MediaPlayer2.TrackInfo ()

Public methods

getFormat

public abstract MediaFormat getFormat ()

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

Returns
MediaFormat

getLanguage

public abstract String getLanguage ()

Gets the language code of the track.

Returns
String a language code in either way of ISO-639-1 or ISO-639-2. When the language is unknown or could not be determined, ISO-639-2 language code, "und", is returned.

getTrackType

public abstract int getTrackType ()

Gets the track type.

Returns
int TrackType which indicates if the track is video, audio, timed text.

toString

public abstract String toString ()

Returns
String