Skip to main content
These examples describe the current Bijection CLI and SDK source. Use builds from the same source commit for these APIs. The public CLI and npm SDK are published independently and may lag this reference.
The media library, @bijectionhq/library-media, keeps recorded media for the app that places it: sources, recordings tiled by segments and gaps, playback, retention and erasure, transcripts and renditions. media({...}) returns a subtree; its functions take their paths where you place it (cctv.recordings.open).
bijection/media.ts
bijection/app.ts
bindings.ts
Every fact is at label, and so are segment files, utterances and rendition files: everything derived from a recording carries its label. The transcriber and renderer are slots placed inside the subtree (cctv.transcriber, cctv.renderer.launcher).
  • The transcriber is a transcription@1 slot needing the engine you name. Unbound, it is Bijection’s managed Transcribe on the cell’s AWS account (aws-transcribe, priced per second with a 15-second minimum). A successful answer requires deletion of the staged segment, output and job. The host gives a send at most ten seconds for processing and cleanup. A managed send registers independent cleanup before staging. If the send reaches its deadline, the outcome can be unknown while cleanup waits for the job to finish and deletes its job record and late output. The cleanup workflow runs for up to seven days. The staging bucket expires objects after one day, and AWS can retain an undeleted job record for up to 90 days. placement.managed({ account: placement.aws.account({ account, region, staging }) }) runs the same engine and driver on your AWS account. Use a staging bucket with no versioning history, with s3:GetBucketVersioning granted to the role. Configure expiration for staged objects in your account and remove terminal jobs that outlive the host’s deadline. placement.endpoint(...) reaches any server that speaks the protocol, such as the compute pack’s bijection_compute.speech with a Whisper engine.
  • The renderer is a worker pool slot (worker@1). No host offers it today, so the bindings file binds it to your launcher with placement.endpoint, workerPool.aws or workerPool.gcp; unbound, it is refused at deploy with PlacementUnavailable (NotOffered). The launcher is sent the bearer its binding’s credential names (bijection secret set cctv.renderer), unless the receiver is given auth.
Functions refuse with Invalid, Absent, Conflict, Erased, Disallowed or the codes in MEDIA_REFUSES. Absent arguments are null; lists take { size, cursor } and answer { facts, next }.

Record

A gateway opens a recording on a source, posts each segment’s bytes to POST <path>/segments (session-verified, at most 8 MiB of fragmented MP4) and appends it by sequence, interval, size and SHA-256 with recordings.appendSegment. The segment route admits only ingesters, and a staged segment is kept only once its uploader’s append names it. Segments (at most 30 seconds) and gaps tile the recording. recordings.seal with final: true ends the source’s timeline. Pass source positions such as { microseconds: 1_000_000n } as sourceFrom when opening a recording and as from and to when appending a segment or recording a gap. Each position is a signed 64-bit integer in whole microseconds on the recording’s timeline. An interval includes from and excludes to. The open result’s end is the next append position.

Play back

playback.page lists segments and gaps over a from and to interval. Continue a truncated page at its nextFrom. Use playback.bytes to open a segment’s file under the reader’s clearance. For browser playback UI, install the recordings kit elements from ui.bijection.com (@bijection/recording-player, @bijection/frame-strip, @bijection/observation-timeline).

Retain and erase

A segment expires retention after it is appended (the source’s retention, else the subtree’s). Its expiry turn deletes it, the host retires its file, and an expired gap takes its place, unless a hold keeps the recording. recordings.hold and recordings.unhold, or cctv.hold(ctx, …) and cctv.unhold(ctx, key) in your own function, keep the library’s retention ledger. recordings.erase deletes a sealed, unheld recording and everything derived from it in bounded rounds.

Transcribe and render

  • transcripts.request (or cctv.transcribe(ctx, …)) submits one transcribe task per segment to the transcriber, its File sent by reference, at most eight at a time. Reviewers correct utterances at the revision they saw (transcripts.correct); transcripts.captions pages WebVTT and transcripts.lookup finds text.
  • renditions.request (or cctv.render(ctx, …)) submits one run to the renderer with a recipe: thumbnail, poster, waveform, page image, tile, PDF slice, annotation, DICOM frame, spreadsheet or email JSON. OCR is a document reader, not a rendition. The renderer posts its output to POST <path>/renditions (bearer-verified with renderer.upload), and the continuation attaches the upload whose SHA-256 matches.
The renderer’s Python side and the transcription reference provider ship in @bijectionhq/pack-compute’s Python package (bijection_compute.media, bijection_compute.speech).