OcrControl.StartPreviewAsync() Method


Deprecated. The StartPreviewAsync() Method starts The Bing Optical Character Recognition (OCR) Control camera in preview mode. If the camera has been previously stopped, it will reset the control and resume preview.

Published date: March 4, 2014


The Bing OCR Control is deprecated as of March 12, 2014


public IAsyncAction StatPreviewAsync();


When calling StartPreviewAsync(), the method will first search for a rear facing camera that supports 1280x720 or 640x480 resolution in photo mode. If there is no rear facing camera, or the camera does not meet the resolution requirements of the control, the method will raise the OcrControl.Failed Event with the appropriate error code and then exit.

After selecting a camera, the method starts the camera in preview mode and waits until ether the CaptureFrame() or ResetAsync() method is called. In the default Ocr Control, CaptureFrame() is called when the user clicks or taps the camera display area.


This following code example shows the StartPreviewAsync() method in the page load event handler and in a button click event handler.

// Start the preview when the application starts.
private async void MainPage_Loaded(object sender, RoutedEventArgs e)
    await ocrControl.StartPreviewAsync();

// Start the preview when the user clicks a button.
private async void StartPreview()
    btnStart.IsEnabled = false;
    await OCR.StartPreviewAsync();
    btnStart.IsEnabled = true;

In this example, the button is disabled until the StartPreviewAsync method completes. This is done to prevent collisions because the method is not thread safe.


Minimum Supported Client

Windows 8.1

Required Extensions

Bing OCR