Production tech
Running a church live stream from a Stream Deck
A Bitfocus Companion module in TypeScript that shows Resi streaming encoder status on Stream Deck buttons and starts or stops the stream, using Resi's web API.
The problem
The church streams every service through Resi. Starting and checking the stream meant opening Resi’s website on a separate screen, while everything else in the booth runs from Stream Decks through Bitfocus Companion.
What I built
- A Companion module that signs in to Resi, finds the church’s encoders, and shows each one’s live status on a button
- Start and stop actions that pick the stream profile and encoder profile, so going live is one button press
- Status that refreshes itself, fetching again whenever an encoder’s last update is more than 20 seconds old, and signing in again when the session expires
Resi doesn’t publish this API. It’s the one their own web app uses, so the module’s README warns it can change without notice.
- Sign intoken for the session
- Who am Icustomer ID
- Pollencoder status
- Buttonlive, idle or error
- Actionstart or stop
The status loop
fn ensure_token():
if token == null or token.expires_at < now():
token = post("/api/v3/auth/token", credentials) # sent as X-Bearer, not Bearer
customer = get("/api_v2.svc/users/me").customerId
fn statuses():
if cache.empty or cache.any(e -> now() - e.lastUpdate > 20s):
ensure_token()
cache = get("/api/v3/customers/" + customer + "/encoders/status?wide=true")
return cache
fn start(encoder, stream_profile, encoder_profile):
ensure_token()
patch("/api_v2.svc/encoders/" + encoder.id,
{requestedStatus: "start", streamProfile: stream_profile, encoderProfile: encoder_profile})
Why it matters
Going live sits next to the rest of the service controls, and whoever’s running the booth can see at a glance whether the stream is actually up.