Open AllonisDave opened 3 years ago
Here is my solution for running webrtc-streamer as a service on the PI. Video and Audio working now.
/lib/systemd/system/livepreview.service is
[Unit]
Description=LivePreview
After=graphical.target
[Service]
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
ExecStart=/usr/local/Allonis/streamer/webrtc-streamer
Restart=always
RestartSec=10s
KillMode=process
TimeoutSec=infinity
[Install]
WantedBy=graphical.target
What is the correct way to run webrtc-streamer at boot/login and have it run in the background? PI4 and webrtc-streamer 0.6.4
I have tried creating a service like this.
/lib/systemd/system/livepreview.service
When the service starts at boot video streaming works but audio streaming is NOT working. Here is the status from the service starting. PulseAudio is complaining.
● livepreview.service - LivePreview Loaded: loaded (/lib/systemd/system/livepreview.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2021-06-03 16:08:55 PDT; 5s ago Main PID: 2643 (webrtc-streamer) Tasks: 55 (limit: 4915) CGroup: /system.slice/livepreview.service └─2643 /usr/local/Allonis/streamer/webrtc-streamer
Jun 03 16:08:55 myserver systemd[1]: Started LivePreview. Jun 03 16:08:55 myserver webrtc-streamer[2643]: Version:v0.6.4/Linux-armv7l civetweb@v1.13 webrtc@376cf07ea2-dirty live555helper@d351689 Jun 03 16:08:55 myserver webrtc-streamer[2643]: nullLogger level:3 Jun 03 16:08:55 myserver webrtc-streamer[2643]: [000:000][2643] (audio_device_pulse_linux.cc:1605): failed to connect context, error=-1 Jun 03 16:08:55 myserver webrtc-streamer[2643]: [000:000][2643] (audio_device_pulse_linux.cc:145): failed to initialize PulseAudio Jun 03 16:08:55 myserver webrtc-streamer[2643]: [000:001][2643] (audio_device_impl.cc:341): Audio device initialization failed. Jun 03 16:08:55 myserver webrtc-streamer[2643]: USB Video: USB Video=>audiocap://2 Jun 03 16:08:55 myserver webrtc-streamer[2643]: HTTP Listen at 0.0.0.0:8000
I also tried to start it in a script at login using this script /etc/init.d/streamer.sh
When this script runs at boot webrtc-streamer video will stream but again, no audio. The contents of the generated log is attached. streamer.log
also http://192.168.0.235:8000/api/getAudioDeviceList reports []
http://192.168.0.235:8000/api/getVideoDeviceList reports [ "USB Video: USB Video", "bcm2835-isp", "videocap://2" ]
Thoughts?
Best Dave...