views:

291

answers:

1

I want to use the addmusic example that apple have created for the IPod library access and be able to play the music in MY application; I however dont know which files to copy and how to combine the two... can someone please tell me what to do? I already have created a button in MY application which will then upon click do the same thing that the button in the AddMusic example does to open up the Mediapicker thing. Any help will be greatly appreciated.

+1  A: 

You don't need to copy any specific files from the example, just some of the functions.

To pick the music you use MPMediaPickerController , look at AddMusicOrShowMusic in MainViewController.m to see how to instantiate that and what delegate methods you need to implement.

The important class you need to use to play the music is MPMusicPlayerController. In MainViewController.m you'll see the methods you need to implement and how to use it, see - (IBAction) playOrPauseMusic: (id)sender { for example.

Essentially you'll take the media items returned by MPMediaPickerController and call setQueueWithItemCollection on the MPMediaPickerController to queue up the music. After that it's really just a case of calling play/pause/etc and updating your interface.

The code you need is all in there, you just need to pull out the right bits.

NeilInglis
Firstly, thank you very much for the fast response.It really helps when i would like to solve the situation today.Is there a possibility of you being able to tell me EXACTLY what i need to copy, because there are many variables involved, and imjust getting confused.All i want is that when i click on the button on MY application it just opens up the MPMediaPicker and then i can select a few tracks from my library --> click done and then it plays them automatically.I understand all the code is there but what do i copy and where do i place them in my project?
Pavan
continuation from the previous comment ......I have the following files:ViewAppDelegate.hSecondViewController.hSecondViewController.mThirdViewController.hThirdViewController.mViewViewAppDelegate.mViewController.hViewController.m....my second view contains the actualy button where i would like the media picker to appear once clicked on the button in the second view; just telling you that incase you need to know where the button is.I greatly appreciate your help. I had a look in the apple documentation but i was just confused.thank you in advance
Pavan
basically, what are the buts that i need to pull out, and where do i place them now that ive told you the files that are involved in my project?
Pavan