- Enclosing class:
public static interface MediaDownloadable.MediaFormatListenerInterface definition for a callback to be invoked when the video tracks have been read and are available. The tracks include Video renditions, audio languages and captions.
void onResult(MediaDownloadable mediaDownloadable, android.os.Bundle mediaFormatBundle)Method to be called when the tracks are available. By using the mediaFormatBundle, you can get the tracks by using the keys
MediaDownloadable.CAPTIONSwhich will return a Parcelable ArrayList
audio = mediaFormatBundle.getParcelableArrayList(MediaDownloadable.AUDIO_LANGUAGES);
Sometimes the audio has additional information as the role, such as 'main', 'alternate', commentary, etc. but that information can't be retrieved from the MediaFormat object. To get that information you need to use the key
MediaDownloadable.AUDIO_LANGUAGE_ROLESto get an ArrayList
. The size and indexes of the array matches those of the ArrayList returned by
audioRoles = mediaFormatBundle.getStringArrayList(AUDIO_LANGUAGE_ROLES); If an audio doesn't have a role, it will have an empty string.
mediaDownloadable- , the object containing the information about the video to be downloaded
mediaFormatBundle- the bundle having the tracks