Im making a iPhone app and want to make a seek bar for a AVPlayer. I want to make it with a UISlider. How can I do this?
Asked
Active
Viewed 7,487 times
2 Answers
3
You can map the duration of the file being played by the AVPlayer to the UISlider's range (maximum and minimum values) using the duration
property of AVPlayer and make changes in the slider position to set the currentTime
of the AVPlayer.

MiguelB
- 1,913
- 18
- 20
-
How would I let them change the time – Sam Baumgarten Aug 19 '11 at 23:30
-
"... changes in the slider position set the `currentTime` of the AVPlayer." — just quoting myself. – MiguelB Aug 19 '11 at 23:36
-
Ahh sorry thought you meant get the current time from currentTime – Sam Baumgarten Aug 19 '11 at 23:40
-
1No worries. By the way, your question seems to be an almost exact duplicate of http://stackoverflow.com/q/2654849/635451, which might help you further. – MiguelB Aug 19 '11 at 23:43
-
I am doing the same thing with MPMOvie player controller. But how to change the slider according to seekBar of Movie player. Is there any notification that fires when value of that seekBar chage ? – Iducool Sep 01 '11 at 14:58
0
Change the current duration of the song by slider value
- (IBAction)currentTimeSliderTouchUpInside:(id)sender
{
[self.player stop];
self.player.currentTime = self.currentTimeSlider.value;
[self.player prepareToPlay];
[self play:self];
}

Rafik Farhad
- 1,182
- 2
- 12
- 21

iTag
- 413
- 1
- 4
- 10