Constructor
new CapturePlugin(baseURLopt, pluginId)
- Description:
Instantiate a CapturePlugin
- Source:
- See:
Example
const capture = new CapturePlugin('capture_camera_canon')
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
baseURL |
string |
<optional> |
Protocol, domain, and port for the service. |
pluginId |
string | The Id of the desired plugin to use for this
camera instance. The plugin must support the |
Extends
Members
baseUrl
- Source:
- Overrides:
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:
- Overrides:
- 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:
- Overrides:
- See:
Example
const plugin = await captureBridge.plugin('capture_camera_canon')
const devices = await plugin.devices()
Returns:
Array of Device
objects.
- Type
- Array.<object>
(async) fullCapture(captureOptopt, deviceOptopt)
- Description:
Take a full capture
- Source:
Example
// Capture an image as an ArrayBuffer and add it to an img tag appended to
// the document's body.
const img = document.createElement('img')
img.src = await capture.fullCapture()
document.body.appendChild(img)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
captureOpt |
CaptureOptions |
<optional> |
Additional options for capturing an image. |
deviceOpt |
string | object |
<optional> |
Take the capture using either a specific Device ID or a Device Object. The default is the first available device. |
(async) hasMethod(method) → {boolean}
- Description:
Check if a plugin has an RPC method
- Source:
- Overrides:
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:
- Overrides:
- 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 |