Functions
FileMeta
Alias of ::hot::file/FileMeta
duration
fn (media: Media): Dec?
Get duration in seconds for audio/video. Returns null for images.
Example
seconds duration(audio-media) // 3.5
seconds duration(image-media) // null
has-duration
fn (media: Media): Bool
Check if media has a duration (audio or video).
is-audio
fn (media: Media): Bool
Check if media is an Audio variant.
is-image
fn (media: Media): Bool
Check if media is an Image variant. The bare => default arm is what
makes this dispatch helper safe on the open Media enum — any future
variant enrolled via an arrow falls through to false rather than
producing a runtime error.
is-video
fn (media: Media): Bool
Check if media is a Video variant.
ns
Alias of ::hot::media/
Unified types for media files (images, audio, video).
These are pure media types focused on file metadata and format properties.
For AI-generated media with generation metadata, see ::hot::ai::media.
Types
Audio
Audio type {
file: ::hot::file/FileMeta,
duration_seconds: Dec?,
format: AudioFormat?,
transcript: Str?
}
Audio file metadata.
Fields
file- File metadata from ::hot::fileduration_seconds- Audio duration in secondsformat- Audio file formattranscript- Transcript text (for transcribed audio)
AudioFormat
AudioFormat type "mp3" | "wav" | "ogg" | "flac" | "aac" | "opus"
Common audio file formats. Declared open so applications can register
additional formats (e.g., "m4a", "alac") without forking this type.
Image
Image type {
file: ::hot::file/FileMeta,
width: Int?,
height: Int?,
format: ImageFormat?
}
Image file metadata.
Fields
file- File metadata from ::hot::filewidth- Image width in pixelsheight- Image height in pixelsformat- Image file format
ImageFormat
ImageFormat type "png" | "jpeg" | "webp" | "gif"
Common image file formats. Declared open so applications can register
additional formats (e.g., "heic", "avif", "tiff") without forking this
type. Add members at top level in any namespace, e.g.
::hot::media/ImageFormat type open | "heic"
::hot::media/ImageFormat type open "avif" | "tiff"
Media
Unified enum for media files.
Declared enum open so applications can register additional media
kinds (e.g., a custom Document or Avatar) via arrow enrollment
without forking this type:
Document type { file: FileMeta, page-count: Int? }
Document -> Media.Document // bodyless arrow enrolls the variant
Because the variant set is open-ended, match on Media MUST
include a _ default arm (open-enum-match-missing-default otherwise).
Usage
import ::hot::media
// Pattern match on media type
describe-media fn (media: Media): Str {
match media {
Media.Image => { `Image: ${media.width}x${media.height}` }
Media.Audio => { `Audio: ${media.duration_seconds}s` }
Media.Video => { `Video: ${media.width}x${media.height} ${media.duration_seconds}s` }
_ => { "unknown media kind" }
}
}
// Access common file info
path file(media).path
size file(media).size
MediaBatch
MediaBatch type {
items: Vec,
succeeded: Int,
failed: Int,
errors: Vec?
}
Result of batch media processing.
Fields
items - Media files
succeeded - Count of successful operations
failed - Count of failed operations
errors - List of errors (if any)
MediaError
MediaError type {
index: Int,
message: Str
}
Error that occurred during batch media processing.
Video
Video type {
file: ::hot::file/FileMeta,
duration_seconds: Dec?,
width: Int?,
height: Int?,
format: VideoFormat?,
fps: Int?
}
Video file metadata.
Fields
file - File metadata from ::hot::file
duration_seconds - Video duration in seconds
width - Video width in pixels
height - Video height in pixels
format - Video file format
fps - Frames per second
VideoFormat
VideoFormat type "mp4" | "webm" | "mov" | "avi"
Common video file formats. Declared open so applications can register
additional formats (e.g., "mkv", "flv") without forking this type.