views:

748

answers:

1

Hi Guys,

Can any one suggest me how to play the music using MPMusicPlayerController in my application.

Anyone's help will be very much appreciated.

Thank you, Monish.

+2  A: 

Create a MPMediaPickerController so you can choose some music from the iPod, then in the mediaPicker:didPickMediaItems: call back you do this:

MPMusicPlayerController* playa;
playa = [MPMusicPlayerController applicationMusicPlayer];
[playa setQueueWithItemCollection:mediaItemCollection];
[playa play];
Rhythmic Fistman
thank you for you answear, but how can I create a mediaItemCollection from files or urls on the local app?
Panagiotis Korros
I can't see any way to do it. You probably can't. If you don't want audio from the iPod library, you should use AVAudioPlayer. The iPhone music APIs are not very orthogonal.
Rhythmic Fistman