Skip to content

[wip]#1462

Open
shomix wants to merge 1 commit into
mainfrom
ai_main_1cbd79a1c6ce4d8db80a
Open

[wip]#1462
shomix wants to merge 1 commit into
mainfrom
ai_main_1cbd79a1c6ce4d8db80a

Conversation

@shomix

@shomix shomix commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a direct-to-GCS resumable upload path for the Clips recorder, allowing the browser to PUT video chunks straight to GCS via a resumable session URI — bypassing the per-chunk app-server hop.

Problem

Previously, every video chunk recorded in the browser was routed through the app server before reaching GCS/Builder.io storage. This added unnecessary latency and load on the server for each chunk during upload.

Solution

When BUILDER_PRIVATE_KEY is configured, the server initiates a GCS resumable session and returns the session URI to the browser. The browser then PUTs chunks directly to GCS using Content-Range headers. After all chunks are uploaded, the browser calls a completion endpoint that registers the asset with Builder.io and finalizes the recording row.

Key Changes

  • packages/core/src/file-upload/builder.ts: Added requestBuilderResumableSession() to initiate a GCS resumable upload session via the Builder.io /api/v1/upload/signed-url?isResumable=true endpoint, and completeBuilderResumableUpload() to register the completed upload and retrieve the CDN URL.
  • packages/core/src/file-upload/index.ts: Exported the two new functions and the BuilderResumableSession type.
  • templates/clips/server/routes/api/uploads/[recordingId]/init-resumable.post.ts: New route (POST /api/uploads/:recordingId/init-resumable) that authenticates the user, validates the request, and returns a resumableSessionUri + assetId for the browser to use.
  • templates/clips/server/routes/api/uploads/[recordingId]/complete.post.ts: New route (POST /api/uploads/:recordingId/complete) that calls completeBuilderResumableUpload() and then invokes finalizeRecording with the resulting CDN URL, skipping chunk assembly entirely.
  • templates/clips/actions/create-recording.ts: Returns supportsResumableUpload: true when BUILDER_PRIVATE_KEY is set, signaling to the frontend that the direct upload path is available.
  • templates/clips/actions/finalize-recording.ts: Added videoUrl and videoSizeBytes input fields; when videoUrl is provided, chunk assembly and server-side upload are skipped and the recording is marked ready immediately.
  • templates/clips/app/routes/record.tsx: Passes useResumableUpload flag to the recorder engine based on the supportsResumableUpload flag returned from recording creation.

Edit in Builder  Preview


To clone this PR locally use the Github CLI with command gh pr checkout 1462

You can tag me at @BuilderIO for anything you want me to fix or change

@builder-io-integration builder-io-integration Bot changed the title Update from the Builder.io agent Add direct-to-GCS resumable upload for recordings Jun 24, 2026
@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Here's a visual recap of what changed:

Visual recap

Open the full interactive recap

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@netlify

This comment has been minimized.

@shomix shomix changed the title Add direct-to-GCS resumable upload for recordings [wip] Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants