Interface MediaDownloadable.MediaFormatListener

  • Enclosing class:
    MediaDownloadable

    public static interface MediaDownloadable.MediaFormatListener
    Interface 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.
    • Method Detail

      • onResult

        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.VIDEO_RENDITIONS, MediaDownloadable.AUDIO_LANGUAGES and MediaDownloadable.CAPTIONS which will return a Parcelable ArrayList.

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

        ex. ArrayList audioRoles = 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