Spaces:
Running
Running
Juan Jimenez Carrero Claude Fable 5 commited on
Commit ·
06114cd
1
Parent(s): a99b699
chore: add daemon helper for headless Lite hosting (no-camera + STUN)
Browse filesrun_daemon_nocam.py launches the Reachy Mini daemon with two workarounds
needed to host the Lite for remote web sessions from this Mac:
- patches get_video_device to skip the robot camera (macOS denies camera
access to background-launched daemons; the web app uses no video)
- injects a public STUN server into webrtcsink (this reachy_mini release
configures no ICE servers, so remote clients only saw LAN candidates)
Both are documented as temporary; proper fixes are granting Camera access
in System Settings and Pollen's upcoming TURN relay for remote NAT traversal.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- run_daemon_nocam.py +40 -0
run_daemon_nocam.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Temporary daemon launcher with two workarounds:
|
| 2 |
+
|
| 3 |
+
1. Skip the robot camera: macOS TCC denies camera access to background-launched
|
| 4 |
+
processes, and the failed video pipeline blocked the WebRTC producer. The
|
| 5 |
+
cookAIware web app doesn't use video, so audio+data is enough.
|
| 6 |
+
Proper fix when at the Mac: grant Camera permission to the launching app in
|
| 7 |
+
System Settings -> Privacy & Security -> Camera, then use reachy-mini-daemon.
|
| 8 |
+
|
| 9 |
+
2. Add a public STUN server to webrtcsink: this reachy_mini release configures
|
| 10 |
+
no ICE servers, so the daemon only offers LAN host candidates and remote
|
| 11 |
+
(non-home-Wi-Fi) clients can never reach it. STUN adds a server-reflexive
|
| 12 |
+
candidate, which lets remote sessions connect through many (not all) NATs.
|
| 13 |
+
Proper fix: Pollen's upcoming TURN relay support.
|
| 14 |
+
"""
|
| 15 |
+
import sys
|
| 16 |
+
|
| 17 |
+
from reachy_mini.media import device_detection, media_server
|
| 18 |
+
|
| 19 |
+
device_detection.get_video_device = lambda: ("", None)
|
| 20 |
+
media_server.get_video_device = device_detection.get_video_device
|
| 21 |
+
|
| 22 |
+
_orig_configure_webrtc = media_server.GstMediaServer._configure_webrtc
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def _configure_webrtc_with_stun(self, pipeline):
|
| 26 |
+
webrtcsink = _orig_configure_webrtc(self, pipeline)
|
| 27 |
+
try:
|
| 28 |
+
webrtcsink.set_property("stun-server", "stun://stun.l.google.com:19302")
|
| 29 |
+
self._logger.info("STUN server injected into webrtcsink (stun.l.google.com:19302)")
|
| 30 |
+
except Exception as exc: # property may not exist on older plugin builds
|
| 31 |
+
self._logger.warning(f"Could not set stun-server on webrtcsink: {exc}")
|
| 32 |
+
return webrtcsink
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
media_server.GstMediaServer._configure_webrtc = _configure_webrtc_with_stun
|
| 36 |
+
|
| 37 |
+
from reachy_mini.daemon.app.main import main
|
| 38 |
+
|
| 39 |
+
sys.argv = ["reachy-mini-daemon", "--wake-up-on-start", "--log-level", "INFO"]
|
| 40 |
+
main()
|