Reputation: 1
I'm developing an app for Windows 8 that uses audio device but I have a problem with the initializeAsync method. Well..
In the app manifest capabilities I have checked microphone.
In the OnNavigatedTo method I have written:
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
try
{
var settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.Audio;
await mediaCaptureMgr.InitializeAsync(settings);
}
catch (Exception ex)
{
}
}
When I run my app the first time I have the following message:
"Can my app use your microphone?" with two buttons: Allow & Block. If I click Allow the app works good. If I click Block the app crash with Access is Denied exception and I can think that it is right but if I run again my app I receive the same exception another time and not the message. How can I close the audio driver that I have started with InitializeAsync??????? How can I proceed????
I could:
1) Disable block button but I don't know how I can do that. 2) Manage the exception (Ex: If click block button reset audio device so I can see the message again) 3) I don't know....
I have passed my last two days on this problem but I havent found a solution.
Thanks in advance.
Andrea
Upvotes: 0
Views: 1558
Reputation: 406
Try add this:
<Capability Name="removableStorage" />
<DeviceCapability Name="webcam" />
<DeviceCapability Name="microphone" />
<DeviceCapability Name="proximity" />
to Capabilities in Package.appxmanifest file.
Upvotes: 1
Reputation: 1
Please Set VideoDeviceId Property of MediaCaptureInitializationSettings
Upvotes: 0