Audio not playing when iPhone is sleeping
<p>I would like to know one thing. I hope you people can guide me well.</p>

<p>I am creating an application which needs some audio alerts. I am using <code>AVAudioPlayer</code> for this purpose.</p>

<p>I also set the Audio session like this (in my main delegate class):</p>

<pre><code>//to play from sleep
OSStatus result = AudioSessionInitialize(NULL, NULL, interruptionListenerCallback, self);
UInt32 category = kAudioSessionCategory_MediaPlayback;
result = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(category), category);
AudioSessionSetActive(YES);
</code></pre>

<p>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.</p>

<p>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.</p>

<p><hr /></p>

<p><strong>EDIT 1</strong></p>

<p>I am currently using kAudioSessionCategory_MediaPlayback.
I written it in my code, i pasted it here.</p>

<p><hr /></p>

<p><strong>EDIT 2</strong></p>

<p>I want to start a audio play back from a sleeping iphone.</p>

<p>Please help me if you know.</p>

<p><hr /></p>

<p><strong>EDIT 3</strong></p>

<p>idleTimerDisabled , consume my battery ?</p>

<p>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.</p>

<p>Let me try this, thank you for the reply.</p>
