onResult

abstract fun onResult(mediaDownloadable: MediaDownloadable, mediaFormatBundle: Bundle)

Method to be called when the tracks are available. By using the mediaFormatBundle, you can get the tracks by using the keys VIDEO_RENDITIONS, AUDIO_LANGUAGES and CAPTIONS which will return a Parcelable ArrayList.

ex. ArrayListaudio = 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 AUDIO_LANGUAGE_ROLES to get an ArrayList. The size and indexes of the array matches those of the ArrayList returned by .

ex. ArrayListaudioRoles = mediaFormatBundle.getStringArrayList(AUDIO_LANGUAGE_ROLES); If an audio doesn't have a role, it will have an empty string.

Parameters

mediaDownloadable,

the object containing the information about the video to be downloaded

mediaFormatBundle

the bundle having the tracks