Skip to main content

Voice chat in parties

Enabling voice chat in EOS parties is easy. Just set the bChatEnabled / "Chat Enabled" flag in the party configuration when creating the party, and the user will automatically join the voice chat room. When they leave the party, they will be disconnected from the voice chat room.

You can discover the name of the channel for later use with IVoiceChatUser by calling IVoiceChatUser::GetChannels().

Enabling voice chat in parties

For a more detailed example on creating a party and handling callbacks, refer to Creating a party. This example just shows how to enable chat on the party configuration before calling CreateParty:

TSharedRef<FPartyConfiguration> Config = MakeShared<FPartyConfiguration>();
Config->bIsAcceptingMembers = true;
Config->MaxMembers = 4; // The maximum number of players in the party.

// This line enables voice chat for the party.
Config->bChatEnabled = true;

if (!Party->CreateParty(
*Identity->GetUniquePlayerId(0).Get(), // The local player creating the party.
(FOnlinePartyTypeId)PartyTypeId, // The party type ID.
*Config,
FOnCreatePartyComplete::CreateLambda([](
const FUniqueNetId &LocalUserId,
const TSharedPtr<const FOnlinePartyId> &PartyId,
const ECreatePartyCompletionResult Result)
{
// If Result == ECreatePartyCompletionResult::Succeeded, the party
// was created and you are now the party leader.
})))
{
// Call didn't start, return error.
}

Get the party ID that a voice chat channel is associated with

You can discover the associated party IDs by iterating through the channel list, and calling GetSetting on the voice chat user for each channel:

for (const auto& ChannelName : VoiceChatUser->GetChannels())
{
FString PartyId = VoiceChatUser->GetSetting(FString::Printf(TEXT("__EOS_PartyId:%s"), *ChannelName));
if (!PartyId.IsEmpty())
{
// PartyId contains the ID of the party this voice chat channel is associated with.
}
}