Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Not entering PhotoCapture.CreateAsync() when running in Hololens

Hi,
I am trying to take a picture with the Hololens Camera. When I am trying it in Unity on my PC it works, but when I try it on Hololens it doesn't even enter the PhotoCapture.CreateAsync(). I have set all capabilities that are needed (webcam and microphone) an made sure it's in the manifest file. Here is the problematic code.

void Start() {
startHeadPosition = Camera.main.transform.position;
newHeadPosition = startHeadPosition;
dIndikator.text = "";

    CreateScene("Test");


    Debug.Log("\n Taking picture \n");

    PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);

    Debug.Log("\n Debug 2 \n");
}


void OnPhotoCaptureCreated(PhotoCapture captureObject)
{
    Debug.Log("\n Debug 1 \n");
    photoCaptureObject = captureObject;

    m_cameraResolution = PhotoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).Last();

    CameraParameters c = new CameraParameters();
    c.hologramOpacity = 0.0f;
    c.cameraResolutionWidth = m_cameraResolution.width;
    c.cameraResolutionHeight = m_cameraResolution.height;
    c.pixelFormat = CapturePixelFormat.JPEG;

    Debug.Log("\n PhotoModeStarted \n");

    captureObject.StartPhotoModeAsync(c, OnPhotoModeStarted);
}

When running in Unity the log says :
Taking picture
Debug 2
Debug 1
PhotoModeStarted

But in Hololens it only says :
Taking picture
Debug 2

I am getting desperate because I can't find a solution.

Sign In or Register to comment.