Search Unity

Audio stops, while preforming an interrupt in ios.

Discussion in 'Audio & Video' started by liven410, Nov 28, 2014.

  1. liven410

    liven410

    Joined:
    Dec 23, 2010
    Posts:
    36
    Hi,
    I am facing a weird issue. While playing the game if I click on some ad, or perform a home button or power button interrupt and then return to the game, I see Sometimes randomly all the game audio (music & sfx) stops.
    Either I re-launch the game or I perform the interrupt again 1-2 times, then it again starts playing.

    I performed some debug gui text on screen to test this issue. And the result was just weird.
    The debug information mentioned me
    - name = "xyz" music file is currently playing by "abc' audio source
    - audio source volume = 1.0
    - audio source enabled = true
    - audio source loop = true
    - audio source ispaused = false
    - audio listener volume = 1.0
    - audio listener enabled = true

    According the debug information, the music is playing normally with full volume. But actually there is no music playing in the game. And the device hardwared button audio level was also full. I am currently using Unity 4.5.5 and ipad 3 ios 8.1.1 and ipod touch 5 ios 8.1. building from xcode 6.1.

    I think the Audio engine within unity, shuts down completely and resume on re-interrupt.
    Can anybody faced this issue before, any solution or suggestion?

    Thanks.
     
  2. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    I've seen this issue since Unity 3.x. Seems that FMOD isn't properly re-initializing after interruptions. You should file a bug report. In my experience the bug is quite random and impossible to reproduce reliably, which is quite unfortunate...

    The hackiest workaround is to reload your entire scene when the app regains focus.
    Less jacky would be to try to detect the problem ( maybe through querying the AudioSession's status natively? ) and reboot the scene only if necessary.