This file contains the readily available functions which interact with the ITSLanguage pronunciation analysis API.
Note that this is one of the "nested" or "composite" APIs; You can only obtain the data if you provide a reference to the challenge for which you want a recording.
Methods
(static) alignChallenge(analysisId) → {Promise.<*>}
A Pronunciation Challenge could hold an alignment already. If not so this function will instruct the backend to create the alignment and return it to the client.
Parameters:
| Name | Type | Description |
|---|---|---|
analysisId |
string | The ID of the analysis to create the alignment for. |
Returns:
- The alignment.
- Type
- Promise.<*>
(static) endStreamAudio(analyseId, progressCbopt) → {Promise.<*>}
Finishing the recording means we're ready to analyse! Smartest man in the entire universe. We also accept a special callback that can be used to receive progress on.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
analyseId |
string | The ID of the Analysis to analyse on. |
|
progressCb |
function |
<optional> |
A callback which will be used to receive progress on. |
Returns:
- The result will return the analysis.
- Type
- Promise.<*>
(static) getById(challengeId, analysisId) → {Promise.<Object>}
Ask the backend for a Pronunciation Analysis.
Parameters:
| Name | Type | Description |
|---|---|---|
challengeId |
string | The ID of the corresponding challenge. |
analysisId |
string | The ID of the analysis you want result for. |
Returns:
- The Pronunciation Analysis.
- Type
- Promise.<Object>
(static) prepare() → {Promise|Promise.<*>}
Create a new analysis and return the ID.
Returns:
- The result will hold the ID for the analysis.
- Type
- Promise | Promise.<*>
(static) prepareAudio(analyseId, recorder) → {Promise}
Prepare the backend for our audio.
Parameters:
| Name | Type | Description |
|---|---|---|
analyseId |
string | The Analysis that belongs to the audio. |
recorder |
MediaRecorder | The recorder to get specs from. |
Returns:
- Result of preparing the audio.
- Type
- Promise
(static) prepareChallenge(analysisId, challengeId) → {Promise.<*>}
Prepare the backend by telling it which challenge it can expect by a new analysis.
Parameters:
| Name | Type | Description |
|---|---|---|
analysisId |
string | The ID of the analysis to attache the challenge to. |
challengeId |
string | The ID of the challenge that belongs to a specific analysis. |
Returns:
- Promise with the result of the init_challenge call.
- Type
- Promise.<*>
(static) streamAudio(analyseId, recorder) → {Promise}
Us the provided recorder to stream/send the recorded audio to the backend.
Parameters:
| Name | Type | Description |
|---|---|---|
analyseId |
string | The ID of the analysis we're receiving audio for. |
recorder |
MediaRecorder | Instance of an Recorder. |
Returns:
- Stream result.
- Type
- Promise
(inner) url(challenge) → {string}
The URL for the Pronunciation Analysis handler(s).
Parameters:
| Name | Type | Description |
|---|---|---|
challenge |
Returns:
- Type
- string