Class: VideoPlugin<ResultT>
@geenee/armature.VideoPlugin
Generic video plugin
VideoPlugin can be attached to SceneRenderer instances. Usually they perform simple image transformations on video stream, e.g. smooth effects or gamma correction. VideoPlugin interface is very similar to Renderer and consist of two basic methods load() and update(). But instead of a scene, update() works with input image provided within canvas element. Plugin is a level of abstraction to single out ready-made helpers that can be reused as atomic building blocks of the application.
Type parameters
Name | Type | Description |
---|---|---|
ResultT | extends Object = {} | Type of processing results |
Constructors
constructor
• new VideoPlugin<ResultT
>()
Type parameters
Name | Type |
---|---|
ResultT | extends Object = {} |
Properties
loaded
• loaded: boolean
= false
Loaded state
Methods
dispose
▸ dispose(): void
Dispose render plugin
Returns
void
load
▸ load(): Promise
<void
>
Initialize plugin
Initializes everything required for image processing. Overridden by derived classes for particular filter.
Returns
Promise
<void
>
Promise resolving when initialization is finished
unload
▸ unload(): void
Reset plugin
Releases all resources and instances created in load(). Overridden by derived classes for particular filter.
Returns
void
update
▸ update(result
, stream
, canvas
): Promise
<void
>
Update the image
Main method implementing image filter or 2D drawing. Updates the image according to provided results. Image is updated in place drawing on canvas directly. Overridden by derived classes for particular filter.
Parameters
Name | Type | Description |
---|---|---|
result | ResultT | Results of video processing |
stream | HTMLCanvasElement | Captured video frame |
canvas | null | CanvasRenderingContext2D | Rendering context of canvas |
Returns
Promise
<void
>
Promise resolving when update is finished