Request Audio Permission
You can use the Permission interface as provided by Unity to enable audio capture from the microphone or other devices, the documentation for which is available here.
We do provide our own cross platform interface which provides better support on certain platforms (iOS and macOS). An example of how to use it is provided below:
Debug.Log("Checking user has authorization to use the Microphone");
switch (CaptureBase.HasUserAuthorisationToCaptureAudio())
{
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.Unavailable:
Debug.LogWarning("Audio capture is unavailable, no audio will captured");
break;
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.NotDetermined:
Debug.Log("Audio capture status is not determined, requesting access");
yield return CaptureBase.RequestAudioCaptureDeviceUserAuthorisation();
switch (CaptureBase.HasUserAuthorisationToCaptureAudio())
{
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.Unavailable:
Debug.LogWarning("Audio capture is unavailable, no audio will captured");
break;
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.NotDetermined:
Debug.LogWarning("Audio capture status is still not determined, no audio will captured");
break;
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.Denied:
Debug.LogWarning("Audio capture status denied, no audio will be captured");
break;
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.Authorised:
Debug.Log("Audio capture is authorised");
break;
}
break;
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.Denied:
Debug.LogWarning("Audio capture status denied, no audio will be captured");
break;
case CaptureBase.AudioCaptureDeviceAuthorisationStatus.Authorised:
Debug.Log("Audio capture is authorised");
break;
}