iPhone - MPMusicPlayerController - Is there any limit on number of songs to select - iphone

I created my own music player that runs on iPhone using the class MPMusicPlayerController.
I'm using the class MPMediaPickerController to select the songs and add to my player.
I've around 900 songs in my iPhone. When I'm adding songs by selecting "Add All Songs" from MpMediaPickerController, the app is crashing.
Can some one tell me whether is there any solution to stop this crash?
Or is there any limit on number of songs selection that I've to impose so that app won't crash?

No, there is no limit on selection of songs.

Related

Swift App: User selects playlist and then fills in buttons with each song?

I'm trying to create a mediaplayer app. I was wondering if there is a way, and how would that look, to program the app so that a user can select a playlist from their own library and those songs from the playlist would be added to various buttons. For example, a user selects a playlist that has 10 songs. Those 10 songs would then would be assigned to 10 separate buttons, not a tableview, so that a user can tap the button to play a selected song from that playlist.
If you want to use Apple Music library, than it will not work because Apple does not allow any manipulations with data (licensed songs) in their apps. But if you create a library of songs downloaded from somewhere inside of your app, then you can easily do it, but you should expand on that in a different post.

How to change the notification sound of the iPhone using one coming from the iPod library

I have an alarm app in which I have a tableview where I am accessing all the iPod library songs. I want that when any of this song is selected this song must be set to the notification sound so when the alarm appears the alarm should ring with the sound selected from the iPod library.
ok I got your point. In my similar case i have achieved in following way, but that was somewhat different case. You can try one of the following case.
ONE CASE:
You can do one thing is You can store the URL of iPod Library song in NSUserDefault and pass that URL in didReceivedNotification method to your MPMediaPlayer class.
SECOND CASE
Another case will be copying the selected song in your app's document folder and then use that song for playing. For this you need to take care of previous files and delete them when selected new. This could make your app size somewhat larger.

iPhone - MPMusicPlayerController - Selecting audio from the queue and play it

I'm using MPMusicPlayerController in my application. I'm setting a queue using method "setQueueWithItemCollection". I'm able to play the songs, move to prev/next songs etc.
But how can I make MPMusicPlayerController play some 5th song from the queue?
when you set the queue, save the queue somewhere else that you can access.
if you want to play the fifth song, use MPMusicPlayerController.nowPlayingItem= [[queue items] objectAtIndex:4] and it will play the fifth song. you don't have to skip 5 times.
you have to maintain another list of queue in your application.
Then everytime, when you to jump to another song, get players current item, compare it from your array iterating through it and at the same time use skip to prev or next song from music player.
no other solution found.

Big problems when adding the same MPMediaItem into an iPod queue - how can I track which one is playing?

I've had a few complaints about my app, InstanTunes, when people are adding the same song twice to the queue, which is queued in the iPod app.
[[MPMusicPlayerController iPodMusicPlayer] setQueueWithItemCollection:collection];
Basically, the problem is that when the user leaves my app and continues to listen to their queue via the iPod app, InstanTunes loses all control and understanding of what is going on. On return to InstanTunes, I'm faced with the problem of the now playing song, given by [musicPlayer nowPlayingItem]; is in my NSMutableArray of MPMediaItems twice but I have no idea what instance of it is the now playing song.
Here's a simple diagram to illustrate:
Is song A at index 0 playing? Or song A at index 2 playing?
Can anyone think of a way for me to be able to tell which instance of 'Song A' is playing when the user returns to my app? As far as I know, I can't tag the MPMediaItems to be played in the iPod app.
This is really annoying, since I don't want to remove the ability to add the same song twice, but it is causing countless problems.
Any help, insight or suggestions would be greatly appreciated.
You can get the index of the nowPlayingItem

playing ipod library songs in audio queues , not with mpmusicplayer controller

i need to play songs from my music library in the background , while playing video..
Both audio and video will play at the same time... first i tried using mpmusicplayercontroller to play music , but when i play video , its stops playing song in background. after that i tried to play music using audiotoolbox."Audio Queues". now i can play audio and video at the same time ,but the song i am playing is static. i want to play song from ipod library and i need to provide the file path there, so is there any way to get the library song path? or any other idea? please suggest..!
While it may be possible, Apple doesn't want you to know how. They don't want people to be able to programmatically access the song data. It can lead to music sharing, which Apple tries not to make easy.
Maybe the way to do this is to have your videos be the thing that is static and get your songs through MPMusicPlayer. Of course, you'll have to play them with a different mechanism than MPMediaPlayer.