Documentation Index
Fetch the complete documentation index at: https://docs.prism.byescaleira.com/llms.txt
Use this file to discover all available pages before exploring further.
PrismVideo
PrismVideo provides an actor-based video downloader with progress streaming, video metadata modeling, and resolution detection — all built on AVFoundation with zero third-party dependencies.Video Entity
Type-safe metadata model with URL, title, duration, resolution, and thumbnail.
Async Downloader
Actor-isolated download with
AsyncStream progress updates and export session management.Resolution Detection
Automatic resolution classification — 4K, 1080p, 720p, SD — from pixel dimensions.
Video Entity
PrismVideoEntity models video metadata:
Video Entity
Properties
| Property | Type | Description |
|---|---|---|
id | UUID | Unique identifier |
url | URL | Video source URL |
title | String | Display title |
duration | TimeInterval? | Duration in seconds |
resolution | PrismVideoResolution? | Detected resolution |
type | AVFileType | Container format (default: .mp4) |
thumb | URL? | Thumbnail image URL |
Video Resolution
PrismVideoResolution auto-classifies from pixel height:
Resolution Detection
| Case | Label | Pixel Range |
|---|---|---|
._4K | 4K | 2160+ |
.fullHD | 1080p HD | 1080–2159 |
.HD | 720p HD | 720–1079 |
.SD | SD | 0–719 |
Video Downloader
PrismVideoDownloader is an actor that downloads and exports video with real-time progress via AsyncStream:
Download Video with Progress
Download Status
| Status | Description |
|---|---|
.downloading(progress:session:) | Download in progress — progress is 0.0–1.0, session is the underlying AVAssetExportSession |
.completed(URL) | Download finished — URL points to the exported file in the temp directory |
.error(PrismVideoError) | Download failed with a typed error |
How It Works
- Loads the remote
AVURLAssetand verifies it’s playable - Extracts video and audio tracks into an
AVMutableComposition - Exports using
AVAssetExportSessionwith highest quality preset - Streams progress at 100ms intervals via a Timer publisher
- Yields the final file URL on completion
Video Errors
PrismVideoError conforms to PrismError with descriptions, failure reasons, and recovery suggestions:
| Error | Description | Recovery Suggestion |
|---|---|---|
.assetNotPlayable | The AVAsset could not be prepared for playback | Try reloading or verifying the video source |
.missingTracks | Source file lacks valid video or audio tracks | Ensure the file has at least one video or audio track |
.failedToCreateExportSession | AVAssetExportSession could not be initialized | Check export configurations or try different parameters |
.custom(message:) | Custom error with user-provided message | — |
Error Handling