By using the persistentID for uniquely identify the song but we have the provision in music app to add the same song multiple times to the playlist this tends to have same song many times in the playlist along with same persistentID so I can't able to the find out the which song is currently selecting because all the songs has the same persistentID. Is there any alternative to identify the MPMediaItem rather then persistentID.
NOTE: I can't decide through selected cell on the UITableView too because it has some other dependencies.
How about using the playbackStoreID from MPMediaItem?
See https://developer.apple.com/documentation/mediaplayer/mpmediaitem/2813404-playbackstoreid
Related
Is there a way to get the iTunes Store ID for a song from an MPMediaItem?
I'm trying to pull the user's playlists, transfer those to another device, then play the songs using MPMusicPlayerController's setQueueWithStoreIDs. This would require mapping the MPMediaItems to content in the iTunes Store, which is the purpose of iTunes Match, which is included in an Apple Music subscription.
Theoretically, this should be possible for songs that were matched to iTunes content. However, I can't find a property or valueForKey on MPMediaItem or any other class in MPMediaPlayer framework that supports this. The persistentId set of properties are local DB keys and don't tie back to the iTunes content for the item. They don't seem to be the same across devices for the same user either.
This is now possible in iOS 10.3+ using the playbackStoreID instance property on MPMediaItem.
https://developer.apple.com/documentation/mediaplayer/mpmediaitem/2813404-playbackstoreid
Is there any way to search top genre songs ie. Top songs in "Dance" in Deezer API?
For example when I use http://api.deezer.com/genre/113/artists system sends only the artist list related with the Genre Id. But I need top songs related with the Genre. iTunes is supplying this kind of information but I couldn't find this solution in Deezer. Any help appreciated.
I think this is what you're looking for: http://developers.deezer.com/api/chart/tracks
Usage example:
http://api.deezer.com/chart/113/tracks
I am currently building a music player app. One of the functions of my app is "My Favorites". This is nothing different from other music player apps, for it allows user to mark down their favorite songs, and when they want to play only their favorite songs, they can play them directly from the "My Favorites" list.
My problem now is that in order for me to remember and be able to play that song next time, I think I have to remember the UNIQUE ID of that song. I am not sure if there is really a UNIQUE ID for every music file stored in the phone. I just thought of that because if there is, it would be a key for me to access that music file.
The solution I tried is appending the name of the music and the artist and use it as the key. Then, I will get the music list and run a loop through it, once I find the corresponding music file by comparing it with the key I will store it in an NSMutableDictionary. Then I will be able to play it later.
The problem of my solution is that what id two music files have exactly the same artist name and same title. That I won't be able to distinguish which is which.
I hope I made my self clear. To summarize:
Problem: Is there a way to get the UNIQUE ID of a music file. If there isn't are there any other ways to determine one music file from the other?
As what #Larme suggested. I could use MPMediaItemPropertyPersistentID for the unique ID of my music files, and that is what I've applied, and it is the right answer for me.
Thank you #Larme!
I have a confused, I want to through the generation of playlist in the ident (eg: 0_11) to get the song name, what shoud I do and those functions can be used. thank you!
Collection Summaries in Gracenote Playlist do not store any metadata. The Collection Summary only stores the identifier for a piece of media that your application gives it. Playlists that are generated will only return these identifiers.
It is up to your application to use these identifiers to refer back to the media to do what you wish (in your case, to get the track name). Most media applications already have a media database of their own, so the identifier is normally a reference into the application's media store.
TL;DR;
You need to create a database that maps the Playlist identifiers to the song name.
I have an app that interacts with both the iPod player, and the iTunes Store Web Service Search API. Is there a way to obtain the iTunes ID for a song that I retrieve from my user's iPod library (e.g. via MPMusicPlayerController, or MPMediaItem)?
The documentation says that the MPMediaItemPropertyPersistentID is a unique identifier that persists across app launch. This however, seems like it might be a unique local id.
The only solution I can think of is to retrieve the song title and artist from MPMediaItem, then query iTunes to obtain the iTunes ID. Is the iTunes ID stored anywhere locally within the iPod library?
Thanks - I am pretty new to the media framework.
The API documentation does not list a property for MPMediaItem that gives the iTunes Song ID, but it does give all of the information about a song such as the Artist and song name so, as you suggested, you could search the store for that criteria.