Search Unity

Audio coming out of small phone call speaker instead of speakers on bottom.

Discussion in 'iOS and tvOS' started by jeffweber, Oct 28, 2013.

  1. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    This is a weird one. I did a release recently using XCode 5 to support iOS7.

    Now, I'm getting several reports that game-audio is coming out of the tiny ear speaker on the top front of the phone (The speaker used when on a phone call) instead of the larger speakers on the bottom of the phone.

    I think most the reports are from people with iPhone5s but can't confirm.

    Anyone else see this and/or know how to fix it.

    -Jeff
     
    Last edited: Oct 29, 2013
  2. cbaltzer

    cbaltzer

    Joined:
    Jan 11, 2012
    Posts:
    120
    luma2057 likes this.
  3. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I'm not purposefully using the microphone, but possible I enabled it by accident during deploy. I'll did around XCode and see if I accidently enabled it.

    Thanks for the fix... will give that a shot if I can't fix it in XCode.
     
  4. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    Did you solve the problem, I have exactly same problem ?
     
  5. Deoxyz

    Deoxyz

    Joined:
    Dec 13, 2009
    Posts:
    38
    @jeffweber @cbaltzer

    We have the same problem, but where wondering if this fix forces audio to the speaker EVEN when a headphone is plugged in?
    Our app is allready on the appstore and need to fix this ASAP.

    Thanks in advance.
     
    Last edited: May 2, 2014
  6. Jakob

    Jakob

    Joined:
    Sep 29, 2011
    Posts:
    42
    I also have same problem. I have Unity 4.5.2 installed and Xcode 5.1.1. What is weird is that this worked fine a couple a days ago. So is it unity or xcode or ios that is the problem ??.

    It seems to work fine when applying the fix from https://github.com/cbaltzer/UnitySpeakerFix thank you for that cbaltzer. But the issue still exist on the iPhone 5s

    I have tested on these with the fix applied.
    iPhone 5c(worked)
    ipad 1(ios 5 worked)
    ipad mini(worked)
    iphone 5s(no sound from speakers)

    Does anyone know if downgrading xcode or Unity would solve this ?
     
  7. iMagesBlues

    iMagesBlues

    Joined:
    Mar 18, 2013
    Posts:
    76
    Hi all. I also had the problem and I was able to resolve it by unchecking "Prepare iOS for recording" in the Player Settings. I am using Unity 4.6.0p1
    Please verify if it works for you as well.
     
    MattWhiting likes this.
  8. omarR

    omarR

    Joined:
    Jul 28, 2013
    Posts:
    1
    Finally! thanks!
     
  9. Marlena13

    Marlena13

    Joined:
    Jun 11, 2015
    Posts:
    1
    Thank's very much. I solved my problem :D
     
  10. domdev

    domdev

    Joined:
    Feb 2, 2015
    Posts:
    375
    Last edited: Mar 4, 2016
  11. DavieTag

    DavieTag

    Joined:
    Mar 23, 2015
    Posts:
    10
    That's an easy fix, just make it a bridged cast in xcode.
    The problem I'm having is that if you do this while there are headphones plugged in, and then unplug the headphones, the sound still comes through the ear speaker. Any clues?
     
  12. erniesbot

    erniesbot

    Joined:
    Feb 24, 2016
    Posts:
    15
    I'm having the same issue, any ideas? Its driving me crazy thanks
     
  13. FrankI3D

    FrankI3D

    Joined:
    Jun 26, 2014
    Posts:
    4
    Yeah... just hit this iPhone earpiece instead of speaker problem using Photon Voice. Has anyone found the culprit yet?
     
  14. FrankI3D

    FrankI3D

    Joined:
    Jun 26, 2014
    Posts:
    4
     
  15. FrankI3D

    FrankI3D

    Joined:
    Jun 26, 2014
    Posts:
    4
    Tap tap tap .... Testing .... Is this thing on ? testing...
     
  16. SaltwaterAssembly

    SaltwaterAssembly

    Joined:
    Mar 8, 2016
    Posts:
    95
    It appears to be a unity <?> bug - not sure if anyone has reported as such.
    The way around it is at the start of a scene (or when you implement audio) to put into the code:
    Code (csharp):
    1.  
    2. using UnityEngine.iOS;
    3.  
    4. if((Device.generation.ToString()).IndexOf("iPhone") > -1){  //for iphones only
    5.        iPhoneSpeaker.ForceToSpeaker ();
    6. }
    7.  
     
  17. bu213200

    bu213200

    Joined:
    Jun 10, 2014
    Posts:
    2
  18. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    66
    information devices : iphone 6s ios 12 , Samsung "android 7 ".
    unity version : 2018.2.12f1.

    i tried speaker script is work fine with my iphone , but still there is problem
    the problem is : microphone not work i don't hear anything in anther device !



    Code (CSharp):
    1.  iPhoneSpeaker.CheckiOSPrepare();
    2.         AudioClip_m = Microphone.Start(null, false, 100, 44100);
    3.         Microphone.End(null);
    4.         iPhoneSpeaker.ForceToSpeaker();
    i think iphone mic not sent to anther device after apply script .

    i am work from 4 days ago still i have some problem.
     
    Last edited: Nov 14, 2018
  19. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    66
    anyone !!
     
  20. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    66
  21. Avinash-pdy

    Avinash-pdy

    Joined:
    Mar 4, 2013
    Posts:
    28
    Hi, I am facing same issue. There's no sound on iPhone. Although i can speak from iPhone. But it doesn't play received sound. It works on Android and Unity Editor. UnitySpeakerFix plugin didn't work for me as well. I am using Unity 2018.2.5f1
     
    mahmoud93p and JohnTube like this.
  22. hdv0112

    hdv0112

    Joined:
    Sep 13, 2014
    Posts:
    1
    Problem: The sound was emitted from the speaker but the microphone did not work. Please help!. Thanks so much
     
  23. mahmoud93p

    mahmoud93p

    Joined:
    Feb 11, 2015
    Posts:
    66
    JohnTube likes this.
  24. tmdchi

    tmdchi

    Joined:
    Apr 22, 2010
    Posts:
    12
    We're having this issue. In our case we need to record the screen with ReplayKit, and looks like the key is to set the category mode to videoRecording:

    Code (CSharp):
    1.  
    2. do {
    3.    try AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: .mixWithOthers)
    4.    try AVAudioSession.sharedInstance().setMode(.videoRecording)
    5. }
    6. catch {
    7.    print("error setting category options and mode")
    8. }
    9.  
    Sorry for it being Swift instead of ObjC. Put it in a plugin and execute it on init, and the audio session should properly handle output routing, being it through the speaker, headphones or bluetooth. At least it works perfectly in an iPhone6S.
     
    Last edited: May 27, 2020
  25. Ikaro88

    Ikaro88

    Joined:
    Jun 6, 2016
    Posts:
    300
    Hi, i have the same problem but ONLY appens on iphone11
    Any knowed issue?
     
  26. unity_107801B5E237A5D0D25D

    unity_107801B5E237A5D0D25D

    Joined:
    Nov 29, 2021
    Posts:
    5
    Hey what is the solution for this problem, How to output audio through speakers instead of from an earpiece in IOS, Is there any method, or process for it. and when connecting to a Bluetooth it should switch to the Bluetooth device.