mediaplayer getduration returns 0 only in my server files
问题 i'm trying to get the audio file duration from my server using media player MediaPlayer mp = new MediaPlayer(); try { mp.reset(); mp.setDataSource("link here"); mp.prepare(); }catch (IOException e){ e.printStackTrace(); } mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mediaPlayer) { Log.e("time",mp.getDuration()+" .."); } }); when i put my server file link , it always return 0 but when i use another link from the web it gives me