Questions API Methods
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
object
stating the quality of the recording orfalse
if there was no response recorded in the current session.The method accepts an optional qualityParameters object that allows the client to override the default parameters used to assess the audio quality.
-
settings object
-
backgroundNoiseThreshold float
Value (between
0
and1
) 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
0
and1
) 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.
-
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
true
if the given metadata was able to be set for this question's response; otherwisefalse
.-
metadata Metadata
-
-
stop function
Important Audio or Video question only.
Stop playing the user's response.
-
volume object
-
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%).-
volume float
-
-