title: How can i get time of my recorded audio in iphone?
body: <p>I am recording audio using <code>AVAudioRecorder</code>,and now i want to get exact time duration of my recorded audio,how can i get that.</p>
  
  <p>i have tried this:</p>
  
  <pre><code>AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:avAudioRecorder.url options:nil];
  CMTime time = asset.duration;
  double durationInSeconds = CMTimeGetSeconds(time);
  </code></pre>
  
  <p>But my <code>time</code> variable return NULL and <code>durationInSeconds</code> return 'nan',what does that means by nan.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><code>user1903074</code> answer have solved my problem but just for curiosity ,is thair any way to do it without <code>AVAudioplayer</code>. </p>