Questions API Methods
response
Returns the interface for the specified Question response.
Examples
var audioQuestion = myLearnosityApp.question('60001');
audioQuestion.response.getMetadata();
audioQuestion.response.setMetadata({ /* Insert response metadata here */ });
audioQuestion.response.play();
audioQuestion.response.pause();
audioQuestion.response.resume();
audioQuestion.response.seek(50);
audioQuestion.response.stop();
audioQuestion.response.audioQualityCheck();
audioQuestion.response.volume.get();
audioQuestion.response.volume.set(0.5);
Values
Type object
Properties
-
audioQualityCheck function
Important Audio Question only.
Returns an
objectstating the quality of the recording orfalseif there was no response recorded in the current session (AudioQuality object).The method accepts an optional qualityParameters object that allows the client to override the default parameters used to assess the audio quality.
The following arguments are available.
-
settings object
The following properties are supported.
-
backgroundNoiseThreshold float
Value (between
0and1) to compare the minimum energy computed on the recording, if it is higher than this value, it is considered the recording has "background noise".Default:
0.025 -
numberOfClippingSamples integer
Number of clipping samples that are tolerated before considering the recording "Too loud".
Default:
40 -
tooQuietThreshold float
Value (between
0and1) to compare the computed loudness on the recording, if it is lower than this value, it is considered the person was "Too quiet".Default:
0.08
-
-
-
getMetadata function
Gets the response metadata set for this question.
-
pause function
Important Audio or Video question only.
Pause the user's response.
-
play function
Important Audio or Video question only.
Play the user's response.
-
resume function
Important Audio or Video question only.
Resume the user's response.
-
seek function
Important Audio or Video question only.
Go to a point in the user's response. Takes the position in percentage of the audio or video duration.
The following arguments are available.
-
percentage integer
-
-
setMetadata function
Sets the given response metadata for this question.
The metadata passed into this method may be anything that should be stored with the response object. A response must already exist before this method is called; if not, the metadata will not be set and an error will be logged.
Returns
trueif the given metadata was able to be set for this question's response; otherwisefalse.The following arguments are available.
-
metadata Metadata
-
-
stop function
Important Audio or Video question only.
Stop playing the user's response.
-
volume object
The following properties are supported.
-
get function
Important Audio or Video question only.
Returns an integer stating volume of the recording. The returned values are between
0(0%) and1(100%). -
set function
Important Audio or Video question only.
Set the volume of an audio file (including recording) that is or will be played by an audio or video question. The valid values are between
0(0%) and1(100%).The following arguments are available.
-
volume float
-
-
Type definitions
-
AudioQuality object
The following properties are supported.
-
code integer
Possible values
-
0 -
1 -
2 -
3
-
-
message string
Possible values
-
"Acceptable" -
"background noise" -
"Too quiet" -
"Too loud"
-
-
-
Metadata object
Note For more information, see the metadata article.