Song duration with MusicKit

I want to use the ApplicationMusicPlayer in my SwiftUI App and need the song duration to build a progression bar. ApplicationMusicPlayer only provides currentPlaybackTime and the Song struct in MusicKit has no duration prop. Is there an easy way to get the song duration with MusicKit or do I have to use a separate Apple Music API request to get durationInMillis?

Accepted Answer

Hello @legendario,

Thank you very much for your question about accessing the song's duration property with MusicKit.

We are working on adding a number of properties to music item types in MusicKit.

Stay tuned.

Best regards,

Answers

Hello @legendario,

Thank you very much for your question about accessing the song's duration property with MusicKit.

We are working on adding a number of properties to music item types in MusicKit.

Stay tuned.

Best regards,

Hello @legendario,

We have exposed Song.duration in iOS 15 beta 4.

I hope this helps.

Best regards,