Capture clients and integrations
Cap extends beyond its main desktop app through clients and integration surfaces that bring capture, playback, and automation into other contexts. Native iOS and browser clients create recordings, SDKs let other products record or embed videos, and command-line or chat tools connect Cap to agent and release workflows.
Capture surface map
The alternate clients share one product goal: turn media captured in a local context into a Cap recording that can be processed, shared, and managed through the Cap service. They differ in who owns capture and how they keep work safe while media moves from the device to Cap.
This diagram shows how alternate surfaces send capture or control work to Cap and return a result to a person or an external workflow.
flowchart LR
A[Native iOS client] --> C[Cap service]
B[Chrome extension] --> C
D[Recorder SDK] --> C
G[CLI and agents] --> C
C --> E[Share link]
C --> F[Cap library]
H[Chat and release tools] --> I[External workflow]
The main boundaries are:
| Surface | Primary role | Cap result |
|---|---|---|
| Native iOS client | Capture from the iPhone, import media, and manage Caps across foreground and background app work | A mobile recording or upload that becomes a Cap recording, library item, or share result; current recording entry points are camera and screen |
| Chrome extension | Capture a screen, window, tab, or camera from the browser | An instant recording with a share link or a recoverable local copy |
| Recorder SDK | Add browser recording to another product | A video identity and share or embed URLs |
| Embed SDK | Place a Cap video in another web product | A Cap player in an iframe |
| CLI and agent tools | Start, inspect, export, upload, and automate Cap work from a shell | Machine-readable recording and upload results |
| Chat and release integration | Connect team chat to repository release work | Status messages and links in the external workflow |
Client and service relationship
Alternate clients do not replace the Cap service. The clients collect media and present a user or machine control surface, while Cap remains the place that authenticates access, creates recording identities, accepts uploads, processes media, and produces shareable results.
This split lets each client fit its host environment. The native iOS client owns camera and screen capture, resumes work after background launches, and uses the mobile API for library, playback, sharing, editing, analytics, organization settings, and notification state. The browser extension uses Chrome permissions, a page overlay, and a long-lived recorder context. Browser SDKs use standard web media APIs and a public-key upload boundary. The CLI uses the same installed Cap binary as the desktop app and can reuse desktop login state.
References: README.md• L31-45 README.md• L154-175 apps/…/AppModel.swift• L7-17 apps/…/APIClient.swift• L331-519 apps/…/README.md• L44-51
Mobile and browser clients
The mobile and browser clients adapt Cap to two places where the desktop app is not the best capture point. The native iOS client covers capture, media upload and import, Cap playback, editing, sharing, library work, analytics, account notifications, and saving downloaded Caps to Photos, while the Chrome extension puts capture controls in the browser and keeps recording alive when its popup closes. On iOS, the recorder presents an Instant Mode for camera and screen capture; Studio Mode and Screenshot Mode remain visible as future capture choices rather than active flows. apps/…/RecordView.swift• L253-341
Native iOS capture client
The native iOS client provides a mobile Cap workspace as well as a capture surface. It records from the camera or the device screen, uploads photos and videos from Photos or Files, imports Loom links, saves permitted videos to Photos, and places the result in a personal or organization library. It also supports folders and organization context, so mobile capture can enter the same shared workspace as desktop capture. The library presents personal Caps, organization spaces, and folders as one navigable scope, with layout rules that keep the content usable on regular-size devices such as iPhone Duo. apps/…/RecordView.swift• L6-89 apps/…/AddMenu.swift• L21-97 apps/…/HomeView.swift• L6-39 apps/…/Theme.swift• L135-177
The client keeps capture and upload useful after the user leaves the app. Camera and screen recordings stream toward Cap as they are made, while picked media moves through a background upload job. Camera capture can switch between front and back cameras and keeps the recorded frame upright; if iOS interrupts the camera, the client stops cleanly and keeps the media already captured. The app restores unfinished work after a relaunch or unlock, shows progress in the app and in the system's upload surface, and can pass a screen recording between the broadcast extension and the main app. A completed recording refreshes the library and exposes its share link. apps/…/RecordingCoordinator.swift• L16-139 apps/…/UploadCenter.swift• L74-229 apps/…/BackgroundUploadCoordinator.swift• L40-157 apps/…/RecordingUploads.swift• L98-263 apps/…/CameraCapture.swift• L178-232 apps/…/RecordModel.swift• L267-276
The mobile client is also a consumer of the full Cap result. A person can open a Cap from a deep link, push notification, pasted link, or the library, watch it, use comments and reactions, copy or share its link, save permitted media to Photos, and change sharing or title settings. Owners with access to editing can split, remove, trim, or restore parts of a recording; Cap renders the saved version and the client waits for the refreshed result. The client also presents organization and Cap analytics when the account can use them. apps/…/CapDetailModel.swift• L162-255 apps/…/CapDetailModel.swift• L707-835 apps/…/PhotoLibrary.swift• L3-10 apps/…/EditorModel.swift• L600-631 apps/…/AnalyticsScreen.swift• L6-87
The app uses the mobile API as the contract for login, organization context, Cap data, uploads, recording completion, edits, analytics, Loom import, and notification preferences. Push registration points server events back to a Cap or recording, while settings let the user control the same notification preferences used by cap.so. Session changes clear local work so uploads and events cannot move to another account. apps/…/APIClient.swift• L331-519 apps/…/APIClient.swift• L549-593 apps/…/AppModel.swift• L227-289 apps/…/NotificationSettingsView.swift• L114-151
The native boundary keeps mobile capture separate from the browser and desktop surfaces while still targeting the same Cap service. Shared application-group access and push entitlements allow native recording handoff and server-driven return paths to work across app states. The app targets iOS 26, while release packaging also protects the layout and native package path needed for newer iPhone Duo hardware. apps/mobile-ios/Config/Cap.entitlements#L5-L23 apps/…/CapApp.swift• L7-55 apps/…/RecordingHandoff.swift• L4-64 apps/…/README.md• L77-83 apps/mobile-ios/Cap.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings#L1-L8
See Mobile and browser capture clients for the native iOS capture boundary, broadcast handoff, mobile upload lifecycle, and release model.
References: apps/…/PhotoLibrary.swift• L3-10 apps/…/CapDetailModel.swift• L162-255 apps/…/CapDetailModel.swift• L783-805 apps/…/CapUITests.swift• L308-329 apps/…/Cap.entitlements• L5-23 apps/…/server.py• L322-327 apps/…/README.md• L15-21 apps/…/README.md• L53-59
Browser capture client
The Chrome extension adds Cap capture to the active browser session. Its recorder panel selects the source and devices, while an in-page overlay keeps the camera preview and recording controls beside the content being captured. A separate extension recording context owns the media session, so the recorder stays active after the panel closes and can recover its state after a background worker restart.
The extension supports full-screen, window, current-tab, and camera-only modes. It can include microphone and system audio, show a pre-roll countdown, and warn when a selected microphone has no usable sound. A stale saved microphone falls back to the default device, and a temporary device lock can trigger a retry. Tab capture keeps the tab's shape instead of forcing it into the screen's shape. During capture, the in-page controls support pause, resume, microphone mute, drawing, and temporary page blur. The camera preview can be moved, resized, mirrored, or placed in Picture in Picture without changing the recorded page.
The recorder streams media to Cap while it records and also keeps a local recovery copy for interrupted uploads. If local storage fails, the client keeps a complete in-memory continuation only within a bounded limit; it does not offer a truncated recording as recoverable data. A capture source that ends during setup cancels the provisional recording. A source that ends after capture starts follows the normal stop and upload path. A recovery page can retry an upload or download the recording, and an uncertain server response keeps the share link available for verification before another upload attempt.
The browser client mirrors recording state across tabs, so a tab switch, page reload, or worker restart does not create a second or stale control surface. It also keeps settings and media access state in shared extension storage, which prevents one extension page from restoring an old device choice over a newer one.
The extension keeps the recorder available on Cap-owned pages when Chrome blocks content scripts on browser pages such as New Tab or Settings. Opening the toolbar action on such a page opens a supported Cap page beside it and asks that page to show the recorder overlay. The overlay treats host content as untrusted and uses extension-owned message paths for camera and control traffic.
See Mobile and browser capture clients for the browser capture lifecycle, service-worker coordination, recovery behavior, and store release path.
References: apps/…/service-worker.ts• L196-376 apps/…/service-worker.ts• L1270-1621 apps/…/recorder.ts• L424-638 apps/…/recorder.ts• L896-1438 apps/…/recorder.ts• L1454-1699 apps/…/recording-bar.tsx• L104-357 apps/…/main.tsx• L132-220 apps/…/types.ts• L137-205 apps/…/recording-upload.spec.ts• L889-1166 apps/…/recording-upload.spec.ts• L1168-1443 apps/…/recording-upload.spec.ts• L1480-1661 apps/…/recorder.test.ts• L190-531
SDK surfaces
Cap exposes small web SDKs for products that need Cap capture or playback without adopting a full Cap client. The recorder SDK owns a browser recording session and upload. The embed SDK turns a Cap video identity into a player that another site can place in its own page.
Recorder SDK
The recorder SDK gives a third-party web surface a simple recording lifecycle. A host supplies a public key and optional capture settings, then receives phase, duration, error, and completion events as the SDK requests media, records it, uploads it, and returns a video ID with share and embed URLs.
It supports full-screen, window, tab, and camera capture. Camera, microphone, and system audio are optional inputs, and a React hook maps the same lifecycle to component state. The SDK depends on the host browser's media permissions and encoding support.
References: packages/…/index.ts• L23-63 packages/…/index.ts• L112-169 packages/…/types.ts• L1-36
Embed SDK
The embed SDK lets another web product show a Cap video without rebuilding the player. It creates a Cap embed URL and can render that URL as an iframe through vanilla JavaScript, a global browser loader, or a React component.
The host can set autoplay and limited branding values. The iframe remains the playback boundary, which keeps the consuming product coupled to the public embed contract rather than to Cap player internals.
See Recorder SDK and shared core for the SDK contracts, browser recording lifecycle, upload boundary, and reusable recorder logic.
References: packages/…/index.ts• L23-63 packages/…/index.ts• L112-169 packages/…/types.ts• L1-36 packages/…/types.ts• L1-10 packages/…/cap-embed.ts• L3-41 packages/…/CapEmbed.tsx• L5-35
Shared recorder core
The shared recorder core provides common browser capture and upload behavior for Cap's web recording surfaces. It defines the common shape of recorder phases, upload states, video identities, upload targets, and local recovery results so clients can use the same service language.
The same core supports dashboard and share-page recorders. The Chrome extension's offscreen recorder uses its upload and recovery capabilities while owning browser-specific capture. This shared boundary reduces drift between product-owned recorders and alternate clients.
See Recorder SDK and shared core for the core package's role and its relationship to the SDKs and web recording surfaces.
References: packages/…/index.ts• L1-8 packages/…/recorder-types.ts• L3-47 packages/…/capture-streams.ts• L14-19 packages/…/capture-streams.ts• L57-81 apps/…/recorder.ts• L1-21 apps/…/recorder.ts• L896-1438 apps/…/recorder.ts• L1549-1699
Command-line and chat integrations
Command-line and chat surfaces connect Cap to work that does not start in a Cap window. The CLI makes recording and media actions usable by shells and AI agents, while the Discord bot connects repository release actions to team communication.
Command-line and agent surface
The cap CLI is a machine-oriented entry point for recording, screenshots, project inspection, export, upload, diagnostics, and automation. Its recording command supports an interactive foreground session and a detached session that can outlive the launching shell. JSON output and newline-delimited events make its results suitable for scripts and agents.
The detached lifecycle returns a recording ID, stores session state, and lets a later stop command request the end of recording and wait for finalization. The CLI can reuse the login stored by Cap Desktop or use an API key for headless work. A companion agent skill and local MCP server make the same Cap operations available to supported coding agents.
The CLI shares automation rules authored in Cap Desktop. It applies those rules to capture and upload events, with actions such as saving, exporting, uploading, running commands, and calling webhooks. Desktop-only actions remain unavailable from the CLI, so an automation action can be skipped even when capture succeeds.
See CLI and chat integrations for the command contract, agent setup, authentication, automation behavior, and command coverage.
References: apps/…/README.md• L1-5 apps/…/README.md• L14-30 apps/…/README.md• L62-101 apps/…/record.rs• L132-178 apps/…/record.rs• L401-565 apps/…/automation.rs• L1-13 apps/…/automation.rs• L471-577
Chat and release surface
The Discord bot is a small external service for release coordination rather than a capture client. It verifies Discord interaction signatures, accepts a release command, starts the Cap repository's GitHub workflow, and stores enough interaction context to update the original message with the finished release links.
The release path is a callback flow between Discord, the Cloudflare Worker service, GitHub Actions, and the Cap release system. Its runtime uses Hono for request handling and signed-token libraries for trust checks. Authenticated callbacks update team-facing status only for the expected Cap repository and release interaction.
See CLI and chat integrations for the Discord command flow, worker boundary, release callbacks, and tests.
References: apps/…/package.json• L1-26 apps/…/index.ts• L59-75 apps/…/index.ts• L77-139 apps/…/index.ts• L141-222 apps/…/index.ts• L226-267
Integration contracts
Every external surface depends on contracts that connect a host environment to Cap. The contract includes identity, capture permissions, media state, upload completion, and the final link or library result. For the browser extension, it also covers which page may host the overlay and which extension context may handle camera or recording work. For iOS, it also covers background transfer, native recording handoff, push delivery, account and organization state, analytics events, Photos authorization, and the mobile API's Cap state.
| Contract group | What it connects | Why it matters |
|---|---|---|
| Identity | Host client, user or organization, and Cap server | The client must create work in the correct account or space |
| Capture | Host permissions and selected media sources | Available modes depend on browser or native platform rules |
| Recording state | Start, pending capture, pause, stop, upload, complete, and error states | Separate surfaces must show the same recording truth |
| Media delivery | Local bytes, upload targets, background transfer, and server processing | A finished local capture is not a finished Cap recording until the server accepts it |
| Account and notification state | Mobile session, push token, user notification preferences, and organization context | A mobile event must reach the correct account and device without restoring stale settings |
| Usage events | Mobile actions, app metadata, and the signed-in session | Product signals must not be sent as another user's events or expose media details |
| Result | Video ID, share URL, embed URL, library item, or local Photos asset | Downstream users and systems need a stable way to find or keep the result |
When an integration changes, follow the contract from the host surface to the service and then to the result consumer. This is especially important for clients with a native or browser process separate from their user interface.
External surface selection
Choose the surface that matches where the capture or action starts:
- Use the native iOS client when the source is an iPhone camera, screen broadcast, photo, video upload, Loom link, or mobile library action.
- Use the Chrome extension when the source is a browser tab, browser window, full screen, or browser camera.
- Use the recorder SDK when another web product must own the recording UI.
- Use the embed SDK when another web product only needs to show a Cap video.
- Use the CLI when a shell, CI job, or coding agent must control capture or media work.
- Use the chat integration when a team workflow needs release state in Discord.
References: apps/…/PhotoLibrary.swift• L3-10 apps/…/CapDetailModel.swift• L783-805 apps/…/APIClient.swift• L331-519 apps/…/APIClient.swift• L549-593 apps/…/RecordingCoordinator.swift• L69-139 apps/…/BackgroundUploadCoordinator.swift• L95-157 apps/…/Analytics.swift• L98-223 packages/…/types.ts• L14-29 packages/…/types.ts• L1-10 apps/…/README.md• L78-101 apps/…/index.ts• L236-266
Change checklist
When these files or sections are changed, remember to consider these:
- Keep each alternate client's identity and server URL rules aligned with the matching Cap API contract.
- Keep the native iOS app-group, push, Photos access, and background-session declarations aligned with the app and its recording handoff.
- Keep the iOS recording mode contract aligned with the modes actually offered to users. Future mode labels must not imply a working capture path.
- Keep mobile recording, upload, completion, recent-recording, download, and Photos-save states aligned across camera capture, screen capture, background transfers, Loom imports, and the library result.
- Keep mobile API routes and response models aligned for authentication, organization context, upload targets, recording completion, Cap access, edits, analytics, sharing, downloads, and notification preferences.
- Keep mobile push token registration, notification preference saves, and push deep links aligned with account sign-out and session expiry.
- Keep mobile usage event names, allowed values, app metadata, queue ownership, and sign-out behavior aligned with the mobile events contract.
- Keep mobile edit ranges, trim behavior, and saved edit payloads aligned with the server's edit and render contract.
- Keep browser and native permission declarations aligned with the capture modes shown by each client.
- Keep browser capture-source end handling aligned with server-side recording cleanup. A source that ends before capture starts must cancel the provisional recording, while a live source end must use the normal stop and upload path.
- Keep browser device fallback and retry behavior aligned with the device and permission state shown to the user.
- Keep browser recovery metadata aligned with the local recording bytes. A retry entry must describe the same complete recording as its stored media.
- Keep browser overlay tokens, frame origins, and runtime message routes aligned.
- Keep browser status mirrors aligned across the service worker, recording context, content overlay, and upload page.
- Keep SDK public-key, video-ID, share-URL, and embed-URL behavior aligned with the server's public integration routes.
- Keep CLI JSON and NDJSON output stable for agent and automation consumers.
- Keep CLI foreground and detached recording lifecycles aligned with session lookup, stop requests, and final project metadata.
- Keep Discord interaction storage, GitHub workflow inputs, and callback payloads aligned with the worker's signed request boundary.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A browser or native client lacks the permission or capture capability for its selected mode | Recording cannot start or loses its intended source | Tie the mode list to supported host capabilities and native entitlements |
| The iOS app lacks the required application-group, push, Photos, or background-session entitlement | Screen handoff, Photos export, background completion, or server-driven mobile alerts do not return to the app | Keep native entitlements, Photos authorization, and background identifiers aligned with the app services |
| A mobile upload or recording is not handed to the background transfer system while the app is active | The upload stops when iOS suspends the app | Start preparation and handoff before leaving the foreground, then restore jobs on launch |
| A visible iOS recording mode has no supported capture path | A user can select a mode that cannot produce a recording | Keep unavailable modes marked as future choices until their capture flow is connected |
| A Cap download is valid but Photos authorization is denied or the temporary video is not accepted by Photos | The user cannot save the Cap locally even though playback or download works | Request add-only Photos access, validate the downloaded media, and report the save result |
| A mobile API response changes without a matching CapKit model or request contract | A Cap, upload, edit, analytics, notification, or Photos action fails or shows stale state | Treat API request and response models as one mobile integration contract |
| A mobile usage batch keeps events from a prior account or sends without the current session | Analytics are attributed to the wrong account or rejected by the service | Bind queued events to their session and require the matching user before sending |
| A push token is registered for the wrong environment or remains after sign-out | The phone misses alerts or receives alerts for a signed-out session | Register the token with its APNs environment and remove it during sign-out |
| A saved mobile notification change races another change | The server keeps one switch at an older value | Serialize preference saves and restore the last server-confirmed state on failure |
| A saved edit is sent while another render is active or with invalid keep ranges | The server rejects the edit or the client waits for a result that cannot complete | Gate edits by server edit state and enforce valid non-empty ranges |
| A saved browser device is gone or briefly busy | Recording starts without the expected input or fails during setup | Fall back from stale device choices and retry transient device-open failures |
| A browser capture source ends while recording is being created | A provisional server recording or local session can remain pending | Cancel setup and clean up the provisional recording |
| A client creates media but upload completion does not reach Cap | Local media exists without a completed library or share result | Preserve a complete recoverable local copy and expose retry or recovery status |
| The browser recovery spool fails and its memory continuation cannot hold the full recording | The client cannot safely offer a truncated recording for retry or download | Mark recovery unavailable unless all local bytes remain |
| A browser tab switch or worker restart loses the shared recording phase | A visible tab shows an idle or duplicate control | Treat the recording context as the media owner and reconcile its status |
| A recording start waits on a hidden picker or prompt in another window | The start stays pending with no clear result | Tie prompts to the clicked tab and provide cancellation handling |
| An agent parses human logs instead of the CLI stdout contract | Automation misses success, failure, or progress events | Consume structured JSON or NDJSON output and use the exit code |
| A detached CLI worker exits before final project metadata is written | The stop command cannot confirm a valid completed recording | Validate session state and project completion before reporting success |
| A Discord interaction or GitHub callback fails signature or repository checks | Release status is not updated in the team channel | Verify external signatures and the expected Cap repository |
Key files
| File | Why to read it |
|---|---|
| README.md | Establishes Cap's product purpose and the top-level map of alternate apps and SDKs |
| apps/…/README.md | Describes the iOS product boundary, recording modes, background upload, Photos save path, analytics, testing, and release constraints |
| apps/…/AppModel.swift | Shows the mobile service boundary, signed-in state, account cleanup, and sign-out behavior |
| apps/…/CapApp.swift | Shows mobile entry points for background work, deep links, push actions, tabs, and the main product surfaces |
| apps/…/RecordingCoordinator.swift | Shows how camera and screen recordings become recent Caps across app and background states |
| apps/…/BackgroundUploadCoordinator.swift | Shows how background transfers, imports, progress, completion, and Live Activities return to the app |
| apps/…/UploadCenter.swift | Shows how phone media becomes a background upload and then a library result |
| apps/…/PhotoLibrary.swift | Shows the native boundary for saving a downloaded Cap video to Photos |
| apps/…/RecordView.swift | Shows the mobile capture choices and the user-facing recording flow |
| apps/…/CameraCapture.swift | Shows the camera capture boundary and how interruptions or device changes affect recording |
| apps/…/RecordModel.swift | Shows the mobile camera recording lifecycle, account placement, duration limits, and interruption handling |
| apps/…/AddMenu.swift | Shows the mobile entry points for recording, media upload, Loom import, folders, and share links |
| apps/…/CapDetailModel.swift | Shows how the mobile client consumes playback, access, comments, reactions, sharing, download, and Photos-save results |
| apps/…/EditorModel.swift | Shows the mobile edit flow from local preview to server-rendered Cap |
| apps/…/AnalyticsScreen.swift | Shows the organization and Cap analytics surface exposed by the mobile client |
| apps/…/NotificationSettingsView.swift | Shows the shared notification preference surface and its mobile push state |
| apps/…/APIClient.swift | Defines the mobile API contract for account, organization, Cap, upload, recording, edit, analytics, import, download, and notification work |
| apps/…/Analytics.swift | Defines the queued usage-event contract and session-safe delivery behavior |
| apps/…/RecordingHandoff.swift | Defines the handoff result shared by the screen broadcast and main app |
| apps/…/RecordingUploads.swift | Defines the shared recording upload lifecycle used by the app and broadcast extension |
| apps/…/SampleHandler.swift | Shows how screen capture becomes a Cap recording when the user is outside the main app |
apps/mobile-ios/Cap.xcodeproj/project.pbxproj | Shows the iOS app, broadcast extension, widget, test target, and release SDK gate |
apps/mobile-ios/Cap.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings | Shows the workspace setting required for arm64e Swift package builds |
| apps/…/service-worker.ts | Shows the browser coordinator for auth, page hosting, overlay state, recording start, and status recovery |
| apps/…/recorder.ts | Shows browser capture ownership, device handling, upload, cleanup, and local recovery |
| apps/…/recording-bar.tsx | Shows the browser's floating ready and active recording controls |
| apps/…/types.ts | Defines browser capture modes, recording states, recovery results, and cross-context messages |
| apps/…/recording-upload.spec.ts | Verifies capture modes, audio, source cancellation, device behavior, upload completion, recovery, and repeated recordings |
| apps/…/recorder.test.ts | Verifies microphone mute, source end handling, device fallback, retries, and tab capture sizing |
| packages/…/capture-streams.ts | Shows the shared browser capture boundary used by multiple recording surfaces |
| packages/…/index.ts | Shows the public recorder lifecycle and result returned to an embedding product |
| packages/…/cap-embed.ts | Shows the public video embed boundary |
| apps/…/README.md | Defines the CLI's machine-readable contract and external automation role |
| apps/…/record.rs | Shows foreground and detached recording lifecycles and the session result contract |
| apps/…/package.json | Shows the deployed worker runtime and trust or request libraries used by the chat integration |
| apps/…/index.ts | Shows the Discord-to-GitHub release workflow boundary |