Recordings and assets
Capture a program and authorize retained media without exposing storage credentials.
On this page
These methods run on your backend and require a compatible API/SDK build; see installation.
Import and client
Set RELAYRTC_API_URL and RELAYRTC_SECRET_KEY in your backend environment. Keep the secret key on the server.
import { RelayServer } from '@relayrtc/node'
const relay = new RelayServer({
apiUrl: process.env.RELAYRTC_API_URL!,
apiKey: process.env.RELAYRTC_SECRET_KEY!,
})Authorization and inputs
Recording reads and asset playback use recordings:read; capture, policy and deletion controls use recordings:create. StartRecordingInput accepts an explicit broadcastId and policy. Supply the storage region, retention and duration in seconds, partial-output/export choices, and consentAcknowledged: true only after obtaining consent.
Methods
All methods return promises. Their final argument is optional RequestOptions. Input and result names are public imports from @relayrtc/node.
| Method | Signature |
|---|---|
streams.recordings.start | (streamId: string, input: StartRecordingInput, options?: RequestOptions): Promise<RecordingResource> |
streams.recordings.list | (streamId: string, query?: { cursor?: string; limit?: number; }, options?: RequestOptions): Promise<RecordingPage> |
streams.recordings.getPolicy | (streamId: string, options?: RequestOptions): Promise<{ policy: RecordingPolicy | null; version: number; }> |
streams.recordings.setPolicy | (streamId: string, input: { policy: RecordingPolicy; version: number; }, options?: RequestOptions): Promise<{ policy: RecordingPolicy; version: number; }> |
recordings.list | (query?: { cursor?: string; limit?: number; }, options?: RequestOptions): Promise<RecordingPage> |
recordings.get | (recordingId: string, options?: RequestOptions): Promise<RecordingResource> |
recordings.stop | (recordingId: string, options?: RequestOptions): Promise<RecordingResource> |
recordings.getPlayback | (recordingId: string, options?: RequestOptions): Promise<RecordingPlayback> |
recordings.delete | (recordingId: string, options?: RequestOptions): Promise<RecordingResource> |
assets.get | (assetId: string, options?: RequestOptions): Promise<MediaAsset> |
assets.createAccessGrant | (assetId: string, input?: { action?: "playback" | "download"; ttlSeconds?: number; audience?: "preview" | "viewer"; }, options?: RequestOptions): Promise<AssetAccessGrant> |
assets.delete | (assetId: string, options?: RequestOptions): Promise<RecordingResource> |
Behavior and results
Policies require the current version. Automatic policy applies to subsequently created runs. Stop initiates finalization; wait for recording.state ready before issuing playback or download grants. Asset grants distinguish playback from download and preview from viewer. Viewer clip grants require publication. Deletion revokes access before physical cleanup completes.
Requests and errors
Streaming commands generate an idempotency key when omitted. Use an explicit stable key when retrying an uncertain application command; reuse its payload and target. Mutations do not retry automatically. Read retries and cancellation follow RequestOptions. A canceled HTTP request does not undo committed server work.
Failures throw RelayApiError. Reload resources after version conflicts; inspect asynchronous operation/processing states before reporting completion.
See REST parameters, defaults and errors and the public type index.
Asset delivery and link revocation routes are detailed in assets. The current SDK has no dedicated asset link-revocation method; use the REST route from your backend.