Skip to main content

smwebsdk.scene

Home > @soulmachines/smwebsdk > Scene

Scene class

Scene class to hold a webrtc connection to a scene containing a persona.

Signature:

export declare class Scene 

Constructors

ConstructorModifiersDescription
(constructor)(options)Construct Scene from options object
(constructor)(videoElement, audioOnly, requestedUserMedia, requiredUserMedia, contentAwarenessDebounceTime, loggingConfig, tracerOptions, chromaKeyOptions)Construct Scene with parameters

Properties

PropertyModifiersTypeDescription
connectionResultany
connectionStateConnectionState
contentAwarenessContentAwareness | undefined
contentAwarenessDebounceTimenumber | undefined
conversationConversation
currentPersonaIdPersonaId
echoCancellationEnabledboolean
isWebSocketOnlyboolean
onCameraActivereadonlySmEvent
onConversationResultEventsreadonlyPersonaEventMap
onDisconnectedFunction
onDisconnectedEventreadonlySmEvent
onMicrophoneActivereadonlySmEvent
onRecognizeResultsFunction
onRecognizeResultsEventreadonlySmEvent
onSpeechMarkerEventsreadonlyPersonaEventMap
onStateFunction
onStateEventreadonlySmEvent
onUserTextFunction
onUserTextEventreadonlySmEvent
version{ webSdk: string; platformSdk: string; }Returns the version of the webSdk and platformSdk
videoElementHTMLVideoElement | undefined
viewerOffsetXreadonlynumber
viewerOffsetYreadonlynumber

Methods

MethodModifiersDescription
configure(configuration)Send configuration to the scene
connect(options)Connect to a scene using options object
connect(serverUri, userText, accessToken, retryOptions)Connect to a scene at the given server uri.
connectionValid()
disconnect()Disconnects the session
getMinLogLevel()Check minimal log level of session logging.
getState()Get the current scene state
hasContentAwareness()
hasServerControlledCameras()
isCameraActive()Specifies if the camera is currently active and streaming video to the server.
isCameraConnected()Is the camera connected in the session
isConnected()Check if the scene connection is open and valid.
isLoggingEnabled()Check if the session logging is enabled.
isMicrophoneActive()Specifies if the microphone is currently active and streaming audio to the server.
isMicrophoneConnected()Is the microphone connected in the session
isResumedSession()Check if current session is a new session or a resumed session
keepAlive()Extends the server side timeout. This also happens automatically whenever the persona speaks.
onMessage(message)
onSceneMessage(message)
processResponse(body, name, status, transaction)protected
sendContent()
sendOnewaySceneRequest(name, body)
sendVideoBounds(width, height)Sends updated video element size to server this gives the app the chance to choose what size should be rendered on server and the application is responsible to register for a video element size change event and call this method to maintain best possible video quality for the size and/or to set an updated video element size and then call this method.
session()
setLogging(enable)Enable/disable session logging
setMediaDeviceActive(options)On success, starts or stops streaming video/audio to the server based on the values of microphone and camera.
setMinLogLevel(level)Set minimal log level of session logging.
startRecognize(audioSource)Start the speech to text recognizer
startVideo(videoElement)Play the video element and return results. Different browsers have different restrictions on autoplay. Using this method can handle all the cases browsers can have on inital video playback.
stopRecognize()Stop the speech to text reconizer
supportsSessionPersistence()Check if session persistence feature is supported in current session