Skip to main content
@rendermate/recorder records the screen, camera and microphone in the browser and uploads each as an asset in your workspace. Your API key stays on your backend: the page uploads with short-lived upload tokens that your backend makes for it.

Install

Make upload tokens on your backend

Give the page an endpoint that returns an upload token. Check who’s asking first, and give each person their own prefix, so they can only upload under it:

Record

recorder.streams.screen and recorder.streams.camera are the live streams, for a preview in a <video>. pause() and resume() pause and resume every track. The SDK calls getUploadToken whenever it needs a token, including when one expires, so return a fresh one each time.

Tracks and assets

Each source is recorded as its own track and becomes its own asset; nothing is composited. Assets are named <prefix><recording id>/<track>.<extension>, such as recordings/u_42/rec_mx6sj6yh2s3m5u/screen.mp4. Pass name to createRecorder to choose your own:
Browsers that record H.264 in MP4, such as Chrome, Edge and Safari, make .mp4 files; others, such as Firefox, make .webm. A screen is recorded at up to 4K. Each track uploads while it’s recorded, in 8 MiB parts (5 MiB for audio) straight to Rendermate’s storage, so stop() only sends the last part and records the asset. progress events report the uploaded bytes during recording too.

Closed and crashed tabs

While recording, the SDK saves what it has recorded every second in the browser’s own storage (the origin private file system). When a tab is closed or crashes, call resumeUnfinished on the next page load to upload what it left; it sends only the parts that weren’t up yet:
A recording another tab is still recording or uploading is left to that tab. In a browser without that storage, recorder.durable is false and a closed tab loses its recording.

Devices

onDevicesChange calls back when a device is plugged in or out, and permissions() says whether the page may use the camera and the microphone (granted, denied or prompt).

Errors

start() rejects when the person refuses access or picks nothing to share. stop() rejects when an upload fails; an api refusal is a RendermateError with the answer’s status, code and message, such as 403 forbidden for a name outside the token’s prefix. A recording whose upload failed stays in the browser’s storage, and resumeUnfinished uploads it later; it skips a recording that fails again and leaves it for its next call.