# Why cant i get voice chat interface?

**URL:** <https://forums.unrealengine.com/t/why-cant-i-get-voice-chat-interface/880525>\
**Category:** C++\
**Tags:** voice-chat, voice, unreal-engine, question\
**Created:** [April 9, 2023, 10:35am UTC](https://forums.unrealengine.com/t/why-cant-i-get-voice-chat-interface/880525 "2023-04-09T10:35:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kokapuk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kokapuk](https://forums.unrealengine.com/u/Kokapuk)\
**Post date:** [April 9, 2023, 10:35am UTC](https://forums.unrealengine.com/t/why-cant-i-get-voice-chat-interface/880525/1 "2023-04-09T10:35:26Z")

</div>

void UAdvancedVoiceLibrary::StartNetworkedVoice(uint8 LocalPlayerNum)  
{  
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();

```
if (!VoiceInterface.IsValid())
{
	UE_LOG(AdvancedVoiceLog, Warning, TEXT("Start Networked Voice couldn't get the voice interface!"));
	return;
}

VoiceInterface->StartNetworkedVoice(LocalPlayerNum);

```

}

IsValid() always false, and voice chat not working.  
Here is my DefaultEngine:

```auto
[Voice]

bEnabled=true

[OnlineSubsystem]

DefaultPlatformService=Steam

bHasVoiceEnabled=true

[OnlineSubsystemSteam]

bEnabled=true

```

---

<div class="post-metadata">

**Author:** ![theconone](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@theconone](https://forums.unrealengine.com/u/theconone)\
**Post date:** [June 10, 2024, 2:52pm UTC](https://forums.unrealengine.com/t/why-cant-i-get-voice-chat-interface/880525/2 "2024-06-10T14:52:39Z")

</div>

Hey @Kokapuk , I have also been scratching my head on why this wasn’t working. After looking into it a bit, it seems like we need to add “GetWorld()” to the “Online::GetVoiceInterface()” like this:

`IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld());`

However, I see that you are using the “UAdvancedVoiceLibrary” in that case you would want to modify the AdvancedVoiceLibrary.cpp/.h to have each of the functions containing:

`IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();`

to have a new param “const UObject\* WorldContextObject” since a UBlueprintFunctionLibrary does not have a UObject out right to reference the UWorld.

e.g.

```auto
AdvancedVoiceLibrary.h

UFUNCTION(BlueprintCallable, Category = Online|AdvancedVoice, meta = (WorldContext = "WorldContextObject"))
static void StartNetworkedVoice(const UObject* WorldContextObject, uint8 LocalPlayerNum = 0);

```

```auto
AdvancedVoiceLibrary.cpp

void UAdvancedVoiceLibrary::StartNetworkedVoice(const UObject* WorldContextObject, uint8 LocalPlayerNum)
{
	if (!IsValid(WorldContextObject))
	{
		UE_LOG(AdvancedVoiceLog, Warning, TEXT("No valid UObject to use to get World!"));
		return;
	}

	IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(WorldContextObject->GetWorld());

	if (!VoiceInterface.IsValid())
	{
		UE_LOG(AdvancedVoiceLog, Warning, TEXT("Start Networked Voice couldn't get the voice interface!"));
		return;
	}

	VoiceInterface->StartNetworkedVoice(LocalPlayerNum);
}

```

Also something to note: when using these functions now is that they will automatically take the UObject Context of whatever they are getting called within.

I am not 100% on the reason why but it seems to be on the lines of a call to GetOnlineSubSystem() during the Init() of FVoiceEngineImpl - during the Init() of FOnlineVoiceImpl - returns a nullptr to a IOnlineSubsystem\* variable which then makes the VoiceInterface invalid. I think this happens because without directly saying that we want the VoiceInterface for the UWorld, we were trying to create another one.
