Skip to main content
Back to plugins
@capgo/camera-preview
Tutorial
@capgo/camera-preview

Camera Preview

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

Guide

Tutorial on Camera Preview

Test on device

Download the Capgo app, then scan the QR code.

Camera Preview plugin preview QR code

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

Keep going from Using @capgo/camera-preview

If you are using Using @capgo/camera-preview to plan native media and interface behavior, connect it with @capgo/camera-preview for the implementation detail in @capgo/camera-preview, Getting Started for the implementation detail in Getting Started, Using @capgo/capacitor-live-activities for the native capability in Using @capgo/capacitor-live-activities, @capgo/capacitor-live-activities for the implementation detail in @capgo/capacitor-live-activities, and Using @capgo/capacitor-video-player for the native capability in Using @capgo/capacitor-video-player.