Skip to content
Service

Live Streaming

Interactive live streaming (host + audience) on the SFU, plus RTMP restream out and RTMP ingest in. One-to-many with real-time interaction.

Interactive live streaming

A live room is a normal room where hosts publish and the audience subscribes. You decide the role by the token you mint: hosts get canPublish: true, audience get canPublish: false. Audience can be promoted to co-host by issuing a publish token.

host.ts
1// A host publishes; the audience subscribes. Same room, different roles —2// controlled by the token your backend mints per user.3// Host token: canPublish=true.  Audience token: canPublish=false.4// (Mint tokens server-side — see Server & tokens.)5const room = new Room();6await room.connect(url, token);       // host: publishes camera+mic7await room.localParticipant.enableCameraAndMicrophone();
  • Scales to large audiences via the SFU (audience only subscribe).
  • Sub-second latency — real interaction (raise hand, co-host, chat).
  • Use the same chat + data channels for reactions and Q&A.

RTMP out & ingest

POST/v1/streams/startx-api-key
POST/v1/ingressx-api-key
terminal
1# Restream a room to an external RTMP target (YouTube/Twitch/…)2curl -X POST https://cloud.unitythink.com/v1/streams/start \3  -H 'x-api-key: sk_live_xxxxxxxx' -H 'Content-Type: application/json' \4  -d '{"room":"live-1","rtmpUrl":"rtmp://a.rtmp.youtube.com/live2/KEY"}'5# → { egressId, status }   (stop via /v1/recordings/stop with the egressId)67# Pull an external RTMP source INTO a room (ingest)8curl -X POST https://cloud.unitythink.com/v1/ingress \9  -H 'x-api-key: sk_live_xxxxxxxx' -H 'Content-Type: application/json' \10  -d '{"room":"live-1","name":"OBS feed"}'11# → { ingressId, url, streamKey }   ← point OBS at url + streamKey
Note:GET /v1/ingress lists ingress endpoints; DELETE /v1/ingress/:id removes one. Stop a restream with /v1/recordings/stop (both are egress). Buy Live Streaming minutes in the console.