I am using AVPlayer, and its working good.
I put slider and it is progression according to player duration. But i want if user drags slider then play time changes accordingly. i.e. Song forwards or backwards according to slider position.
I have tried
-(IBAction)sliderChange:(id)sender{
[player pause];
CMTime t = CMTimeMake(slider.value,1);
[player seekToTime:t];
[player play];
}
But it again takes slider to starting point. Any help would be much appreciated.
EDIT (WORKING WITH BELOW LINK)
AVPlayer Video SeekToTime
-(IBAction) valueChangeSliderTimer:(id)sender{
[avplayer pause];
isPlaying = FALSE;
[btnPauseAndPlay setTitle:@"Play" forState:UIControlStateNormal];
float timeInSecond = sliderTimer.value;
timeInSecond *= 1000;
CMTime cmTime = CMTimeMake(timeInSecond, 1000);
[avplayer seekToTime:cmTime toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
}
Edited Code .
And try this link as well : Try this link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With