Android.Media.MediaPlayer.SelectTrack Method
Selects a track.

Syntax

[Android.Runtime.Register("selectTrack", "(I)V", "GetSelectTrack_IHandler")]
public virtual void SelectTrack (int index)

See Also

MediaPlayer.GetTrackInfo

Parameters

index
the index of the track to be selected. The valid range of the index is 0..total number of track - 1. The total number of tracks as well as the type of each individual track can be found by calling MediaPlayer.GetTrackInfo method.

Exceptions

TypeReason
Java.Lang.IllegalStateExceptionif called in an invalid state.

Remarks

Selects a track.

If a MediaPlayer is in invalid state, it throws an IllegalStateException exception. If a MediaPlayer is in Started state, the selected track is presented immediately. If a MediaPlayer is not in Started state, it just marks the track to be played.

In any valid state, if it is called multiple times on the same type of track (ie. Video, Audio, Timed Text), the most recent one will be chosen.

The first audio and video tracks are selected by default if available, even though this method is not called. However, no timed text track will be selected until this function is called.

Currently, only timed text tracks or audio tracks can be selected via this method. In addition, the support for selecting an audio track at runtime is pretty limited in that an audio track can only be selected in the Prepared state.

[Android Documentation]

Requirements

Namespace: Android.Media
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 16