Utbu
Utbu

Reputation: 47

UWP IOT, How to access camera on board?, not usb camera

I have a problem accessing IOT camera, I try create simple code that access camera, view live streaming from that camera. It works on Windows-phone 10 && Windows 10. but I got error when try it on IOT Device, it says 'No devices found' the camera is like here in this link

here is the code

private async Task StartPreviewAsync()
    {
        try
        {
            mediaCapture = new MediaCapture();
            var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
            var count = allVideoDevices.Count;

            System.Diagnostics.Debug.WriteLine(count+"Video Capture Device");
            await mediaCapture.InitializeAsync();
            PreviewControl.Source = mediaCapture;
            await mediaCapture.StartPreviewAsync();
        }
        catch (UnauthorizedAccessException)
        {
            // This will be thrown if the user denied access to the camera in privacy settings
            System.Diagnostics.Debug.WriteLine("The app was denied access to the camera");
        }
        catch (Exception)
        {
            System.Diagnostics.Debug.WriteLine("MediaCapture initialization failed.");
        }
    }
    //protected async override void OnNavigatedFrom(NavigationEventArgs e)
    //{
    //    await CleanupCameraAsync();
    //}
    protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
        StartPreviewAsync();
       
    }

any suggestion for my problem?

Upvotes: 1

Views: 404

Answers (1)

Dmitri Soshnikov
Dmitri Soshnikov

Reputation: 727

Windows 10 IoT Edition currently supports limited number of devices which are on Hardware Compatibility List (see Cameras section). Unfortunately, if you camera is not listed there, you will not be able to use it from your UWP Application. As far as I know, Raspberry Pi native camera is not supported.

Upvotes: 4

Related Questions