@corti/ambient-web package provides a set of custom elements that handle microphone management, audio streaming, transcript delivery, and facts on top of the Corti API. It works with any frontend framework or plain HTML.
Package: @corti/ambient-web on npm | Examples: corti-examples/ambient
<corti-ambient>— opinionated, all-in-one component with built-in UI (recommended for most use cases)- Modular components — individual building blocks (
<ambient-root>,<ambient-recording-button>, etc.) for fully custom layouts
OAuth 2.0 authentication is not handled by this library. The client must provide an authorization token or token refresh function while using the component. Each ambient session also requires an
interactionId.Installation
Module import
Quick start
Configuration
SetambientConfig as a JavaScript property to configure the stream. The type matches the StreamConfig from the Streams WebSocket API.
When using mode.type: "facts", you must also set mode.outputLocale (the language for extracted facts).
interactionId property is required — it identifies the session for the Streams API.
See the Streams API Reference for the full configuration schema.
Modular components
For custom UI layouts, use individual components inside an<ambient-root> parent:
| Component | Description |
|---|---|
<ambient-root> | Context provider. Same properties as <corti-ambient> (auth, config, interactionId, virtualMode, devices, keybindings). Add noWrapper attribute to remove default styling. |
<ambient-recording-button> | Start/stop button with audio visualization. Supports allowButtonFocus. Has startRecording(), stopRecording(), toggleRecording(), openConnection(), closeConnection() methods. Requires interactionId on the root. |
<ambient-settings-menu> | Settings panel with device, language, and virtual mode selectors. Supports settingsEnabled. |
<ambient-device-selector> | Standalone device dropdown. Supports disabled. |
<ambient-language-selector> | Standalone language dropdown. Supports disabled. |
<ambient-keybinding-selector> | Keybinding configuration. Supports keybindingType ("push-to-talk" or "toggle-to-talk") and disabled. |
<ambient-virtual-mode-selector> | Virtual mode toggle. Supports disabled. |
Virtual mode
Virtual mode captures tab/window/app audio mixed with microphone input. Enable it via thevirtualMode attribute or property, or let users toggle it from the settings menu when settingsEnabled includes "virtualMode" (included by default on <corti-ambient>).
Keyboard shortcuts
The component supports two keybinding modes:| Mode | Behavior | Default key |
|---|---|---|
| Push-to-talk | Hold key to record, release to stop | Space |
| Toggle-to-talk | Press to start, press again to stop | Enter |
event.key names (e.g. "Space", "k", "Meta") or event.code values (e.g. "KeyK", "Backquote"). Modifier combinations are not supported.
When both keybindings are set to the same key, toggle-to-talk takes priority.
Preventing keybinding activation
Use thekeybinding-activated event to conditionally block keybindings:
Attribute formatting
| Type | Format | Example |
|---|---|---|
| Boolean | Presence = true, absence = false | <corti-ambient virtualMode> |
| String | Attribute value | accessToken="token" |
| Array | Comma-separated | settingsEnabled="device,language,virtualMode" |
| Object | JavaScript property only | ambient.ambientConfig = { ... } |
Resources
- npm package — latest version and install info
- Examples — integration examples
- API Reference — properties, methods, and events for every component
- Authentication Guide — access tokens and automatic refresh
- Proxy Guide — route WebSocket traffic through your own server
- Styling Guide — CSS custom properties and theming
- Streams API Reference — underlying WebSocket API specification
For support or questions, reach out through help.corti.app