Heap.VideoFile
Declares a field for convenient storage and manipulation of the identifier of a video file uploaded to the file storage.
This is a non-standard 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 StorageVideoFile.
You can read more about working with files in the relevant section of the guide.
Usage / Signature
import { Heap } from '@app/heap'
Heap.VideoFile()
Return Value
JSON schema for a string field.
Examples
Getting src for the poster (frame) of the video and directly for the player
const products = Heap.Table('products', {
video: Heap.Nullable(Heap.VideoFile()),
})
const product = await products.findOneBy(ctx)
if (product?.video) {
<video-poster
src={product.video.getThumbnailSrc(600)}
video={{
src: product.video.videoSrc,
}}
/>
}