Best Practices
Essentials (every setup)
Setup A — Local, output to a browser (prototyping)
client = OjinSTVClient(
api_key=..., config_id=...,
decoder=PassthroughDecoder(), # forward JPEG; the browser decodes it
)
async for frame in client.output_stream():
if isinstance(frame, STVVideoFrame):
await ws.send_bytes(frame.source_bytes) # raw JPEG -> draw on a canvas
elif isinstance(frame, STVAudioFrame):
await ws.send_bytes(frame.pcm) # play at frame.sample_rateSetup B — Backend, relay to a WebRTC service (production)
See also
Last updated
Was this helpful?