new com_prsonas_sdk_Avatar()
Constructs a new Avatar object
Methods
-
onSpeechTimeout(data)
-
Fires when the translation session has exceeded the internal limits.
Parameters:
Name Type Description dataObject The data being handled.
-
onPhraseRecognized(data)
-
Handles inbound phrase
Parameters:
Name Type Description dataObject The data being handled.
-
onPhraseCancelled(data)
-
Handles phrase cancellation
Parameters:
Name Type Description dataObject The data being handled.
-
onIsCharacterSpeaking(data)
-
Handles the Is Character Speaking event
Parameters:
Name Type Description dataObject The data being handled.
-
getPointFromString()
-
Converts a camera position string into an object
-
<async> getCameraPos(callback)
-
Retrieves the current camera position from the Avatar
Parameters:
Name Type Description callbackfunction The callback that will be invoked with the camera
position -
setCameraPos(x, y, z)
-
Sets the current camera position for the Avatar
Parameters:
Name Type Description xfloat The X position axis
yfloat The Y position axis
zfloat The Z position axis
position -
<async> getCameraRot(callback)
-
Retrieves the current camera rotation from the Avatar
Parameters:
Name Type Description callbackfunction The callback that will be invoked with the camera
rotation -
setCameraRot(x, y, z)
-
Sets the current camera rotation for the Avatar
Parameters:
Name Type Description xfloat The X rotation axis
yfloat The Y rotation axis
zfloat The Z rotation axis
position -
<async> getCameraFOV(callback)
-
Retrieves the current camera field of view from the Avatar
Parameters:
Name Type Description callbackfunction The callback that will be invoked with the camera
FOV -
setCameraFOV(fov)
-
Sets the current camera field of view for the Avatar
Parameters:
Name Type Description fovfloat The FOV in degrees
position -
<async> getCameraAvatarBox(callback)
-
Retrieves the current camera settings that define a screen-space box that
frames the AvatarParameters:
Name Type Description callbackfunction The callback that will be invoked with the Avatar display
box settings -
setCameraAvatarBox(top, left, width, height)
-
Sets the parameters that define a screen-space box where the
Avatar will be displayed. All values are normalized between 0 and 1.0Parameters:
Name Type Description topfloat The top coordinate of the box
leftfloat The left coordinate of the box
widthfloat The width of the box
heightfloat The height of the box
position -
<async> getCameraAvatarView(callback)
-
Retrieves the current camera settings that define how the Avatar is
framed within the Avatar display boxParameters:
Name Type Description callbackfunction The callback that will be invoked with the Avatar view settings
box -
setCameraAvatarView(headroom, bodyView, center, cameraZ)
-
Adjusts the framing of the Avatar within the display box
Avatar will be displayed. All values are normalized between 0 and <= 1.0.Parameters:
Name Type Description headroomfloat The amount of space from the top of the Avatar's head to the top of the display box.
bodyViewfloat The amount of the Avatar's lower body that is displayed in the display box.
centerfloat The horizontal shift of the character withing the display box.
cameraZfloat The distance from the camera to the center of the Avatar in the display box.
position -
playAnimation(anim, synthesizedFromText)
-
Plays the supplied animation on the avatar
Parameters:
Name Type Description animstring The animation to play.
synthesizedFromTextstring Optional text string that will be used to generate the animation.
-
getSupportedLanguages()
-
Returns a list of languages that the speech recognition supports.
Returns:
Return object with the data property set as the array of languages.
- Type
- Object
-
getSupportedLanguagePrefixes()
-
Returns only the prefixes for each of the supported languages. A lot of methods only require the prefix
instead of the full ISO identifier.Returns:
Return object with the data property set as the array of language prefixes.
- Type
- Object
-
translateText(destLangId, textArray, sourceLangId)
-
Translates an array of strings or a single string in the source language to into
a different language specified by the destLangId parameter.
Returns an empty array if there is an error.Parameters:
Name Type Description destLangIdstring The language id that the string will be translated into.
textArraystring An array of text formatted in the sourceLangId that will be translated to the dest language. Can be a single string
or a pipe separated list of strings.sourceLangIdstring The language id specifying what language the text parameter is in. If not supplied then
the internal language specified by the InternalLanguage config setting is used. -
getQAProjectInfo(includeQnA)
-
Returns a dictionary lookup of the properties for the Question and Answer project
associated with the experience. The corresponding admin settings must be present.Parameters:
Name Type Description includeQnAboolean If set to true then question and answer info is included
in the "qna" property of the return value. -
setLanguage(language)
-
Sets the language that the Avatar will respond in.
Parameters:
Name Type Description languagestring The ISO language to start responding in.
-
setNarrativeLanguage(language)
-
Sets the native language of the response text on the Avatar
Parameters:
Name Type Description languagestring The ISO language to start responding in.
-
startListening(language)
-
Starts up the speech processing engine.
Parameters:
Name Type Description languagestring The ISO language start listening on.
-
stopListening()
-
Shuts down the language processing engine
-
isSpeaking()
-
Returns the speaking status of the Avatar.
Returns:
True if the character is currently speaking; False otherwise.
- Type
- boolean
-
isConnected()
-
Returns true if the Viewer is currently connected to the Avatar's web socket server.
Returns:
True if the character is currently speaking; False otherwise.
- Type
- boolean
-
<async> getManifest(callback)
-
Returns Avatar manifest object. This call will fail if the Avatar is not
running. Must be called after receiving the WEBSOCKET_CONNECTED event.Parameters:
Name Type Description callbackfunction The callback that will be invoked with the manifest
JSON data. -
<async> getAvailableCharacters(callback)
-
Retrieves a list of details for all available characters.
Parameters:
Name Type Description callbackfunction The callback that will be invoked with the character list
-
<async> getCurrentCharacter(callback)
-
Retrieves retrieves details about the currently selected character
Parameters:
Name Type Description callbackfunction The callback that will be invoked with the character details
-
<async> setCurrentCharacter(name)
-
Sets the current Avatar character
Parameters:
Name Type Description namestring The name of the character to set