Plugin

Plugin

CaptureBridge utilizes a plugin system for interacting with hardware devices and vendor SDKs. Clients will interact with plugins via the REST API using their unique plugin ID. This class provides basic methods for working with these plugins such as obtaining a list of compatible devices and managing the plugin's configuration.

Constructor

new Plugin(plugin, baseURLopt)

Description:
  • Instantiate a plugin.

Source:
See:
Parameters:
Name Type Attributes Default Description
plugin object | string

plugin object as received from the API or a plugin ID string.

Properties
Name Type Description
id string

ID of the plugin, used when building endpoint paths to call methods on the plugin.

name string

Human friendly name of plugin.

description string

Human friendly description of plugin.

version string

Semantic version version of the plugin.

methods Array.<string>

plugin's capabilities.

ready boolean

True if plugin has been loaded into memory and is ready.

baseURL string <optional>
BASE_URL

Override the default protocol, domain, and port for the service.

Throws:

Will throw an Error the plugin argument is not a plugin ID (String) or an object.

Members

baseUrl

Source:
Properties:
Name Type Description
id string

ID of the plugin, used when building REST endpoint paths.

name string

Human friendly name for the plugin.

description string

Human friendly description of plugin.

version string

Semantic version version of the plugin.

methods Array.<string>

A plugin's list of supported RPC methods.

ready boolean

True if plugin has been loaded into memory and is ready to receive requests.

defaultDevice object

Default device to use for the plugin.

configMethods Array.<string>

Methods required to implement configuration.

Methods

(async) device(id) → (nullable) {object}

Description:
  • Get a device by ID for this plugin

Source:
See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const device = await plugin.device('AWOOO56709')
Parameters:
Name Type Description
id string

Device ID

Returns:

Requested Device or null

Type
object

(async) devices() → {Array.<object>}

Description:
  • Get all devices for this plugin

Source:
See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const devices = await plugin.devices()
Returns:

Array of Device objects.

Type
Array.<object>

(async) hasMethod(method) → {boolean}

Description:
  • Check if a plugin has an RPC method

Source:
Example
const canCapture = await plugin.hasMethod('capture')
Parameters:
Name Type Description
method string

An RPC method

Returns:

Return true if plugin has the provided method.

Type
boolean

(async) shutdown(timeoutopt)

Description:
  • Shutdown a plugin

Source:
See:
Example
await plugin.shutdown()
Parameters:
Name Type Attributes Default Description
timeout number <optional>
10

Timeout in seconds. Forcefully terminate the plugin if it doesn't shutdown cleanly within the specified timeout. A value of 0 will result in immediately terminating the plugin and should be avoided unless the plugin is unresponsive.