Note that there are some explanatory texts on larger screens.

plurals
  1. POTurn off Webcam flash light metro app C#
    primarykey
    data
    text
    <p>Apologize if I'm wrong, I'm developing metro app using C# and XAML for Windows 8,My app has capability to capture a QR Code image, Save it in picture library, decode QR image(I'm using XZing.Net library to decode) and display content encoded in QR image. Every thing works fine if I <strong>block Webcam flash light with my finger</strong> and capture image, But if Flash light is ON after capturing image XZing.Net cannot able to decode. Is there any way I can turn off flash light using code.Please check my code below</p> <pre><code>try { MediaCapture m_mediaCaptureMgr = new MediaCapture(); await m_mediaCaptureMgr.InitializeAsync(); qrCameraElement.Source = m_mediaCaptureMgr; await m_mediaCaptureMgr.StartPreviewAsync(); } catch(Exception) { } </code></pre> <p>"qrCameraElement" is instance of CaptureElement</p> <p>On capture button Click</p> <pre><code>StorageFile m_photoStorageFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("QRImage.png", CreationCollisionOption.ReplaceExisting); ImageEncodingProperties imageProperties = ImageEncodingProperties.CreatePng(); await m_mediaCaptureMgr.ClearEffectsAsync(MediaStreamType.Photo); await m_mediaCaptureMgr.CapturePhotoToStorageFileAsync(imageProperties, m_photoStorageFile); StorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync("QRImage.png"); try { using (IRandomAccessStream photoStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) { WriteableBitmap writeableBitmap = await BitmapFactory.New(1, 1).FromStream(photoStream); writeableBitmap.SetSource(photoStream); var barcodeReader = new BarcodeReader { PossibleFormats = new List&lt;BarcodeFormat&gt; { BarcodeFormat.QR_CODE }, TryHarder = true, AutoRotate = true }; var result = barcodeReader.Decode(writeableBitmap); if(result != null) { //Do something } else { //Display message as unable to read QR image } } } catch(Exception e) { Console.WriteLine(e.Message); } </code></pre> <p>I'm getting <code>result</code> as null when Webcam Flash is used. Please help me.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload