Task-oriented streams snippets: create inputs, ingest via RTMP/SRT/WHIP/TUS2, mint signed playback, publish and view, rotate keys.
This page gives short answers that you can copy for common streams tasks.
Each example assumes two steps: you imported from clutchcall_connect/streams
(TS) or clutchcall.streams (Python), and you constructed a
control-plane Streams client with baseUrl/apiKey/orgId.
WHIP is the WebRTC-HTTP ingest path. Capture the camera and POST an SDP
offer. Create the input with ingest: "whip". Then publish with a standard
WHIP client.
VOD uploads use TUS2, so large files survive network drops. Create the
upload. PATCH chunks at the confirmed offset. On completion, the engine
packages the file to CMAF.
// 1) create the resumable upload, get a location to PATCH intoconst { uploadUrl } = await streams.assets.createUpload({ name: "Keynote.mp4" });// 2) send chunks; on reconnect, HEAD to learn the offset, then resumelet offset = 0;const file = await fileHandle.arrayBuffer();while (offset < file.byteLength) { const end = Math.min(offset + CHUNK, file.byteLength); await fetch(uploadUrl, { method: "PATCH", headers: { "tus-resumable": "2.0.0", "upload-offset": String(offset), "content-type": "application/offset+octet-stream", }, body: file.slice(offset, end), }); offset = end;}
streams.assets.* is Preview. Until the typed helper ships, call
the TUS2 endpoint directly with the same bearer key.
The control-plane analytics surface exposes overview KPIs, viewer
time-series, and glass-to-glass latency.
// Preview: streams.analytics.* — reach the control-plane analytics route// directly with the bearer key until the typed helper ships in your SDK version.