question

Resul avatar image
Resul asked

Avoid hearing my own voice on PlayFab Party Voice Unity SDK with Photon - PUN 2

I have tested one user on Windows and the other on Android Device. I went away from my computer for making sure that my Laptop does not receive any audio. When I talk on my Android Device, I can hear my own voice and vice-versa. I think this makes echoes while on two applications I can hear my own voice.

How should I set the chat permission for that only the other persons on the same network can hear my voice?

Also if any player joins to a network that has already been created, let's say the fifth person joined for PlayFab Party Features, that fifth player calls "OnRemotePlayerJoined" callback for every other player in the same network.

(I am using Unity PlayFab SDK with Photon - PUN 2. And two players are in the same room and the same scene.)

Here is the OnRemotePlayerJoined function:

private void OnRemotePlayerJoined(object sender, PlayFabPlayer player)
{    
    SDK.PartyChatControlGetPermissions(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle, player._chatControlHandle,
        out PARTY_CHAT_PERMISSION_OPTIONS options);

    options = PARTY_CHAT_PERMISSION_OPTIONS.PARTY_CHAT_PERMISSION_OPTIONS_SEND_AUDIO |
              PARTY_CHAT_PERMISSION_OPTIONS.PARTY_CHAT_PERMISSION_OPTIONS_RECEIVE_AUDIO;
    
    SDK.PartyChatControlSetPermissions(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle, player._chatControlHandle,
        options);
}

Here is the OnNetworkJoined function:

private void OnNetworkJoined(object sender, string networkId)
{
    SDK.PartyChatControlSetAudioInput(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle,
    PARTY_AUDIO_DEVICE_SELECTION_TYPE.PARTY_AUDIO_DEVICE_SELECTION_TYPE_SYSTEM_DEFAULT, null, null);
SDK.PartyChatControlSetAudioOutput(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle,
    PARTY_AUDIO_DEVICE_SELECTION_TYPE.PARTY_AUDIO_DEVICE_SELECTION_TYPE_SYSTEM_DEFAULT, null, null);

SDK.PartyChatControlGetPermissions(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle, null,
    out PARTY_CHAT_PERMISSION_OPTIONS options);

options = PARTY_CHAT_PERMISSION_OPTIONS.PARTY_CHAT_PERMISSION_OPTIONS_SEND_AUDIO |
          PARTY_CHAT_PERMISSION_OPTIONS.PARTY_CHAT_PERMISSION_OPTIONS_RECEIVE_AUDIO;

SDK.PartyChatControlSetPermissions(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle, null,
    options);
}

If you have any additional info, please do not hesitate to ask.

apisunity3dsdksandroidwindows
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rick Chen avatar image
Rick Chen answered

Please note that there are local chat control and remote chat control in the audio manipulation. For a local chat control, this is used to retrieve the microphone input; for a remote chat control, this is used to retrieve incoming voice audio. Please check if you have configured your local chat control. For more detail, please refer to Using real-time audio manipulation to apply custom voice effects - PlayFab | Microsoft Docs.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Resul avatar image
Resul answered

@Rick Chen Thank you for your kind support. I have managed to work on 2 Android devices.


Here is the OnRemotePlayerJoined function:

private void OnRemotePlayerJoined(object sender, PlayFabPlayer player)
{
    SDK.PartyChatControlGetPermissions(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle, player._chatControlHandle,
        out PARTY_CHAT_PERMISSION_OPTIONS options);

    options = PARTY_CHAT_PERMISSION_OPTIONS.PARTY_CHAT_PERMISSION_OPTIONS_RECEIVE_AUDIO |
              PARTY_CHAT_PERMISSION_OPTIONS.PARTY_CHAT_PERMISSION_OPTIONS_SEND_AUDIO;

    SDK.PartyChatControlSetPermissions(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle, player._chatControlHandle,
        options);
}
Here is the OnNetworkJoined function:
private void OnNetworkJoined(object sender, string networkID)
{
    SDK.PartyChatControlSetAudioInput(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle,
        PARTY_AUDIO_DEVICE_SELECTION_TYPE.PARTY_AUDIO_DEVICE_SELECTION_TYPE_SYSTEM_DEFAULT, null, null);
    SDK.PartyChatControlSetAudioOutput(PlayFabMultiplayerManager.Get().LocalPlayer._chatControlHandle,
        PARTY_AUDIO_DEVICE_SELECTION_TYPE.PARTY_AUDIO_DEVICE_SELECTION_TYPE_SYSTEM_DEFAULT, null, null);
}


This document (Platform support) says Real-time audio manipulation only works on Windows and Xbox. But this article is 2 years old. Is it still the same? Is the Audio Stream features available for Android and iOS with Unity3D?


If a player plays the game with a built-in speaker and microphone, the opponents hear their own voices because of the built-in microphone takes input from speaker. Is there anything we can do with PlayFab Party for it?


And while Bluetooth headphones were connected to one of the android devices, game voices suddenly stopped. But the other phone connected with wired headphones could hear game and chat voices. With Bluetooth headphones, I can listen to music and talk. It is working properly but I can not hear the game voices somehow. Is there something that I have missed?

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rick Chen avatar image Rick Chen ♦ commented ·

The Real-time audio manipulation is not available for Android and iOS. PlayFab Party does not have feature to distinguish the noise and remove it.

For the issue that Bluetooth headphones cannot hear the game voice, it seems not related to the PlayFab Party. Please check your Bluetooth headphones and your System’s Audio setthings.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.