views:

369

answers:

1

Hi,

Would anybody have a link to a tutorial to add a playback progress bar to AVAudioPlayer?

I've searched extensively on this site and on google to no avail

A: 

I figured it out and it wasnt too bad.

Just update it in a timer

playbackTimer=[NSTimer scheduledTimerWithTimeInterval:0.5
                                     target:self 
                                                 selector:@selector(myMethod:) 
                                   userInfo:nil 
                                    repeats:YES];

}


-(void)myMethod:(NSTimer*)timer {

    float total=audioPlayer.duration;
    float f=audioPlayer.currentTime / total;

    NSString *str = [NSString stringWithFormat:@"%f", f];

    playbackProgress.progress=f;

    NSLog(str);
}
dubbeat