2026-07-09 22:16:20 +00:00
|
|
|
[Unit]
|
|
|
|
|
Description=mpv video player (KMS/DRM -- the actual player)
|
2026-07-09 23:04:45 +00:00
|
|
|
# Needs the DRM/HDMI + sound devices present.
|
2026-07-09 22:16:20 +00:00
|
|
|
After=local-fs.target systemd-udev-settle.service sound.target
|
|
|
|
|
Wants=systemd-udev-settle.service
|
2026-07-09 23:04:45 +00:00
|
|
|
# Keep a login getty off the primary display so nothing else claims tty1.
|
2026-07-09 22:16:20 +00:00
|
|
|
Conflicts=getty@tty1.service
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
User=${MEDIAPI_USER}
|
2026-07-09 23:04:45 +00:00
|
|
|
# mpv on KMS/DRM needs: video+render (GPU/DRM), input (remotes/keyboard), audio
|
|
|
|
|
# (HDMI/ALSA). It becomes DRM master simply as the first/only DRM client on the
|
|
|
|
|
# seat -- no PAM login session and no elevated capabilities required, provided
|
|
|
|
|
# nothing else is already holding the GPU. (An older Kodi-based deploy DID hold
|
|
|
|
|
# it; install.sh tears any leftover Kodi down before starting this.)
|
|
|
|
|
SupplementaryGroups=video render input audio
|
2026-07-09 22:16:20 +00:00
|
|
|
# Create /run/mediapi (owned by this user) for the IPC socket the app connects to.
|
|
|
|
|
RuntimeDirectory=mediapi
|
2026-07-09 23:04:45 +00:00
|
|
|
StandardInput=null
|
|
|
|
|
StandardOutput=journal
|
|
|
|
|
StandardError=journal
|
|
|
|
|
# --idle keeps mpv running with no file loaded (holds the playlist between clips
|
|
|
|
|
# and after the last one), so the service stays up and the app can always reach
|
|
|
|
|
# the socket. Playback renders straight on KMS.
|
2026-07-09 22:16:20 +00:00
|
|
|
ExecStart=/usr/bin/mpv \
|
|
|
|
|
--idle=yes \
|
|
|
|
|
--input-ipc-server=/run/mediapi/mpv.sock \
|
|
|
|
|
--no-terminal \
|
|
|
|
|
--no-input-default-bindings \
|
|
|
|
|
--fullscreen \
|
|
|
|
|
--force-window=yes \
|
|
|
|
|
--keep-open=no \
|
|
|
|
|
--vo=gpu --gpu-context=drm --hwdec=auto \
|
|
|
|
|
--ao=alsa --audio-device=alsa/hdmi:CARD=vc4hdmi0,DEV=0
|
|
|
|
|
Restart=on-failure
|
|
|
|
|
RestartSec=5
|
|
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|