4

Using an MPMusicPlayerController is there a way to query the tracks length?

Using .currentPlaybackTime I can figure out how far I am into the track but I have no way of knowing how long the track is.

My [MPMediaItem valueForProperty:MPMediaItemPropertyAssetURL] returns null for some tracks so using the AVAsset won't work for me.

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
TurqMage
  • 3,321
  • 2
  • 31
  • 52

1 Answers1

14

Easy just use

   NSNumber *duration=[item valueForProperty:MPMediaItemPropertyPlaybackDuration];
Daniel
  • 22,363
  • 9
  • 64
  • 71