Sunday, 15 January 2012

iphone - How to make progressive UISlider like UIProgressView in AVAudioPlayer as song is being playing? -



iphone - How to make progressive UISlider like UIProgressView in AVAudioPlayer as song is being playing? -

actually made while song playing in avaudioplayer, slider progressed song running. made if seek forwards or backward, position current song playing. problem after seeking slider particular position not progressed , stop there still song running position.

the code below :

blockquote

mytimer = [nstimer scheduledtimerwithtimeinterval:0.1 target:self selector:@selector(updatemyprogressofcurrentplayingsong:) userinfo:nil repeats:yes]; -(void)updatemyprogressofcurrentplayingsong:(nstimer *)thetimer{ //for current song playing slider float progr = [mediaplayer currenttime]/[mediaplayer duration]; self.audiocurrentplayingslider.value = progr; } //for slider value alter -(ibaction)audiocurrentsongplayingslider:(id)sender { [mytimer invalidate]; mytimer = nil; [self.audiocurrentplayingslider setminimumvalue:0.0]; [self.audiocurrentplayingslider setmaximumvalue:[mediaplayer duration]]; [mediaplayer setcurrenttime:[self.audiocurrentplayingslider value]]; [mytimer methodforselector:@selector(updatemyprogressofcurrentplayingsong:)]; }

blockquote

see next link may help you, 1)how add together uislider avplayer 2)uislider command avaudioplayer 3)create uislider progress bar , timer (like ipod player) within app 4)http://www.mobisoftinfotech.com/blog/iphone/integrate-music-player-in-iphone/

iphone ios6 avaudioplayer uislider

No comments:

Post a Comment