How can I play continuous music in the background when my iPhone app is running?
<p>I want to run light music (non-stop) when user is running my application actively. When user exits my application, then the music will be stopped automatically. I tried the following code to execute continuous music play (that is, play the music on a loop). But it doesn't actually loop; it ends the music once said music is completed. </p>

<pre><code>- (void) PlayLoopMusic {
    NSString* path;
    NSURL* url;
    path = [[NSBundle mainBundle] pathForResource:@"music" ofType:@"mp3"];
    url = [NSURL fileURLWithPath:path];

    player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL];
    [player prepareToPlay];
    [player setVolume: 0.030];
    [player setDelegate: self];

    // Start playing it while starting the game ...
    [player play];
}
</code></pre>

<p>Could someone please suggest methods to achieve looping, continuous music?</p>
