locked
Camera Capturing Image is Not working in windows 8 apps

    Question

  • Hi All,

    Am developing Win 8 Apps.

    Capturing Image from camera is working fine in one screen but its giving error is screen 2

    am using following code

    CameraCaptureUI dialog = new CameraCaptureUI();
                    Size aspectRatio = new Size(16, 9);
                    dialog.PhotoSettings.CroppedAspectRatio = aspectRatio;
    
                    file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);
    
    
                    if (file != null)
                    {
                        BitmapImage bitmapImage = new BitmapImage();
                        using (IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.Read))
                        {
                            bitmapImage.SetSource(fileStream);
                        }
                       
                      
                        ImagePath = string.Empty;
                        ImagePath = file.Path;

    "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

    Am getting this error

    At this line 

    file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Photo);

    am getting this error when i try to use the same code which i have used in screen 1.

    in scree 1 am not getting any error.

    any suggestion would be of great help.

    Thanks

    Arjun.M


    Arjun


    Friday, March 28, 2014 1:18 PM

Answers

  • Hi,

    Would you set the device capability in the app manifest? To enable webcam access, the app must include the Webcam DeviceCapability in the application manifest:

    1.In Microsoft Visual Studio, in Solution Explorer, open the designer for the application manifest by double-clicking the package.appxmanifest item

    2.Click Capabilities.

    3.Check the box for Webcam

    See the link below to get more information:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh868171.aspx

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, March 31, 2014 5:44 AM