# @joraclista/ptz-edge-js

> API for controlling PTZ device on windows inside electron container

Latest version **1.0.7** (published 2021-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install @joraclista/ptz-edge-js
pnpm add @joraclista/ptz-edge-js
yarn add @joraclista/ptz-edge-js
bun add @joraclista/ptz-edge-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2021-04-24 |
| First published | 2021-04-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 443.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | joraclista |
| Maintainers | joraclista |
| Keywords | edge-js, electron, ptz |

## Links

- npm: https://www.npmjs.com/package/@joraclista/ptz-edge-js
- npm.io page: https://npm.io/package/@joraclista/ptz-edge-js

## Dependencies (1)

- [electron-edge-js](https://npm.io/package/electron-edge-js.md) ^12.18.5

## Recent versions

- 1.0.7 (latest) — 2021-04-24
- 1.0.6 — 2021-04-23
- 1.0.5 — 2021-04-23
- 1.0.4 — 2021-04-05
- 1.0.3 — 2021-04-05
- 1.0.2 — 2021-04-05
- 1.0.1 — 2021-04-05
- 1.0.0 — 2021-04-05

## README

# ptz-edge-js
API for controlling PTZ device on windows inside electron container

## Running DEMO Application

1. `npm install`
2. `npm start`

## Build c# project after changes in c# files:

In cmd of project root do one of the next options:

*  run `tools\build.bat`
*  run `dotnet build .\src\logitech-ptz-pro\PTZDevice.csproj` and copy dll files from `bin\Debug` folder to project root: `copy /y .\src\logitech-ptz-pro\bin\Debug\*.dll`
*  open `PTZDevice.csproj` in Visual Studio, click 'Build Project' Option, again copy dll files to project root.

## Publish npm package:

use `npm publish --access public`

Mind that only next files are included in npm package:

* DirectShowLib-2005.dll
* PTZDevice.dll
* index.js
* package.json
* README.md

So c-sharp source code is not included.

## Usage inside your electron app


```bash
const ptz = require("@joraclista/ptz-edge-js");

ptz.getCameraZoomInfo('PTZ Pro 2', function(error, result) {
  if (error) throw error;
  console.log(JSON.stringify(result));
});
      
ptz.moveLeft('PTZ Pro 2', function (error, result) {
  if (error) throw error;
  console.log(result);
});      
```

## Available functions: 

All function can be run synchronously or async. 

To invoke function async, please pass callback as 2nd param: `stop(name, callback)`
To invoke function in sync, please pass true instead of callback: `stop(name, true)`

getCameraZoomInfo(name, callback), - returns min/max/current zoom, name - is a name of the camera device

moveLeft(name, callback), moves camera a little bit left 

moveRight(name, callback), 

moveUp(name, callback), 

moveDown(name, callback), 

zoomIn(name, callback),

zoomOut(name, callback),

startMoveUp(name, callback), - starts continuously moving camera Up until max Up position is reached or until user invokes stop function

startMoveDown(name, callback),

startMoveLeft(name, callback),

startMoveRight(name, callback),

stop(name, callback) - stops camera if it was moving up/down/left/right

```diff
+ getCameras(callback) returns array of cameras, from 1.0.6 version
```


#### Project dependencies

Project depends on https://github.com/agracio/electron-edge-js
which for now supports Electron 11.x - Node.js v12.18.3 at max, so will not run for Node.js v14.x.y

To build electron-edge-js for later Node.js versions:

* Fork `electron-edge-js` repo
* Run in cmd: `tools\build.bat release 14.6.0` where after `release` desired node version is specified.
* Update lib/edge.js, tools/buildall.bat, tools/build.bat file to include supported Node version
* Submit pull request to main project

NB. For me described above steps worked after `Python 3.7.*` installation + setting `--msvs_version 2019` in build.bat

---
_Source: https://npm.io/package/@joraclista/ptz-edge-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
