Skip to content

Media stream out

core ยท v0.1.0

The plumbing for media the server streams out: producers run one at a time per session and can be cut off as a whole, and what was sent is kept so a connection joining part-way is replayed. The base the speech output kits build on.

Installed for you

With audio-stream-out. Open it to build a kit on top of it.

Install copit add @chanx-kit/media-stream-out
Import from media_stream_out
Requires kits media-stream-in
Python packages chanx>=2.10.2,<3
Keywords media, streaming, audio, replay
Source kits/media_stream_out

The plumbing for media the server streams out over a chanx websocket. It has no topic of its own: audio-stream-out builds the synthesizer on it.

copit add @chanx-kit/media-stream-out

One producer at a time, per session

SerialJobs runs jobs per key in submission order, one at a time. A spoken reply needs exactly that: an agent queues sentence after sentence and they play in order, and an interruption (cancel(key)) stops the one playing and drops the rest. Jobs run in the process that submitted them and reach clients through the channel layer.

Replay for late joiners

A second tab joining while audio is streaming has missed its start, and audio cannot be picked up part-way. ReplayStore keeps what was sent on the stream in flight, numbered from 1, so a joiner is replayed it and then continues live, the same way the ag-ui kit replays a run. InMemoryReplayStore is process-local and bounded; implement the protocol against Redis when producers and connections live in different processes.