24min

SDK Methods



Constructor

new Uneeq(options: UneeqOptions)

Construct a new Uneeq object. See UneeqOptions for constructor parameter details.

Parameters: options: UneeqOptions

Returns Uneeq





sessionId

sessionId

The active session id as a string. If the session has not started yet value will be null. Note, this is an accessor and not a method. You can retrieve the value by accessing it as a property of Uneeq, e.g. Uneeq.sessionId.

Parameters: no parameters

Returns string | null





enableMicrophone

enableMicrophone(enable?: <boolean>, foo?: <boolean>)

Enable or disable the users microphone.

Parameters: enable: boolean (optional) Defaults to true foo: string (optional) Defaults to false

Returns void





endSession

endSession()

Ends the session, releases the microphone and camera and ends the avatar process. On success, SessionEndedMessage will be sent. On error, ErrorEndingSessionMessage will be sent.

Parameters: no parameters

Returns void





initWithToken

initWithToken(tokenId: string)

Initialise the session. ReadyMessage will be sent when init is ready. initWithToken should be used instead of init() when a third party conversation service is used.

Parameters: tokenId: string

Returns Promise<void>

Note: In order to avoid browser autoplay restrictions, you must call initWithToken as part of a mouse or keyboard event chain. Calling initWithToken as a result of an async request may cause the session to be unable to start.





pauseSession

pauseSession()

Pauses a live session. Local video and audio will stop being sent and remote avatar video audio will be stopped. On success, SessionPausedMessage will be sent.

Parameters: no parameters

Returns boolean





playWelcomeMessage

playWelcomeMessage()

Trigger this conversation's welcome message.

Parameters: no parameters

Returns Promise<void>





resumeSession

resumeSession()

Resumes a live session. Local video and audio will start being sent again and remote avatar video audio will be restarted. On success, SessionResumedMessage will be sent.

Parameters: no parameters

Returns boolean





sendTranscript

sendTranscript(text: string)

Send a text based message to the digital human.

Parameters: text: string

Returns void





setAvatarDebug

setAvatarDebug(enabled: boolean)

Show Avatar Debugging.

Parameters: enabled: boolean

Returns Promise<any>





setCamera

setCamera(deviceId: string)

Set a preferred camera to use in a live session. On success, SetCameraSuccessMessage will be sent. DeviceNotFoundErrorMessage will be sent when the requested device is not found.

Parameters: deviceId: string

Returns void





setMic

setMic(deviceId: string)

Set a preferred microphone to use in a live session. On success, SetMicSuccessMessage will be sent. DeviceNotFoundErrorMessage will be sent when the requested device is not found.

Parameters: deviceId: string

Returns void





setSpeaker

setSpeaker(deviceId: string)

Set a preferred speaker to use in a live session. On success, SetSpeakerSuccessMessage will be sent. DeviceNotFoundErrorMessage will be sent when the requested device is not found.

Parameters: deviceId: string

Returns void





startRecording

startRecording()

Start Recording voice audio through microphone. Call this method before using voice to speak to avatar. stopRecording should be called when finished speaking.

Parameters: no parameters

Returns void





stopRecording

stopRecording()

Stop Recording voice audio through microphone. Call this method after startRecording has been called.

Parameters: no parameters

Returns void





stopSpeaking

stopSpeaking()

Stop the avatar from speaking. This will stop avatar speaking even if interrupts are turned off. When successful a corresponding AvatarRequestCompleted should be received.

Parameters: no parameters

Returns Promise<void>