ChatiumFor developersPlaygroundPricing
Sign in

StorageAudioFile

A wrapper class for convenient handling of hash identifiers for audio files uploaded to the media storage.

Instances of the StorageAudioFile class represent runtime values of fields in heap tables declared through Heap.AudioFile and Heap.File (only for video files).

It can also be used for convenient handling of uploaded image files outside the context of the heap.

Usage/Signature

import { StorageAudioFile } from '@app/storage'
const file = new StorageAudioFile(hash)

Properties and Methods

All properties of the base class StorageFile (only type always returns audio) + ...

audioSrc: { url, durationSeconds? }
Returns an object with absolute URLs and the length of the recording in seconds in a format accepted by the src property of the audio block.

duration: number
The "strict" length of the clip in seconds, determined from the hash property. If for any reason the length cannot be determined, an appropriate exception will be thrown upon access.

durationMaybe: number | undefined
The "non-strict" length of the clip in seconds, determined from the hash property. Returns undefined if for any reason the length cannot be determined.