Heap.AudioFile
Declares a field for convenient storage and manipulation of the identifier of an audio recording file uploaded to the file storage.
This is a custom type in the JSON schema. It is stored in the database as a string identifier of the file in the storage, obtained when uploading the file using the attachMedia action, and at runtime it is represented by an instance of the special class StorageAudioFile.
You can read more about working with files in the relevant section of the guide.
Usage / Signature
import { Heap } from '@app/heap'
Heap.AudioFile()
Return Value
JSON schema for a string field.
Examples
Getting the src of the audio player
const messages = Heap.Table('messages', {
audio: Heap.Nullable(Heap.AudioFile()),
})
const msg = await messages.findOneBy(ctx)
if (msg?.audio) {
<audio
src={msg.audio.audioSrc}
title="Voice message"
>
}