While looking for some examples of mobile apps that make use of a device’s camera, I came across a nice sample app to record videos with a Windows Phone.
However when I tried the same thing in the app I’m currently developing, the camera ( or VideoCaptureDevice) wasn’t available.
The fix for this is however rather simple, once you know it.
You have to specify the ID_CAP_ISV_CAMERA and ID_CAP_MICROPHONE Capabilities in the app manifest as shown below.
Next time you run your app, it should have access to the phone’s camera.
What are Capabilities?
Capabilities represent the software and hardware features that a device must possess in order for your app to function properly.
If, for example, your app accesses contact data on the phone, you will need to set the ID_CAP_CONTACTS capability in the VMAppManifest.xml file. This can be done using the app manifest editor which opens automatically when you double-click on the file in Visual Studio.
By specifying a phone’s software and hardware requirements, you will ensure that your app can only be downloaded and installed from the Windows Phone Store by users with a ‘capable’ phone. If you don’t mark the capabilities correctly, your app may quit unexpectedly and you will end up with some very unhappy users!
Please refer to App capabilities and hardware requirements for Windows Phone for a full description.