2

I'm using Visual Studio 2015 (Update 2) to build an app using Apache Cordova. This app uses the cordova-plugin-media plugin for recording audio. However, when I try to record audio, I get this error: Access is denied.

Looking at the generated package.windows10.appxmanifest file in \platforms\windows, I don't see the microphone capability in there. There's is only one capability:

<Capability Name="internetClient" />

So the microphone capability is missing. However, this is what I find in windows.json:

"config_munge": {
    "files": {
        "package.appxmanifest": {
            "parents": {
                "/Package/Capabilities": [
                    {
                        "xml": "<DeviceCapability Name=\"microphone\" />",
                        "count": 1
                    }
                ]
            }
        }
    }
}

What can I do to make sure this capability is properly added to the generated manifest(s)? Notice the different name: package.appxmanifest in windows.json, whereare the generated manifest is actually package.windows10.appxmanifest.

This is with Cordova 6.1.1 and Cordova@Windows 4.3.1.

Knelis
  • 6,782
  • 2
  • 34
  • 54

2 Answers2

1

There are two ways to add the capability:

  1. Add <DeviceCapability Name="microphone" /> inside Capabilities tag of your package.windows10.appxmanifest file like this:

    <Capabilities>
      <Capability Name="internetClient" />
      <DeviceCapability Name="microphone" />
    </Capabilities>
    
  2. Navigate to the root folder of your project. Open command line window and type in cordova platform update windows command to update the windows platform. <DeviceCapability Name="microphone" /> will be added to the mannifest file.

Elvis Xia - MSFT
  • 10,801
  • 1
  • 13
  • 24
  • Hi, that definitely helped me out. Turns out there was a bug in the `cordova-windows` package, which has been solved in the latest version. – Knelis Apr 12 '16 at 09:01
0

It looks like I was affected by a bug in cordova-windows@4.3.1 which prevented capabilities in the manifest file from being updated.

The issue has been resolved as of cordova-windows@4.3.2, which was release April 5th.

Knelis
  • 6,782
  • 2
  • 34
  • 54