MPMusicPlayerController Track Length

Using MPMusicPlayerController is there a way to request track lengths?

Using .currentPlaybackTime, I can understand how much I am in the track, but I have no way of knowing how long the track takes.

My [MPMediaItem valueForProperty:MPMediaItemPropertyAssetURL] returns null for some tracks, so using AVAsset will not work for me.

+4
source share
1 answer

Simple use

  NSNumber *duration=[item valueForProperty:MPMediaItemPropertyPlaybackDuration]; 
+12
source

Source: https://habr.com/ru/post/1384386/


All Articles