how to gradually decrease the remaining time of the song for every second which is played in AVAudioPlayer
<p>I am new to iphone. I am working on an audio player. I have to show the current time and remaining time of the current song in audioplayer. In video player it will gets as default but in audioplayer it is not getting so I need to write logic for getting current time of the song. </p>

<p>The code below is for that</p>

<pre><code>int minutes = (int)audioPlayer.currentTime / 60;
int seconds = (int)audioPlayer.currentTime % 60;
startDurationLabel.text = [NSString stringWithFormat:@"%d:%02d",minutes,seconds];
</code></pre>

<p>Here <code>audioPlayer</code> is instance of <code>AVAudioPlayer</code> and <code>startDurationLabel</code> is the label for display the current time of the song.</p>

<p>I am struggling to get the logic to show the remaining time of the song. It is decreased gradually for every second from back side of duration  for example duration of song is 4min:52sec then for every second it reduces to 4min:51sec, 4min:50sec, 4min:49sec... like in the iphone video player applications.</p>

<p>I have tried the below code</p>

<pre><code>NSTimeInterval interval = audioPlayer.duration - audioPlayer.currentTime;
NSLog(@"the interval is %f",interval);
</code></pre>

<p>Here I get the value for time interval <code>292, 291, 290</code>. Gradually it decreases but I want show those in the format of min:sec how it is possible?</p>

<p>If any body know this please help me.</p>
