Quote:
Originally Posted by albotrg
i need help [AVAudioPlayer setCurrentTime:0.0];
(IBAction)f4 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"gun" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPathath] error:NULL];
theAudio.delegate = self;
[theAudio play];
[AVAudioPlayer setCurrentTime:0.0];
|
Try This if you want to play the file from the beginning.:
Code:
(IBAction)f4 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"gun" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPathath] error:NULL];
theAudio.delegate = self;
[theAudio setCurrentTime:0.0];
[theAudio play];
You need to call serCurrentTime on your 'theAudio' object. Not on the AVAudioPlayer class.