0

I am creating a music application, much like the standard music app. Now, I am befuddled on how they were able to read and change the elapsed time of a song using a UISlider. How is it possible to read and change the elapsed time of a song?

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
Flafla2
  • 691
  • 2
  • 11
  • 21

1 Answers1

1

By calling beginGeneratingPlaybackNotifications on the MPMusicPlayerController and registering for MPMusicPlayerControllerPlaybackStateDidChangeNotification notifications, you will receive periodic updates when the playback state has changed. In the handler for that notification you can then get the currentPlaybackTime from the MPMusicPlayerController.

Stefan Arentz
  • 34,311
  • 8
  • 67
  • 88