In a Music Playing app (tracks from a url, using STKAudioPlayer by tumtumtum) i added a UISlider to the Music player view controller, i handled the slidervaluechanged method to make the audio player seek to a particular playback time, then i set the continuous property of the UISlider to YES in viewDidLoad, but when the music plays the thumb image of the slider doesn’t move, it’s static while the song is playing, unlike other music players where the slider thumb moves as the time changes to show progress. does anyone have any idea what i could be doing wrong? This is what i've done
self.progressSlider.continuous = YES;
[self.progressSlider setValue:self.audioPlayer.progress animated:YES];
if (!audioPlayer) {
self.progressSlider.value = 0;
self.streamStatus.text = @"";
return;
}
if (audioPlayer.duration != 0) {
self.progressSlider.minimumValue = 0;
self.progressSlider.maximumValue = audioPlayer.duration;
self.progressTimer.text = [NSString stringWithFormat:@"%@", [self formatTimeFromSeconds:audioPlayer.progress]];
self.musicLength.text = [NSString stringWithFormat:@"%@", [self formatTimeFromSeconds:audioPlayer.duration]];
}
and this:
-(NSString*) formatTimeFromSeconds:(int)totalSeconds
{
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
return [NSString stringWithFormat:@"%02d:%02d", minutes, seconds];
}
-(void) setupTimer { timer = [NSTimer timerWithTimeInterval:0.001 target:self selector:@selector(ticker) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
}
formatTimeFromSeconds
? – jose920405