Asynchronous transcription
In order to perform an asynchronous transcription, you must use a combination of the Generate pre-signed URL and Get transcription status functions.
Performing an asynchronous transcription
Below we will recommend a procedure to complete this task:
- Generate a Pre-signed URL for the audio file you want to transcribe. Remember that all the features to complete this task can be found at: Generate Pre-signed URL.
- Upload the audio file to the generated Pre-signed URL. Below is a Javascript example that performs this task:
fetch(presingUrl, {
method: 'PUT',
headers: {
'Content-Type': 'audio/wav'
},
body: preRecordedAudio as File
}).then((response) => {
if (response.ok) {
// implement logic for successfully request here
}else{
// implement logic for unsuccessfully request here
}
}).catch((error)=>{
// Implement the logic here when an exception occurs
})
From this point on, all that remains is to wait for the audio transcription to finish. To know when this process ends, we can use two methods:
- If the callbackUrl parameter was sent when generating the Pre-signed URL, once the transcription is finished, the result of the transcription will be sent to the URL passed in this field.
- The
/api/get-transcription
endpoint can be called. For more details on how to use this endpoint, you can see the section: Get transcription status.