[Interest] Trying to access Microphone via QAudioInput on Mac 10.14

Roland Winklmeier roland.m.winklmeier at gmail.com
Fri May 3 16:44:19 CEST 2019

Am Fr., 3. Mai 2019 um 16:35 Uhr schrieb Jason H <jhihn at gmx.com>:

> You have to add the description of microphone use to be presented to the
> user.
> I've done somethign similar to this, for video I think, and I did get the
> popup and it worked as it should have.

Almost. Meanwhile I can answer my own question.
The description you are referring to was already added in the form of
<key>NSMicrophoneUsageDescription</key>. However that did not cause any
popup. The reason is that when creating QAudioInput, its using the
CoreAudio plugin. In that case, the security chip in MacOS prevents the
access without saying anything. For the popup to be raised, AVFoundation is
required. That is used in video by default, thats why it worked for you.
The workaround for audio is to ask via
[AVCaptureDevice authorizationStatusForMediaType:mediaType]
for the current authorization and if not yet determined, request the access
[AVCaptureDevice requestAccessForMediaType:mediaType]
before the audio input device is opened. That will raise the popup and kill
the app if NSMicrophoneUsageDescription is missing.

Maybe its worth adding that QtMultimedia plugins.

Cheers Roland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190503/9bd2dcf2/attachment.html>

More information about the Interest mailing list