Search code examples
iphoneobjective-ccocoa-touchios4

How to start and stop songs programmatically?


Possible Duplicate:
How to play a song from the itunes library in iphone

In my app,

I want to fetch songs from iPhone Library.

And want to play that song.

How do I fetch song?

And How to start and stop songs programmatically in my app?


Solution

  •   AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:recordFile] error:nil];
                [player prepareToPlay];
       [player play];
    
        [player pause];