So I want to set up a system that will let me check whenever a local player is talking, so that I can perform another function afterwards. I’ve set up the Voice Chat system, and I’ve created a new PlayerController, from which I’m attempting to call IsLocalPlayerTalking(). However, it seems to always return false. I was hoping someone might have a usage case that I could take a look at, or perhaps they might see where I’m making my mistake?
Code is below:
bool ANetworkPlayerController::OnTick()
{
ULocalPlayer* LP = Cast<ULocalPlayer>(GetNetOwningPlayer());
if (LP != NULL)
{
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
IOnlineVoicePtr VoicePointer = OnlineSub->GetVoiceInterface();
if (VoicePointer->IsLocalPlayerTalking(LP->GetControllerId()))
return true;
else
Print("No one is talking");
}
}
return false;
}