Android Mediaplayer.Trackinfo getFormat() is not defined

半城伤御伤魂 提交于 2019-12-13 02:55:34

问题


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?

来源:https://stackoverflow.com/questions/22839982/android-mediaplayer-trackinfo-getformat-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!