Error Initializing AudioSession(errNO:1768843636)

I am getting the following error when returning from using the iPhoneUtils.PlayMovie() method. The background music that had been playing before beginning the movie does not resume.

Error Initializing AudioSession(errNO:1768843636)

C&P from my response to your thread on the Unity forums:

So...I've found a (partial?) solution to *my* problem. I am building to iOS. My original audio clips were imported from mp3. Originally, I had 3D Sound, Decompress On Load, and Hardware Decoding toggle ON. When I went back to the audio clip for my button sound, turned Decompress On Load OFF, I still generate the AudioSession error code, but my application *does not* crash.

I tried Christopher Browns code from the forum which didnt work for me (music did not resume) unless I supplied the AudioSource before .audio.Play()

e.g.

public void OnApplicationPause( bool pause)
{

                if(pause == true)
                {
                    time = bgMusicSource.audio.time;
                    bgMusicSource.audio.Pause();
                }
                else
                {

                    bgMusicSource.audio.time = time;
                    bgMusicSource.audio.Play ();
                }
}

This works and resumes the music from any resuming state (e.g. home button or call) but you still get the error in the XCode console. Infact you dont need to Pause() or Stop() the music as the iPhone does that itself ?!?, you just need to play it again.

if pause is false (which is a resume) the error occurs regardless of any code (even no code). so its something to do with how Unity or iOS stops the music automatically in the first place that I guess causes the error.

This is with a native WAV, no 3D Sound, Decompress on load not ticked using latest Unity iPhone basic as of this date. I also generate the gameObject, AudioSource and AudioClip (from resources) at runtime.

I also have this problem, but when I comment "bNeedToRestoreIPhoneAudioSession = true;" on applicationWillEnterForeground method in AppController file, it works and resume music when I resume the application. But I'm not sure is this right?

and sometimes will get log: MP _playbackInterruptionDidEndNotification :: NSConcreteNotification 0xaab0a0 {name = AVController_PlaybackInterruptionDidEndNotification; object = ; userInfo = { "AVController_InterruptionStatusNotificationParameter" = "non-resumable.SoloAmbientSound"; "AVController_InterruptorNameNotificationParameter" = "AudioSession-4241"; }}, _state = 0

test on iPod3 32g + iOS 4.2.1 + iPhone SDK 4.2 + Unity 3.1.0f4(55865)

Could you please submit a bug report with a project and post a bug case number. It something specific that I can't reproduce with my project. Thanks!

Andrius Kuznecovas QA Engineer