Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

TrackInfo

open class TrackInfo : CustomVersionedParcelable
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
static Int

static Int

static Int

static Int

static Int

Public constructors
<init>(id: Int, type: Int, @Nullable format: MediaFormat?)

Constructor to create a TrackInfo instance.

<init>(id: Int, type: Int, @Nullable format: MediaFormat?, isSelectable: Boolean)

Constructor to create a TrackInfo instance.

Public methods
open Boolean
equals(@Nullable other: Any?)

open MediaFormat?

Gets the MediaFormat of the track.

open Int

Gets the id of the track.

open Locale

Gets the language code of the track.

open Int

Gets the track type.

open Int

open Boolean

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

open String

Constants

MEDIA_TRACK_TYPE_AUDIO

static val MEDIA_TRACK_TYPE_AUDIO: Int
Value: 2

MEDIA_TRACK_TYPE_METADATA

static val MEDIA_TRACK_TYPE_METADATA: Int
Value: 5

MEDIA_TRACK_TYPE_SUBTITLE

static val MEDIA_TRACK_TYPE_SUBTITLE: Int
Value: 4

MEDIA_TRACK_TYPE_UNKNOWN

static val MEDIA_TRACK_TYPE_UNKNOWN: Int
Value: 0

MEDIA_TRACK_TYPE_VIDEO

static val MEDIA_TRACK_TYPE_VIDEO: Int
Value: 1

Public constructors

<init>

TrackInfo(
    id: Int,
    type: Int,
    @Nullable format: MediaFormat?)

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

<init>

TrackInfo(
    id: Int,
    type: Int,
    @Nullable format: MediaFormat?,
    isSelectable: Boolean)

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

open fun equals(@Nullable other: Any?): Boolean

getFormat

@Nullable open fun getFormat(): MediaFormat?

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

getId

open fun getId(): Int

Gets the id of the track. The id is used by selectTrack(TrackInfo) and 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 TrackInfo is used.

Return
Int id of the track

getLanguage

@NonNull open fun getLanguage(): Locale

Gets the language code of the track.

Return
Locale Locale which includes the language information

getTrackType

open fun getTrackType(): Int

Gets the track type.

Return
Int MediaTrackType which indicates if the track is video, audio or subtitle

hashCode

open fun hashCode(): Int

isSelectable

open fun isSelectable(): Boolean

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

Return
Boolean true if the current track can be selected; false if otherwise.

toString

@NonNull open fun toString(): String