Skip to main content

Camera Module Reference

Complete API reference for camera capture and vision components.

EstuaryCamera (Example)​

Example component for handling camera capture on Spectacles hardware. Listens for cameraCaptureRequest events and captures images automatically.

Location: Examples/EstuaryCamera.ts

:::note Example Component EstuaryCamera is an example implementation provided in the SDK's Examples/ folder. Copy it to your project and customize as needed. :::

Inspector Inputs​

InputTypeDefaultDescription
debugModebooleantrueEnable debug logging
captureResolutionnumber512Image resolution (smaller dimension in px)

Methods​

MethodParametersReturnsDescription
manualCapture()text?: stringvoidManually trigger camera capture

Lifecycle​

// CameraModule APIs cannot be called in onAwake!
// Component automatically initializes in OnStartEvent

Example Usage​

@component
export class CameraController extends BaseScriptComponent {

@input
estuaryCamera: ScriptComponent;

onAwake() {
// Set up a tap to capture
this.createEvent("TapEvent").bind(() => {
(this.estuaryCamera as any).manualCapture("What is this?");
});
}
}

CameraCaptureRequest​

Request object sent by the server when the AI agent decides it needs visual context. The server's LLM uses function calling to trigger camera captures — no client-side intent detection is needed.

Location: src/Core/EstuaryEvents.ts

import { CameraCaptureRequest } from 'estuary-lens-studio-sdk';

Interface​

interface CameraCaptureRequest {
request_id: string; // Unique identifier for this request
text?: string; // Optional text context for the capture
}

Usage​

import { EstuaryManager, CameraCaptureRequest } from 'estuary-lens-studio-sdk';

// Receiving camera capture requests from the server
EstuaryManager.instance.on('cameraCaptureRequest', (request: CameraCaptureRequest) => {
print(`Capture requested: ${request.request_id}`);
print(`Context: ${request.text}`);
});

EstuaryManager Camera Methods​

Camera-related methods on the EstuaryManager singleton.

Location: src/Components/EstuaryManager.ts

sendCameraImage​

Send a captured image to the server for AI analysis.

sendCameraImage(
imageBase64: string,
mimeType?: string,
requestId?: string,
text?: string,
sampleRate?: number
): void
ParameterTypeDefaultDescription
imageBase64stringrequiredBase64-encoded image data
mimeTypestring'image/jpeg'MIME type of the image
requestIdstring-Request ID if responding to a cameraCaptureRequest
textstring-Text context to send with image
sampleRatenumber16000TTS output sample rate (Hz). Pass 24000 if the rest of your session uses 24 kHz playback (see warning below).

:::caution Sample-rate mismatch on image-driven responses sendCameraImage() defaults the TTS sample rate to 16 kHz for Spectacles' hardware-locked recording rate, but voice sessions typically initialize DynamicAudioOutput at 24 kHz. Feeding a 16 kHz response into a 24 kHz player produces audible pitch/speed drift. Pass 24000 explicitly when your session uses 24 kHz TTS playback. :::

import { EstuaryManager } from 'estuary-lens-studio-sdk';

EstuaryManager.instance.sendCameraImage(
base64ImageData,
'image/jpeg',
'request-123',
'What do you see?',
24000 // Match the rate used by DynamicAudioOutput.initialize()
);

Events​

cameraCaptureRequest​

Emitted by both EstuaryManager and EstuaryCharacter when the server's AI agent requests a camera capture.

import { EstuaryManager, CameraCaptureRequest } from 'estuary-lens-studio-sdk';

// Via EstuaryManager
EstuaryManager.instance.on('cameraCaptureRequest', (request: CameraCaptureRequest) => {
print(`Server requested capture: ${request.request_id}`);
});

// Via EstuaryCharacter
character.on('cameraCaptureRequest', (request: CameraCaptureRequest) => {
print(`Server requested capture: ${request.request_id}`);
// Capture and send image
const imageBase64 = captureImage();
EstuaryManager.instance.sendCameraImage(imageBase64, 'image/jpeg', request.request_id);
});

Type Definitions​

Complete Type Reference​

// Camera Capture Request (server → client)
interface CameraCaptureRequest {
request_id: string;
text?: string;
}

SDK Structure​

estuary-lens-studio-sdk/
├── src/
│ ├── Components/
│ │ └── EstuaryManager.ts ← sendCameraImage()
│ └── Core/
│ └── EstuaryEvents.ts ← CameraCaptureRequest type
└── Examples/
├── EstuaryVoiceConnection.ts ← Vision integration with voice
└── EstuaryCamera.ts ← Camera capture settings (captureResolution, debugMode)

See Also​