Claude: WebRTC

This commit is contained in:
chk
2026-06-02 23:15:13 +02:00
parent 11811a2e03
commit 1a712ed877
3 changed files with 75 additions and 58 deletions

View File

@@ -4,43 +4,19 @@ name: approbotwebcam
#
# Voraussetzungen:
# 1. Code auf dem Server (git clone / Synology Drive sync)
# 2. In Portainer → "Environment variables":
# 2. go2rtc.yaml muss im selben Verzeichnis liegen wie dieses File
# 3. In Portainer → "Environment variables":
# APP_PATH = /absoluter/pfad/zum/appRobotWebcam
#
# Firewall: genau zwei Ports freigeben:
# TCP 8444 → HTTP (Viewer · Snapshot-API · WebRTC-Signaling)
# UDP 8555 → WebRTC Media (go2rtc direkt, kann nicht proxiert werden)
#
# go2rtc-Konfiguration steht unten im "configs"-Block.
# Kameras, Codec oder Ports ändern? → configs.go2rtc_config.content anpassen.
# network_mode: host → beide Container teilen den Host-Netzwerk-Stack.
# Das ist für WebRTC entscheidend: go2rtc bekommt die echte Host-IP als
# ICE-Kandidat, nicht eine Docker-interne 172.x-Adresse.
# ─────────────────────────────────────────────────────────────────────────────
# ── go2rtc-Konfiguration (eingebettet, kein separates File nötig) ─────────────
configs:
go2rtc_config:
content: |
streams:
cam0:
- "ffmpeg:/dev/video0#video=h264"
cam1:
- "ffmpeg:/dev/video2#video=h264"
webrtc:
ice_servers:
- urls:
- stun:stun.l.google.com:19302
- stun:stun1.l.google.com:19302
# Fixer UDP-Port → eine Firewall-Regel reicht
listen: ":8555/udp"
api:
listen: ":1984"
origin: "*"
log:
level: warn
# ─────────────────────────────────────────────────────────────────────────────
services:
# ── go2rtc: Kamera-Capture + H.264-Encoding + WebRTC ──────────────────────
@@ -48,17 +24,15 @@ services:
image: ghcr.io/alexxit/go2rtc
container_name: AppRobotGo2RTC
restart: unless-stopped
# host-Netzwerk: go2rtc bekommt die echte Host-IP als ICE-Kandidat
# → WebRTC funktioniert auf LAN und über die Firewall
network_mode: host
devices:
- /dev/video0:/dev/video0
- /dev/video2:/dev/video2
group_add:
- video
configs:
- source: go2rtc_config
target: /config/go2rtc.yaml
volumes:
# go2rtc.yaml liegt im selben Verzeichnis wie docker-compose.yaml
- ${APP_PATH:-.}/go2rtc.yaml:/config/go2rtc.yaml:ro
# ── webcam: Node.js (Viewer · Snapshot-Proxy · WebRTC-Signaling-Proxy) ───
webcam:
@@ -71,7 +45,7 @@ services:
image: approbotwebcam:latest
container_name: AppRobotWebcam
restart: unless-stopped
network_mode: host # Erreicht go2rtc über localhost:1984
network_mode: host
command: sh -c "npm install && node server.js"
volumes:
- ${APP_PATH:-.}:/usr/src/app