I've got valuechanged event handler like that:
-(void)scrub:(id)sender
{
if(self.audioPlayer.playing)
{
self.audioPlayer.pause;
self.audioPlayer.currentTime=self.scrubber.value;
self.audioPlayer.play;
}
}
Why doesn't rewind happen? what should I add? thanks! Moreover, how to display current time in a label?
To set the time, you can do:
However, you need to verify that that is actually a number. You also need to make sure it has an appropriate time for the file you are using. I don't know what kind of scrubber you are using. If setCurrentTime doesn't work, there is some problem with your scrubber.
If you are using a UISlider, you can do something like this to set the time:
To get the time, you simply do audioPlayer.currentTime. This is an NSTimeInterval, which is just a double. To display the time, you can do: