iphone - Dynamically size UISlider based on audio file -


a user selects single .mp3 mediapicker. want dynamically set width of uislider based on length of .mp3 (in seconds). uislider displayed in uiscrollview timer animates/scrolls uislider during music playback (similar how audio track appears in imovie).

**my question: how can set width of uislider no matter width ( .mp3 length in seconds), thumb "scroll" @ same speed , not change dependent upon length of song. ie. short song , long song, thumb should scroll @ same speed because width of uislider has changed according music length.

i have been @ 2 days. appreciated.

create instance of avaudioplayer mp3 file. set slider maximum , minimum value according audio file played:

firstly set minimum value of slider.

yourslider.minimum = 0; 

now set maximum value in slider using avaudioplayer's duration property gives total duration of mp3 or audio file:

 yourslider.maximum = ceilf(float)avaudioplayer.duration); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -