I am developing a simple Flash Light application for WP8, and I am using the great example code by JustinAngel in this question: Reflection failure when attempting to access Microsoft.Phone.Media.Extended
My question is; How do I close the camera flash? I Have been trying with setting the VideoTorchMode.Off property, but when I try to initiate the camera again using the code below, it just throws me the following error: Operation is not valid due to the current state of the object.
// get the AudioViceoCaptureDevice
var avDevice = await AudioVideoCaptureDevice.OpenAsync(sensorLocation,
AudioVideoCaptureDevice.GetAvailableCaptureResolutions(sensorLocation).First());
You need to cache the avDevice for later use. Don’t initialize it multiple times and make sure to dispose of it once you’re done with it.