TurqMage
TurqMage

Reputation: 3321

MPMusicPlayerController Track Length

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.

Upvotes: 4

Views: 2652

Answers (1)

Daniel
Daniel

Reputation: 22405

Easy just use

   NSNumber *duration=[item valueForProperty:MPMediaItemPropertyPlaybackDuration];

Upvotes: 14

Related Questions