feat: media player API, web player panel, and Hope music MCP

- web/media_server.py: FastAPI service owning the permanent library
  (library.json + ./media volume), yt-dlp YouTube Music search, queued
  download jobs with mp3 transcode (ffmpeg), per-room player desired
  state, and an HTTPS proxy for external live-stream URLs.
- agent/media_mcp.py: Hope tools — search_music, play_song,
  offer_song_choices, pause/resume/stop/skip/seek, now_playing,
  list_library, add_stream.
- agent/agent.py: media toolset wiring + conversation rule (music
  playing disables the agent mic; re-engaging pauses music).
- web UI: slide-out Music panel (search, suggestions, library, live
  stream add, play/pause, ±10s, seek, volume) with a reconciling poller
  and media_state data-channel reports.
- token server returns the minted room name; nginx serves /media/files
  as static (native Range) and proxies /media/api to the media server.
- supervisord runs media-server; compose mounts ./media and adds
  ffmpeg to the image.
This commit is contained in:
snowspeeder committed 2026-08-29 13:03:12 -04:00
1 parent a4ae96f01b
commit 04c4a53594
16 files changed
+1876 -12

No files matched your search

+9 -3
View File
@@ -24,9 +24,10 @@ ENV PYTHONUNBUFFERED=1
# Fix SSL cert path for the slim base image (ca-certificates installs to /etc/ssl/certs)
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
# Install LiveKit server binary + supervisord + nginx
# Install LiveKit server binary + supervisord + nginx + ffmpeg (yt-dlp audio
# extraction/transcoding for the media player)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates supervisor nginx libasound2 iproute2 \
curl ca-certificates supervisor nginx libasound2 iproute2 ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Download LiveKit server (latest stable)
@@ -48,8 +49,9 @@ COPY agent/task_registry.py /opt/voice-agent/task_registry.py
COPY agent/task_router.py /opt/voice-agent/task_router.py
COPY agent/task_worker.py /opt/voice-agent/task_worker.py
COPY agent/dispatch_mcp.py /opt/voice-agent/dispatch_mcp.py
COPY agent/media_mcp.py /opt/voice-agent/media_mcp.py
# Copy web frontend + token endpoint
# Copy web frontend + token endpoint + media server
COPY web/index.html /var/www/voice/
COPY web/app.js /var/www/voice/
COPY web/style.css /var/www/voice/
@@ -57,6 +59,10 @@ COPY web/livekit-client.umd.js /var/www/voice/
COPY web/manifest.json /var/www/voice/
COPY web/favicon.svg /var/www/voice/
COPY web/token_server.py /opt/voice/token_server.py
COPY web/media_server.py /opt/voice/media_server.py
# Permanent media library mount point (bind-mounted from ./media)
RUN mkdir -p /data/media/files /data/media/thumbs /data/media/jobs
# Config files
COPY livekit.yaml /etc/livekit.yaml