hl2ss icon indicating copy to clipboard operation
hl2ss copied to clipboard

Is it possible to build the server app from scratch and intergrate it to some other Unity App?

Open zijianh4 opened this issue 1 year ago • 10 comments

Hi, I am currently trying to run the hl2ss app in 2d version with another 3D app which uses the Anchor service of Microsoft. However, it seems that one of them always quit because of the HoloLens 2 resource limitation. Therefore, I wonder if there is a way to intergrate the hl2ss server app to another Unity project. Thanks!

zijianh4 avatar Sep 26 '24 01:09 zijianh4

Hi, If you have access to the Unity project you can try adding the hl2ss plugin to it. See hl2ss_unity for an example.

jdibenes avatar Sep 26 '24 02:09 jdibenes

Hi, If you have access to the Unity project you can try adding the hl2ss plugin to it. See hl2ss_unity for an example.

Thanks. Sorry for another question. If I want to build the plugin directly from source in another project. Do you know how to do it. I notice that there is one guide for building the whole app directly from source and mention the plugin but I am not sure if I need to follow the same steps. Thanks!

zijianh4 avatar Sep 30 '24 19:09 zijianh4

The plugin depends on winrt code generated when building the app so it may be complicated (the VS solution referenced by the guide builds the app and then the plugin). What's your setup? Are you trying to add the C++ files to Unity and use IL2CPP?

jdibenes avatar Oct 01 '24 00:10 jdibenes

The plugin depends on winrt code generated when building the app so it may be complicated (the VS solution referenced by the guide builds the app and then the plugin). What's your setup? Are you trying to add the C++ files to Unity and use IL2CPP?

Hi, I extracted the plugin files into the Assets folder as required and the Anchor App https://github.com/Azure/azure-spatial-anchors-samples can run with the Plugin on HoloLens 2. However, I keep getting this error which seems saying that the portal cannot transfer the data. Could you please help me to resolve this issue? Thanks! As for the context, I run the ./viewer/simple_recorder.py to receive the leftfront and right front cameras. image

zijianh4 avatar Oct 02 '24 19:10 zijianh4

Did you add the Hololens2SensorStreaming.cs script to the Main Camera? The plugin requires some setup when added to a Unity project. See "Adding the plugin to an existing project" under "Unity plugin" in the readme for details.

jdibenes avatar Oct 02 '24 20:10 jdibenes

Did you add the Hololens2SensorStreaming.cs script to the Main Camera? The plugin requires some setup when added to a Unity project. See "Adding the plugin to an existing project" under "Unity plugin" in the readme for details.

Hi, Yes, I follow the set up under "Unity plugin", which is shown in the image. image I think it is a little bit strange that although it says recording start later it will report the timeout issue. Previously when I try collecting the data directly with the hl2ss app, if it does not connect successfully the recording starts line will not show. Here is also a codeblock of the Package.appxmanifest after I build the App.

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" xmlns:mobile="http://schemas.microsoft.com/appx/manifest/mobile/windows10" IgnorableNamespaces="uap uap2 uap3 uap4 mp mobile iot" xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
  <Identity Name="Template3D" Publisher="CN=Microsoft" Version="1.0.0.0" />
  <mp:PhoneIdentity PhoneProductId="80053089-59db-9242-a659-45186024729c" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
  <Properties>
    <DisplayName>HelloAR U3D</DisplayName>
    <PublisherDisplayName>Microsoft</PublisherDisplayName>
    <Logo>Assets\StoreLogo.png</Logo>
  </Properties>
  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10240.0" MaxVersionTested="10.0.22621.0" />
  </Dependencies>
  <Resources>
    <Resource Language="x-generate" />
  </Resources>
  <Applications>
    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Template3D.App">
      <uap:VisualElements DisplayName="HelloAR U3D" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Template_3D" BackgroundColor="transparent">
        <uap:DefaultTile ShortName="HelloAR U3D" Wide310x150Logo="Assets\Wide310x150Logo.png" />
        <uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#FFFFFF" />
        <uap:InitialRotationPreference>
          <uap:Rotation Preference="landscape" />
          <uap:Rotation Preference="landscapeFlipped" />
          <uap:Rotation Preference="portrait" />
          <uap:Rotation Preference="portraitFlipped" />
        </uap:InitialRotationPreference>
      </uap:VisualElements>
    </Application>
  </Applications>
  <Capabilities>
    <rescap:Capability Name="perceptionSensorsExperimental" />
    <Capability Name="internetClient" />
    <Capability Name="internetClientServer" />
    <Capability Name="privateNetworkClientServer" />
    <uap2:Capability Name="spatialPerception" />
    <uap3:Capability Name="remoteSystem" />
    <DeviceCapability Name="webcam" />
    <DeviceCapability Name="microphone" />
    <DeviceCapability Name="bluetooth" />
    <DeviceCapability Name="gazeinput" />
    <DeviceCapability Name="backgroundSpatialPerception" />
    <DeviceCapability Name="wiFiControl" />
  </Capabilities>
</Package>

zijianh4 avatar Oct 02 '24 21:10 zijianh4

I think it is a little bit strange that although it says recording start later it will report the timeout issue. Previously when I try collecting the data directly with the hl2ss app, if it does not connect successfully the recording starts line will not show. Here is also a codeblock of the Package.appxmanifest after I build the App.

Check that the Unity App has access to:

  • Camera (Settings -> Privacy -> Camera).
  • Eye tracker (Settings -> Privacy -> Eye tracker).
  • Microphone (Settings -> Privacy -> Microphone).
  • User movements (Settings -> Privacy -> User movements).

jdibenes avatar Oct 03 '24 00:10 jdibenes

I think it is a little bit strange that although it says recording start later it will report the timeout issue. Previously when I try collecting the data directly with the hl2ss app, if it does not connect successfully the recording starts line will not show. Here is also a codeblock of the Package.appxmanifest after I build the App.

Check that the Unity App has access to:

  • Camera (Settings -> Privacy -> Camera).
  • Eye tracker (Settings -> Privacy -> Eye tracker).
  • Microphone (Settings -> Privacy -> Microphone).
  • User movements (Settings -> Privacy -> User movements).

Hi, I am not sure if I understand correctly, but I can only find the Project settings under Edit (I'm using Unity 2022.3.12f1) image and I follow the setup here to open the access image Is this correct? Thanks!

zijianh4 avatar Oct 03 '24 01:10 zijianh4

Settings from the Start menu on the HoloLens, which opens when you tap your wrist.

jdibenes avatar Oct 03 '24 02:10 jdibenes

Settings from the Start menu on the HoloLens, which opens when you tap your wrist.

Hi, Yes. I turn on all the permissions and the error still exists.

zijianh4 avatar Oct 03 '24 15:10 zijianh4