MacOS and iOS can't use the mic

Hello, what could be the reason behind Mac OSX and iOS returns a false when trying to use the Voice unreal demo? (but it works for Windows)

Comments

  • vadim
    vadim mod
    edited February 2022

    Hi,

    What do you mean by "returns a false"?

    Since we do not provide opus libraries for mentioned platforms, most likely you get linkage errors.

    Mac OSX and iOS are not supported by UE4 demo currently.

    Even with opus library, the app may not work on the platform if FVoiceModule used in SDK for audio capture doesn't support this platform.

  • Correction: we do provide opus libraries for Mac and iOS in Realtime packages but as I said, FVoiceModule may not work on these platforms.

    Please share your logs to clarify this.

  • Thanks Vadim, so I am trying to make photon voice to work on iOS and OSX using Unreal (4.26 and 4.27) and the PhotonVoice realtime library. Everything compiles and builds ok, but even if the FVoiceModule::CreateVoiceCapture returns a valid TSharedPtr<IVoiceCapture> looks like it is not capturing any audio. But using the same config ,for Windows or Android, it works fine.

    Permissions

    • For Android, you need to request the permissions with this method https://docs.unrealengine.com/4.26/en-US/BlueprintAPI/AndroidPermission/RequestAndroidPermissions/ android.permission.RECORD_AUDIO and android.permission.MODIFY_AUDIO_SETTINGS are needed, and it works ok. It works
    • For Windows, there is no need right now to ask for permissions. It works.
    • For Mac, you first need permissions for the mic for the Unreal Editor (and also any build you do of your game), so there is a way to request them editing this file /YourUE4Root/Engine/Source/Runtime/Launch/Resources/Mac/Info-Editor.plist and adding the following lines in the base dictionary: <key>NSMicrophoneUsageDescription</key> <true/> , you also need to add this in the plist of the game packaging settings for Mac, and we also need Objective C code to request permissions for the mic (it's not enough with having the plist option added) -> developer.apple.com/documentation/avfaudio/avaudiosession/1616601-requestrecordpermission but you can't run this in the editor, only in Builds. It works , the CreateVoiceCapture uses the mic, but it does not capture audio.
    • For IOS, I did add the permissions for the plist in the iOS packaging info : <key>NSCameraUsageDescription</key><string>PhotonVoice</string>\n<key>NSMicrophoneUsageDescription</key><string>PhotonVoice</string> and to request the permissions you need this ObjC code : [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(__unused BOOL granted){}]; . It asks for permissions, but there is no audio capturing.

    Any idea how to solve this? I can send you logs via email .

    Thanks!