Skip to content

Use meeting token to start video recording automatically - #171

Merged
zachm-vapi merged 2 commits into
mainfrom
zachm/vapics-1216-start-daily-video-recording-automatically
Aug 20, 2026
Merged

Use meeting token to start video recording automatically#171
zachm-vapi merged 2 commits into
mainfrom
zachm/vapics-1216-start-daily-video-recording-automatically

Conversation

@zachm-vapi

Copy link
Copy Markdown
Contributor

Use meeting token to start video recording automatically

Linear: VAPICS-1216

Context

Customers with weak network connections sometimes end calls with no videoRecordingUrl because the client-initiated startRecording() request never reaches Daily. Per Daily support's recommendation, the backend now creates a meeting token with start_cloud_recording: true when video recording is enabled and returns it on the web call as call.transport.callToken. Joining with that token makes Daily start the cloud recording automatically, which is more reliable.

This relates to #168, which allows the client to retry the recording if it fails. Both changes are needed, because the recording can still fail even when started via a token.

Changes

SDK (vapi.ts)

  • start() reads call.transport.callToken from the create-web-call response and joins the Daily room with it. When a token is present, the client-side startRecording() call is skipped because it will start automatically.
  • reconnect() does the same; the WebCall param type gains an optional transport.callToken field, which is picked up automatically by apps that pass back the Call object from start().
  • The recording-started listener that sends the say-first-message control is now registered before join() in both methods. On the token path the recording can start while join is still in flight, and a listener registered after join could miss the event (and never trigger the assistant's greeting).
  • The video-recording-setup progress event reports metadata.action: 'auto-started-via-meeting-token' on the token path so the two flows are distinguishable in telemetry.

Example app — Updated so that we can test the video recording and reconnect workflows. Video recording is now toggleable via a checkbox, a local camera preview (with recording indicator) shows when the camera is live, the stored call data includes transport so reconnects use the token, and Stop (leave) / End are now separate buttons (previously the stop button would always end the call, so it wasn't possible to reconnect).

Backward compatibility

  • No token (old servers, ZDR orgs, token-creation failure): join() gets no token key and the SDK falls back to client-initiated startRecording() — identical to the old flow.
  • Old SDKs + new server: ignore the token field and keep client-initiated recording; the backend still sets room-level enable_recording for exactly this case.
  • Recording stop semantics are unchanged. The recording is still stopped manually when the client leaves because the meeting token only starts it automatically.
  • Progress-event ordering: on the token path, the video-recording-started progress event can occasionally be emitted before video-recording-setup: completed, because the recording may start while join() is still in flight (on the old client-initiated path, setup always preceded started). Consumers should not assume the ordering; each event carries a timestamp and, on the token path, a metadata.action discriminator for disambiguation.

Testing

Used the example app to manually verify that video recording works, including when the caller stops and reconnects to the call. Tested against both the Vapi prod server (before the backend change), and my local test server (including the backend change), to verify that we still fall back to the old behavior when a callToken isn't provided.

zachm-vapi commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

@zachm-vapi
zachm-vapi force-pushed the zachm/vapics-1216-start-daily-video-recording-automatically branch from 6ecaadf to e53997d Compare August 20, 2026 21:49
@zachm-vapi
zachm-vapi force-pushed the zachm/vapics-1170-missing-videorecordingurl branch from aca20ad to 5213a79 Compare August 20, 2026 21:49

zachm-vapi commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Aug 20, 9:51 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 20, 9:53 PM UTC: Graphite rebased this pull request as part of a merge.
  • Aug 20, 9:53 PM UTC: @zachm-vapi merged this pull request with Graphite.

@zachm-vapi
zachm-vapi changed the base branch from zachm/vapics-1170-missing-videorecordingurl to graphite-base/171 August 20, 2026 21:51
@zachm-vapi
zachm-vapi changed the base branch from graphite-base/171 to main August 20, 2026 21:51
The meeting token will auto-start the recording, so we don't need to
start it manually.
- Added a video-recording toggle and a webcam view.
- Fixed the Stop Call button so it actually stops the call instead of
  ending it, so that we can test reconnecting. Also added a separate End
  Call button.
@zachm-vapi
zachm-vapi force-pushed the zachm/vapics-1216-start-daily-video-recording-automatically branch from e53997d to 3e1840a Compare August 20, 2026 21:52
@zachm-vapi
zachm-vapi merged commit 25aa3e1 into main Aug 20, 2026
5 checks passed
@zachm-vapi
zachm-vapi deleted the zachm/vapics-1216-start-daily-video-recording-automatically branch August 20, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants