Skip to content
Menu+

Architecture

Three processes, three ports, one state file.

There are exactly three processes: server, bridge and controlled browser. The phone is just a shell for the page. Any one can restart without touching the other two's local state.

phone browser / Android shell
   |  HTTPS or LAN HTTP
   v
media-web :8097  (auth, queue, state, pages)
   |  SSH or LAN call
   v
bridge :8765     (on Windows or macOS)
   |  CDP :9222
   v
controlled browser -> system output -> speakers

Ports

PortHostPurposeExposure
8097serverpages, API, authLAN or TLS proxy only
8765Windows/macOSplayback bridgeserver only
9222Windows/macOSCDPlocalhost only

State

Queue, position, speed, both volume levels and autoplay debounce live in media-state.json. Restarts restore from the file, regardless of whether a tab is open.

Request flow

  • The page polls state every two seconds; the bridge keeps a snapshot
  • Writes require the CSRF header or are rejected
  • Search and track switches take up to ~15s with client timeouts
  • The bridge is single-threaded: long requests block concurrent status reads (known)

Why not a framework

The data model is one queue and one player. A framework's runtime, build chain and upgrade treadmill cost more than it solves here. The stdlib server is enough and can be read end to end at 3am.