Null-DRM-Official/apps/agent/README.md
404errordeveloper 066e018749
All checks were successful
release / build-and-upload (push) Successful in 6m18s
modules-release / build-and-upload (push) Successful in 5m18s
streamd: preview quality picker, dashboard polish, C4 wrap keys
- Preview player can select FHD/HD/SD (or ABR master) from publish links
- Embed dashboard screenshots in README; Linux streamd+agent setup guide
- C4 Widevine wrap license mode + require --wvd; prefer Widevine PSSH
- Channel 4 and My5 modules; streamd auth, variants, schedules, HLS gate
2026-10-09 20:57:43 +02:00

2.1 KiB

agent

Always-on credentials refresher, hosted by the single binary as drm agent.

apps/agent/
  agentcmd/        the command body, imported by apps/cli
  internal/        poller, durable queue, device pool, worker, ws client
  agent.yaml       config

What it does

  1. Polls streamd (GET /api/streams)
  2. When an enabled stream is down/errored or missing mpd/key, enqueues a job in a durable SQLite queue under data_dir
  3. Claims a free ADB device that already has the app installed — it never installs
  4. Runs a phone capture through the stream's app module
  5. POST /api/streams/:id/credentials
  6. Force-stops the app and clears the device proxy so the phone is free

It never runs a downloader. Claims are kept alive by a websocket heartbeat, so they expire by themselves if the agent dies.

Run

# terminal 1 — control plane
./bin/drm serve --bind 127.0.0.1:8083 --data .cache/streamd

# terminal 2 — agent (operator API key from streamd Settings → API keys)
export STREAMD_API_KEY=ndk_…
# or legacy: export STREAMD_TOKEN=…
./bin/drm agent run --config apps/agent/agent.yaml
./bin/drm agent status
./bin/drm agent devices
./bin/drm agent enqueue --stream tg4-ioi --reason manual
./bin/drm agent cancel --job 3

App modules are discovered under modules/. The agent drives whichever module a stream names and contains no provider logic.

Config

agent.yaml — streamd_url, api_key (preferred) or token (alias), or env STREAMD_API_KEY / STREAMD_TOKEN. Also: poll_interval_sec, workers, max_attempts, capture_wait_sec, devices (empty = any authorised device), wvd, user_agent, agent_id, data_dir.

Create the key in the streamd dashboard (role operator). The legacy shared --token / STREAMD_TOKEN still works but is meant for migration only.

wvd must be set or key fetches fail.

Build

go -C apps/cli build -o ../../bin/drm .

# cross-compile
GOOS=darwin GOARCH=arm64 go -C apps/cli build -o ../../bin/drm .

Full guide: docs/streamd.md