smwebsdk.contentawareness
Home > @soulmachines/smwebsdk > ContentAwareness
ContentAwareness class
ContentAwareness class
An instance of this class is used to enable CUE behaviors in the digital human. This is achived by measuring tagged HTML elements and sending their coordinates back to the server
See documentation on GitHub for further reference on how to use this API https://github.com/soulmachines/smwebsdk/blob/cue-content-awareness-api/guide/content-awareness.md
Signature:
export declare class ContentAwareness
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(scene, debounceTime, logger) | Constructs a new instance of the ContentAwareness class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
contentCollection | Record<string, Element> | ||
debouncedMeasure | CallableFunction | ||
debounceTime | number | ||
resizeObserver | ResizeObserver | ||
videoFrame | Element | null |
Methods
Method | Modifiers | Description |
---|---|---|
buildUpdateContentAwarenessRequest(viewWidth, viewHeight, videoFrame, content) | Builds the required UpdateContentAwareness message that gets sent to the server | |
disconnect() | Publicly accessible function to disconnect observers and event listeners | |
getMinLogLevel() | Check minimal log level of content awareness. | |
isLoggingEnabled() | Check if the content awareness logging is enabled. | |
measure() | Publicly accessible function to trigger measurement of CUE-relevant elements in the DOM and send an updateContentAwareness message | |
measureDebounced() | ||
mutationCallback(mutations) | Takes an array of MutationRecords and measures the ones marked with content awareness attributes | |
reconnect() | Publicly accessible function to reconnect observers and event listeners | |
setLogging(enable) | Enable/disable content awareness logging | |
setMinLogLevel(level) | Set minimal log level of content awareness logging. | |
setupEventListeners() |