new babylonjs/LexFeature()
Extends
Members
(readonly) id :string
Gets the string id of the object.
Type:
- string
- Inherited From:
Methods
_processWithAudio(inputAudio, sourceSampleRate, configopt) → {Promise}
Sends audio input to Amazon Lex.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputAudio |
TypedArray | TypedArray view of the input audio buffer |
|||||||||||||||||
sourceSampleRate |
Number | Sample rate of the input audio |
|||||||||||||||||
config |
Object |
<optional> |
Optional config for overriding lex bot info Properties
|
- Inherited From:
Returns:
A Promise-like object that resolves to a Lex response object.
For details on the structure of that response object see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property
- Type
- Promise
_setupAudioContext()
Setup audio context
- Overrides:
beginVoiceRecording()
Begin microphone recording. This function will also try to resume audioContext so that
it's suggested to call this function after a user interaction
- Inherited From:
emit(message, valueopt)
Send a message, causing listener functions for the message on this object
to be executed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to emit. |
|
value |
any |
<optional> |
Optional argument to pass to listener callbacks. |
- Inherited From:
(async) enableMicInput()
Async function to setup microphone recorder which will get user permission for accessing microphone
This method must be called before attempting to record voice input with the
beginVoiceRecording() method. Expect an error to be thrown if the user has
chosen to block microphone access.
- Inherited From:
Throws:
-
See the documentation for
MediaDevices.getUserMedia().
The most likely error to expect will be the "NotAllowed" error indicating
the user has denied access to the microphone. - Type
- DOMException
endVoiceRecording() → {Promise}
Stop microphone recording and send recorded audio data to lex.
- Inherited From:
Returns:
A Promise-like object that resolves to a Lex response object.
For details on the structure of that response object see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property
- Type
- Promise
getEngineUserAgentString()
- Overrides:
Returns:
The useragent string for the engine you are using, e.g. 'babylonjs/5.1.0'
listenTo(message, callback)
Execute a function when a message is received for this object.
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to listen for. |
callback |
function | Function to execute once the message is received. |
- Inherited From:
processWithText(inputText, configopt) → {Promise}
Sends text user input to Amazon Lex.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputText |
String | Text to send to lex bot |
|||||||||||||||||
config |
Object |
<optional> |
Optional config for overriding lex bot info Properties
|
- Inherited From:
Returns:
A Promise-like object that resolves to a Lex response object.
For details on the structure of that response object see: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property
- Type
- Promise
stopListening(message, callbackopt)
Prevent a function from being executed when a message is received for this
object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message |
string | The message to stop listening for. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Inherited From:
stopListeningByRegexp(regexp, callbackopt)
De-register callback(s) from being executed when messages matching the given
regular expression are received.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
regexp |
Regexp | regexp - The regular expression to filter messages with. |
|
callback |
function |
<optional> |
Optional callback to remove. If none is defined, |
- Inherited From:
stopListeningToAll()
Prevent any functions from being executed when any message is received for
this object.
- Inherited From: