Reputation: 111
I want to use the following code in my application to get the current playing time and total time on a UISlider and i get ths code from this link.
-(IBAction)sliding:(id)sender{
CMTime newTime = CMTimeMakeWithSeconds(seeker.value, 1);
[self.player seekToTime:newTime];
}
-(void)setSlider{
sliderTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES]retain];
self.seeker.maximumValue = [self durationInSeconds];
[seeker addTarget:self action:@selector(sliding:) forControlEvents:UIControlEventValueChanged];
seeker.minimumValue = 0.0;
seeker.continuous = YES;
}
- (void)updateSlider {
self.seeker.maximumValue = [self durationInSeconds];
self.seeker.value = [self currentTimeInSeconds];
}
- (Float64)durationInSeconds {
Float64 dur = CMTimeGetSeconds(duration);
return dur;
}
- (Float64)currentTimeInSeconds {
Float64 dur = CMTimeGetSeconds([self.player currentTime]);
return dur;
}
But I don't know what is seeker. I am new in iOS and i need help any suggestion any tutorial for this problem.
Upvotes: 1
Views: 3665
Reputation: 1317
@Mr.Bond
- (Float64)currentTimeInSeconds {
double runningTime = CMTimeGetSeconds(_playerViewController.player.currentTime);
NSLog(@"currentTime %f",runningTime);
return dur;
}
Upvotes: 0