0

I have a media player in my android app. I have to find the codecs used in the file that is played by this media player. I have the following code.

TrackInfo[] ti = mediaplayer.getTrackInfo();
    MediaFormat mf;
    for (int i = 0; i<ti.length;i++){
        if(ti[i].getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_AUDIO)
        {
            mf = ti[i].getFormat();
        }
    }

But, I get an error saying "The method getFormat() is undefined for the type MediaPlayer.TrackInfo". But it can be seen here that there is indeed a function. I am able to call getTrackType, but not getFormat. What is the reason?

  • That method was introduced in API19. Are you testing on device with lower API? – MalaKa Apr 03 '14 at 13:57
  • Oops. Yes. Is there any other way I can find the codec used in the video being played? – Manikandan Kandasamy Apr 03 '14 at 14:03
  • I don't know that. But maybe the question [here](http://stackoverflow.com/questions/8034995/how-to-get-video-codec-properties-of-video) might help. – MalaKa Apr 03 '14 at 14:05
  • Hi, that helps in reading the MIME type. But, I would like to get more details, like video codec type, bitrate, audio codec, audio bitrate etc. Please let me know if you know of any. – Manikandan Kandasamy Apr 03 '14 at 14:37

0 Answers0