PhotoCamera hangs when app is started from phone

Hello.

I have created a simple project for WP8. I tried to implement a PhotoCamera, and when I deploy the App via VS2012, it runs fine. But whenever I try to launch the app via the phone, the camera hangs.

This is how I have set up the XAML page.

<DrawingSurfaceBackgroundGrid x:Name="DrawingSurfaceBackground" Loaded="DrawingSurfaceBackground_Loaded">

        <Canvas VerticalAlignment="Center" x:Name="arCameraStack" Canvas.ZIndex="1" Width="732" Height="549" HorizontalAlignment="Left" Visibility="Collapsed">
            <Canvas.Background>
                <VideoBrush x:Name="viewfinderBrush" />
            </Canvas.Background>
        </Canvas>

    </DrawingSurfaceBackgroundGrid>

And this is what I do to show the camera.

 private void ShowCamera()
        {
            camera = new PhotoCamera(CameraType.Primary);
            viewfinderBrush.SetSource(camera);
            arCameraStack.Visibility = System.Windows.Visibility.Visible;
        }

This code ran fine on older versions of Unity I think. Now I’m using the latest version, but I also tried the 4.3.0 version, same error.

What should I do to unblock the camera?

Thanks,
Nenad

The new version of Unity seems to remove the “capabilities” and “requirements” section. It is now your responsibility to do this inside Visual Studio. My first thought is that these capabilities are not enabled. Can you double-check your App’s Manifest to ensure they are indeed enabled?

Also, grab Windows Phone Power Tools which will allow you to grab the log file left on the device during testing. That way you can see if the log contains any important information and double-check your Visual Studio Debug output (they are two separate things for the time being).

I have had it enabled. Found out the problem after so many hours.

I’ve missed to add

UnityApp.SetRenderResolution(0, 0);

when I was hiding the Unity panel.