Modules
Programmable voice and video rooms for Phoenix apps, carried by Cloudflare Realtime SFU.
Conversions between room PCM (48 kHz stereo s16le, Opus's own format, 20 ms frames) and the format a worker asks for. Rates must divide 48 kHz (8, 12, 16, 24 or 48 kHz) and channels must be 1 or 2.
The Cloudflare Realtime SFU operations Octoroom uses, as a behaviour.
Octoroom.Cloudflare.HTTP calls the real API; tests use an in-memory fake.
Octoroom.Cloudflare over Cloudflare's HTTP API. Needs :app_id and
:app_secret in the config. :request_fun (default &Req.request/1) is
for tests.
An in-process, localhost-only Octoroom.Cloudflare SFU backed by ex_webrtc.
Deletes room records, and what the room's workers saved, whose room
hasn't run for longer than :room_ttl_ms:
past that, no resume token can bring the room back, so the record would
only make a new room with the same id think it's recovering.
One worker output track. Paces audio to real time and sends it, Opus encoded, through the worker's peer connection: Cloudflare forwards whatever it is sent, so anything sent early would still play after a barge-in.
A connected client: its id, the metadata its room's join/2 returned, and
the tracks it publishes.
A Phoenix channel that connects one browser to a room.
Diffs desired against actual room state and returns the operations that turn one into the other. Pure.
A room module decides who may join a room and who hears whom.
Where Octoroom keeps what must outlive a room server or a node restart: room records and what workers save. A small key-value behaviour, so it can sit on ETS, Postgres or Redis.
The default Octoroom.Store: an ETS table, snapshotted to a file so it
survives a node restarting in place. Enough for one node; a deploy that
replaces the machine needs a store outside it.
The :telemetry events Octoroom emits. Measurements are maps of numbers;
metadata always includes room_id where there is a room.
A subscription to a room-scoped track, such as "alice/mic" or
"alice/camera".
A server-side participant: a process that hears input tracks and plays output tracks as PCM, with no WebRTC in sight.
What a worker knows when it starts: its room, its id, its input and output
track names, its data outputs, and the room's participants at that
moment. Call
Octoroom.Room.state/1 for anything newer.