Search Unity

Audio doesn't resume after sleep mode

Discussion in 'iOS and tvOS' started by dock, Jan 9, 2010.

  1. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    I just had a bug report on the iPhone 3GS that my audio isn't resuming after the phone goes into sleep mode. Both the music and sound effects stop working.

    Are there any known issues with audio not resuming?
     
  2. Wozik

    Wozik

    Joined:
    Apr 10, 2009
    Posts:
    662
    What OS version does your device have?
    What Unity iPhone version do you use?
     
  3. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    I'm on the latest version of OS3, but all customers report the same bug.

    I'm using Unity iPhone 1.5.1f2

    I've looked into my use of sound, and I'm not doing anything special with it at all.
     
  4. Profas

    Profas

    Joined:
    Oct 15, 2009
    Posts:
    73
    Hi,

    I tested with 5 devices and results are:

    With iPhone 3GS (OS 3.1), iPod 3GS (OS 3.1.2), iPod 3G (OS 3.0) this issue is not reproducible.

    With iPhone 3G (OS 2.2.1), iPod (OS 2.2.1) this issue is reproducible.

    I can assume that it is a OS 2.x bug. However you said that your project is reproducible with "OS3" so maybe you can show your project or how you reproduce this issue.

    I investigated this with an empty scene with "Audio Listener" and "Audio Source" components and mp3 song.

    Andrius Kuznecovas
    QA Engineer
     
  5. dock

    dock

    Joined:
    Jan 2, 2008
    Posts:
    605
    It's definitely reproducible on iPhone OS 3.0, because my game is presently 3.0 only (there's an update coming to make it 2.2.1 compatible). I'll submit my project to you!
     
  6. bliprob

    bliprob

    Joined:
    May 13, 2007
    Posts:
    901
    dock, is this maybe an Enhancement Pack bug? If so, ping me before you send it in.
     
  7. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    something to do with UnitySetAudioSessionActive() when the phone resumes maybe?
     
  8. andreash

    andreash

    Joined:
    Jan 19, 2010
    Posts:
    1
    We encounter a similar problem:

    Compressed audio stops playing after standby, consistent between scene changes, meaning even after loading a new scene there is no compressed audio playing anymore. Only restarting the app helps.

    Reported on iPod touch (1st and 2nd Generation) with OS 2.2.1 but no problems on other/same device with OS 3.1.2 (iPhone 3GS/1.Gen/iPod touch)!

    Steps taken to reproduce:
    - Create a scene with compressed and uncompressed audio playing simultaneousely.
    - Start on device and note both sounds playing
    - Activate standby
    - Return from standby by pressing button
    - Note that uncompressed sound can already be heard on the "Slide to unlock" screen
    - Slide and return to game
    - Note that compressed sound is not played anymore.




    After commenting out the following in AppController.mm

    Code (csharp):
    1.  
    2. UnitySetAudioSessionActive(true);
    3. UnitySetAudioSessionActive(false);
    4.  
    5.  
    everything worked as expected on 2.2.1 device and no immediate problems occured.

    Can this be used as solution? What are the sideeffects?
     
  9. FiveFingers

    FiveFingers

    Joined:
    Oct 15, 2009
    Posts:
    541
    We would like to know it either.

    We are experiencing similar problem coming back from the open feint dashboard,
    but not with the lock (we don't have the os2.2.1 to try) but perhaps is connected ?
     
  10. Gaspedal

    Gaspedal

    Joined:
    Mar 29, 2009
    Posts:
    376
    same problem here.

    I have now commented out the both calls UnitySetAudioSessionActive() in AppController and now it works.

    I hope that it causes no side effect. :)
     
  11. Gaspedal

    Gaspedal

    Joined:
    Mar 29, 2009
    Posts:
    376
    I think YES. Same game without Enhancement Pack works fine with audio-resuming. When I try to declare include the function UnitySetAudioSessionActive(true) into EP (before UnityPause(false) in ApplicationDidbecomeactive, I get an EXC_BAD_ACCESS Error from Xcode.
     
  12. RMGK

    RMGK

    Joined:
    Sep 30, 2011
    Posts:
    75
    I am getting this issue with Unity 5 and iOS 8.2, No solutions yet