When I use more than one cameras and switch from one to another, the first one sometimes closed but sometimes did not close properly.
Before I open a new camera, I stop the camera by following code:
if (this.captureDevice != null)
{
// Discard capture device.
if (this.captureDevice.IsRunning)
{
await this.captureDevice.StopAsync();
}
if (this.captureDevice != null)
{
await this.captureDevice.DisposeAsync();
//this.captureDevice.Dispose();
this.captureDevice = null;
}
}
Is there anything wrong?
When I use more than one cameras and switch from one to another, the first one sometimes closed but sometimes did not close properly.
Before I open a new camera, I stop the camera by following code:
if (this.captureDevice != null)
{
// Discard capture device.
if (this.captureDevice.IsRunning)
{
await this.captureDevice.StopAsync();
}
}
Is there anything wrong?