Huddly SDK supportes the following node versions: (Needs to support NAPI v3 )
- 8.11.2
- 10.15.2
- 11.5.0
We recommend using nvm as your node version manager https://github.com/creationix/nvm.
After you've setup nvm run
nvm use 8.11.2
Then you can install and start using the huddly sdk you need first install it and the transport
npm install @huddly/sdk @huddly/device-api-usb
Start by creating the sdk and the transport
const HuddlyDeviceAPIUSB = require('@huddly/device-api-usb').default;
const HuddlySdk = require('@huddly/sdk').default;
// Create instances of device-apis you want to use
const usbApi = new HuddlyDeviceAPIUSB();
// Create an instance of the SDK
const sdk = new HuddlySdk(usbApi);
setup camera attached
subscriber, this will give you a camera than has been attached.
// Create a instance that will represent the `IDeviceManager` interface
let cameraManager;
sdk.on('ATTACH', (d) => {
cameraManager = d;
});
then initialize it
sdk.init();
Then you should be good to go. All the actions on the cameraManager are done after the attach event. For example, to get the camera information, call getInfo
when the camera is attached.
sdk.on('ATTACH', (d) => {
cameraManager = d;
cameraManager.getInfo().then(console.log);
});
If you have a question or found a bug please open an issue. Thank you
For more details on the rest of the functionality to the sdk check out the documentation for the sdk class and the cameraManager (IDeviceManager) interface.
Check out the sdk code on github (https://github.com/Huddly/sdk)
Internally the camera always sees full field of view, the coordinates are relative to full field of view by deafault. If you want the coordinates to be be absolute to the current framing, you can specify this when you get the detector.
cameraManager.getDetector({ convertDetections: 'FRAMING' });
This makes it easy to draw these bbox directly on top of the main stream.
Another available detector configuration is the shouldAutoFrame
option which when set to false, it allows you to configure Genius Framing to send detection data without autoframing.
cameraManager.getDetector({ shouldAutoFrame: false });
By default, the detector is configured to run autoframing and generate detection information.
If you want to get detection data only when the camera is streaming on the host machine, you need to configure the detector class with the DOWS
option.
cameraManager.getDetector({ DOWS: true });
This option makes it possible to configure the detector so that you only get detection data when you are streaming on host machine. By default, this option set to false
so that you don't have to stream to get detection data.
After v0.4.0, SDK comes with a new feature ragarding the way you get detection data from the camera. On this version (and onward) the default behavior of detector is starting an internal stream (controlled by the camera only) to give you detection information. As a result the LED light is turned ON. Proper tearing down of the detector instance will stop the internal stream on the camera and with it the LED light.
Make sure that no other application such as the Huddly app or another sdk instance is running and using the camera.
The transition from 0.3.* to 0.4.0 involves breaking changes with regards to Genius Framing configuration and detection data retrival. The breaking change is that we have moved the configuraion part of GeniusFraming (autozoom) into a separate interface that we called AutozoomControl. The autozoom configuration methods enable
, disable
, start
and stop
which used to live in the detector interface are now moved to the new AutozoomControl
interface. On the other hand, the Detector interace remains responsible for only setting up events for getting detection and framing data from the camera. Have a look at the documentation of each interface to see usage examples.