[Feature Request] HL2SS as a client and not the server
It would be great to have a way to make this library work the other way around. Instead of connecting to the HoloLens to get the sensor stream data, it would also be great to have the HoloLens send its stream to an external device (e.g., a server with a public IP).
This would be much better in terms of security and would help decouple the AR headset from services that use the data from these sensors. Would that change be easy to develop? I am available to collaborate on this feature.
Hi. I added some example code to make the hl2ss app start the connection to the PC: https://github.com/jdibenes/hl2ss/tree/client_test The app tries to connect to the PC every second, and streaming starts when the PC runs the server script (viewer/server_pv.py). Is this what you're asking for?
To test this, where can I define the IP/Domain of the PC that the HoloLens tries to connect to?
https://github.com/jdibenes/hl2ss/blob/20a9efd4a6a07fc355ac02a826c0a7faa1fb112a/hl2ss/hl2ss/server_channel.cpp#L7-L8
Awesome, I'll give it a go next Friday and then leave some feedback
Just tested it and it worked very well! It would be great to have these two modes of functionality for all sensors.
Currently, I am looking for something that would work to get the microphone stream. Would that be something easy you could develop?
The example should work for all streams. For the microphone, for example, try running client_stream_microphone.py with host set to None.
Ok that's great, and what would be the steps for me to load this custom version of the hl2ss plugin into Unity?
Build the plugin and copy it to the plugins folder (Assets/Plugins/WSA).
Would it be possible to have the server's IP in a config file? This would remove a lot of the unnecessary compilation of hl2ss and subsequent applications that use hl2ss, if I want to use a different server
I've also tried to put the plugin into a Unity application, but it doesn't seem to work. Any idea why?
EDIT: fixed it by going into the Unity Inspector, selecting the file, and setting: SDK = UWP and CPU = ARM64
Sorry for information dumping, but I think this might be helpful. I am trying to get both hl2ss client and server modes working at the same time. I have put both .dll files into my project: the one from the release, and the one I've built via the client_test branch, named hl2ss.dll and hl2ss-client.dll, respectively. The client_stream_microphone.py seems to work as expected, but the client_stream_pv.py doesn't work either with host set to None or the IP of the headset.
Server IP and other settings can now be loaded from a file. Create a file named hl2ss.txt and:
- Put the server IP in the first line.
- Put 0/1 in the second line to enable/disable the app's server socket.
- Put 0/1 in the third line to disable/enable the app's client socket.
- The fourth line is the time in ms between connection attempts to the PC.
Examples
hl2ss in server mode (default):
192.168.1.3
0
0
1000
hl2ss in server / client modes:
192.168.1.3
0
1
1000
hl2ss in client mode:
192.168.1.3
1
1
1000
Then, upload hl2ss.txt to the HoloLens: Device Portal > System > File explorer > LocalAppData > hl2ss > LocalState.
I have not tested this in Unity + plugin yet.
Just gave it a quick try on the HL2SS app and as a plugin. Seems to work as expected!