Use meeting token to start video recording automatically - #171
Open
zachm-vapi wants to merge 2 commits into
Open
Conversation
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.
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Use meeting token to start video recording automatically
Linear: VAPICS-1216
Context
Customers with weak network connections sometimes end calls with no
videoRecordingUrlbecause the client-initiatedstartRecording()request never reaches Daily. Per Daily support's recommendation, the backend now creates a meeting token withstart_cloud_recording: truewhen video recording is enabled and returns it on the web call ascall.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()readscall.transport.callTokenfrom the create-web-call response and joins the Daily room with it. When a token is present, the client-sidestartRecording()call is skipped because it will start automatically.reconnect()does the same; theWebCallparam type gains an optionaltransport.callTokenfield, which is picked up automatically by apps that pass back theCallobject fromstart().recording-startedlistener that sends thesay-first-messagecontrol is now registered beforejoin()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).video-recording-setupprogress event reportsmetadata.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
transportso 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
join()gets notokenkey and the SDK falls back to client-initiatedstartRecording()— identical to the old flow.enable_recordingfor exactly this case.video-recording-startedprogress event can occasionally be emitted beforevideo-recording-setup: completed, because the recording may start whilejoin()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, ametadata.actiondiscriminator 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
callTokenisn't provided.