Skip to main content

Platform

Microphone Permissions (Mac, iOS and Android)

In order to use the microphone while running on Mac or iOS, you will need to allow the user to give the application permission.

The UInworldPlayerAudioCaptureComponent will automatically attempt to prompt the user for permission.

auto& PlatformModule = FModuleManager::Get().LoadModuleChecked<FInworldAIPlatformModule>("InworldAIPlatform");
Inworld::Platform::IMicrophone* Microphone = PlatformModule.GetMicrophone();

if(Microphone->GetPermission() == Inworld::Platform::Permission::UNDETERMINED)
{
Microphone->RequestAccess([](bool Granted)
{
ensureMsgf(Granted, TEXT("Platform has denied access to microphone."));
});
}
else
{
const bool Granted = Microphone->GetPermission() == Inworld::Platform::Permission::GRANTED;
ensureMsgf(Granted, TEXT("Platform has denied access to microphone."));
}

It is required to provide a NSMicrophoneUsageDescription in the Info.plist of the application. Otherwise, attempting to request access to the microphone will result in a termination of the application.

Editor (Mac)

For running in the editor, change the UnrealEditor-Info.plist used for your project by editing /Project/Intermediate/Mac/UnrealEditor-Info.plist.

Mac

For running on Mac builds, edit the Info.plist by right-clicking the package, selecting 'Show Package Contents', and editing /Contents/Mac/Info.plist.

Infoplist

iOS

For running on iOS builds, add the following to /Project/Config/DefaultEngine.ini

[/Script/IOSRuntimeSettings.IOSRuntimeSettings]
AdditionalPlistData=<key>NSMicrophoneUsageDescription</key><string>Inworld.ai wants to use your microphone.</string>

Android

For running Android builds, enable android.permission.RECORD_AUDIO permission by either adding it to Extra Permissions or enabling Add permission to support Voice chat option in Project Settings.

AndroidPermission