Apple MusicKit Queue entry endtime not set

Hello,

I have a question and I hope someone can help me out.

I'm trying to build a view that will respond to changes in ApplicationMusicPlayer.shared.queue. it gets back the current entity(MusicPlayer.Queue.Entry) with a lot of information but the endtime property isn't set. how can I resolve this issue?

Stap one Getting playlist information with all tracks from apple music

        var request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: playlist.musicID)

        request.properties = [.tracks]

        request.limit = 1;

            if let tracks = try await request.response().items.first?.tracks {

                viewModel.tracks = tracks

            }

Step 2 Add tracks to Queue

ApplicationMusicPlayer.shared.queue = ApplicationMusicPlayer.Queue(for: viewModel.tracks)`
 try await ApplicationMusicPlayer.shared.play()

Sep 3 Player Starts playing update the view with the current entry

I will successfully get title, subtitle and artwork but not a endtime that I need for building a nice playback timer

Kind regards, Reinier de la Parra

Answered by Frameworks Engineer in 703285022

Hello @foxoffire33,

Regarding the issue where the song's duration or music video's duration is set to nil in MusicPlayer.Queue.Entry's item, we have included a fix for this issue in iOS 15.4 Beta 1.

I hope this helps.

Best regards,

Hello @foxoffire33,

Thank you very much for your question about the end time of a MusicPlayer.Queue.Entry.

I think the endTime property is not actually the most appropriate thing for you to build a playback timer. Instead, the way we envision this being used is that you need to get the entry's item, and check the underlying song's duration or music video's duration.

That said, it looks like you might get nil values for those properties for songs and music videos embedded in a music player queue entry. Would you mind filing a ticket on Feedback Assistant, asking for the duration property to be filled in as expected for such songs and music videos?

Thanks again for your help.

Best regards,

Accepted Answer

Hello @foxoffire33,

Regarding the issue where the song's duration or music video's duration is set to nil in MusicPlayer.Queue.Entry's item, we have included a fix for this issue in iOS 15.4 Beta 1.

I hope this helps.

Best regards,

Thanks

Apple MusicKit Queue entry endtime not set
 
 
Q