Playing back audio
In this section, we'll show how you can embed an audio player into the interface, and how you can make sure that the user listened to your file.
Add audio player to the interface
To insert an audio file into the task interface, add the view.audio component to the template. In the
url
property, specify a direct link to the file (we recommend that you use the MP3 format):{
"type": "view.audio",
"url": "http://example.com/audio.mp3"
}
If you pass a link to an audio file in the input data, use the data.input
component in the url
property.
To loop audio playback automatically, put true
in the loop
property.
Make sure that the user listened to the audio
To make sure that the user played back the audio and at least started listening to it, use the
condition.played
component in the validation
property.{
"type": "view.audio",
"url": "http://example.com/audio.mp3",
"validation": {
"type": "condition.played"
}
}
To make sure that the user listened to the entire recording, use the
condition.played-fully
component in the validation
property.{
"type": "view.audio",
"url": "http://example.com/audio.mp3",
"validation": {
"type": "condition.played-fully"
}
}
Create a task to transcribe audio
To create a template for audio transcription tasks, we used the following components:
- condition.played: To make sure that the user listened to the audio.
- condition.required: To make sure that the user entered text into the multiline field (field.textarea).
- plugin.toloka: To customize the task layout.