Photon Voice and iphone



  • @JohnTube Hello i am using " MicrophoneType photon " but nothing solve the sound come from "ear speaker", Also right know i tried " MicrophoneType photon " without any addition code and without this script "IOSAudioForceToSpeaker" still problem (sound come from "ear speaker")

    So please explain to me how can i solve problem when i am using MicrophoneType photon
    step by step or give to me any test project is work in ios and sound come from "Main Speaker" !

    Note :MicrophoneType unity unstable in ios impassable , try it .
  • @JohnTube @vadim can you help me
  • any one !!
  • mahmoud93p
    edited November 2018
    To understand my problem please make this test

    Test 1 follow this step
    * Select microphone type : photon
    * Then test your project in ios devices - must test in tow device ios
    The Result : When you make this test the sound come from : ear speaker .

    Test 2 follow this step
    * Select microphone type : unity
    * Then test your project in ios devices - must test in tow device ios
    The Result : Sound come from main speaker but unusable because too much"echo" and sound is repeat. .

  • Hi,

    Did you try to select speaker in ios control center?
  • mahmoud93p
    edited November 2018
    @vadim yes but same think ,also this is not solution i can't say to players please make this way .

  • I fix photon voice issue . @JohnTube @vadim
    I've edited "AudioIn" line 231 ,
    old code ([sessionInstance setCategory:AVAudioSessionCategoryPlayAndRecord)
    i add this to old code ("withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker ")
    --------new code
    [sessionInstance setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:&error];

    Now microphone type :"photon" is work in android and in ios and the sound come from "Main speaker" without used "IOSAudioForceToSpeaker"

    But there is a simple observation: when I hear my voice it is coarse or bigger than my natural voice!
    Any suggestion may be helpful

  • vadim
    vadim mod
    edited November 2018
    i'm afraid players should guess this way themselves in such case. Setting speaker is a standard ios action.
    Automatic routing to speakers does not work for Photon microphone currently. We are looking into this.
  • Maybe something else should be copied from ForceToSpeaker.m.
    Also take a look at forcing to speaker module recently updated in one of its repos:
    They state that it makes ios 7 / Unity 2018 working.
  • @vadim After edit my code automatic routing to main speakers in microphone type photon , but the problem if connected headphone then take off the headphone not routing to main speakers but may be can i fix this problem via some manually action .

    Either i tried this plugin" ForceToSpeaker" in microphone photon that is not work . you can make test ,that is not work in Microphone photon .

    Right now microphone photon is work for my after edit in AudioIn .
    If you have anther way to fix this problem make you sure test in tow ios device , also microphone unity unstable you can try it .

  • mahmoud93p
    edited November 2018
    There is some pitch in Audioin it is make sound slow around 0.07% , so do you know how can i control the pitch in Audioin ?
    i can write some code to handle this problem but i want to edit in "Audioin" .

    And i want to ask you when i edit value in photon voice setting it is effect when select microphone type photon ?

    Note : i am looking for official update from photon voice 1 to solve microphone photon without edit any code .

    Any suggestion may be helpful !
  • @mahmoud93p
    I tested Unity 2018.2.17f1 and iPhone 6s ios 12.1
    With "force to speaker" component from PhotonVoice package, both unity and photon mic modes route sound to speaker. So I can't reproduce the bug with this setup.
    With unity built-in "force to speaker" option, unity mic mode routes to speaker, photon mic mode routes to phone.
    Are you sure that sound in your tests comes from phone? Sometimes low volume sound form speaker seems like phone sound.

    Setting required mode in AudioIn as you do instead of doing so with separate component looks reasonable. I will try this.
  • vadim
    vadim mod
    edited November 2018

    I played a bit with audio session categories. For now, I found that category most appropriate for games is set via call
    [sessionInstance setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:(AVAudioSessionCategoryOptionDefaultToSpeaker|AVAudioSessionCategoryOptionAllowBluetooth)
    Without AVAudioSessionCategoryOptionAllowBluetooth, app did not switch to bluetooth device in my tests.

    Of course, no need for ForceToSpeaker component with such call.
    We plan to provide interface in voice api allowing set at least most common audio session categories
  • mahmoud93p
    edited November 2018
    @vadim thank you for this point it is an important point , and i don't try with bluetooth device , i will try today, but did you try to trun off bluetooth device after connected ? maybe should call again AVAudioSessionCategoryOptionDefaultToSpeaker !

    And did you work everything good ?
  • vadim
    vadim mod
    edited November 2018
    I plugged and unplugged wired headset, switched on and off bluetooth headset in different combinations. While no headset is plugged or connected, sound goes through speaker.
    AVAudioSessionCategoryOptionDefaultToSpeaker set once for audio session persists while session exists or until setCategory call updates it.
  • mahmoud93p
    edited November 2018
    @vadim After few test in headset and bluetooth device "Airpods" the result :
    When the sound goes through speaker and i plugged wired headset or "Airpods" it is work good , but if unplugged wired headset or "Airpods" the main problem is back the sound come from "ear speaker"
    so i think we need to call automatic again - (void)setupAudioSession - i don't try it .

    something important : if you don't use this line of code "AVAudioSessionCategoryOptionAllowBluetooth"
    the "Airpods" not work .
    Now I will mention the remaining problems that we will try to solve
    1-if i unplugged wired headset or "Airpods" the sound come from "ear speaker"
    2- The sound come from main speaker is slow, i mean slow not from internet no i mean sound is not normal the sound like big man (i think there is something in pitch in photon mic).
  • 1. This happens sometime to me too. I'm looking into it.
    2. So it's ok for headsets but slow for speaker? I can't reproduce this.
    Note that our codebases are pretty different for the moment. To synchronize them you need to wait next Photon Voice 1 update.
  • 1. Sound source is correct in my tests in fact. But the level is significantly lower than before connecting headset. The level is almost as low as phone's when holding smartphone at some distance. So please check carefully which output actually works.
    I noticed that it's much easier determine source of sound on iPhone 6s than on Xs since the latter has speaker at top side.
    Look at logs. On each route change, Photon Voice logs previous and current record and play devices.
    I don't know if the level changed intentionally by system and how to avoid this. But I always managed to revert to normal level by temporary sending app to background.
  • I can confirm this also happens for me with an iPhone 7, iOS 12.1.2, running Photon Voice 1.15 with Unity 2017.4.17. Tried with both mic types Photon and Unity. Voice comes through the ear speaker instead of the loud speaker, so it is not audible when looking at the screen and playing the game.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2019
    Hi @crystalpug,

    Please update to Photon Voice 1.17 and try again using Photon MicrophoneType.
  • Hello, I am using Photon voice 1 ver 1.18.1 and Unity 2018.3.12 with "photon microphone".
    Same problem, can't use loud speaker on iPhone.
    How can I fix it?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @devolzhas,

    Thank you for choosing Photon!

    This issue is handled in a better way in Photon Voice 2.
    We will not backport this to Photon Voice 1.

    Before you start thinking about migrating, could you try building the demo scenes from a new project where you import Photon Voice 2?
  • @JohnTube can I use Photon Voice 2 with PUN v.1?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @maxtyt,

    Thank you for choosing Photon!

    While the topic of this discussion is different, I will answer anyway.
    Please open a new discussion next time or use one that has the same topic.

    Photon Voice 2 does not support integration with PUN Classic (or PUN 1).