Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set UISlider.value to AVPlayer.currentTime

I am trying to set a UISlider's Value to a AVPlayer's Current Time.

I am trying to use this code audioPlayer.currentTime = nowPlayingSlider.value;

I am getting this error:
Setter method is needed to assign to object using property assignment syntax
How do I get this to work.

like image 999
Sam Baumgarten Avatar asked Aug 21 '11 17:08

Sam Baumgarten


1 Answers

Here is how I handled this:

-(IBAction) timeScrubberChange:(id) sender{
CMTime t = CMTimeMake(self.nowPlayingTimeScrubber.value, 1);
self.nowPlayingCurrentTime.text = [self formatTimeCodeAsString: t.value];
self.nowPlayingDuration.text = [self formatTimeCodeAsString:(self.actualDuration - t.value)];
[self.avPlayer seekToTime:t];                                
}
like image 53
John G Avatar answered Sep 19 '22 01:09

John G