Skip to main content
Back to plugins
@capgo/camera-preview
Tutorial
by github.com/Cap-go

Camera Preview

Display live camera feed as overlay with customizable controls and capture capabilities

Guide

Tutorial on Camera Preview

Using @capgo/camera-preview

The main interface for the CameraPreview plugin.

Install

bun add @capgo/camera-preview
bunx cap sync

What This Plugin Exposes

  • start - Starts the camera preview.
  • stop - Stops the camera preview.
  • capture - Captures a picture from the camera.
  • captureSample - Captures a single frame from the camera preview stream.

Example Usage

start

Starts the camera preview.

import { CameraPreview } from '@capgo/camera-preview';

await CameraPreview.start({} as CameraPreviewOptions);

stop

Stops the camera preview.

import { CameraPreview } from '@capgo/camera-preview';

await CameraPreview.stop();

capture

Captures a picture from the camera.

import { CameraPreview } from '@capgo/camera-preview';

await CameraPreview.capture({} as CameraPreviewPictureOptions);

captureSample

Captures a single frame from the camera preview stream.

import { CameraPreview } from '@capgo/camera-preview';

await CameraPreview.captureSample({} as CameraSampleOptions);

Full Reference