Post

Replies

Boosts

Views

Activity

Reply to Creating a song using MediaPlayer so it shows up in a playlist, from stored file on device.
So, I've made progress. Got the authorization request working fine, can now create a playlist (correctly localized too), but am still having no luck creating a song. I have an mp3 stored in the documents directory, so full filenameURL (or it could be a byte array, doesn't really matter - I can supply it in either form, and I need to be able to create a MusicKit Song, or MPMediaItem, using that URL/Byte stream, so the music file shows up in Apple Music. Once I have that, I can use the son.id.raw value as a productID I can pass ingo MPMediaPlaylists addItem function call. I found this text elsewhere that helps that along - Furthermore, you can definitely use the new MusicKit framework alongside MediaPlayer framework. For example, if you have a MusicKit Song, you could pass song.id.rawValue as the productID parameter to the MPMediaPlaylist's addItem(withProductID: ). The issue is that I have no idea how to create a musicKit Song from a file URL. How do I go about that? Or how about creating a MPMediaItem instead? Would that work? @joekun - might you have ideas about this? I'm completely blocked on this right now.
Apr ’24