Audio coming out of headset after a phone call?

gfalk
✭
in Photon Voice
Photon Voice 2.16.1
Input Mic
Type Photon
iOS Audio Session Parameters
Use Custom
Play and Record
Voice chat
Categories: 2
Default to Speaker
Allow Bluetooth
The Issue:
1. Audio outputs to speaker
2. Receive call
3. Audio outputs to headset
iOSAudioForceToSpeaker Component added to same GameObject that has the Recorder Component
Photon does a poor job of getting the microphone back if it taken from an external source (see SIRI when notification window is pulled down) so we do a manual check that looks like this
if (RecorderResetTimer.ElapsedMilliseconds > 5000 && bRetryRecorder == false && recorder.TransmitEnabled == true && recorder.IsCurrentlyTransmitting == false &&
PhotonNetwork.NetworkClientState == ClientState.Joined && voiceConnection.ClientState == ClientState.Joined)
then we reset the recorder data
recorder.UserData = UnityEngine.Random.Range(1, 10000000);
so that we can call
recorder.RestartRecording();
I hate this code, but without the microphone can stop working
So - How do we get it so that the audio STOPS getting changed to being routed to the headset?
Input Mic
Type Photon
iOS Audio Session Parameters
Use Custom
Play and Record
Voice chat
Categories: 2
Default to Speaker
Allow Bluetooth
The Issue:
1. Audio outputs to speaker
2. Receive call
3. Audio outputs to headset
iOSAudioForceToSpeaker Component added to same GameObject that has the Recorder Component
Photon does a poor job of getting the microphone back if it taken from an external source (see SIRI when notification window is pulled down) so we do a manual check that looks like this
if (RecorderResetTimer.ElapsedMilliseconds > 5000 && bRetryRecorder == false && recorder.TransmitEnabled == true && recorder.IsCurrentlyTransmitting == false &&
PhotonNetwork.NetworkClientState == ClientState.Joined && voiceConnection.ClientState == ClientState.Joined)
then we reset the recorder data
recorder.UserData = UnityEngine.Random.Range(1, 10000000);
so that we can call
recorder.RestartRecording();
I hate this code, but without the microphone can stop working
So - How do we get it so that the audio STOPS getting changed to being routed to the headset?
0
Comments
-
Hi @gfalk,
Thank you for choosing Photon!
We will try to add a built-in out-of-the-box way to automatically restart recording when the audio is interrupted due to a phone call...I'm not sure about the SIRI thing or other cases, we will have to test and you would need to provide details.
Anyway, to restart recording, no need to change the UserData.
Call recorder.StopRecording and then recorder.StartRecording
or recorder.IsRecording = false and recorder.IsRecording = true.
Thank you for your patience and understanding.0 -
Thanks for response - please let me know what you need, or a workaround as this is a highly urgent issue, if we can't resolve we may need to drop and move onto another provider as it is, its too unreliable.0
-
Hi @gfalk,
As I told you we're currently studying how to implement generic callbacks for audio interruptions and route changes in iOS and react to them if possible out of the box so the user/developer does not have to do this manually/explicitly.
It's not easy and there is no magic solution and there are a lot of possible scenarios/combinations (incoming call, notification, background audio, SIRI, video ad, etc.)
So this will take time but we're aware of it.
If this is blocking send an email to [email protected].0 -
Hi @gfalk,
Find here a new version of Photon Voice's iOS native plugin.
Import it in a project where Photon Voice 2.17 is already present and try again.
It should fix the issues you reported before.
Thanks again for your patience and understanding.
Looking forward to reading positive results from your side.0 -
thank you - we have added this to the build today, and are testing - we will report back1
-
audio is going to the wrong speaker.
A: everyone in room its working
b: leave for >15 seconds by swiping to the home screen
c: come back into room
both photon, and voice show disconnected state, they reconnect, and sometimes the wrong speaker is used.
Any advice?0 -
Hi @gfalk,sometimes the wrong speaker is used.Any advice?
Besides you are now testing a different thing.
original report/issue:Audio coming out of headset after a phone call?The Issue:
1. Audio outputs to speaker
2. Receive call
3. Audio outputs to headsetPhoton does a poor job of getting the microphone back if it taken from an external source (see SIRI when notification window is pulled down)b: leave for >15 seconds by swiping to the home screenboth photon, and voice show disconnected state, they reconnect, and sometimes the wrong speaker is used.
So I would like to know first if original issues are fixed or not.0 -
After a good week+ of testing, we can confidently say the issue seems to be resolved. Updating to the latest version, applying your hotfix has resulted in none of the issues I described above.1