Photon Voice and iphone

Hi

using 1.13 Photon Voice

I can see you have implemented the https://github.com/cbaltzer/UnitySpeakerFix

However we still get sound only from the iphone ear speaker (the one used when making or receiving a call) not the main speakers.

On older devices with plug in headphones sound is routed to the headphones when plugged in.

If using bluetooth headphones on newer devices the sound is not routed and the ear speaker (the one used when making or receiving a call) remains activated.

Help, what am I missing?

All fine on Android though

Cheers
«1

Comments

  • JohnTubeJohnTube mod
    edited December 2017
    Hi @VRCraftworks,

    Thank you for choosing Photon!

    We are considering improving the iOS (and other) native Unity plugins to fix or add what's missing in Unity in terms of input and output audio devices handling.

    Could you help us by defining what you mean by "older" and "newer" devices?
    Maybe clearly list what's working and what's not, the different combinations you tried, Unity version(s), used device(s), expected and actual behaviors?
    Thanks.
  • edited January 2018
    Hi there

    Happy New Year!

    Devices
    Older devices - those iphones with plug in headphones the 5 series and the 6.
    Newer devices - iphone devices all have bluetooth headphones which are the iphone 7s and iphone 8s

    List whats working and not working:

    Working
    On older devices iphone 5 and 6 series with plug in headphones sound is routed to the headphones when plugged in and the audio speakers (not the ear/call speaker the one used when making and receiving calls) when not.

    Not working
    If using bluetooth headphones on newer iphone 7 and 8 series devices the sound is not routed to the headphones and remains routed to the ear speaker (the one used when making or receiving a call). Sound is also only routed to the ear/call speaker when no headphone device is present.

    The expected behavior
    The sound to be routed properly to the audio speakers on newer devices the iphone 7 and 8 when no headphones are present and to the blue tooth headphones when they are plugged in. This expected behaviour is what happens on the older devices.

    Unity
    5.6.2 and 2017.1

    Photon
    1.13 Photon Voice which contains the fix for this from https://github.com/cbaltzer/UnitySpeakerFix

    Let me know if you need any further information.

    Cheers

  • Hi guys

    any progress on this?

    Cheers B)
  • Hi @VRCraftworks,

    No sorry, nothing yet but we have a task on our list for this.
    We will post any updates here.
  • edited January 2018
    No probs John.

    Just thought it could be something we missed as the solution from

    https://github.com/cbaltzer/UnitySpeakerFix

    seems to have been implemented apart from the scripts in:

    https://github.com/cbaltzer/UnitySpeakerFix/tree/master/Unity/Assets/Plugins/iPhoneSpeaker

    Can this possibly be the reason??

    Perhaps its missing an added call to iPhoneSpeaker.ForceToSpeaker() after you call Microphone.Start()?

    Not a fan of ploughing through other peoples code but do you know in which scripts Microphone.Start() is called so we can quickly have check through?

    We will also try this as sometimes its something as simple as this:

    https://forum.unity.com/threads/audio-coming-out-of-small-phone-call-speaker-instead-of-speakers-on-bottom.207680/

    (final post) that solves the issue.

    Cheers :)
  • so at the end how do you solve it? i've tried
    using UnityEngine.iOS;

    if((Device.generation.ToString()).IndexOf("iPhone") > -1){ //for iphones only
    iPhoneSpeaker.ForceToSpeaker ();
    }

    but it doesn't seem to work. Where did you place that code to make it work?
  • Hello,
    I am facing problem, when i connected iPhone 7 or iPhone 8, i cant hear the voice generally.(with any headphones and Bluetooth also i cant hear the voice).But my voice is transmitting to another device.
    What i have done wrong. Can you please let me know.
    Thanks in advance.
  • Hi @ModulusPI,

    Thank you for choosing Photon!

    Can you please give us more details about the issue?
    What is the Photon Voice version?
    What is the Unity version?
    iOS device (model + iOS version) sending audio
    iOS device (model + iOS version) receiving audio
    expected behaviour + actual behavior

    Thanks.
  • Hello @JohnTube ,
    Thanks for your quick response.
    I am using unity 2017.3 and photon voice is 1.13.
    When i am testing with iPhone 5s and version 11.2.6, with iPhone 6s and iPhone 7, Its not working well.
    In iphone 5s voice is transmitting and hearing the voice from speaker, But in 6&7 voice is transmitting, they cant listen the voice from opponent person.
    And some times photon speaker is unlinking by automatically.
    Thanks.
  • Hi guys

    sorry about not checking back. As far as I can determine there is no easy fix here. The accepted solution was to use a plugin from github.

    However this code seems to be incorporated into the latest build so I can't see how that would solve things now.

    Here are the links should you wish to research out yourselves. Would be interested if anyone else has come to the same conclusion.

    https://forum.unity.com/threads/audio-coming-out-of-small-phone-call-speaker-instead-of-speakers-on-bottom.207680/

    https://forum.unity.com/threads/ios-speaker-volume-is-low.505657/

    https://issuetracker.unity3d.com/issues/ios-audio-will-be-played-from-earspeaker-if-microphone-dot-start-is-used

    https://github.com/cbaltzer/UnitySpeakerFix

    Cheers all :/
  • edited August 2018
    Greetings @VRCraftworks @JohnTube , is the issue still unresolved?

    I'm using Unity 2018.2.4f1, Dissonance 6.2.4 and PUN 1.91 and I have the problem with an iPhone X. I've tried the recommended links from the last post and still can't resolve it.
  • Hi @utickledev,

    Thank you for choosing Photon!

    On this forum, we usually give support for Photon Voice and not Dissonance.
    You could ask on Dissonance's support channels or ask @martindevans directly.
  • JohnTubeJohnTube mod
    edited November 2018
    Hey guys,

    We are working on the fix for this iOS issue.
    We want your help in testing few things.

    Could you update to latest Photon Voice and use Photon Microphone type instead of Unity one (Read more about "Microphone Selection") and try if that fixes the audio output routing to the proper speaker? It may seem weird or unrelated but the system initialization may be different.

    Let us know what do you find.
    Please include the Unity version, iPhone device model, iOS version and external speaker if any with your results.
  • @JohnTube hello
    unity version : 2018.2.12f1
    iPhone device : iphone x and iphone 6s
    iOS version : 12.0
    still some problem , also i am use this plugin (https://github.com/cbaltzer/UnitySpeakerFix)
    also when i am using mic type photon not work plugin ! but when change mic type to unity plugin is work but with problem " echo too match" > so give me any solution to fix this problem .


    note : i tried Photon voice 2 with pun 2 - some problem .
  • any one ?!
  • hi @mahmoud93p,

    What versions did you try? 1.16 and 2.1?
    Do you use an external device like AirPods?
    also i am use this plugin (https://github.com/cbaltzer/UnitySpeakerFix)
    No need to use that, it is included with Photon directly and does not cover all cases.
    also when i am using mic type photon not work plugin ! but when change mic type to unity plugin is work but with problem " echo too match"
    What do you mean? Could you give us logs or describe the issue? as using Photob MicrophoneType is the way the to go.
  • edited November 2018
    @JohnTube thx for replay ,
    Photon voice : 1.16
    no i did't use any external device .
    also if i don't use any plugin the sound come from ear speaker .

    ok yesterday i tried few think , i found this scripts is update
    "https://github.com/10people/UnitySpeakerFix"
    "https://github.com/10people/UnitySpeakerFix/commit/e1d5e360c2c5a6c5b35a791a05c3e518074d8d4a#diff-1e290ac8433d555bce009b162cb869d0"

    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 !
    iPhoneSpeaker.CheckiOSPrepare();
    AudioClip_m = Microphone.Start(null, false, 100, 44100);
    Microphone.End(null);
    iPhoneSpeaker.ForceToSpeaker();
    i think iphone mic not sent to anther device after apply script .
  • edited November 2018
    Device : iphone 6s ,Iphone x, ios 12.
    Photon voice version : 1.16
    unity version : 2018.2.12f1

    @JohnTube right now i removed every plugin , problem is back sound come from "ear speaker "
    and i don't use any code addition like (microphone.start()); , i'm back everything is default and the result
    android work , iphone sound come from "ear speaker ".

    what can i do ?
  • JohnTubeJohnTube mod
    edited November 2018
    @mahmoud93p

    In Photon Voice 1.16:

    1. Add "IOSAudioForceToSpeaker" component which will use the iOS speaker fix

    OR

    2. Set MicrophoneType to Photon (see here for more details).
  • @JohnTube can you give to me how can i use "IOSAudioForceToSpeaker"
    and already i am using microphone type : photon .
  • @JohnTube thank you for everything right my project in android and iphone

    what did i do ?
    Step 1
    Select : microphone type : unity .

    Step 2
    after create your player call this function (IOSAudioForceToSpeaker.PhotonVoiceCreated();) this function from IOSAudioForceToSpeaker and this class include photon voice no need to download any plugin .


    thank you @JohnTube شكرا لك

  • hey @mahmoud93p,

    IOSAudioForceToSpeaker.PhotonVoiceCreated(); will be called automatcially if you add the IOSAudioForceToSpeaker component to the same GameObject as the PhotonVoiceRecorder. Sorry I did not mention that before.
  • edited November 2018
    @JohnTube thank you, yes you can add this component "IOSAudioForceToSpeaker".

    After few test I discovered unity microphone unusable there is echo tow match in android and ios, maybe is work fine if connected headset !

    So the only way to use photon voice must be use "photon microphone" , but when you use "photon microphone" you can't use (IOSAudioForceToSpeaker) even if used the sound come fast or cut off ,also when you use " photon microphone " without (IOSAudioForceToSpeaker) in android work 100% but in ios sound come from "ear speaker".

    how can i turn on main speaker in ios when used "photon microphone" ?

    Note : when i am test there is tow device one location in Saudi arabia second device in Switzerland.
  • edited November 2018
    @JohnTube Do you have paid support ? I am very upset

    And does this plugin fix all issues in photonvoice ?
    Plugin link : https://assetstore.unity.com/packages/tools/audio/dissonance-voice-chat-70078
  • JohnTubeJohnTube mod
    edited November 2018
    Hi @mahmoud93p,

    I suggest you create a separate new project and test Photon Voice 2:

    About echo when using Unity Microphone API without headset/earpieces:

    We have introduced acoustic echo cancellation and noise suppression in Voice 2.
    You can try it in DemoVoiceUI scene in Voice 2 package.
    There is a "VoiceAudioPreprocessor" component that when attached to the same GameObject as "Recorder" it will help with this issue.
    I cannot guarantee results however as this depends on lots of factors.

    About using Photon Microphone, in Photon Voice 2, make sure to Reinit the Recorder if you change the type at runtime.

    Dissonance is another different product.
  • @JohnTube If i upgrade to Photon Voice 2 must be also upgrade pun2 right !
    and does fix this problem in Photon Voice 2 because my project is already is finish .

    I am beginner in photon voice so can you explain to me more "how to Reinit Recorder" when i am just add this component "IOSAudioForceToSpeaker" ? also my player is Instantiate and have component (photon voice recorder , photon voice speaker , IOSAudioForceToSpeaker , etc) .
    Screen-Shot-2018-11-17-at-11-55-11-PM
  • edited November 2018
    @JohnTube Today i tried pun2 with photon voice 2 the problem still some think the sound in ios come from ear speaker, and you must to know few think

    1 - i tried this scene "DemoVoiceUI" without any edit and problem in ios not fix.
    2- when i am add "IOSAudioForceToSpeaker" the sound tow low in photon mic "unusable" ,also unity mic is bad .



    Information
    Xcode version : Version 10.1 (10B61).
    unity version : 2018.2.12f1 .
    Devices 1 : iphone 6s - ios 12
    Devices 2: iphone x - ios 12

    So right know i am back to my old project photon voice 1 , and i will try again fix photon voice problem
    so if you have any note please tell me .
  • @vadim can you help me
  • edited November 2018
    Some update, after few tests the sound in ios come from main speaker using "Photon mic " , but there is anther problem mic does not work any more

    this code work in realtime "OnClick button" .
    AudioClip_m = Microphone.Start(null, false, 100, 44100);
    Microphone.End(null);
    IOSAudioForceToSpeaker.PhotonVoiceCreated();

    --------------
    So right know does have any solution for this problem ?
    -------------
    @JohnTube btw in photon voice 2 Reinit call automatic after change mic to photon !
    and how can i Reinit Recorder in photon voice 1 ? and there is api for photon voice 1 !?
  • Hi @mahmoud93p,

    after few tests the sound in ios come from main speaker using "Photon mic " , but there is anther problem mic does not work any more
    I don't get it. What does work and what doesn't? The IOSAudioForceToSpeaker is useful only when using Unity MicrophoneType, you do not need it when you use Photon MicrophoneType.

    AudioClip_m = Microphone.Start(null, false, 100, 44100);
    Microphone.End(null);
    I don't think we need this and I don't see how that is being used with Photon Voice.

    photon voice 2 Reinit call automatic after change mic to photon
    No, if you change Recorder.MicrophoneType's value from Unity Editor or by code when the Recorder is already initialized you need to call Recorder.ReInit().
    how can i Reinit Recorder in photon voice 1 ? and there is api for photon voice 1 !?
    In Photon Voice 1 call PhotonVoiceRecorde.UpdateAudioSource().
Sign In or Register to comment.