LightNight
LightNight

Reputation: 1625

Play sound from any position on iPhone

I have a "*.caf" file, I can play it, but I need progress of playing, and jump to any position of music track. How to implement it?

enter image description here

Upvotes: 1

Views: 160

Answers (1)

Vanya
Vanya

Reputation: 5005

AVAudioPlayer has property currentTime which can be use either for picking position

- (Float32)getProgressValue:(NSString*)section
{
return backgroundMusicPlayer.currentTime;
}

or setting position

- (void) progressMusic:(Float32)progressMusic
{
[backgroundMusicPlayer setCurrentTime:progressMusic];   
}

then u can easily implement progress bar or UI Slider according this values.

Upvotes: 2

Related Questions