Skip to content

@camera.ui/sdk / plugin / PluginAPI

Interface: PluginAPI

Defined in: plugin/api.ts:41

The PluginAPI is injected into the plugin at runtime and exposes the system services the plugin is allowed to talk to. It also acts as an EventEmitter for plugin lifecycle events (see API_EVENT).

Example

ts
import { BasePlugin } from '@camera.ui/sdk';

export default class MyPlugin extends BasePlugin {
  async configureCameras() {
    // Access FFmpeg path
    const ffmpeg = await this.api.coreManager.getFFmpegPath();
  }
}

Properties

coreManager

readonly coreManager: CoreManager

Defined in: plugin/api.ts:46

System-level operations such as the FFmpeg path and the server addresses used for media URLs (HTTP/RTSP).


deviceManager

readonly deviceManager: DeviceManager

Defined in: plugin/api.ts:51

Owns the camera devices assigned to this plugin and publishes camera-state changes.


downloadManager

readonly downloadManager: DownloadManager

Defined in: plugin/api.ts:56

Mints token-protected download URLs for files the plugin wants to expose to the UI (e.g. clip exports, snapshots).


notificationManager

readonly notificationManager: NotificationManager

Defined in: plugin/api.ts:62

Publishes notifications into the host so they fan out to every installed Notifier-plugin and the in-app UI. Requires PluginCapability.PublishNotifications in the plugin contract.


storagePath

readonly storagePath: string

Defined in: plugin/api.ts:67

Absolute path to the plugin's writable storage directory. Created and cleaned up by the host. Use it for caches, models, sqlite/bolt files.

Methods

off()

off(event, listener): this

Defined in: plugin/api.ts:74

Remove a previously registered listener (alias of removeListener).

Parameters

event

API_EVENT

listener

() => void

Returns

this


on()

on(event, listener): this

Defined in: plugin/api.ts:70

Subscribe to a lifecycle event. Returns this for chaining.

Parameters

event

API_EVENT

listener

() => void

Returns

this


once()

once(event, listener): this

Defined in: plugin/api.ts:72

Subscribe to a lifecycle event for one delivery only.

Parameters

event

API_EVENT

listener

() => void

Returns

this


removeAllListeners()

removeAllListeners(event?): this

Defined in: plugin/api.ts:81

Remove every listener for event, or every listener entirely if no event is given.

Parameters

event?

API_EVENT

Returns

this


removeListener()

removeListener(event, listener): this

Defined in: plugin/api.ts:76

Remove a previously registered listener.

Parameters

event

API_EVENT

listener

() => void

Returns

this