title: Android How to get Audio File duration
body: <p>i made application which use class AudioRecorder to recording files in format pcm. I made list with all files in my app and i want get duration from all files but i have problem. I tried:</p>
  
  <pre><code>MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever();
     metaRetriever.setDataSource(filePath);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>MediaPlayer mplayer =  new MediaPlayer();
  mplayer.reset();
  mplayer.setDataSource(URL);
  mplayer.prepare();
  Integer totalFileDuration = mplayer.getDuration();
  </code></pre>
  
  <p>I have only errors with this solutions.</p>