Search Unity

iOS No Audio

Discussion in 'iOS and tvOS' started by ChurroLoco, May 6, 2011.

  1. ChurroLoco

    ChurroLoco

    Joined:
    Sep 20, 2010
    Posts:
    82
    I am moving my project to iOS and one of my bugs is that I can't hear any of the audio on my iPad. Everything sounds good on the computer though.

    My music is .mp3 format and the small effects are .wav files. I have tweaked each of the sounds to have different import values to test if that was the problem but I still can't hear any of the effects.

    Is there something special I need to do for iOS to get audio working?
     
  2. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    You shouldn't have to do anything special to get your audio working. Are you absolutely positive the mute switch is off and the volume is turned up on your device?
     
    XNChen and Jroel like this.
  3. ChurroLoco

    ChurroLoco

    Joined:
    Sep 20, 2010
    Posts:
    82
    Yep, the audio is on and the speakers are working for for iPod music, but the game audio still isn't working on the iPad.

    I even created a new small test project with just a lit sphere that emits jungle noises. It plays fine in the editor, but there is no sound on the iPad. I guess I haven't tried with headphones yet, but I doubt that is the problem...

    Right now I'm updating my iPad from 4.3.1 to 4.3.2... maybe that will change something, but I hope that isn't the problem since who knows what people will be using.

    Any other ideas?
     
  4. ChurroLoco

    ChurroLoco

    Joined:
    Sep 20, 2010
    Posts:
    82
    Wow, I tried with headphones and the audio works. Now the question is how do I get audio to work over the iPad speakers?

    Anyone have any ideas?
     
    MMOERPG likes this.
  5. ChurroLoco

    ChurroLoco

    Joined:
    Sep 20, 2010
    Posts:
    82
    Ok... so I heard somebody had the same problem with Angry birds. Apparently the mute/volume control are different for headphones and speaks.

    This is probably dumb, but I couldn't figure how to check the "speaker" volume/mute control in the menu but I went into angry birds saw a mute button enabled and disabled it... now all my games work.. Thanks Angry Birds?

    I guess I'm not sure where this option is in the normal menus. Why would iPod music play over the speakers but others sounds wouldn't. besides going through Angry Birds where can I find this setting?
     
  6. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Just to let you know, iOS devices have at least 2 or 3 audio levels. I would check your iPad's settings for more info.
     
  7. ChurroLoco

    ChurroLoco

    Joined:
    Sep 20, 2010
    Posts:
    82
    So to un-mute the ipad speakers I have to go to settings, change the switch from controlling screen lock to mute, then flip the switch until it is un-muted, then go back and change the switch back to controlling screen lock...

    They should just put these audio settings in the audio menu ...
     
    megadavido likes this.
  8. jmpp

    jmpp

    Joined:
    Jun 1, 2010
    Posts:
    93
    Hey ChurroLoco! I'm running into the exact same issue with a 4th gen iPod Touch I have for testing, music works over the speakers but my game's audio doesn't, while it certainly does over the headphones. Thanks for posting your findings, I'll give them a try to see if they solve my problem.

    Regards,


    - jmpp
     
  9. telcanty

    telcanty

    Joined:
    May 25, 2011
    Posts:
    2
    We're having the same issue here and we need a development side fix. Knowing how to fix the issue on a device doesn't really solve the issue. We are noticing this issue is a lot more prevalent in the iPad2. I'm assuming it's because those devices are already updated with the toggle mute/orientation lock functionality.
     
  10. ChurroLoco

    ChurroLoco

    Joined:
    Sep 20, 2010
    Posts:
    82
    Unfortunately I don't think apps have access to unmute or adjust iOS device's volume settings. You probably shouldn't have access to it anyway. So I think you best bet is to just inform the user how their device works using forums or in-game messages.
     
  11. pomedas

    pomedas

    Joined:
    Jun 15, 2011
    Posts:
    7
    Hi, the instructions to unlock the mute from the iPad settings worked for me too.
    thanks.
     
  12. fisyher

    fisyher

    Joined:
    Apr 27, 2011
    Posts:
    8
    Hi all.

    I am facing very similar issue with my iPad updated to iOS 5.1.1. I have successfully build the Unity application with Unity 3.5.2 on my iPad and I can only hear music when I plugged in the earphones. There is no sound coming from the speakers despite me trying everything I know in the Settings page or upping the volume to max. Does anyone know what is going on? Is this a Unity 3.5 bug and how can I fix it?
     
    Last edited: Jun 26, 2012
  13. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Mine too, but is this a permanent solution? and how can we expect our paying clients to know this? also, is this only an issue on the iPad?
     
  14. Default117

    Default117

    Joined:
    Mar 13, 2011
    Posts:
    134
    Great to hear that others are having this issue as well. I've been ripping out my hair trying to figure out what bugs in my code could be causing this!!
    We've received numerous 1 star ratings on the app store regarding "no audio" working. Most people who email for support we've told to unmute it and the audio seems to miraculously work again :p

    Does anyone know of a better solution for this though? 1 star ratings are hurting us for a user error problem. I'm assuming there wont be a way to force the device to unmute. Is there a way to check whether it is muted or not? And that way we can display a notification that the audio has been muted?
     
  15. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    the easiest way to unmute is: double touch the home button. swipe the bottom bar to right. This gives you the volume, mute, screen brightness, audio player bar > unmute.

    I would never come up with the idea to switch the hardware lock from rotation to mute on my ipads
     
  16. Default117

    Default117

    Joined:
    Mar 13, 2011
    Posts:
    134
    @dreamora - yes that's an easy solution, but unfortunately for some users they are so technologically impaired that they cannot do that. And the first reaction is "Oh the app is broken", and 1 star the app and uninstall, or even request a refund.
     
  17. coquifrogs

    coquifrogs

    Joined:
    Jan 17, 2012
    Posts:
    16
    The confusion comes from some apps like iPod and Youtube ignoring the mute switch. It has to do with audio categories in iOS. The most common complaint we get is that the iPad isn't playing sound in our apps even though it's "not muted because the iPod app plays audio". A clear test for this is if the headphones play audio from the app. This means the device is muted (which means most audio categories are muted except the media playback ones used by ipod/youtube/mpmovieplayer). So in fact the audio is muted. This is frustrating to explain, especially to users, but it's the way iOS audio works.

    See:

    http://developer.apple.com/library/...s.html#//apple_ref/doc/uid/TP40007875-CH4-SW1
     
    Last edited: Jun 27, 2012
    JuanJSAR likes this.
  18. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    So, I have not released a title yet with Unity but am about to. Can I expect a flood of users reporting that there is no sound?? This is not very ideal, to have to explain to them that indeed, there is sound, but you have to unmute your device by following these steps.


    ::???
    Not very convienent.
     
    Last edited: Jun 28, 2012
  19. fisyher

    fisyher

    Joined:
    Apr 27, 2011
    Posts:
    8
    YES! That works! I can never phantomed why the mute/unmute settings is so obscured and not shown in the General->Sounds settings in Settings app. Looks like I am one of those "technologically impaired" people too. *Sob* Thank you!
     
  20. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Again,
    Will tnis be an issue when people download from iTunes?

    Also, my audio files play at very low levels despite having been optimized and having Uinty volume on full.


    Any ideas?
     
  21. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    2.5 possibilities:

    1. Device volume is low
    2. Your audio volume within the audiofile itself is very low
    2.5 You tested it with headphones and are hit by the weak speakers


    The situation is generally the same for those buying it from the app store as it will be for you with your builds too
     
  22. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    1. Device volume was normal, files are definetly quiet, with out headphones.
    2. Audio file (if that is what you mean) was optimized to be at good levels. I have a background in audio engineering so I know.
    2.5 Did not test with headphones.


    So, any person who purchases, may have no sound????



    That is really unacceptable. I know they can turn the sound on, but who buys an app, it has no sound and would think to un-mute the device via the steps that were given in this thread? Certainly not me and I am a programmer who works with devices. Not good.

    Please just confirm yeh or neh.

    Thanks!!!
     
  23. Lav-patel

    Lav-patel

    Joined:
    Jul 3, 2012
    Posts:
    23
    you use (*.Ogg) formate.
    it should be work for IOS.
     
  24. Default117

    Default117

    Joined:
    Mar 13, 2011
    Posts:
    134
    @renman3000 you may not be understanding the issue here. This is an iOS audio design choice. As coquifrogs suggested, the user may have their device muted without their knowing or realising.
    It has to do with the iOS Audio Session Categories:
    http://developer.apple.com/library/...s.html#//apple_ref/doc/uid/TP40007875-CH4-SW1

    Certain apps, such as YouTube, and iPod run under a different category, so the user may have their device muted, play your app and think that there is no audio, then they would open up their iPod and hear audio thinking that your app is broken. Resulting in them complaining to you, giving bad ratings and/or uninstalling, just as we have been experiencing.
     
  25. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Nope, you have to do it with the physical hardware device.
     
  26. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    No.
     
  27. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Right, so what is the remedy? ogg files?
     
  28. Default117

    Default117

    Joined:
    Mar 13, 2011
    Posts:
    134
  29. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Ok, so I am thinking 3, for mine, anyhow, where do I set this? I thought in the Build Section of XCode but that is not the case.

    edit.
    I am looking in the AVAudioSession.h script, but not sure how to alter it so the AVAudioSessionCategoryPlayback is the one used.
     
    Last edited: Jul 4, 2012
  30. Default117

    Default117

    Joined:
    Mar 13, 2011
    Posts:
    134
    Well since it is a native function, you'll need to write a plugin to run it. I'm not the best at doing native things, but from what i've gathered, you need to write you plugin and expose a function and call it within C#.

    The native method needs to pretty much do the following:
    http://developer.apple.com/library/...k.html#//apple_ref/doc/uid/TP40007875-CH6-SW6

    You need to set the category. For instance:

    Run this on your application start and it should change the category. I found that i also needed to do this on application resume, in case the user minimized the app and muted it and went back in again etc.
     
  31. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Ok, will try tomorrow, or thru the week. Can anyone confirm this, or have a script, plugin they are willing to share?
     
  32. Default117

    Default117

    Joined:
    Mar 13, 2011
    Posts:
    134
    I can confirm it works since i'm using it at the moment. I'm not sure what Apple would do though during the review process since you're basically blocking the user from muting the app. Their docs state that you should use the correct category depending on the app, so if it is integral that the user always has audio and prevent muting i.e. an alarm app, then there would be no issues in setting it to a category catering for this.

    As for the code, what i wrote up there is pretty much the only line of code you need to call for the native code. As for writing a plugin, the Unity scripting reference has a page on it:
    http://docs.unity3d.com/Documentation/Manual/PluginsForIOS.html
     
  33. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Well the version I selected is for no muting, even when locked off, but that does seem extreme. I just want my user to play the game and have audio, if his audio volume is up. I do not want people to have to jump thru any hoops. As small as it is, it is a nucense.
     
  34. AdbC99

    AdbC99

    Joined:
    Jan 18, 2012
    Posts:
    53
    I dealt with this by altering the audio categories, I do audio software and so I need to disable mute entirely, ipad users have 1 star reviewed my app for having no sound when in fact this is the problem, here is my solution:

    1. In AppController.mm add #import <AudioToolbox/AudioToolbox.h>
    2. In AppController.mm set applicationDidBecomeActive to:

    - (void) applicationDidBecomeActive:(UIApplication*)application
    {
    printf_console("-> applicationDidBecomeActive()\n");

    AudioSessionInitialize (NULL, NULL, NULL, NULL);
    AudioSessionSetActive(true);

    UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
    AudioSessionSetProperty (kAudioSessionProperty_AudioCategory,
    sizeof(sessionCategory),&sessionCategory);

    printf_console("-> audio setup complete\n");


    if (_didResignActive)
    {
    UnityPause(false);
    }

    _didResignActive = NO;
    }

    p.s. the unhappy face above is a : and then a ( not a :(
     
    ankit_sayg likes this.
  35. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Also no sound on my iPads speakers.
    Headphones do work.

    Tested wav and ogg.
     
  36. sarthakshah

    sarthakshah

    Joined:
    Jun 27, 2013
    Posts:
    3
    Hi,I had a same issue, i got solution,there was a just a silly mistake by me,i forgot to switch-on the ringer of my ipad, after switching on , audio would working..;)!!!
     
  37. johndis34

    johndis34

    Joined:
    Oct 16, 2012
    Posts:
    4
    This proved to be the problem for us as well--SOLUTION HERE! Also, why in the hell does Apple make something where you can be hitting the volume buttons and have it show full volume when there's a damn switch on that's muting everything?
     
    codestage likes this.
  38. Anisoropos

    Anisoropos

    Joined:
    Jul 30, 2012
    Posts:
    102
    I know right?? It scared the hell out of me, I just did a "final test" and all of a sudden boom! no sound -_-
     
    codestage likes this.
  39. LunarExGames

    LunarExGames

    Joined:
    Feb 18, 2015
    Posts:
    44
    This is what solved it for me! I didn't know there was a button on the phone since the case was covering it pretty well. With it turned on you could still listen to music, youtube, etc.. but not a regular app/game. So lame.

     
    danishgoel and NelsonChristensen like this.
  40. khanhabib

    khanhabib

    Joined:
    Oct 11, 2018
    Posts:
    29
    Facing the same issue in Unity 2020.
     
  41. nobluff67

    nobluff67

    Joined:
    Nov 3, 2016
    Posts:
    338
    If the sound is fine with earphone then the issues is the sound settings in the particular app.

    For ipads (new ones at least), with the app open, swipe from top right of screen and switch the mute off, which is the Bell, red = sound off, white for sound on. I assume newer iPhones are the same.

    No idea why it isn't default on. Interestingly, YouTube app is not effected by this setting.
     
  42. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    776
    I also used to have this issue too, But I know how to fix just by press mute button on device!