ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Retrieving current playback video and audio formats

Open AntonAFA opened this issue 9 years ago • 2 comments

Hello, I want to retrieve data about currently active tracks(Format).

When i am implementing TrackSelector.EventListener interface i have an onTrackSelectionsChanged() method which is triggered each time the track selection is changed. There i am trying to get the formats by player.getVideoFormat and player.getAudioFormat(). But when i am trying to get the format it is null. At least the one i am changing. As i understand, this happens because the onVideoDisabled() of the VideoRendererEventListener happens first. Is it a bug or it is me, who doing something wrong? Another question, is there any way to get the current TextFormat?

AntonAFA avatar Dec 05 '16 11:12 AntonAFA

In Exo2 you can listen to AdaptiveMediaSourceEventListener.onDownStreamFormatChanged() event and check the trackType and save those trackFormat depending on the type. Then you always have the current Format for video/audio/text.

gvidda avatar Dec 08 '16 09:12 gvidda

thank you for your help.

AntonAFA avatar Dec 11 '16 10:12 AntonAFA