Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

PhotoCapture.CreateAsync Not running on Hololens 2

Discussion in 'Windows Mixed Reality' started by JeffroVS, Oct 17, 2019.

  1. JeffroVS

    JeffroVS

    Joined:
    Oct 17, 2019
    Posts:
    3
    When building my project to the Hololens 2 I found the PhotoCapture.CreateAsync is not calling the method I used for the parameter "onCreatedCallback" which sets a reference to the PhotoCapture object, but it is never run. However, when debugging this I found the method I used as the parameter for "onCreatedCallback" is called on the Hololens 1 but not on the Hololens 2.

    Has anyone else had this problem, and found a fix for it?

    Unity Version 2018.4.11f1
     
  2. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    87
    Hey, welcome to the Unity forums!

    So this is very odd, since the underling code for PhotoCapture doesn't differentiate between devices, e.g. UWP Desktop, HoloLens1, and HoloLens2. The Unity API is mostly a thin wrapper around the WinRT Windows.Media.Capture.MediaCapture API.

    It's possible the calls into MediaCapture are failing, but the callback should still be fired with an error HR in this case.

    If you're familiar with ETW (Event Tracing for Windows), you could capture events from MediaCapture on your HL2 device, via DevicePortal, and see if that reveals anything. i.e. API failures or other errors.

    Also, I'd recommend posting this problem on Microsoft's "HoloDevelopers" Slack channels (you can join them using this link: https://holodevelopersslack.azurewebsites.net/) to see if this is a known issue.

    If you're unable to find an answer for the problem, please file a Unity bug so we can investigate the problem.
     
  3. JeffroVS

    JeffroVS

    Joined:
    Oct 17, 2019
    Posts:
    3
    Thank you for your reply. I'm not familiar with ETW but I'll look into it see what I can learn from that. I think it might be the case that MediaCapture is falling in some way because I tried using that as a workaround but it could not find any devices of the VideoClass for devices.
     
  4. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    87
    One other thought, although it's a long shot: have you verified the UWP Capabilities (permissions) are set to allow MediaCapture? Specifically have you tried enabling both "Webcam" and "Microphone".

    Since you app works on HL1, I doubt this is the problem. Also the Unity implementation for PhotoCapture excludes Microphone access when initializing MediaCapture (so you don't need this permission) but maybe with HL2 you need to enable some other Capability.

    Still worth trying as permissions are a common "gotcha" with UWP.
     
  5. JeffroVS

    JeffroVS

    Joined:
    Oct 17, 2019
    Posts:
    3
    I have the "Webcam" and "Microphone" permissions enabled so I don't thank that would be the cause, unless like you mentioned HL2 requires other permissions but I havent found anything that says it dose.