Import
Constructor
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| options | CameraOptions | Optional configuration for the camera instance. | |
| options.logger | Partial<LoggerConfig> | Logger configuration for debugging and logging. | |
| options.device | DeviceDescriptor | Device descriptor for the camera. If provided, the appropriate vendor-specific implementation will be selected automatically. |
Methods
connect
Connect to a camera device.| Parameter | Type | Required | Description |
|---|---|---|---|
| device | DeviceDescriptor | Optional device descriptor. If not provided, uses the device from the constructor options. |
disconnect
Disconnect from the camera device.send
Send a PTP operation to the camera.| Parameter | Type | Required | Description |
|---|---|---|---|
| operation | OperationDefinition | ✓ | The operation definition to send. |
| params | any | ✓ | Parameters for the operation. |
| data | Uint8Array | Optional data payload. | |
| maxDataLength | number | Optional maximum data length. |
get
Get a camera property value.| Parameter | Type | Required | Description |
|---|---|---|---|
| property | PropertyDefinition | ✓ | The property definition to get. |
set
Set a camera property value.| Parameter | Type | Required | Description |
|---|---|---|---|
| property | PropertyDefinition | ✓ | The property definition to set. |
| value | any | ✓ | The value to set. |
on
Register an event handler.| Parameter | Type | Required | Description |
|---|---|---|---|
| event | EventDefinition | ✓ | The event definition to listen for. |
| handler | function | ✓ | The handler function to call when the event occurs. |
off
Unregister an event handler.| Parameter | Type | Required | Description |
|---|---|---|---|
| event | EventDefinition | ✓ | The event definition to stop listening for. |
| handler | function | Optional handler function. If not provided, all handlers for the event are removed. |
getAperture
Get the current aperture value.setAperture
Set the aperture value.| Parameter | Type | Required | Description |
|---|---|---|---|
| value | string | ✓ | The aperture value to set. |
getShutterSpeed
Get the current shutter speed value.setShutterSpeed
Set the shutter speed value.| Parameter | Type | Required | Description |
|---|---|---|---|
| value | string | ✓ | The shutter speed value to set. |
getIso
Get the current ISO value.setIso
Set the ISO value.| Parameter | Type | Required | Description |
|---|---|---|---|
| value | string | ✓ | The ISO value to set. |
captureImage
Capture an image from the camera.| Parameter | Type | Required | Description |
|---|---|---|---|
| params | object | Capture parameters. | |
| params.includeInfo | boolean | Whether to include object info in the response. Defaults to true. | |
| params.includeData | boolean | Whether to include image data in the response. Defaults to true. |
captureLiveView
Capture a live view frame from the camera.| Parameter | Type | Required | Description |
|---|---|---|---|
| params | object | Live view capture parameters. | |
| params.includeInfo | boolean | Whether to include object info in the response. Defaults to true. | |
| params.includeData | boolean | Whether to include image data in the response. Defaults to true. |
startRecording
Start video recording.stopRecording
Stop video recording.listObjects
List all objects stored on the camera.getObject
Retrieve an object from the camera.| Parameter | Type | Required | Description |
|---|---|---|---|
| objectHandle | number | ✓ | The handle of the object to retrieve. |
| objectSize | number | ✓ | The size of the object in bytes. |
Exports
The module also exports the vendor-specific camera implementations:CanonCameraGenericCameraNikonCameraSonyCamera