Duration and Timers

Under most circumstances, users will want to have information available to them about the current status of their song, such as how much time has been played and how much time is left in the track. The sample app features two methods for generating this data. The first updateSongDuration is called whenever the song changes or when the app is launched. A reference to the current track being played is created, and the song duration expressed in seconds is retrieved through the key playbackDuration. The total hours, minutes, and seconds are derived from this data, and the song duration is displayed in a label next to the UIProgressIndicator.

-(void)updateSongDuration;{    currentSongPlaybackTime ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.