PhotoCapture.CreateAsync() never executed

Hi,
I'm using the HoloLens and Unity and I try to take a photo.

I have the same problem as in this discussion
https://forums.hololens.com/discussion/897/locatable-camera-known-issue-photocapture-createasync-doesnt-start

This code in a MonoBehaviour in Unity :
void Start() { Debug.LogError("CreateAsync start"); Debug.LogError(WebCam.Mode); Debug.LogError(PhotoCapture.SupportedResolutions); foreach (Resolution resolution in PhotoCapture.SupportedResolutions) { Debug.LogError(resolution); } Debug.LogError("END"); PhotoCapture.CreateAsync(false, delegate (PhotoCapture captureObject) { Debug.LogError("CreateAsync done"); } }

Print this output :

CreateAsync start
None
UnityEngine.Resolution[]
END

Here is my "Capabilities" part of the Package.appxmanifest :
<Capabilities> <Capability Name="internetClient" /> <uap2:Capability Name="spatialPerception" /> <DeviceCapability Name="webcam" /> <DeviceCapability Name="microphone" /> </Capabilities>

Here is the "Module information" part of the log :

Module information:
Built with Compiler Ver '190023918'
Built from '5.5/release' branch
Version is '5.5.3f1 (4d2f809fd6f3)'
Release build
Application type 'D3D11'
Used 'UWP'

OS 'Windows 10 (10.0.14393)'

Do you see my problem ?
Can some other script block the execution ?

Best Answer

  • KandoharKandohar
    Accepted Answer

    On the hololens :

    Settings/Privacy/Camera/"Let apps use my camera" => ON

    It's works...
    I wish there was an explict error message in this case.

Answers

  • KandoharKandohar
    edited April 2017

    With some breakpoints, I have this error :

    Failed to initialize IMediaCapture

    when the code reach the line :

    PhotoCapture.CreateAsync()

  • KandoharKandohar
    Accepted Answer

    On the hololens :

    Settings/Privacy/Camera/"Let apps use my camera" => ON

    It's works...
    I wish there was an explict error message in this case.

  • Hi, I got the same error message while I call "PhotoCapture.CreateAsync()". Have you solve this problem? Help me, Please.

Sign In or Register to comment.