I would like to know one thing. I hope you people can guide me well.
I am creating an application which needs some audio alerts. I am using AVAudioPlayer
for this purpose.
I also set the Audio session like this (in my main delegate class):
//to play from sleep
OSStatus result = AudioSessionInitialize(NULL, NULL, interruptionListenerCallback, self);
UInt32 category = kAudioSessionCategory_MediaPlayback;
result = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), category);
AudioSessionSetActive(YES);
I am able to play music if my screen is locked forcefully, but I am not able to play mp3 files if the iPhone go into sleep mode automatically.
In general after 10 minutes I am not getting any music from my application. Could anyone tell me what I am missing? Please guide me if you know about my problem.
EDIT 1
I am currently using kAudioSessionCategory_MediaPlayback. I written it in my code, i pasted it here.
EDIT 2
I want to start a audio play back from a sleeping iphone.
Please help me if you know.
EDIT 3
idleTimerDisabled , consume my battery ?
I am creating a alarm so this application can run up to 10 hours. It will disable light on screen? then i can use it. I already seen some application which running on iPhone which play music from sleep mode.
Let me try this, thank you for the reply.