Skip to main content
CameraManager is the entry point for the Client SDK. It replaces the manual ServerManager + CameraClient + EventStream workflow — one class handles binary management, camera discovery, connection lifecycle, SSE events, and reconnection.

Server (Node.js)

Import from camera-remote-web-api/server. This variant spawns and manages the native binary.
import { CameraManager } from 'camera-remote-web-api/server';

const manager = new CameraManager({ port: 8080 });

manager.on('camera-ready', async ({ cameraId, camera }) => {
  console.log(`${camera.model} connected`);
  await manager.client.setPriorityKey(cameraId, { setting: 'pc-remote' });
  await manager.client.triggerShutter(cameraId);
});

await manager.start();

Browser

Import from camera-remote-web-api (the default export). Connects to an already-running server — no binary management.
import { CameraManager } from 'camera-remote-web-api';

const manager = new CameraManager({
  baseUrl: 'http://localhost:8080',
});

manager.on('camera-ready', ({ cameraId, camera }) => {
  console.log(`${camera.model} ready`);
});

manager.start();  // Synchronous — just starts polling + SSE
manager.client is a full CameraClient instance — use it for all REST calls (properties, actions, live view, SD card). See Properties & Actions.

Options

const manager = new CameraManager({
  // Server options (server variant only)
  port: 8080,              // Default: 8080
  autoPort: true,          // Find next available port if busy
  binaryPath: '/path/to', // Explicit path to CameraWebApp binary

  // Connection options (all variants)
  baseUrl: 'http://localhost:8080', // Server URL (browser variant only)
  autoConnect: true,       // Auto-connect discovered cameras (default: true)
  connectionMode: 'remote-transfer', // Default: 'remote'
  autoReconnect: true,     // Reconnect on unexpected disconnect (default: true)
  maxReconnectAttempts: 5, // Give up after N attempts (default: 5)
  pollInterval: 5000,      // Camera discovery interval in ms (default: 5000)
});
OptionDefaultDescription
port8080Server port (server only)
autoPortfalseFind next available port if busy (server only)
binaryPathauto-detectedExplicit binary path (server only, required in Next.js)
baseUrlhttp://localhost:8080Server URL (browser only)
autoConnecttrueConnect cameras automatically on discovery
connectionMode'remote'Default connection mode for auto-connect
autoReconnecttrueReconnect on unexpected disconnect
maxReconnectAttempts5Max reconnect attempts before giving up
pollInterval5000Camera discovery polling interval (ms)

Connection Modes

The connection mode determines what operations are available on a connected camera.
ModeDescription
remoteFull camera control. Photos auto-transfer to host PC.
remote-transferFull camera control + explicit SD card file download.
contentsSD card browsing and file download only — no shooting or settings.
Not all cameras support all modes or APIs. See Compatibility for per-camera details.

Choosing a mode

I want to shoot and auto-save photos to my computer

Use remote. Set still-image-store-destination to 0x1 (Host PC) or 0x3 (Both) for auto-transfer. Listen for downloadComplete events to know when files are saved.
Use remote-transfer. You get full shooting control plus explicit file listing and download from the SD card. This is the most flexible mode.
Use contents. No shooting or settings control — just file browsing and download.
// Set mode globally
const manager = new CameraManager({ connectionMode: 'remote-transfer' });

// Or per-camera when using manual connection
await manager.connect(camera.id, { mode: 'remote-transfer' });

Lifecycle

// Start — boots binary (server), begins polling, subscribes to SSE
await manager.start();

// Access the underlying client for REST calls
await manager.client.setProperty(cameraId, 'iso', { value: '400' });

// Stop — closes SSE, stops polling, kills binary (server)
await manager.close();

Server-only methods

These are only available on the server variant (camera-remote-web-api/server):
manager.getPort();           // Current port (may differ if autoPort)
await manager.isRunning();   // Binary health check
manager.getPid();            // Binary process ID
manager.getStdout();         // Binary stdout lines
manager.getStderr();         // Binary stderr lines

Camera Access

// All cameras with state
const cameras = manager.getCameras();
// → [{ info: { id, model, connectionType, connected }, state: 'connected', reconnectAttempts: 0 }]

// Single camera by ID
const cam = manager.getCamera('D10F60149B0C');
// → { info: {...}, state: 'connected', reconnectAttempts: 0 }

Manual Connection Control

For full manual control over connection lifecycle — connecting specific cameras, managing state transitions, and handling reconnection yourself — use the stateful API classes directly instead of CameraManager.

Stateful API Access

Direct access to CameraClient, EventStream, and ServerManager without CameraManager automation