Here's the code:
MediaCapture mediaCapture;
mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync(new MediaCaptureInitializationSettings { MediaCategory = MediaCategory.Speech });
the last line throws an exception:
"No capture devices are available"
That is despite a microphone being connected. The microphone works with the built in Windows 10 Voice recorder app so I know it's fine. The app has permission to use the microphone, and it is on in the app's settings.
So why do I get the error / How do I overcome it?
Have you specify Micorphone
capabilities in Package.appxmainfest
?
If does, it should work, but throw another exception.
There are no more endpoints available from the endpoint mapper.
Cause you need to set StreamingCaptureMode
.
I have corrected your code, see below.
MediaCapture mediaCapture = new MediaCapture();
await mediaCapture.InitializeAsync(new MediaCaptureInitializationSettings
{
MediaCategory = MediaCategory.Speech,
StreamingCaptureMode = StreamingCaptureMode.Audio
});
For more info about speech, you can refer to this doc.