HandEngine
Hand engine
Specialization of @geenee/armature!Engine
for HandProcessor. Straightforward wrapper,
instead of new Engine(HandProcessor, ...)
you can
use simpler const engine = new HandEngine(...})
.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new HandEngine(
engineParams?
,Source?
):HandEngine
Constructor
Parameters
Section titled “Parameters”engineParams?
Section titled “engineParams?”Parameters of the engine
Source?
Section titled “Source?”() => VideoSource
Video source class or instance
Returns
Section titled “Returns”HandEngine
Overrides
Section titled “Overrides”Properties
Section titled “Properties”engineParams?
Section titled “engineParams?”
protected
optional
engineParams:EngineParams
Parameters of the engine
Inherited from
Section titled “Inherited from”init()
Section titled “init()”init: (
procParams
) =>Promise
<boolean
>
Initialize engine. Sets up processor.
The SDK access token is required parameter that authenticates the user and enables the SDK on the current url. By default, path to required wasm modules provided with SDK packages is the current url. You can change the root path to wasms passing root parameter.
Parameters
Section titled “Parameters”procParams
Section titled “procParams”Parameters of the processor
Returns
Section titled “Returns”Promise
<boolean
>
Status of initialization
Inherited from
Section titled “Inherited from”iterate()
Section titled “iterate()”
protected
iterate: () =>Promise
<void
>
Iterate
Returns
Section titled “Returns”Promise
<void
>
Inherited from
Section titled “Inherited from”pause()
Section titled “pause()”pause: () =>
void
Pause pipeline.
Nothing happens if pipeline is not started yet.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”processCanvas?
Section titled “processCanvas?”
protected
optional
processCanvas:HTMLCanvasElement
Shallow copy of canvas with video for processors
Inherited from
Section titled “Inherited from”processor
Section titled “processor”
protected
processor:HandProcessor
Processor utilized by the engine
Inherited from
Section titled “Inherited from”processSize
Section titled “processSize”
protected
processSize:Size
Size of video for processors
Inherited from
Section titled “Inherited from”renderers
Section titled “renderers”
protected
renderers:Renderer
<HandResult
>[]
Renderer attached to the engine
Inherited from
Section titled “Inherited from”reset()
Section titled “reset()”reset: () =>
void
Reset pipeline
Stops pipeline, resets video capture and processor. After reset one needs to reinitialize video capture calling setup() before pipeline can be started again.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”resizeBuffer?
Section titled “resizeBuffer?”
protected
optional
resizeBuffer:ImageBuffer
Buffer to resize frames
Inherited from
Section titled “Inherited from”resizeEnabled
Section titled “resizeEnabled”
protected
resizeEnabled:boolean
Original stream is resized
Inherited from
Section titled “Inherited from”setup()
Section titled “setup()”setup: (
videoParams?
) =>Promise
<boolean
>
Setup engine. Initializes video capture.
Video capture can be setup by simplified VideoParams
opening default front/rear camera with provided resolution.
Additional fine-grained MediaStreamConstraints can be passed
via opts
field providing the most flexible way to setup
video stream (for example, by requesting specific deviceId).
Stream constraints have higher priority than rest or params.
Another options are an external MediaStream allowing custom
video sources (e.g. remote stream) or a media file defined
by url or FileParams that allows to limit maximum
capture size in cases resolution is too big for a device.
Parameters
Section titled “Parameters”videoParams?
Section titled “videoParams?”Parameters of video capture
Returns
Section titled “Returns”Promise
<boolean
>
Status of initialization
Inherited from
Section titled “Inherited from”start()
Section titled “start()”start: () =>
Promise
<void
>
Start pipeline.
Pipeline can be started only after successful init and setup.
Returns
Section titled “Returns”Promise
<void
>
Inherited from
Section titled “Inherited from”streamCanvas?
Section titled “streamCanvas?”
protected
optional
streamCanvas:HTMLCanvasElement
Shallow copy of canvas with video for renderers
Inherited from
Section titled “Inherited from”streamSize
Section titled “streamSize”
protected
streamSize:Size
Size of video for renderers
Inherited from
Section titled “Inherited from”
protected
video:VideoSource
Video source instance
Inherited from
Section titled “Inherited from”videoRatio
Section titled “videoRatio”
protected
videoRatio:number
Ratio of video stream
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”addListener()
Section titled “addListener()”addListener<
E
>(event
,listener
):this
Adds the listener function to the end of the listeners array
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”addRenderer()
Section titled “addRenderer()”addRenderer(
renderer
):Promise
<void
>
Attach Renderer to the engine
Parameters
Section titled “Parameters”renderer
Section titled “renderer”Object to be attached
Returns
Section titled “Returns”Promise
<void
>
Inherited from
Section titled “Inherited from”emit()
Section titled “emit()”emit<
E
>(event
, …args
):boolean
Synchronously calls each of the listeners registered for the event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
…Args
<EngineEvents
[E
]>
Arguments passed to the listeners
Returns
Section titled “Returns”boolean
True if the event had listeners, False otherwise
Inherited from
Section titled “Inherited from”enqueue()
Section titled “enqueue()”
protected
enqueue():void
Enqueue the next iteration
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”eventNames()
Section titled “eventNames()”eventNames(): (
string
|symbol
)[]
List of emitter’s events
Returns
Section titled “Returns”(string
| symbol
)[]
List of emitter’s events
Inherited from
Section titled “Inherited from”getMaxListeners()
Section titled “getMaxListeners()”getMaxListeners():
number
Maximum number of listeners per event
Returns
Section titled “Returns”number
Maximum number of listeners per event
Inherited from
Section titled “Inherited from”listenerCount()
Section titled “listenerCount()”listenerCount<
E
>(event
):number
The number of listeners listening to the event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
Returns
Section titled “Returns”number
Number of listeners
Inherited from
Section titled “Inherited from”listeners()
Section titled “listeners()”listeners<
E
>(event
):Function
[]
Copy of the array of listeners for the event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
Returns
Section titled “Returns”Function
[]
Copy of the listeners array
Inherited from
Section titled “Inherited from”off<
E
>(event
,listener
):this
Removes the listener from the listener array for the event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”on<
E
>(event
,listener
):this
Adds the listener function to the event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”once()
Section titled “once()”once<
E
>(event
,listener
):this
Adds a one-time listener function for the event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”prependListener()
Section titled “prependListener()”prependListener<
E
>(event
,listener
):this
Adds the listener function to the beginning of the listeners array
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”prependOnceListener()
Section titled “prependOnceListener()”prependOnceListener<
E
>(event
,listener
):this
Adds a one-time listener function to the beginning of the listeners array
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”rawListeners()
Section titled “rawListeners()”rawListeners<
E
>(event
):Function
[]
Copy of the array of listeners for the event including wrappers
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
Returns
Section titled “Returns”Function
[]
Copy of the listeners array
Inherited from
Section titled “Inherited from”removeAllListeners()
Section titled “removeAllListeners()”removeAllListeners<
E
>(event?
):this
Removes all listeners, or those of the specified event
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”event?
Section titled “event?”E
The name of the event
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”removeListener()
Section titled “removeListener()”removeListener<
E
>(event
,listener
):this
Removes the specified listener from the listener array
Type Parameters
Section titled “Type Parameters”E
extends keyof EngineEvents
Parameters
Section titled “Parameters”E
The name of the event
listener
Section titled “listener”EngineEvents
[E
]
The callback function
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”removeRenderer()
Section titled “removeRenderer()”removeRenderer(
renderer
):void
Remove attached Renderer
Parameters
Section titled “Parameters”renderer
Section titled “renderer”Renderer to be removed
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”resizeVideo()
Section titled “resizeVideo()”
protected
resizeVideo(size
):void
Callback called when video resolution is changed
Parameters
Section titled “Parameters”Size of the video
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”setMaxListeners()
Section titled “setMaxListeners()”setMaxListeners(
n
):this
Sets maximum number of listeners per event
Parameters
Section titled “Parameters”number
Maximum number of listeners
Returns
Section titled “Returns”this
This EventEmitter
Inherited from
Section titled “Inherited from”setupProcessor()
Section titled “setupProcessor()”
protected
setupProcessor(procParams
):Promise
<boolean
>
Setup processor
Parameters
Section titled “Parameters”procParams
Section titled “procParams”Returns
Section titled “Returns”Promise
<boolean
>
Inherited from
Section titled “Inherited from”setupSize()
Section titled “setupSize()”
protected
setupSize(size
):Promise
<void
>
Setup video size
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise
<void
>
Inherited from
Section titled “Inherited from”setupVideo()
Section titled “setupVideo()”
protected
setupVideo(videoParams?
):Promise
<boolean
>
Setup video capture
Parameters
Section titled “Parameters”videoParams?
Section titled “videoParams?”Returns
Section titled “Returns”Promise
<boolean
>