Hi,
I have a music file which runs in the background(non-stop) when my app is running. This is my requirement. But when my app is running, screen goes off as per auto lock time set, music is topped. And then again when switch on the screen, my application is coming there but music is not starting. Is it a known bug? (or) How to get screen ON notification so that i can play the music again. (or) how to resolve it?
I use this code to play the music always ... - (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.50];
player.numberOfLoops = -1;
[player setDelegate: self];
[player play];
} Thank you.